修复总收入计算逻辑,确保金额正确处理为数字类型,并更新显示格式以保持一致性。
This commit is contained in:
@@ -63,7 +63,7 @@ export default function AdminDashboard() {
|
||||
)
|
||||
}
|
||||
|
||||
const totalRevenue = purchases.reduce((sum, p) => sum + (p.amount || 0), 0)
|
||||
const totalRevenue = purchases.reduce((sum, p) => sum + Number(p.amount || 0), 0)
|
||||
const totalUsers = users.length
|
||||
const totalPurchases = purchases.length
|
||||
|
||||
@@ -71,7 +71,7 @@ export default function AdminDashboard() {
|
||||
{ title: "总用户数", value: totalUsers, icon: Users, color: "text-blue-400", bg: "bg-blue-500/20", link: "/admin/users" },
|
||||
{
|
||||
title: "总收入",
|
||||
value: `¥${totalRevenue.toFixed(2)}`,
|
||||
value: `¥${Number(totalRevenue).toFixed(2)}`,
|
||||
icon: TrendingUp,
|
||||
color: "text-[#38bdac]",
|
||||
bg: "bg-[#38bdac]/20",
|
||||
|
||||
Reference in New Issue
Block a user