'use client'; import { useState } from 'react'; interface RefundDialogProps { orderId: string; amount: number; onConfirm: (reason: string, force: boolean) => Promise; onCancel: () => void; warning?: string; requireForce?: boolean; } export default function RefundDialog({ orderId, amount, onConfirm, onCancel, warning, requireForce, }: RefundDialogProps) { const [reason, setReason] = useState(''); const [force, setForce] = useState(false); const [loading, setLoading] = useState(false); const handleConfirm = async () => { setLoading(true); try { await onConfirm(reason, force); } finally { setLoading(false); } }; return (
e.stopPropagation()}>

确认退款

订单号
{orderId}
退款金额
¥{amount.toFixed(2)}
{warning &&
{warning}
}
setReason(e.target.value)} placeholder="请输入退款原因(可选)" className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none" />
{requireForce && ( )}
); }