From 27f3a6212a70c78f162000eb7072918740711402 Mon Sep 17 00:00:00 2001 From: adonis Date: Sun, 16 Aug 2026 14:03:11 +0330 Subject: [PATCH] fixsome changes --- src/pages/menuPages/configuration/index.vue | 74 ++++++- .../menuPages/configuration/settingGroups.ts | 76 ++++++- .../menuPages/configuration/settingTypes.ts | 18 ++ .../base/components/FormulaPriceSection.vue | 63 +++++- .../base/components/ProductEditorFormBody.vue | 197 +++++++++++++++--- src/pages/menuPages/products/base/index.vue | 34 ++- src/utils/productEditorPrice.ts | 66 +++++- 7 files changed, 469 insertions(+), 59 deletions(-) diff --git a/src/pages/menuPages/configuration/index.vue b/src/pages/menuPages/configuration/index.vue index 1e7ccaf..bd77457 100644 --- a/src/pages/menuPages/configuration/index.vue +++ b/src/pages/menuPages/configuration/index.vue @@ -63,7 +63,35 @@ - + + settingGroups.value.filter((g) => (groupedFiltered.value[g.id]?.length ?? 0) > 0) ) +function subsectionBlocks(group: SettingGroupDef) { + const rows = groupedFiltered.value[group.id] ?? [] + if (!group.subsections?.length) { + return [{ id: 'all', title: group.title, rows }] + } + + const used = new Set() + const blocks = group.subsections + .map((sub) => { + const subRows = rows.filter((row) => { + if (row.id == null || used.has(row.id)) return false + if (!sub.match(row.key || '')) return false + used.add(row.id) + return true + }) + return { id: sub.id, title: sub.title, rows: subRows } + }) + .filter((b) => b.rows.length > 0) + + const leftovers = rows.filter((row) => row.id != null && !used.has(row.id)) + if (leftovers.length) { + blocks.push({ id: `${group.id}-other`, title: 'سایر', rows: leftovers }) + } + return blocks +} + const defaultOpenGroupId = computed(() => { const visibleIds = visibleSettingGroups.value.map((g) => g.id) const preferred = isSystemMode.value @@ -740,6 +795,21 @@ async function ok() { margin-bottom: 8px; } +.settings-subsection { + & + & { + margin-top: 1.25rem; + padding-top: 1rem; + border-top: 1px solid var(--admin-border); + } + + &__title { + margin: 0 0 0.75rem; + font-size: 13px; + font-weight: 700; + color: var(--admin-text-primary); + } +} + :deep(.ant-form-item-extra) { font-size: 12px; color: rgba(0, 0, 0, 0.45); diff --git a/src/pages/menuPages/configuration/settingGroups.ts b/src/pages/menuPages/configuration/settingGroups.ts index 910f8e9..6c0a59f 100644 --- a/src/pages/menuPages/configuration/settingGroups.ts +++ b/src/pages/menuPages/configuration/settingGroups.ts @@ -1,8 +1,16 @@ +export type SettingSubsectionDef = { + id: string + title: string + match: (key: string) => boolean +} + export type SettingGroupDef = { id: string title: string icon: string match: (key: string) => boolean + /** زیربخش‌های داخل گروه (مثلاً روش‌های واریز) */ + subsections?: SettingSubsectionDef[] } /** گروه‌های صفحه تنظیمات عادی (فقط can_edit=1) */ @@ -81,6 +89,44 @@ export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [ icon: 'vuesax-linear:shop', match: (k) => /^external_order/.test(k) }, + { + id: 'deposit_methods', + title: 'روش‌های واریز', + icon: 'vuesax-linear:card-send', + match: (k) => + k.startsWith('deposit_method_') + || k === 'deposit_account_holder' + || k === 'deposit_card_number' + || k === 'deposit_account_number' + || k === 'deposit_sheba', + subsections: [ + { + id: 'card_to_card', + title: 'کارت به کارت', + match: (k) => + k === 'deposit_method_card_to_card' + || k === 'deposit_account_holder' + || k === 'deposit_card_number' + || k === 'deposit_account_number' + || k === 'deposit_sheba', + }, + { + id: 'gateway', + title: 'درگاه پرداخت', + match: (k) => k === 'deposit_method_gateway', + }, + { + id: 'identified', + title: 'شناسه واریز', + match: (k) => k === 'deposit_method_identified', + }, + { + id: 'shetab', + title: 'شبکه شتابی', + match: (k) => k === 'deposit_method_shetab', + }, + ], + }, { id: 'support', title: 'پشتیبانی', @@ -89,7 +135,7 @@ export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [ k === 'support_messengers' || k.startsWith('support_messenger_') || k === 'deposit_sms_support_number' - || (k.startsWith('deposit_') && !k.startsWith('external_')), + || k === 'deposit_support_message_text', }, { id: 'bots', @@ -181,12 +227,21 @@ export const SYSTEM_SETTING_GROUPS: SettingGroupDef[] = [ match: (k) => /^node_/.test(k) || k === 'montify_name' || k === 'external_order_api_enabled' }, { - id: 'gateway', - title: 'درگاه شارژ آنلاین', - icon: 'vuesax-linear:card-pos', + id: 'deposit_methods', + title: 'روش‌های واریز', + icon: 'vuesax-linear:card-send', match: (k) => k.startsWith('external_payment_') - || k === 'wallet_payment_provider' + || k === 'wallet_payment_provider', + subsections: [ + { + id: 'gateway', + title: 'درگاه فروشگاه / پرداخت آنلاین', + match: (k) => + k.startsWith('external_payment_') + || k === 'wallet_payment_provider', + }, + ], }, { id: 'payping', @@ -245,3 +300,14 @@ export function getSettingGroupId(key: string, groups: SettingGroupDef[]): strin } return 'misc' } + +export function getSettingSubsectionId( + key: string, + group: SettingGroupDef | undefined +): string | null { + if (!group?.subsections?.length) return null + for (const sub of group.subsections) { + if (sub.match(key)) return sub.id + } + return null +} diff --git a/src/pages/menuPages/configuration/settingTypes.ts b/src/pages/menuPages/configuration/settingTypes.ts index d0abf7c..3a5ab41 100644 --- a/src/pages/menuPages/configuration/settingTypes.ts +++ b/src/pages/menuPages/configuration/settingTypes.ts @@ -368,6 +368,10 @@ const KEY_TYPE_FALLBACK: Record = { deposit_card_number: 'text', deposit_account_number: 'text', deposit_sheba: 'text', + deposit_method_card_to_card: 'switch', + deposit_method_gateway: 'switch', + deposit_method_identified: 'switch', + deposit_method_shetab: 'switch', invite_link_text: 'longtext', support_messenger: 'select', deposit_sms_support_number: 'number', @@ -775,6 +779,14 @@ const KEY_HELP_FALLBACK: Record = { 'شماره حساب بانکی واریز — در مودال راهنمای شارژ کنار کارت و شبا نمایش داده می‌شود. در متن‌ها با ٪حساب یا %حساب جایگزین می‌شود.', deposit_sheba: 'شماره شبا واریز — در متن‌ها با ٪شبا یا %شبا جایگزین می‌شود.', + deposit_method_card_to_card: + 'روشن (پیش‌فرض): روش کارت به کارت در صفحه واریز اپ نمایش داده می‌شود. خاموش: این روش از لیست روش‌های واریز حذف می‌شود.', + deposit_method_gateway: + 'روشن: روش درگاه پرداخت در صفحه واریز نمایش داده می‌شود. خاموش: مخفی است. اتصال و کدهای درگاه در تنظیمات پیشرفته → روش‌های واریز تنظیم می‌شوند.', + deposit_method_identified: + 'روشن: روش شناسه واریز در صفحه واریز نمایش داده می‌شود. خاموش: مخفی است.', + deposit_method_shetab: + 'روشن: روش شبکه شتابی در صفحه واریز نمایش داده می‌شود. خاموش: مخفی است.', deposit_sms_support_number: 'شماره تماس پشتیبانی برای راهنمای واریز و دکمه پیامک داخل مودال شارژ. برای نمایش در منوی شناور، باید «تماس تلفنی» یا «پیامک» را جداگانه در لیست پیام‌رسان‌های پشتیبانی اضافه کنید.', charge_notif: @@ -1030,6 +1042,10 @@ export const KEY_LABEL_FALLBACK: Record = { deposit_card_number: 'شماره کارت واریز', deposit_account_number: 'شماره حساب واریز', deposit_sheba: 'شبا واریز', + deposit_method_card_to_card: 'فعال‌سازی کارت به کارت', + deposit_method_gateway: 'فعال‌سازی درگاه پرداخت', + deposit_method_identified: 'فعال‌سازی شناسه واریز', + deposit_method_shetab: 'فعال‌سازی شبکه شتابی', deposit_sms_support_number: 'شماره تماس پشتیبانی', price_channel_enabled: 'ارسال قیمت به کانال', price_channel_access: 'دسترسی ارسال قیمت به کانال', @@ -1119,6 +1135,7 @@ export const SETTING_EDITABLE_KEYS = new Set([ 'sms_notif_price_trigger', 'sms_notif_wallet_alert', 'sms_notif_support_admin', 'deposit_sms_support_number', 'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba', + 'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab', 'endDay', 'fee_free', 'fee_service_charge_percentage', 'gift_for_referral', 'gift_for_referrer', @@ -1138,6 +1155,7 @@ export const SETTING_EDITABLE_KEYS = new Set([ 'support_messengers', 'support_messenger_text', 'has_chat', 'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba', + 'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab', 'text_about', 'text_rule', 'zaarbox_price_key', 'price_channel_enabled', 'price_channel_messengers', 'price_channel_diff', diff --git a/src/pages/menuPages/products/base/components/FormulaPriceSection.vue b/src/pages/menuPages/products/base/components/FormulaPriceSection.vue index 4881b20..a1ae3ed 100644 --- a/src/pages/menuPages/products/base/components/FormulaPriceSection.vue +++ b/src/pages/menuPages/products/base/components/FormulaPriceSection.vue @@ -1,8 +1,13 @@ @@ -126,9 +131,55 @@ function onToggle(checked: boolean) { + + diff --git a/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue b/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue index 3869f61..f33a902 100644 --- a/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue +++ b/src/pages/menuPages/products/base/components/ProductEditorFormBody.vue @@ -41,18 +41,47 @@ - +
+
+ + + {{ usePrice(selectedReferenceTotal) }} + + + در لیست فعلی نیست + + + قیمت مرجع در دسترس نیست + +
+ +