feat(ui): 个人中心积分统计调整

- 当前积分 -> 剩余积分
- 新增今日消耗统计(基于最近10条交易记录计算)
This commit is contained in:
小鱼开发
2026-05-16 09:43:06 +08:00
parent 3258396e09
commit 7421e9dd7c
+24 -5
View File
@@ -207,12 +207,31 @@ export default function Profile() {
{/* 积分区 */}
<div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', padding: '24px 28px' }}>
<div>
<div style={{ fontSize: '13px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
<div style={{ display: 'flex', gap: '40px' }}>
<div>
<div style={{ fontSize: '13px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
</div>
<div style={{ fontSize: '40px', fontWeight: 700, color: '#36b26a', lineHeight: 1 }}>
{balance?.balance ?? 0}
</div>
</div>
<div style={{ fontSize: '40px', fontWeight: 700, color: '#36b26a', lineHeight: 1 }}>
{balance?.balance ?? 0}
<div>
<div style={{ fontSize: '13px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
</div>
<div style={{ fontSize: '40px', fontWeight: 700, color: '#ff6b6b', lineHeight: 1 }}>
{(() => {
const todayStr = new Date().toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-');
return recentTx
.filter(tx => {
if (tx.type !== 'consume') return false;
const txDate = new Date(tx.createdAt).toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-');
return txDate === todayStr;
})
.reduce((sum, tx) => sum + tx.amount, 0);
})()}
</div>
</div>
</div>
<button