fixed withdraw

This commit is contained in:
2026-07-06 22:16:17 +03:30
parent de7fcefddc
commit 1000df5931
2 changed files with 33 additions and 8 deletions
+3
View File
@@ -15,12 +15,14 @@ declare module 'vue' {
AInputPassword: typeof import('ant-design-vue/es')['InputPassword'] AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
AModal: typeof import('ant-design-vue/es')['Modal'] AModal: typeof import('ant-design-vue/es')['Modal']
AppCreditLink: typeof import('./src/components/AppCreditLink.vue')['default'] AppCreditLink: typeof import('./src/components/AppCreditLink.vue')['default']
ARadio: typeof import('ant-design-vue/es')['Radio']
ARadioButton: typeof import('ant-design-vue/es')['RadioButton'] ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
ASelect: typeof import('ant-design-vue/es')['Select'] ASelect: typeof import('ant-design-vue/es')['Select']
ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
ASlider: typeof import('ant-design-vue/es')['Slider'] ASlider: typeof import('ant-design-vue/es')['Slider']
ASpin: typeof import('ant-design-vue/es')['Spin'] ASpin: typeof import('ant-design-vue/es')['Spin']
ASwitch: typeof import('ant-design-vue/es')['Switch']
ATag: typeof import('ant-design-vue/es')['Tag'] ATag: typeof import('ant-design-vue/es')['Tag']
ATextarea: typeof import('ant-design-vue/es')['Textarea'] ATextarea: typeof import('ant-design-vue/es')['Textarea']
ATooltip: typeof import('ant-design-vue/es')['Tooltip'] ATooltip: typeof import('ant-design-vue/es')['Tooltip']
@@ -68,5 +70,6 @@ declare module 'vue' {
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default'] TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
VanActionSheet: typeof import('vant/es')['ActionSheet'] VanActionSheet: typeof import('vant/es')['ActionSheet']
VanDialog: typeof import('vant/es')['Dialog'] VanDialog: typeof import('vant/es')['Dialog']
VanField: typeof import('vant/es')['Field']
} }
} }
+30 -8
View File
@@ -51,6 +51,8 @@ type TransactionPriceSource = {
cash?: number | null cash?: number | null
gold?: number | null gold?: number | null
type?: number | null type?: number | null
sts?: number | null
sts_str?: string | number | null
order?: { order?: {
price?: number | null price?: number | null
total_price?: number | null total_price?: number | null
@@ -72,6 +74,18 @@ const ORDER_STATUS_LABELS: Record<number, string> = {
3: 'ناموفق', 3: 'ناموفق',
} }
const WITHDRAW_STATUS_LABELS: Record<number, string> = {
1: 'در انتظار تایید',
2: 'انجام شد',
3: 'ناموفق',
4: 'واریز توسط ادمین',
5: 'پاداش معرفی',
9: 'سود زیر مجموعه',
50: 'در انتظار ارسال',
51: 'ارسال شده',
52: 'لغو شده',
}
export function getTransactionTradePrice(item: TransactionPriceSource): number { export function getTransactionTradePrice(item: TransactionPriceSource): number {
const orderPrice = Number(item.order?.price) const orderPrice = Number(item.order?.price)
if (Number.isFinite(orderPrice) && orderPrice > 0) { if (Number.isFinite(orderPrice) && orderPrice > 0) {
@@ -97,22 +111,30 @@ export function getTransactionTradePrice(item: TransactionPriceSource): number {
export function resolveTransactionStatusLabel(item?: TransactionPriceSource | null): string { export function resolveTransactionStatusLabel(item?: TransactionPriceSource | null): string {
if (!item) return '' if (!item) return ''
const raw = item.order?.sts_str ?? item.withdraw?.sts_str const raw = item.order?.sts_str ?? item.withdraw?.sts_str ?? item.sts_str
if (typeof raw === 'string') { if (typeof raw === 'string') {
const trimmed = raw.trim() const trimmed = raw.trim()
if (trimmed && trimmed !== 'بدون مقدار') { if (trimmed && trimmed !== 'بدون مقدار' && !/^\d+$/.test(trimmed)) {
return trimmed return trimmed
} }
} }
if (typeof raw === 'number' || (typeof raw === 'string' && /^\d+$/.test(String(raw).trim()))) { const sts = item.order?.sts ?? item.withdraw?.sts ?? item.sts
const mapped = ORDER_STATUS_LABELS[Number(raw)] if (sts != null) {
if (mapped) return mapped const withdrawLabel = WITHDRAW_STATUS_LABELS[Number(sts)]
if (withdrawLabel) return withdrawLabel
const orderLabel = ORDER_STATUS_LABELS[Number(sts)]
if (orderLabel) return orderLabel
} }
const sts = item.order?.sts ?? item.withdraw?.sts if (typeof raw === 'number' || (typeof raw === 'string' && /^\d+$/.test(String(raw).trim()))) {
if (sts != null && ORDER_STATUS_LABELS[Number(sts)]) { const numericSts = Number(raw)
return ORDER_STATUS_LABELS[Number(sts)] const withdrawLabel = WITHDRAW_STATUS_LABELS[numericSts]
if (withdrawLabel) return withdrawLabel
const orderLabel = ORDER_STATUS_LABELS[numericSts]
if (orderLabel) return orderLabel
} }
if (item.order_id && Number(item.order?.payment_sts) === 4) { if (item.order_id && Number(item.order?.payment_sts) === 4) {