From 9c56aa7e30754c9152ebc5f3f0573040428bf1b5 Mon Sep 17 00:00:00 2001 From: sexygoat <1538832180@qq.com> Date: Wed, 15 Apr 2026 14:10:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=A2=E5=8D=95=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/my-wallet/my-wallet.vue | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/pages/my-wallet/my-wallet.vue b/pages/my-wallet/my-wallet.vue index 1c63aa9..d21db8f 100644 --- a/pages/my-wallet/my-wallet.vue +++ b/pages/my-wallet/my-wallet.vue @@ -481,9 +481,18 @@ ); const newData = (data.items || []).map(item => { + // 格式化时间 + let formattedCreatedAt = item.created_at; + if (formattedCreatedAt && formattedCreatedAt.includes('T')) { + formattedCreatedAt = formattedCreatedAt.replace('T', ' ').slice(0, 19); + } + // 后端已返回 status_name,优先使用 if (item.status_name) { - return item; + return { + ...item, + created_at: formattedCreatedAt + }; } // 兼容旧版本,手动映射 let statusName = '未知'; @@ -503,7 +512,8 @@ } return { ...item, - status_name: statusName + status_name: statusName, + created_at: formattedCreatedAt }; }); @@ -535,10 +545,19 @@ transactionPageSize ); - const newData = (data.items || []).map(item => ({ - ...item, - type_name: item.type === 'recharge' ? '充值' : item.type === 'purchase' ? '消费' : '其他' - })); + const newData = (data.items || []).map(item => { + // 格式化时间 + let formattedCreatedAt = item.created_at; + if (formattedCreatedAt && formattedCreatedAt.includes('T')) { + formattedCreatedAt = formattedCreatedAt.replace('T', ' ').slice(0, 19); + } + + return { + ...item, + type_name: item.type === 'recharge' ? '充值' : item.type === 'purchase' ? '消费' : '其他', + created_at: formattedCreatedAt + }; + }); if (append) { transactionList.push(...newData);