From ba09c1d442fc1f36523656253f17f0d69f68024d Mon Sep 17 00:00:00 2001 From: adonis Date: Wed, 9 Sep 2026 17:13:40 +0330 Subject: [PATCH] added some feature for plugin --- src/pages/PluginCatalogPage.vue | 84 ++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 16 deletions(-) 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(' · ') }} + + قیمتی روشن نیست
{{ items.length ? 'نتیجه‌ای برای این جستجو نیست' : 'کلید دسترسی‌ای در قالب نیست' }} @@ -408,12 +431,13 @@ onMounted(load)
+
@@ -422,7 +446,7 @@ onMounted(load) - +

حداکثر سه عکس. در ادمین ماژول عکس اول روی کارت است.

@@ -493,7 +517,7 @@ onMounted(load) اصلی @@ -502,7 +526,7 @@ onMounted(load) {{ price.hasDiscount ? 'نهایی' : 'قیمت' }} @@ -511,6 +535,7 @@ onMounted(load)
+
.ant-btn { margin-top: 12px; } @@ -679,6 +726,11 @@ onMounted(load) display: grid; gap: 8px; } +@media (min-width: 640px) { + .price-list { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} .price-item { border: 1px solid #e8eef5; border-radius: 12px; @@ -738,8 +790,9 @@ onMounted(load) } .img-slots { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); + grid-template-columns: repeat(3, 4.75rem); gap: 6px; + justify-content: start; } .img-slot { position: relative; @@ -768,9 +821,8 @@ onMounted(load) font-size: 0.75rem; } .img-slots :deep(.ant-upload.ant-upload-select-picture-card) { - width: 100%; - height: auto; - aspect-ratio: 1; + width: 4.75rem; + height: 4.75rem; margin: 0; }