From 1915ba672336b4db5d995be33d1286e214b481ab Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Wed, 18 Mar 2026 14:27:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(usergold):=20=E4=BF=AE=E5=A4=8D=E9=92=B1?= =?UTF-8?q?=E5=8C=85=E8=AE=B0=E5=BD=95=E7=B1=BB=E5=9E=8B=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=92=8C=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 提取类型文本映射函数,支持充值、消费、退款等多种类型 - 修复金额计算逻辑,直接使用后端返回的数值 - 增加空值处理,避免显示 undefined --- src/views/usergold/gold/clientCountWallet.vue | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/views/usergold/gold/clientCountWallet.vue b/src/views/usergold/gold/clientCountWallet.vue index 7fb1bc1..fc49a9e 100644 --- a/src/views/usergold/gold/clientCountWallet.vue +++ b/src/views/usergold/gold/clientCountWallet.vue @@ -232,6 +232,20 @@ const walletDetailQuery = ref({ pageSize: 20 }) +const getWalletRecordTypeText = (item) => { + const type = Number(item.type) + if (type === 0) { + return t('clientCount.recharge') + } + if (type === 1) { + return t('clientCount.consume') + } + if (type === 2) { + return t('clientCount.refund') + } + return item.typeText || t('clientCount.other') +} + const getWalletDetail = async () => { walletDetailLoading.value = true try { @@ -253,9 +267,9 @@ const getWalletDetail = async () => { if (result.code === 200) { walletDetailList.value = result.data.list.map(item => ({ time: moment(item.createTime).format('YYYY-MM-DD HH:mm:ss'), - type: item.type === 0 ? t('common.recharge') : t('common.consume'), - amount: item.type === 1 ? -Math.abs(item.amount) : Math.abs(item.amount), - desc: item.description, + type: getWalletRecordTypeText(item), + amount: Number(item.amount) || 0, + desc: item.description || '', orderNo: item.orderCode, status: item.status === 0 ? 1 : 2 }))