Browse Source

fix(usergold): 修复钱包记录类型显示和金额计算逻辑

- 提取类型文本映射函数,支持充值、消费、退款等多种类型
- 修复金额计算逻辑,直接使用后端返回的数值
- 增加空值处理,避免显示 undefined
milestone-20260304-钱包体系
zhangrenyuan 4 weeks ago
parent
commit
1915ba6723
  1. 20
      src/views/usergold/gold/clientCountWallet.vue

20
src/views/usergold/gold/clientCountWallet.vue

@ -232,6 +232,20 @@ const walletDetailQuery = ref({
pageSize: 20 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 () => { const getWalletDetail = async () => {
walletDetailLoading.value = true walletDetailLoading.value = true
try { try {
@ -253,9 +267,9 @@ const getWalletDetail = async () => {
if (result.code === 200) { if (result.code === 200) {
walletDetailList.value = result.data.list.map(item => ({ walletDetailList.value = result.data.list.map(item => ({
time: moment(item.createTime).format('YYYY-MM-DD HH:mm:ss'), 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, orderNo: item.orderCode,
status: item.status === 0 ? 1 : 2 status: item.status === 0 ? 1 : 2
})) }))

Loading…
Cancel
Save