fix(fulfillment): 改为手动展示客户绑定小程序码
This commit is contained in:
@@ -388,6 +388,8 @@ export default function PlatformFulfillmentPage() {
|
||||
const [detail, setDetail] = useState<PlatformFulfillmentDetail | null>(null);
|
||||
const [detailLoading, setDetailLoading] = useState(false);
|
||||
const [qrOpen, setQrOpen] = useState(false);
|
||||
const [bindingQrImage, setBindingQrImage] = useState('');
|
||||
const [bindingQrLoading, setBindingQrLoading] = useState(false);
|
||||
const [mappingOpen, setMappingOpen] = useState(false);
|
||||
const [mappingSku, setMappingSku] = useState('');
|
||||
const [mappingEditingId, setMappingEditingId] = useState<number | null>(null);
|
||||
@@ -521,10 +523,41 @@ export default function PlatformFulfillmentPage() {
|
||||
const selectedExchangeImageKey = selected?.exchangeResultImage?.objectKey || '';
|
||||
const qrValue = selected?.bindTask?.qrUrl || '';
|
||||
const douyuActionQrValue = douyuActionTask ? taskQrUrl(douyuActionTask) : '';
|
||||
const pendingBindRoleName = selected?.bindTask?.bindReadyForConfirm
|
||||
? selected.bindTask.roleName
|
||||
: '';
|
||||
const pendingBindRoleChannel = selected?.bindTask
|
||||
? [selected.bindTask.platName, selected.bindTask.areaName].filter(Boolean).join(' / ')
|
||||
: '';
|
||||
|
||||
const openBindingQr = async () => {
|
||||
const bindTaskId = selected?.bindTask?.id;
|
||||
setQrOpen(true);
|
||||
setBindingQrImage('');
|
||||
if (!bindTaskId) return;
|
||||
setBindingQrLoading(true);
|
||||
try {
|
||||
const task = await douyuApi.getTask(bindTaskId);
|
||||
const image = task.result?.mini_qrcode_image;
|
||||
if (typeof image === 'string') setBindingQrImage(image);
|
||||
} catch {
|
||||
// 小程序码详情读取失败时保留原链接二维码作为回退。
|
||||
} finally {
|
||||
setBindingQrLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const closeBindingQr = () => {
|
||||
setQrOpen(false);
|
||||
setBindingQrImage('');
|
||||
setBindingQrLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (qrValue) setQrOpen(true);
|
||||
}, [qrValue]);
|
||||
setQrOpen(false);
|
||||
setBindingQrImage('');
|
||||
setBindingQrLoading(false);
|
||||
}, [selectedId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
@@ -1274,7 +1307,7 @@ export default function PlatformFulfillmentPage() {
|
||||
const actionButtons = selected ? (
|
||||
<Space wrap>
|
||||
{selected.bindTask?.qrUrl ? (
|
||||
<Button icon={<QrcodeOutlined />} onClick={() => setQrOpen(true)}>
|
||||
<Button icon={<QrcodeOutlined />} onClick={() => void openBindingQr()}>
|
||||
查看二维码
|
||||
</Button>
|
||||
) : null}
|
||||
@@ -1582,10 +1615,23 @@ export default function PlatformFulfillmentPage() {
|
||||
<Descriptions.Item label="角色绑定">
|
||||
{bindStatusLabel(selected.account.roleBindStatus)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="游戏角色">{selected.account.gameName || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="游戏渠道" span={2}>
|
||||
<Descriptions.Item label="当前已绑定角色">
|
||||
{selected.account.gameName || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="当前游戏渠道">
|
||||
{selected.account.gameChannel || '-'}
|
||||
</Descriptions.Item>
|
||||
{pendingBindRoleName ? (
|
||||
<Descriptions.Item label="待确认角色" span={2}>
|
||||
<Space wrap>
|
||||
<Tag color="gold">待确认</Tag>
|
||||
<Text strong>{pendingBindRoleName}</Text>
|
||||
{pendingBindRoleChannel ? (
|
||||
<Text type="secondary">{pendingBindRoleChannel}</Text>
|
||||
) : null}
|
||||
</Space>
|
||||
</Descriptions.Item>
|
||||
) : null}
|
||||
<Descriptions.Item label="换绑可用时间" span={2}>
|
||||
{formatTime(selected.account.roleChangeAvailableAt) || '无冷却'}
|
||||
</Descriptions.Item>
|
||||
@@ -1777,9 +1823,32 @@ export default function PlatformFulfillmentPage() {
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
<Modal open={qrOpen && Boolean(qrValue)} title="客户扫码绑定游戏角色" footer={null} onCancel={() => setQrOpen(false)}>
|
||||
<Modal
|
||||
open={qrOpen && Boolean(qrValue)}
|
||||
title="客户扫码绑定游戏角色"
|
||||
footer={null}
|
||||
onCancel={closeBindingQr}
|
||||
>
|
||||
<Space direction="vertical" align="center" style={{ width: '100%' }}>
|
||||
{qrValue ? <QRCode value={qrValue} size={260} /> : null}
|
||||
{bindingQrLoading ? (
|
||||
<Text type="secondary">正在加载小程序码...</Text>
|
||||
) : bindingQrImage ? (
|
||||
<div style={{
|
||||
display: 'inline-flex',
|
||||
padding: 10,
|
||||
borderRadius: 8,
|
||||
background: '#fff',
|
||||
lineHeight: 0,
|
||||
}}>
|
||||
<img
|
||||
src={bindingQrImage}
|
||||
alt="客户扫码绑定小程序码"
|
||||
style={{ width: 260, height: 260, objectFit: 'contain' }}
|
||||
/>
|
||||
</div>
|
||||
) : qrValue ? (
|
||||
<QRCode value={qrValue} size={260} />
|
||||
) : null}
|
||||
<Text type="secondary">请客户使用对应游戏平台扫码。二维码只用于当前履约作业。</Text>
|
||||
<Button
|
||||
icon={<CopyOutlined />}
|
||||
|
||||
Reference in New Issue
Block a user