修复(#14): 支持 USDT 提现方式展示
This commit is contained in:
@@ -45,6 +45,7 @@ const WITHDRAWAL_METHOD_MAP: Record<number, string> = {
|
|||||||
1: "支付宝",
|
1: "支付宝",
|
||||||
2: "微信",
|
2: "微信",
|
||||||
3: "银行卡",
|
3: "银行卡",
|
||||||
|
4: "USDT(TRC20)",
|
||||||
};
|
};
|
||||||
|
|
||||||
const rejectSchema = z.object({
|
const rejectSchema = z.object({
|
||||||
@@ -144,6 +145,7 @@ export default function WithdrawalPage() {
|
|||||||
{ value: "1", label: "支付宝" },
|
{ value: "1", label: "支付宝" },
|
||||||
{ value: "2", label: "微信" },
|
{ value: "2", label: "微信" },
|
||||||
{ value: "3", label: "银行卡" },
|
{ value: "3", label: "银行卡" },
|
||||||
|
{ value: "4", label: "USDT(TRC20)" },
|
||||||
{ value: "0", label: "其他" },
|
{ value: "0", label: "其他" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ const WITHDRAWAL_METHODS = [
|
|||||||
{ value: 1, label: "支付宝" },
|
{ value: 1, label: "支付宝" },
|
||||||
{ value: 2, label: "微信" },
|
{ value: 2, label: "微信" },
|
||||||
{ value: 3, label: "银行卡" },
|
{ value: 3, label: "银行卡" },
|
||||||
|
{ value: 4, label: "USDT(TRC20)" },
|
||||||
{ value: 0, label: "其他" },
|
{ value: 0, label: "其他" },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
@@ -111,13 +112,21 @@ function QrCodeView({ url }: { url: string }) {
|
|||||||
<img
|
<img
|
||||||
alt="收款码"
|
alt="收款码"
|
||||||
className="h-16 w-16 cursor-zoom-in object-cover"
|
className="h-16 w-16 cursor-zoom-in object-cover"
|
||||||
|
height={64}
|
||||||
src={url}
|
src={url}
|
||||||
|
width={64}
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
{zoomOpen && (
|
{zoomOpen && (
|
||||||
<Dialog onOpenChange={setZoomOpen} open={zoomOpen}>
|
<Dialog onOpenChange={setZoomOpen} open={zoomOpen}>
|
||||||
<DialogContent className="max-w-sm">
|
<DialogContent className="max-w-sm">
|
||||||
<img alt="收款码" className="w-full" src={url} />
|
<img
|
||||||
|
alt="收款码"
|
||||||
|
className="w-full"
|
||||||
|
height={320}
|
||||||
|
src={url}
|
||||||
|
width={320}
|
||||||
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
)}
|
)}
|
||||||
@@ -149,22 +158,23 @@ const withdrawalFormSchema = z
|
|||||||
path: ["qr_code_url"],
|
path: ["qr_code_url"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (data.method === 3) {
|
} else if (data.method === 3 || data.method === 4) {
|
||||||
if (!data.account) {
|
if (!data.account) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: z.ZodIssueCode.custom,
|
||||||
message: "银行卡收款账号为必填",
|
message:
|
||||||
path: ["account"],
|
data.method === 4
|
||||||
});
|
? "USDT(TRC20) 地址为必填"
|
||||||
}
|
: "银行卡收款账号为必填",
|
||||||
} else if (data.method === 0) {
|
|
||||||
if (!data.account && !data.content) {
|
|
||||||
ctx.addIssue({
|
|
||||||
code: z.ZodIssueCode.custom,
|
|
||||||
message: "收款账号和备注至少填一项",
|
|
||||||
path: ["account"],
|
path: ["account"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (data.method === 0 && !(data.account || data.content)) {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: z.ZodIssueCode.custom,
|
||||||
|
message: "收款账号和备注至少填一项",
|
||||||
|
path: ["account"],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -421,9 +431,7 @@ export default function Affiliate() {
|
|||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
收款码
|
收款码
|
||||||
<span className="ml-1 text-destructive">
|
<span className="ml-1 text-destructive">*</span>
|
||||||
*
|
|
||||||
</span>
|
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
{watchedQrCodeUrl ? (
|
{watchedQrCodeUrl ? (
|
||||||
<div className="relative inline-block">
|
<div className="relative inline-block">
|
||||||
@@ -446,7 +454,9 @@ export default function Affiliate() {
|
|||||||
returnType="file"
|
returnType="file"
|
||||||
>
|
>
|
||||||
<div className="flex h-24 w-24 flex-col items-center justify-center rounded border-2 border-dashed text-muted-foreground text-xs">
|
<div className="flex h-24 w-24 flex-col items-center justify-center rounded border-2 border-dashed text-muted-foreground text-xs">
|
||||||
{qrUploading ? "上传中..." : "点击上传\n收款码"}
|
{qrUploading
|
||||||
|
? "上传中..."
|
||||||
|
: "点击上传\n收款码"}
|
||||||
</div>
|
</div>
|
||||||
</UploadImage>
|
</UploadImage>
|
||||||
)}
|
)}
|
||||||
@@ -456,7 +466,9 @@ export default function Affiliate() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(watchedMethod === 3 || watchedMethod === 0) && (
|
{(watchedMethod === 3 ||
|
||||||
|
watchedMethod === 4 ||
|
||||||
|
watchedMethod === 0) && (
|
||||||
<FormField
|
<FormField
|
||||||
control={withdrawalForm.control}
|
control={withdrawalForm.control}
|
||||||
name="account"
|
name="account"
|
||||||
@@ -464,7 +476,8 @@ export default function Affiliate() {
|
|||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
收款账号
|
收款账号
|
||||||
{watchedMethod === 3 && (
|
{(watchedMethod === 3 ||
|
||||||
|
watchedMethod === 4) && (
|
||||||
<span className="ml-1 text-destructive">
|
<span className="ml-1 text-destructive">
|
||||||
*
|
*
|
||||||
</span>
|
</span>
|
||||||
@@ -473,9 +486,11 @@ export default function Affiliate() {
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder={
|
placeholder={
|
||||||
watchedMethod === 3
|
watchedMethod === 4
|
||||||
? "请输入银行卡号或账户信息"
|
? "请输入 USDT(TRC20) 收款地址"
|
||||||
: "请输入收款账号(与备注至少填一项)"
|
: watchedMethod === 3
|
||||||
|
? "请输入银行卡号或账户信息"
|
||||||
|
: "请输入收款账号(与备注至少填一项)"
|
||||||
}
|
}
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
@@ -519,9 +534,7 @@ export default function Affiliate() {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={
|
disabled={
|
||||||
submitting ||
|
submitting || qrUploading || availableCommission <= 0
|
||||||
qrUploading ||
|
|
||||||
availableCommission <= 0
|
|
||||||
}
|
}
|
||||||
form="withdrawal-form"
|
form="withdrawal-form"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|||||||
Reference in New Issue
Block a user