"use client" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { useStore } from "@/lib/store" import { Users, BookOpen, ShoppingBag, TrendingUp } from "lucide-react" export default function AdminDashboard() { const { getAllUsers, getAllPurchases } = useStore() const users = getAllUsers() const purchases = getAllPurchases() const totalRevenue = purchases.reduce((sum, p) => sum + p.amount, 0) const totalUsers = users.length const totalPurchases = purchases.length const stats = [ { title: "总用户数", value: totalUsers, icon: Users, color: "text-blue-400", bg: "bg-blue-500/20" }, { title: "总收入", value: `¥${totalRevenue.toFixed(2)}`, icon: TrendingUp, color: "text-[#38bdac]", bg: "bg-[#38bdac]/20", }, { title: "订单数", value: totalPurchases, icon: ShoppingBag, color: "text-purple-400", bg: "bg-purple-500/20" }, { title: "转化率", value: `${totalUsers > 0 ? ((totalPurchases / totalUsers) * 100).toFixed(1) : 0}%`, icon: BookOpen, color: "text-orange-400", bg: "bg-orange-500/20", }, ] return (
{p.sectionTitle || "整本购买"}
{new Date(p.createdAt).toLocaleString()}
+¥{p.amount}
{p.paymentMethod || "微信支付"}
暂无订单数据
}{u.nickname}
{u.phone}
{new Date(u.createdAt).toLocaleDateString()}
暂无用户数据
}