From 96fa254abb0f32b49ba39047fb6514fc86ee6883 Mon Sep 17 00:00:00 2001 From: adonis Date: Wed, 29 Jul 2026 16:02:41 +0330 Subject: [PATCH] fix price --- .../components/PargarMobileDetailSheet.vue | 6 +- .../components/PargarMobileListItem.vue | 8 +- .../components/TahesabMobileDetailSheet.vue | 7 +- .../components/TahesabMobileListItem.vue | 9 +- .../components/ZarinMobileDetailSheet.vue | 7 +- .../components/ZarinMobileListItem.vue | 9 +- .../accounting/components/pargarTable.vue | 24 +++- .../accounting/components/tahesabTable.vue | 25 +++- .../accounting/components/zarinTable.vue | 25 +++- .../accounting/utils/accountingDocAmounts.ts | 125 ++++++++++++++++++ .../accounting/utils/pargarDisplay.ts | 98 ++++++++++---- .../menuPages/configuration/settingGroups.ts | 2 +- .../menuPages/configuration/settingTypes.ts | 11 +- 13 files changed, 313 insertions(+), 43 deletions(-) create mode 100644 src/pages/menuPages/accounting/utils/accountingDocAmounts.ts diff --git a/src/pages/menuPages/accounting/components/PargarMobileDetailSheet.vue b/src/pages/menuPages/accounting/components/PargarMobileDetailSheet.vue index 0c66b9b..b34d74a 100644 --- a/src/pages/menuPages/accounting/components/PargarMobileDetailSheet.vue +++ b/src/pages/menuPages/accounting/components/PargarMobileDetailSheet.vue @@ -27,7 +27,8 @@ - + + @@ -79,9 +80,10 @@ import { canRetryPargar, pargarStatusLabel } from '@/pages/menuPages/accounting/ import { formatTransactionAmount, parsePargarPayload, - pargarAmountLabel, pargarCustomerLabel, pargarDescLabel, + pargarMetalAmountLabel, + pargarRialAmountLabel, pargarTypeLabel } from '@/pages/menuPages/accounting/utils/pargarDisplay' import { isMobile } from '@core/utils/is' diff --git a/src/pages/menuPages/accounting/components/PargarMobileListItem.vue b/src/pages/menuPages/accounting/components/PargarMobileListItem.vue index 459d9d7..235cd3b 100644 --- a/src/pages/menuPages/accounting/components/PargarMobileListItem.vue +++ b/src/pages/menuPages/accounting/components/PargarMobileListItem.vue @@ -9,7 +9,8 @@
نوع: {{ pargarTypeLabel(item.type) }} - مقدار: {{ pargarAmountLabel(item) }} + مقدار: {{ metalLabel }} + ریال: {{ rialLabel }}
{{ createdAtLabel }}
@@ -22,8 +23,9 @@ import MobileCard from '@/components/mobile/MobileCard.vue' import { toJalali } from '@core/utils/useDataTime' import { pargarStatusLabel } from '@/pages/menuPages/accounting/utils/pargarStatus' import { - pargarAmountLabel, pargarCustomerLabel, + pargarMetalAmountLabel, + pargarRialAmountLabel, pargarTypeLabel } from '@/pages/menuPages/accounting/utils/pargarDisplay' @@ -39,6 +41,8 @@ const customerName = computed(() => pargarCustomerLabel(props.item)) const createdAtLabel = computed(() => props.item.created_at ? toJalali(props.item.created_at) : '-' ) +const metalLabel = computed(() => pargarMetalAmountLabel(props.item)) +const rialLabel = computed(() => pargarRialAmountLabel(props.item)) const statusText = computed(() => pargarStatusLabel(props.item.sync_status, props.item.pargar_ref, props.item.desc) ) diff --git a/src/pages/menuPages/accounting/components/TahesabMobileDetailSheet.vue b/src/pages/menuPages/accounting/components/TahesabMobileDetailSheet.vue index 7c157ea..396c83c 100644 --- a/src/pages/menuPages/accounting/components/TahesabMobileDetailSheet.vue +++ b/src/pages/menuPages/accounting/components/TahesabMobileDetailSheet.vue @@ -27,7 +27,8 @@ - + + @@ -52,6 +53,10 @@ import MobileDetailSheet from '@/components/mobile/MobileDetailSheet.vue' import MobileIconButton from '@/components/mobile/MobileIconButton.vue' import MobileInfoGrid from '@/components/mobile/MobileInfoGrid.vue' import MobileSheetHeader from '@/components/mobile/MobileSheetHeader.vue' +import { + metalAmountLabel, + rialAmountLabel, +} from '@/pages/menuPages/accounting/utils/accountingDocAmounts' import { canRetryTahesab, tahesabStatusLabel } from '@/pages/menuPages/accounting/utils/tahesabStatus' import { isMobile } from '@core/utils/is' import { toJalali } from '@core/utils/useDataTime' diff --git a/src/pages/menuPages/accounting/components/TahesabMobileListItem.vue b/src/pages/menuPages/accounting/components/TahesabMobileListItem.vue index d9c62aa..e00acd4 100644 --- a/src/pages/menuPages/accounting/components/TahesabMobileListItem.vue +++ b/src/pages/menuPages/accounting/components/TahesabMobileListItem.vue @@ -9,7 +9,8 @@
نوع: {{ item.type || '-' }} - مقدار: {{ item.amount ?? '-' }} + مقدار: {{ metalLabel }} + ریال: {{ rialLabel }}
{{ createdAtLabel }}
@@ -20,6 +21,10 @@ import type { TahesabRecord } from '@/api/tahesab' import MobileCard from '@/components/mobile/MobileCard.vue' import { toJalali } from '@core/utils/useDataTime' +import { + metalAmountLabel, + rialAmountLabel, +} from '@/pages/menuPages/accounting/utils/accountingDocAmounts' import { tahesabStatusLabel } from '@/pages/menuPages/accounting/utils/tahesabStatus' const props = defineProps<{ @@ -34,6 +39,8 @@ const customerName = computed(() => props.item.customer?.name || '-') const createdAtLabel = computed(() => props.item.created_at ? toJalali(props.item.created_at) : '-' ) +const metalLabel = computed(() => metalAmountLabel(props.item)) +const rialLabel = computed(() => rialAmountLabel(props.item)) const statusText = computed(() => tahesabStatusLabel(props.item.sync_status, props.item.tahesab_id) ) diff --git a/src/pages/menuPages/accounting/components/ZarinMobileDetailSheet.vue b/src/pages/menuPages/accounting/components/ZarinMobileDetailSheet.vue index 68f8ba8..eb7b085 100644 --- a/src/pages/menuPages/accounting/components/ZarinMobileDetailSheet.vue +++ b/src/pages/menuPages/accounting/components/ZarinMobileDetailSheet.vue @@ -27,7 +27,8 @@ - + + @@ -52,6 +53,10 @@ import MobileDetailSheet from '@/components/mobile/MobileDetailSheet.vue' import MobileIconButton from '@/components/mobile/MobileIconButton.vue' import MobileInfoGrid from '@/components/mobile/MobileInfoGrid.vue' import MobileSheetHeader from '@/components/mobile/MobileSheetHeader.vue' +import { + metalAmountLabel, + rialAmountLabel, +} from '@/pages/menuPages/accounting/utils/accountingDocAmounts' import { canRetryZarin, zarinStatusLabel } from '@/pages/menuPages/accounting/utils/zarinStatus' import { isMobile } from '@core/utils/is' import { toJalali } from '@core/utils/useDataTime' diff --git a/src/pages/menuPages/accounting/components/ZarinMobileListItem.vue b/src/pages/menuPages/accounting/components/ZarinMobileListItem.vue index 6133a96..705d2ee 100644 --- a/src/pages/menuPages/accounting/components/ZarinMobileListItem.vue +++ b/src/pages/menuPages/accounting/components/ZarinMobileListItem.vue @@ -9,7 +9,8 @@
نوع: {{ item.type || '-' }} - مقدار: {{ item.amount ?? '-' }} + مقدار: {{ metalLabel }} + ریال: {{ rialLabel }}
{{ createdAtLabel }}
@@ -20,6 +21,10 @@ import type { ZarinRecord } from '@/api/zarin' import MobileCard from '@/components/mobile/MobileCard.vue' import { toJalali } from '@core/utils/useDataTime' +import { + metalAmountLabel, + rialAmountLabel, +} from '@/pages/menuPages/accounting/utils/accountingDocAmounts' import { zarinStatusLabel } from '@/pages/menuPages/accounting/utils/zarinStatus' const props = defineProps<{ @@ -34,6 +39,8 @@ const customerName = computed(() => props.item.customer?.name || '-') const createdAtLabel = computed(() => props.item.created_at ? toJalali(props.item.created_at) : '-' ) +const metalLabel = computed(() => metalAmountLabel(props.item)) +const rialLabel = computed(() => rialAmountLabel(props.item)) const statusText = computed(() => zarinStatusLabel(props.item.sync_status, props.item.zarin_id) ) diff --git a/src/pages/menuPages/accounting/components/pargarTable.vue b/src/pages/menuPages/accounting/components/pargarTable.vue index 5130a4d..2621e7a 100644 --- a/src/pages/menuPages/accounting/components/pargarTable.vue +++ b/src/pages/menuPages/accounting/components/pargarTable.vue @@ -130,9 +130,10 @@ import { canRetryPargar, pargarStatusLabel } from '@/pages/menuPages/accounting/ import { formatTransactionAmount, parsePargarPayload, - pargarAmountLabel, pargarCustomerLabel, pargarDescLabel, + pargarMetalAmountLabel, + pargarRialAmountLabel, pargarTypeLabel } from '@/pages/menuPages/accounting/utils/pargarDisplay' import { toJalali } from '@core/utils/useDataTime' @@ -155,7 +156,23 @@ const columns = [ }, { title: 'مشتری', dataIndex: 'customer.name', key: 'customer.name', type: 'Text', customRender: (r: any) => pargarCustomerLabel(r.record) }, { title: 'نوع', dataIndex: 'type', key: 'type', type: 'Text', customRender: (r: any) => pargarTypeLabel(r.record.type) }, - { title: 'مقدار', dataIndex: 'amount', key: 'amount', type: 'Number', customRender: (r: any) => pargarAmountLabel(r.record) }, + { + title: 'مقدار', + dataIndex: 'amount', + key: 'amount', + type: 'Number', + filterable: false, + customRender: (r: any) => pargarMetalAmountLabel(r.record), + }, + { + title: 'مبلغ ریالی', + dataIndex: 'rial_amount', + key: 'rial_amount', + type: 'Text', + filterable: false, + sortable: false, + customRender: (r: any) => pargarRialAmountLabel(r.record), + }, { title: 'شرح', dataIndex: 'desc', key: 'desc', type: 'Text', customRender: (r: any) => pargarDescLabel(r.record) }, { title: 'وضعیت', @@ -197,7 +214,8 @@ const infoItems = computed(() => { { label: 'موبایل', value: row.customer?.mobile || '-' }, { label: 'کد حساب پرگار', value: payload?.accountId || row.pargar_ref || '-' }, { label: 'نوع', value: pargarTypeLabel(row.type) }, - { label: 'مقدار', value: pargarAmountLabel(row) }, + { label: 'مقدار', value: pargarMetalAmountLabel(row) }, + { label: 'مبلغ ریالی', value: pargarRialAmountLabel(row) }, { label: 'شرح', value: pargarDescLabel(row) }, { label: 'تعداد سطر سند', value: payload?.transactions.length ? String(payload.transactions.length) : '-' }, { label: 'زمان ثبت', value: row.created_at ? toJalali(row.created_at) : '-' }, diff --git a/src/pages/menuPages/accounting/components/tahesabTable.vue b/src/pages/menuPages/accounting/components/tahesabTable.vue index 00893fa..eeaded1 100644 --- a/src/pages/menuPages/accounting/components/tahesabTable.vue +++ b/src/pages/menuPages/accounting/components/tahesabTable.vue @@ -92,6 +92,10 @@ import BasicModal from '@/components/BasicModal.vue' import TahesabRetryModal from '@/components/TahesabRetryModal.vue' import TahesabMobileCardList from '@/pages/menuPages/accounting/components/TahesabMobileCardList.vue' import { tahesabStatusLabel } from '@/pages/menuPages/accounting/utils/tahesabStatus' +import { + metalAmountLabel, + rialAmountLabel, +} from '@/pages/menuPages/accounting/utils/accountingDocAmounts' import { toJalali } from '@core/utils/useDataTime' const [submit, reload] = useBaseTable() @@ -112,7 +116,23 @@ const columns = [ }, { title: 'مشتری', dataIndex: 'customer.name', key: 'customer.name', type: 'Text' }, { title: 'نوع', dataIndex: 'type', key: 'type', type: 'Text' }, - { title: 'مقدار', dataIndex: 'amount', key: 'amount', type: 'Number' }, + { + title: 'مقدار', + dataIndex: 'amount', + key: 'amount', + type: 'Number', + filterable: false, + customRender: (r: any) => metalAmountLabel(r.record), + }, + { + title: 'مبلغ ریالی', + dataIndex: 'rial_amount', + key: 'rial_amount', + type: 'Text', + filterable: false, + sortable: false, + customRender: (r: any) => rialAmountLabel(r.record), + }, { title: 'شرح', dataIndex: 'desc', key: 'desc', type: 'Text' }, { title: 'وضعیت', @@ -152,7 +172,8 @@ const infoItems = computed(() => { { label: 'مشتری', value: row.customer?.name }, { label: 'موبایل', value: row.customer?.mobile }, { label: 'نوع', value: row.type }, - { label: 'مقدار', value: row.amount }, + { label: 'مقدار', value: metalAmountLabel(row) }, + { label: 'مبلغ ریالی', value: rialAmountLabel(row) }, { label: 'شرح', value: row.desc }, { label: 'زمان ثبت', value: row.created_at ? toJalali(row.created_at) : '-' }, { label: 'وضعیت', value: tahesabStatusLabel(row.sync_status, row.tahesab_id) }, diff --git a/src/pages/menuPages/accounting/components/zarinTable.vue b/src/pages/menuPages/accounting/components/zarinTable.vue index 7542f7d..b11de9c 100644 --- a/src/pages/menuPages/accounting/components/zarinTable.vue +++ b/src/pages/menuPages/accounting/components/zarinTable.vue @@ -92,6 +92,10 @@ import BasicModal from '@/components/BasicModal.vue' import ZarinRetryModal from '@/components/ZarinRetryModal.vue' import ZarinMobileCardList from '@/pages/menuPages/accounting/components/ZarinMobileCardList.vue' import { zarinStatusLabel } from '@/pages/menuPages/accounting/utils/zarinStatus' +import { + metalAmountLabel, + rialAmountLabel, +} from '@/pages/menuPages/accounting/utils/accountingDocAmounts' import { toJalali } from '@core/utils/useDataTime' const [submit, reload] = useBaseTable() @@ -112,7 +116,23 @@ const columns = [ }, { title: 'مشتری', dataIndex: 'customer.name', key: 'customer.name', type: 'Text' }, { title: 'نوع', dataIndex: 'type', key: 'type', type: 'Text' }, - { title: 'مقدار', dataIndex: 'amount', key: 'amount', type: 'Number' }, + { + title: 'مقدار', + dataIndex: 'amount', + key: 'amount', + type: 'Number', + filterable: false, + customRender: (r: any) => metalAmountLabel(r.record), + }, + { + title: 'مبلغ ریالی', + dataIndex: 'rial_amount', + key: 'rial_amount', + type: 'Text', + filterable: false, + sortable: false, + customRender: (r: any) => rialAmountLabel(r.record), + }, { title: 'شرح', dataIndex: 'desc', key: 'desc', type: 'Text' }, { title: 'وضعیت', @@ -152,7 +172,8 @@ const infoItems = computed(() => { { label: 'مشتری', value: row.customer?.name }, { label: 'موبایل', value: row.customer?.mobile }, { label: 'نوع', value: row.type }, - { label: 'مقدار', value: row.amount }, + { label: 'مقدار', value: metalAmountLabel(row) }, + { label: 'مبلغ ریالی', value: rialAmountLabel(row) }, { label: 'شرح', value: row.desc }, { label: 'زمان ثبت', value: row.created_at ? toJalali(row.created_at) : '-' }, { label: 'وضعیت', value: zarinStatusLabel(row.sync_status, row.zarin_id) }, diff --git a/src/pages/menuPages/accounting/utils/accountingDocAmounts.ts b/src/pages/menuPages/accounting/utils/accountingDocAmounts.ts new file mode 100644 index 0000000..d938cf0 --- /dev/null +++ b/src/pages/menuPages/accounting/utils/accountingDocAmounts.ts @@ -0,0 +1,125 @@ +/** + * استخراج مقدار فلز/تعداد و مبلغ ریالی از ردیف اسناد ته‌حساب / زرین. + * منبع: ستون amount + JSON فیلد data (بدون ستون DB جدا). + */ + +export type AccountingSyncDocRecord = { + amount?: number | string | null + type?: string | null + desc?: string | null + data?: string | null +} + +function parseNum(value: unknown): number { + if (value == null || value === '') return NaN + const n = Number(String(value).replace(/,/g, '').replace('/', '.')) + return Number.isFinite(n) ? n : NaN +} + +export function parseDocPayload(data?: string | null): Record | null { + if (!data?.trim()) return null + try { + const parsed = JSON.parse(data) + return parsed && typeof parsed === 'object' && !Array.isArray(parsed) + ? (parsed as Record) + : null + } catch { + return null + } +} + +function normalizeType(type?: string | null): string { + return String(type ?? '') + .trim() + .replace(/ي/g, 'ی') + .replace(/ك/g, 'ک') +} + +/** سند خالص ریالی (شارژ/برداشت کیف) */ +export function isRialOnlyDoc(record: AccountingSyncDocRecord): boolean { + const type = normalizeType(record.type) + if (type === 'ریال' || type === 'ريال') return true + + const payload = parseDocPayload(record.data) + const handler = String(payload?.handler ?? '') + return handler === 'wallet' +} + +/** + * مقدار فلز/تعداد برای نمایش در ستون «مقدار». + * ردیف ریالی → null (نشان `-`). + */ +export function resolveMetalAmount(record: AccountingSyncDocRecord): number | null { + if (isRialOnlyDoc(record)) return null + + const n = parseNum(record.amount) + if (!Number.isFinite(n)) return null + return n +} + +/** + * مبلغ ریالی برای ستون «مبلغ ریالی». + * - wallet: همان amount + * - storeTrade: total_price یا amount×price + * - walletGold / goldReward: معمولاً نیست مگر در data + */ +export function resolveRialAmount(record: AccountingSyncDocRecord): number | null { + if (isRialOnlyDoc(record)) { + const n = parseNum(record.amount) + return Number.isFinite(n) ? n : null + } + + const payload = parseDocPayload(record.data) + if (!payload) return null + + const handler = String(payload.handler ?? '') + + const totalPrice = parseNum(payload.total_price) + if (Number.isFinite(totalPrice) && Math.abs(totalPrice) >= 1) { + return Math.round(totalPrice) + } + + // value فقط برای wallet ریالی معنا دارد؛ برای فلز نادیده + if (handler === 'wallet') { + const value = parseNum(payload.value) + if (Number.isFinite(value)) return Math.round(value) + } + + if (handler === 'storeTrade' || handler === '') { + const price = parseNum(payload.price) + const qty = parseNum(payload.amount ?? record.amount) + if (Number.isFinite(price) && Number.isFinite(qty) && price > 0 && Math.abs(qty) > 0) { + return Math.round(price * qty) + } + } + + const cash = parseNum(payload.cash ?? payload.mablagh ?? payload.mablagh_kol) + if (Number.isFinite(cash) && Math.abs(cash) >= 1) { + return Math.round(cash) + } + + return null +} + +export function formatMetalAmountLabel(value: number | null | undefined): string { + if (value == null || !Number.isFinite(value)) return '-' + // تعداد صحیح (سکه و …) بدون اعشار اضافی؛ وزن با حداکثر ۶ رقم اعشار مفید + if (Math.abs(value - Math.round(value)) < 1e-9) { + return String(Math.round(value)) + } + const trimmed = Number(value.toFixed(6)) + return String(trimmed) +} + +export function formatRialAmountLabel(value: number | null | undefined): string { + if (value == null || !Number.isFinite(value)) return '-' + return Math.round(value).toLocaleString('fa-IR') +} + +export function metalAmountLabel(record: AccountingSyncDocRecord): string { + return formatMetalAmountLabel(resolveMetalAmount(record)) +} + +export function rialAmountLabel(record: AccountingSyncDocRecord): string { + return formatRialAmountLabel(resolveRialAmount(record)) +} diff --git a/src/pages/menuPages/accounting/utils/pargarDisplay.ts b/src/pages/menuPages/accounting/utils/pargarDisplay.ts index 3362d32..a0bb584 100644 --- a/src/pages/menuPages/accounting/utils/pargarDisplay.ts +++ b/src/pages/menuPages/accounting/utils/pargarDisplay.ts @@ -70,40 +70,86 @@ export function pargarCustomerLabel(record: PargarRecord): string { } export function pargarAmountLabel(record: PargarRecord): string { - if (record.amount != null && record.amount !== 0) { - return formatPargarAmount(record.amount, record) - } - - const payload = parsePargarPayload(record.data) - if (!payload?.transactions.length) return '-' - - let maxGold = 0 - let maxRial = 0 - for (const tx of payload.transactions) { - maxGold = Math.max(maxGold, Math.abs(parseNum(tx.bedGold)), Math.abs(parseNum(tx.besGold))) - maxRial = Math.max(maxRial, Math.abs(parseNum(tx.bedRial)), Math.abs(parseNum(tx.besRial))) - } - - if (maxGold >= 0.01) return `${maxGold} گرم` - if (maxRial >= 1) return `${maxRial.toLocaleString('fa-IR')} ریال` + const metal = pargarMetalAmountLabel(record) + const rial = pargarRialAmountLabel(record) + if (metal !== '-' && rial !== '-') return `${metal} / ${rial}` + if (metal !== '-') return metal + if (rial !== '-') return rial return '-' } -function formatPargarAmount(amount: number, record: PargarRecord): string { +function resolvePargarSummaryUnit(record: PargarRecord): 'rial' | 'gold' | null { + try { + const raw = record.data ? (JSON.parse(record.data) as { _summary?: { amount_unit?: string } }) : null + const unit = raw?._summary?.amount_unit + if (unit === 'rial' || unit === 'gold') return unit + } catch { + // ignore + } + if (record.type === 'wallet_cash') return 'rial' + if (record.type === 'wallet_gold' || record.type === 'mande') return 'gold' + return null +} + +function maxGoldFromPayload(record: PargarRecord): number { const payload = parsePargarPayload(record.data) - let summaryUnit: string | undefined - if (payload && '_summary' in (JSON.parse(record.data || '{}') as Record)) { - const raw = JSON.parse(record.data || '{}') as { _summary?: { amount_unit?: string } } - summaryUnit = raw._summary?.amount_unit + if (!payload?.transactions.length) return 0 + let maxGold = 0 + for (const tx of payload.transactions) { + maxGold = Math.max(maxGold, Math.abs(parseNum(tx.bedGold)), Math.abs(parseNum(tx.besGold))) + } + return maxGold +} + +function maxRialFromPayload(record: PargarRecord): number { + const payload = parsePargarPayload(record.data) + if (!payload?.transactions.length) return 0 + let maxRial = 0 + for (const tx of payload.transactions) { + maxRial = Math.max(maxRial, Math.abs(parseNum(tx.bedRial)), Math.abs(parseNum(tx.besRial))) + } + return maxRial +} + +/** ستون مقدار — فلز/گرم (نه ریال) */ +export function pargarMetalAmountLabel(record: PargarRecord): string { + if (record.type === 'wallet_cash') return '-' + + const unit = resolvePargarSummaryUnit(record) + if (record.amount != null && record.amount !== 0) { + if (unit === 'rial') { + // amount ریالی است؛ فلز را از تراکنش‌ها بگیر + } else if (unit === 'gold' || unit == null) { + if (unit === 'gold' || record.type !== 'document') { + const n = Number(record.amount) + if (Number.isFinite(n) && Math.abs(n) >= 0.000001) { + return Math.abs(n - Math.round(n)) < 1e-9 ? String(Math.round(n)) : String(Number(n.toFixed(6))) + } + } + } } - if (summaryUnit === 'rial' || record.type === 'wallet_cash') { - return `${amount.toLocaleString('fa-IR')} ریال` + const maxGold = maxGoldFromPayload(record) + if (maxGold >= 0.01) { + return Math.abs(maxGold - Math.round(maxGold)) < 1e-9 + ? String(Math.round(maxGold)) + : String(Number(maxGold.toFixed(6))) } - if (summaryUnit === 'gold' || record.type === 'wallet_gold' || record.type === 'mande') { - return `${amount} گرم` + return '-' +} + +/** ستون مبلغ ریالی */ +export function pargarRialAmountLabel(record: PargarRecord): string { + const unit = resolvePargarSummaryUnit(record) + if (record.amount != null && record.amount !== 0) { + if (unit === 'rial' || record.type === 'wallet_cash') { + return Math.round(Number(record.amount)).toLocaleString('fa-IR') + } } - return String(amount) + + const maxRial = maxRialFromPayload(record) + if (maxRial >= 1) return Math.round(maxRial).toLocaleString('fa-IR') + return '-' } export function pargarDescLabel(record: PargarRecord): string { diff --git a/src/pages/menuPages/configuration/settingGroups.ts b/src/pages/menuPages/configuration/settingGroups.ts index 15b39b6..f83e150 100644 --- a/src/pages/menuPages/configuration/settingGroups.ts +++ b/src/pages/menuPages/configuration/settingGroups.ts @@ -21,7 +21,7 @@ export const EDITABLE_SETTING_GROUPS: SettingGroupDef[] = [ title: 'دسترسی مشتری به قابلیت‌ها', icon: 'vuesax-linear:people', match: (k) => - /^(banner_enabled|tracking_systems_enabled|jibit_verification|register_jibit_verify|show_product_details)$/.test(k) + /^(banner_enabled|tracking_systems_enabled|jibit_verification|register_jibit_verify|show_product_details|show_product_trade_status|show_product_card_meta)$/.test(k) }, { id: 'trading_hours', diff --git a/src/pages/menuPages/configuration/settingTypes.ts b/src/pages/menuPages/configuration/settingTypes.ts index b6e7eba..36594a8 100644 --- a/src/pages/menuPages/configuration/settingTypes.ts +++ b/src/pages/menuPages/configuration/settingTypes.ts @@ -271,6 +271,8 @@ const KEY_TYPE_FALLBACK: Record = { show_home_price_when_closed: 'switch', show_gold_ounce_price: 'switch', show_product_details: 'switch', + show_product_trade_status: 'switch', + show_product_card_meta: 'switch', send_to_tahesab: 'switch', accounting_provider: 'select', profit_gold_api_enabled: 'switch', @@ -566,6 +568,10 @@ const KEY_HELP_FALLBACK: Record = { 'روشن: اگر آدرس API تابلو (zaarbox_api_url) تنظیم شده باشد، قیمت انس طلا در اپ مشتری نمایش داده می‌شود. خاموش: نمایش داده نمی‌شود.', show_product_details: 'روشن: بعد از انتخاب محصول در صفحه خرید/فروش، متن توضیح محصول نمایش داده می‌شود. خاموش: توضیح نشان داده نمی‌شود.', + show_product_trade_status: + 'روشن: روی کارت محصول برچسب خرید باز/بسته و فروش باز/بسته نمایش داده می‌شود. خاموش: مخفی است.', + show_product_card_meta: + 'روشن: روی کارت محصول دسته‌بندی، وضعیت تحویل فیزیکی و مقدار/وزن نمایش داده می‌شود. خاموش: مخفی است.', fee_single: 'منسوخ — دیگر استفاده نمی‌شود. اختلاف فقط از buy_fee / sell_fee (خالی = صفر).', buy_fee: @@ -825,6 +831,8 @@ export const KEY_LABEL_FALLBACK: Record = { show_home_price_when_closed: 'نمایش قیمت صفحه اصلی خارج از ساعت کاری', show_gold_ounce_price: 'نمایش قیمت انس طلا', show_product_details: 'نمایش جزئیات اطلاعات محصول', + show_product_trade_status: 'نمایش خرید/فروش باز روی کارت محصول', + show_product_card_meta: 'نمایش دسته و تحویل و مقدار روی کارت محصول', fee_single: 'اختلاف پایه خرید/فروش', buy_fee: 'اضافه قیمت خرید', sell_fee: 'کسر قیمت فروش', @@ -983,7 +991,8 @@ export const SETTING_EDITABLE_KEYS = new Set([ 'open_register', 'referral_id', 'referral_limit', 'referral_gift_on_first_order', 'register_jibit_verify', 'register_referral_bonus_message', 'register_referral_sms_to_referrer', - 'sell_fee', 'show_last_price', 'show_home_price_when_closed', 'show_gold_ounce_price', 'show_product_details', 'startDay', + 'sell_fee', 'show_last_price', 'show_home_price_when_closed', 'show_gold_ounce_price', 'show_product_details', + 'show_product_trade_status', 'show_product_card_meta', 'startDay', 'support_messengers', 'support_messenger_text', 'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_sheba', 'text_about', 'text_rule',