From 6cb2488221ff959a53b112612f49d169ad98a5f2 Mon Sep 17 00:00:00 2001 From: adonis Date: Wed, 19 Aug 2026 12:17:44 +0330 Subject: [PATCH] ui(product): improve formula sections and group visibility switches - FormulaPriceSection: compact inline guide with variables and functions - TvFormulaPriceSection: same compact guide style, remove verbose text - Product specs tab: group visibility switches (list, assets, TV) in single bordered panel Co-authored-by: Cursor --- .../base/components/FormulaPriceSection.vue | 59 ++++++++++++++----- .../base/components/ProductEditorFormBody.vue | 43 ++++++++------ .../base/components/TvFormulaPriceSection.vue | 22 ++++--- 3 files changed, 79 insertions(+), 45 deletions(-) diff --git a/src/pages/menuPages/products/base/components/FormulaPriceSection.vue b/src/pages/menuPages/products/base/components/FormulaPriceSection.vue index a1ae3ed..9d1ff52 100644 --- a/src/pages/menuPages/products/base/components/FormulaPriceSection.vue +++ b/src/pages/menuPages/products/base/components/FormulaPriceSection.vue @@ -1,5 +1,5 @@ @@ -46,7 +59,7 @@ import { computed, ref, watch } from 'vue' import { DEFAULT_PRICE_FORMULA, - getFormulaVariableHelp, + FORMULA_MG, resolveFormulaWeight, computeFormulaProductPrice } from '@/utils/formulaPrice' @@ -72,6 +85,7 @@ const emit = defineEmits<{ const isEditingFormula = ref(false) const localFormula = ref(props.modelValue.price_formula || DEFAULT_PRICE_FORMULA) +const MG = FORMULA_MG watch( () => props.modelValue.price_formula, @@ -84,16 +98,9 @@ watch( const formulaWeight = computed(() => resolveFormulaWeight(props.productAmount)) -const formulaHelp = computed((): DashboardHelp => { - const lines = getFormulaVariableHelp(formulaWeight.value) - .map((item) => `${item.symbol} = ${item.label}`) - .join(' | ') - return { - description: - 'قیمت واحد از فرمول و مظنه مرجع محاسبه می‌شود. تفاوت ارائه‌دهنده در فرمول اثر ندارد و فقط قیمت وسط مرجع (P) استفاده می‌شود.', - formula: `${lines}. مثال: ROUND(((P)/MG)*W+100000, -3)`, - } -}) +const formulaHelp = computed((): DashboardHelp => ({ + description: 'قیمت از فرمول و مظنه مرجع محاسبه می‌شود.', +})) const computedProductPrice = computed(() => computeFormulaProductPrice( @@ -141,6 +148,20 @@ function onToggle(checked: boolean) { color: #78350f; } +.formula-price-section__guide { + background: #fef3c7; + color: #78350f; +} + +.formula-price-section__guide code { + background: rgba(180, 83, 9, 0.12); + padding: 0 4px; + border-radius: 3px; + font-family: monospace; + direction: ltr; + unicode-bidi: embed; +} + .formula-price-section__result { background: #fff; } @@ -171,6 +192,16 @@ html.is-dark .formula-price-section__label { color: #fde68a; } +html.is-dark .formula-price-section__guide { + background: rgba(120, 53, 15, 0.5); + color: #fde68a; +} + +html.is-dark .formula-price-section__guide code { + background: rgba(251, 191, 36, 0.18); + color: #fbbf24; +} + html.is-dark .formula-price-section__result { background: rgba(0, 0, 0, 0.28); } diff --git a/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue b/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue index 21e1fda..ca71f09 100644 --- a/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue +++ b/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue @@ -396,22 +396,27 @@ -
-
+
+
+ + + + +
+
+ + +
- - - -
-
-
+
+ + +
- - -
+ -
-
- -
- - - -
@@ -983,6 +980,14 @@ defineExpose({ @apply flex flex-col items-stretch gap-2; } +.product-visibility-row { + @apply flex items-center justify-between gap-3 px-3 py-2; + border-bottom: 1px solid var(--ant-color-border-secondary, rgba(0, 0, 0, 0.06)); +} +.product-visibility-row:last-child { + border-bottom: none; +} + .product-spec-label { @apply w-full shrink-0 text-right; } diff --git a/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue b/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue index 2980962..5bff141 100644 --- a/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue +++ b/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue @@ -1,5 +1,5 @@