"use client" import { useState, useEffect } from "react" import { useStore, type Withdrawal } from "@/lib/store" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Check, X, Clock } 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 handleApprove = (id: string) => { if (confirm("确认打款并完成此提现申请吗?")) { completeWithdrawal(id) } } return (
暂无待处理申请
) : (| 申请时间 | 用户ID | 姓名 | 渠道 | 账号 | 金额 | 操作 |
|---|---|---|---|---|---|---|
| {new Date(w.createdAt).toLocaleString()} | {w.userId.slice(0, 8)}... | {w.name} | {w.method === "wechat" ? "微信" : "支付宝"} | {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)} | 已完成 |