diff --git a/src/pages/PluginCatalogPage.vue b/src/pages/PluginCatalogPage.vue index 7e56d40..367a063 100644 --- a/src/pages/PluginCatalogPage.vue +++ b/src/pages/PluginCatalogPage.vue @@ -8,6 +8,7 @@ import MoneyInput from '@/components/MoneyInput.vue' import { useAuthStore } from '@/stores/auth' import { SUPERADMIN_SYSTEM_SETTING_KEYS } from '@/config/superAdminSettingKeys' import { rewriteLegacyUploadUrl } from '@/utils/rewriteLegacyUploadUrl' +import { formatNumber, rialToToman } from '@/utils/money' import { resolveSettingDescription, resolveSettingTitle, @@ -250,13 +251,19 @@ async function save(item: CatalogItem) { return } } - const prices = item.prices.map((price) => ({ - durationDays: price.durationDays, - enabled: price.enabled, - originalPriceRials: - price.enabled && price.hasDiscount ? price.originalPriceRials : price.finalPriceRials, - finalPriceRials: price.finalPriceRials, - })) + const prices = item.prices.map((price) => { + const finalPriceRials = Math.max(0, Math.trunc(Number(price.finalPriceRials) || 0)) + const originalPriceRials = + price.enabled && price.hasDiscount + ? Math.max(0, Math.trunc(Number(price.originalPriceRials) || 0)) + : finalPriceRials + return { + durationDays: price.durationDays, + enabled: Boolean(price.enabled), + originalPriceRials, + finalPriceRials, + } + }) savingId.value = item.settingKey try { const id = await ensureCatalogId(item) @@ -268,6 +275,7 @@ async function save(item: CatalogItem) { prices, }) message.success('ذخیره شد') + closeDetail() await load() } catch (e: any) { const msg = e?.response?.data?.message @@ -339,6 +347,17 @@ function slotUploader(item: CatalogItem) { }) => uploadSlot(item, options) } +function priceSummary(item: CatalogItem): string[] { + return item.prices + .filter((row) => row.enabled) + .map((row) => { + const toman = rialToToman(row.finalPriceRials) + const label = durationLabel[row.durationDays] + if (toman <= 0) return `${label} رایگان` + return `${label} ${formatNumber(toman)} تومان` + }) +} + onMounted(load) @@ -398,6 +417,10 @@ onMounted(load) > {{ item.titleFa || 'بدون عنوان' }} {{ item.settingKey }} + + {{ priceSummary(item).join(' · ') }} + + قیمتی روشن نیست
حداکثر سه عکس. در ادمین ماژول عکس اول روی کارت است.
@@ -493,7 +517,7 @@ onMounted(load) اصلی