feat(huya): 统一积分兑换并完善兑换记录
This commit is contained in:
@@ -257,7 +257,8 @@ function bindReadyForConfirm(task: HuyaTaskItem | null | undefined): boolean {
|
||||
}
|
||||
|
||||
function hasPaymentQrcode(task: HuyaTaskItem): boolean {
|
||||
return task.task_type === 'create_recharge_order' && Boolean(resultText(task.result, 'pay_url'));
|
||||
return ['create_recharge_order', 'exchange_goods'].includes(task.task_type)
|
||||
&& Boolean(resultText(task.result, 'pay_url'));
|
||||
}
|
||||
|
||||
function paymentStatus(task: HuyaTaskItem | null | undefined): string {
|
||||
@@ -983,7 +984,7 @@ export default function HuyaTasksPage() {
|
||||
? resultProfileNick(qrResult) || qrTask.account_nickname || qrTask.account_uid || `#${qrTask.account_id}`
|
||||
: '';
|
||||
const payResult = payTask?.result || null;
|
||||
const payUrl = resultText(payResult, 'pay_url');
|
||||
const payUrl = resultText(payResult, 'pay_qr_code') || resultText(payResult, 'pay_cashier_url') || resultText(payResult, 'pay_url');
|
||||
const payProductName = resultText(payResult, 'product_name');
|
||||
const payAmountText = resultText(payResult, 'amount_text');
|
||||
const payChannelLabel = resultText(payResult, 'pay_channel_label');
|
||||
@@ -1099,7 +1100,20 @@ export default function HuyaTasksPage() {
|
||||
}
|
||||
if (record.task_type === 'exchange_goods') {
|
||||
const productName = resultText(value, 'product_name');
|
||||
const orderId = resultText(value, 'order_id');
|
||||
const exchangeOrder = value?.exchange_order;
|
||||
const orderId = exchangeOrder && typeof exchangeOrder === 'object'
|
||||
? String((exchangeOrder as Record<string, unknown>).order_id || '')
|
||||
: resultText(value, 'order_id');
|
||||
if (resultText(value, 'pay_url') && record.status !== 'success') {
|
||||
return (
|
||||
<Space size={6}>
|
||||
<Tag color="processing">等待支付积分包</Tag>
|
||||
<Button size="small" icon={<QrcodeOutlined />} onClick={() => setPayTask(record)}>
|
||||
支付码
|
||||
</Button>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
if (record.status !== 'success') {
|
||||
return productName ? <Text>{productName}</Text> : <Text type="secondary">-</Text>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user