"use client" import { useState, useEffect } from "react" import { useStore } from "@/lib/store" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Check, Clock, Wallet, History } from "lucide-react" export default function WithdrawalsPage() { const { withdrawals, completeWithdrawal } = useStore() const [mounted, setMounted] = useState(false) useEffect(() => { setMounted(true) }, []) if (!mounted) return null const pendingWithdrawals = withdrawals?.filter((w) => w.status === "pending") || [] const historyWithdrawals = withdrawals ?.filter((w) => w.status !== "pending") .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) || [] const totalPending = pendingWithdrawals.reduce((sum, w) => sum + w.amount, 0) const handleApprove = (id: string) => { if (confirm("确认打款并完成此提现申请吗?")) { completeWithdrawal(id) } } return (
待处理 {pendingWithdrawals.length} 笔,共 ¥{totalPending.toFixed(2)}
暂无待处理申请
| 申请时间 | 用户 | 收款方式 | 收款账号 | 金额 | 操作 |
|---|---|---|---|---|---|
| {new Date(w.createdAt).toLocaleString()} |
{w.name} {w.userId.slice(0, 8)}... |
|
{w.account} | ¥{w.amount.toFixed(2)} |
暂无历史记录
| 申请时间 | 处理时间 | 用户 | 渠道 | 金额 | 状态 |
|---|---|---|---|---|---|
| {new Date(w.createdAt).toLocaleString()} | {w.completedAt ? new Date(w.completedAt).toLocaleString() : "-"} | {w.name} | {w.method === "wechat" ? "微信" : "支付宝"} | ¥{w.amount.toFixed(2)} |
|