fix(fulfillment): 改为手动展示客户绑定小程序码
This commit is contained in:
@@ -388,6 +388,8 @@ export default function PlatformFulfillmentPage() {
|
|||||||
const [detail, setDetail] = useState<PlatformFulfillmentDetail | null>(null);
|
const [detail, setDetail] = useState<PlatformFulfillmentDetail | null>(null);
|
||||||
const [detailLoading, setDetailLoading] = useState(false);
|
const [detailLoading, setDetailLoading] = useState(false);
|
||||||
const [qrOpen, setQrOpen] = useState(false);
|
const [qrOpen, setQrOpen] = useState(false);
|
||||||
|
const [bindingQrImage, setBindingQrImage] = useState('');
|
||||||
|
const [bindingQrLoading, setBindingQrLoading] = useState(false);
|
||||||
const [mappingOpen, setMappingOpen] = useState(false);
|
const [mappingOpen, setMappingOpen] = useState(false);
|
||||||
const [mappingSku, setMappingSku] = useState('');
|
const [mappingSku, setMappingSku] = useState('');
|
||||||
const [mappingEditingId, setMappingEditingId] = useState<number | null>(null);
|
const [mappingEditingId, setMappingEditingId] = useState<number | null>(null);
|
||||||
@@ -521,10 +523,41 @@ export default function PlatformFulfillmentPage() {
|
|||||||
const selectedExchangeImageKey = selected?.exchangeResultImage?.objectKey || '';
|
const selectedExchangeImageKey = selected?.exchangeResultImage?.objectKey || '';
|
||||||
const qrValue = selected?.bindTask?.qrUrl || '';
|
const qrValue = selected?.bindTask?.qrUrl || '';
|
||||||
const douyuActionQrValue = douyuActionTask ? taskQrUrl(douyuActionTask) : '';
|
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(() => {
|
useEffect(() => {
|
||||||
if (qrValue) setQrOpen(true);
|
setQrOpen(false);
|
||||||
}, [qrValue]);
|
setBindingQrImage('');
|
||||||
|
setBindingQrLoading(false);
|
||||||
|
}, [selectedId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
@@ -1274,7 +1307,7 @@ export default function PlatformFulfillmentPage() {
|
|||||||
const actionButtons = selected ? (
|
const actionButtons = selected ? (
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{selected.bindTask?.qrUrl ? (
|
{selected.bindTask?.qrUrl ? (
|
||||||
<Button icon={<QrcodeOutlined />} onClick={() => setQrOpen(true)}>
|
<Button icon={<QrcodeOutlined />} onClick={() => void openBindingQr()}>
|
||||||
查看二维码
|
查看二维码
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -1582,10 +1615,23 @@ export default function PlatformFulfillmentPage() {
|
|||||||
<Descriptions.Item label="角色绑定">
|
<Descriptions.Item label="角色绑定">
|
||||||
{bindStatusLabel(selected.account.roleBindStatus)}
|
{bindStatusLabel(selected.account.roleBindStatus)}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="游戏角色">{selected.account.gameName || '-'}</Descriptions.Item>
|
<Descriptions.Item label="当前已绑定角色">
|
||||||
<Descriptions.Item label="游戏渠道" span={2}>
|
{selected.account.gameName || '-'}
|
||||||
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="当前游戏渠道">
|
||||||
{selected.account.gameChannel || '-'}
|
{selected.account.gameChannel || '-'}
|
||||||
</Descriptions.Item>
|
</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}>
|
<Descriptions.Item label="换绑可用时间" span={2}>
|
||||||
{formatTime(selected.account.roleChangeAvailableAt) || '无冷却'}
|
{formatTime(selected.account.roleChangeAvailableAt) || '无冷却'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
@@ -1777,9 +1823,32 @@ export default function PlatformFulfillmentPage() {
|
|||||||
) : null}
|
) : null}
|
||||||
</Modal>
|
</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%' }}>
|
<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>
|
<Text type="secondary">请客户使用对应游戏平台扫码。二维码只用于当前履约作业。</Text>
|
||||||
<Button
|
<Button
|
||||||
icon={<CopyOutlined />}
|
icon={<CopyOutlined />}
|
||||||
|
|||||||
Reference in New Issue
Block a user