'use client'; interface AuditLog { id: string; action: string; detail: string | null; operator: string | null; createdAt: string; } interface OrderDetailProps { order: { id: string; userId: number; userName: string | null; userEmail: string | null; amount: number; status: string; paymentType: string; rechargeCode: string; paymentTradeNo: string | null; refundAmount: number | null; refundReason: string | null; refundAt: string | null; forceRefund: boolean; expiresAt: string; paidAt: string | null; completedAt: string | null; failedAt: string | null; failedReason: string | null; createdAt: string; updatedAt: string; clientIp: string | null; srcHost: string | null; srcUrl: string | null; paymentSuccess?: boolean; rechargeSuccess?: boolean; rechargeStatus?: string; auditLogs: AuditLog[]; }; onClose: () => void; dark?: boolean; } export default function OrderDetail({ order, onClose, dark }: OrderDetailProps) { const fields = [ { label: '订单号', value: order.id }, { label: '用户ID', value: order.userId }, { label: '用户名', value: order.userName || '-' }, { label: '邮箱', value: order.userEmail || '-' }, { label: '金额', value: `¥${order.amount.toFixed(2)}` }, { label: '状态', value: order.status }, { label: 'Payment OK', value: order.paymentSuccess ? 'yes' : 'no' }, { label: 'Recharge OK', value: order.rechargeSuccess ? 'yes' : 'no' }, { label: 'Recharge Status', value: order.rechargeStatus || '-' }, { label: '支付方式', value: order.paymentType === 'alipay' ? '支付宝' : '微信支付' }, { label: '充值码', value: order.rechargeCode }, { label: '支付单号', value: order.paymentTradeNo || '-' }, { label: '客户端IP', value: order.clientIp || '-' }, { label: '来源域名', value: order.srcHost || '-' }, { label: '来源页面', value: order.srcUrl || '-' }, { label: '创建时间', value: new Date(order.createdAt).toLocaleString('zh-CN') }, { label: '过期时间', value: new Date(order.expiresAt).toLocaleString('zh-CN') }, { label: '支付时间', value: order.paidAt ? new Date(order.paidAt).toLocaleString('zh-CN') : '-' }, { label: '完成时间', value: order.completedAt ? new Date(order.completedAt).toLocaleString('zh-CN') : '-' }, { label: '失败时间', value: order.failedAt ? new Date(order.failedAt).toLocaleString('zh-CN') : '-' }, { label: '失败原因', value: order.failedReason || '-' }, ]; if (order.refundAmount) { fields.push( { label: '退款金额', value: `¥${order.refundAmount.toFixed(2)}` }, { label: '退款原因', value: order.refundReason || '-' }, { label: '退款时间', value: order.refundAt ? new Date(order.refundAt).toLocaleString('zh-CN') : '-' }, { label: '强制退款', value: order.forceRefund ? '是' : '否' }, ); } return (