diff --git a/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue b/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue index 49a4137..2980962 100644 --- a/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue +++ b/src/pages/menuPages/products/base/components/TvFormulaPriceSection.vue @@ -27,13 +27,28 @@ dir="ltr" class="tv-formula-input font-mono text-sm" style="direction: ltr; text-align: left" - placeholder="مثال: ROUND(((P)/MG)*W+100000, -3)" + placeholder="((P)/MG)*W+100000" @focus="isEditingFormula = true" @blur="onFormulaBlur" @update:value="onFormulaInput" /> +
+
متغیرها:
+ P = قیمت وسط مرجع (ریال) · + W = وزن محصول ({{ formulaWeight }} گرم) · + MG = ضریب مثقال به گرم ({{ MG }}) +
توابع:
+ ROUND(x, -3) رند به هزار · + FLOOR(x) گرد به پایین · + CEIL(x) گرد به بالا +
+ مثال: + ROUND(((P)/MG)*W+100000, -3) +
+
+
قیمت TV (محاسبه‌شده) {{ usePrice(computedProductPrice) }} @@ -46,6 +61,7 @@ import { computed, ref, watch } from 'vue' import { DEFAULT_PRICE_FORMULA, + FORMULA_MG, resolveFormulaWeight, computeFormulaProductPrice } from '@/utils/formulaPrice' @@ -80,6 +96,7 @@ watch( } ) +const MG = FORMULA_MG const formulaWeight = computed(() => resolveFormulaWeight(props.productAmount)) const formulaHelp = computed((): DashboardHelp => ({ @@ -131,6 +148,20 @@ function onToggle(checked: boolean) { color: #1e3a5f; } +.tv-formula-section__guide { + background: #f0f7ff; + color: #1e3a5f; +} + +.tv-formula-section__guide code { + background: rgba(59, 130, 246, 0.12); + padding: 0 4px; + border-radius: 3px; + font-family: monospace; + direction: ltr; + unicode-bidi: embed; +} + .tv-formula-section__result { background: #fff; } @@ -161,6 +192,16 @@ html.is-dark .tv-formula-section__label { color: #93c5fd; } +html.is-dark .tv-formula-section__guide { + background: rgba(30, 58, 95, 0.5); + color: #bfdbfe; +} + +html.is-dark .tv-formula-section__guide code { + background: rgba(96, 165, 250, 0.18); + color: #93c5fd; +} + html.is-dark .tv-formula-section__result { background: rgba(0, 0, 0, 0.28); }