This commit is contained in:
2026-06-11 21:25:43 +03:30
parent 9b81cba70e
commit bc6a9bd8a2
2 changed files with 19 additions and 7 deletions
@@ -66,6 +66,12 @@
<div class="text-xs text-gray-500">
قیمت خرید/فروش از قیمت صفحه اصلی اپ محاسبه می‌شود. مثبت = گران‌تر، منفی = ارزان‌تر.
</div>
<a-form-item label="قیمت صفر از provider" name="use_last_price_if_zero" class="!mb-0">
<a-switch v-model:checked="form.use_last_price_if_zero" />
<span class="mr-2 text-xs text-gray-500">
اگر provider قیمت نداد (صفر)، با آخرین قیمت ذخیره‌شده معامله شود
</span>
</a-form-item>
</div>
</div>
+13 -7
View File
@@ -93,14 +93,20 @@ export function computeProductEditorPricePreview(input: {
if (input.meltedPriceOption === 'app') {
const base = resolveAppBasePrice(input.appLastPrice)
if (base <= 0) {
return { status: 'empty', message: '' }
}
return {
status: 'ready',
amount: adjustedProductPrice(base, 0, offsetPercent),
source: 'قیمت صفحه اصلی اپ'
if (base > 0) {
return {
status: 'ready',
amount: adjustedProductPrice(base, 0, offsetPercent),
source: 'قیمت صفحه اصلی اپ'
}
}
const fallback = resolveStoredFallbackPrice(
input.form.price,
input.form.use_last_price_if_zero ?? false
)
return fallback > 0
? { status: 'ready', amount: fallback, source: 'آخرین قیمت ذخیره‌شده' }
: { status: 'empty', message: 'قیمت provider صفر است' }
}
if (!input.form.reading_method) {