接入无感发货流程
This commit is contained in:
@@ -76,7 +76,8 @@ const eventOptions = [
|
||||
{ value: 'order.cancelled', label: '订单取消' },
|
||||
]
|
||||
|
||||
const deliveryTestUrl = import.meta.env.VITE_DELIVERY_TEST_URL || 'https://www.jxya.top/test-delivery/dlc/'
|
||||
const deliveryBaseUrl = (import.meta.env.VITE_DELIVERY_BASE_URL || window.location.origin).replace(/\/+$/, '')
|
||||
const deliveryChannel = 'dlc'
|
||||
|
||||
const testOrderStatusOptions = [
|
||||
{ value: 'pending', label: '已支付,可发货' },
|
||||
@@ -123,6 +124,14 @@ export default function MerchantCenter() {
|
||||
label: productOptionLabel(item),
|
||||
})), [testOrderProducts])
|
||||
|
||||
const copyDeliveryLink = useCallback((orderNo: string) => {
|
||||
navigator.clipboard.writeText(buildDeliveryLink(orderNo)).then(() => message.success('发货链接已复制'))
|
||||
}, [])
|
||||
|
||||
const openDeliveryLink = useCallback((orderNo: string) => {
|
||||
window.open(buildDeliveryLink(orderNo), '_blank', 'noopener,noreferrer')
|
||||
}, [])
|
||||
|
||||
const loadCurrent = useCallback(async () => {
|
||||
const data = await merchantApi.current()
|
||||
setMerchant(data.merchant)
|
||||
@@ -427,6 +436,17 @@ export default function MerchantCenter() {
|
||||
{ title: '履约', dataIndex: 'fulfillment_status', width: 100, render: fulfillmentStatusTag },
|
||||
{ title: '上游单号', dataIndex: 'provider_order_no', width: 140, ellipsis: true, render: (v) => v || '-' },
|
||||
{ title: '时间', dataIndex: 'created_at', width: 160, render: formatTime },
|
||||
{
|
||||
title: '发货链接',
|
||||
key: 'delivery_link',
|
||||
width: 150,
|
||||
render: (_, record) => (
|
||||
<Space size={4}>
|
||||
<Button type="link" size="small" onClick={() => copyDeliveryLink(record.order_no)}>复制</Button>
|
||||
<Button type="link" size="small" onClick={() => openDeliveryLink(record.order_no)}>打开</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
const ledgerColumns: ColumnsType<WalletLedgerEntry> = [
|
||||
@@ -532,12 +552,9 @@ export default function MerchantCenter() {
|
||||
children: (
|
||||
<Space direction="vertical" style={{ width: '100%' }} size="middle">
|
||||
<Space style={{ width: '100%', justifyContent: 'space-between' }}>
|
||||
<Typography.Text type="secondary">订单号用于发货平台查询。</Typography.Text>
|
||||
<Typography.Text type="secondary">发货链接会自动携带订单号,用户只填写游戏 UID。</Typography.Text>
|
||||
{canManage && (
|
||||
<Space>
|
||||
<Button icon={<LinkOutlined />} href={deliveryTestUrl} target="_blank" rel="noreferrer">
|
||||
发货测试页
|
||||
</Button>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={openTestOrderCreate}>
|
||||
创建测试订单
|
||||
</Button>
|
||||
@@ -550,7 +567,7 @@ export default function MerchantCenter() {
|
||||
columns={orderColumns}
|
||||
dataSource={orders.list}
|
||||
tableLayout="fixed"
|
||||
scroll={{ x: 1300 }}
|
||||
scroll={{ x: 1450 }}
|
||||
pagination={pageConfig(orders, loadOrders)}
|
||||
/>
|
||||
</Space>
|
||||
@@ -733,12 +750,12 @@ export default function MerchantCenter() {
|
||||
<Button onClick={() => setTestOrderResult(null)}>关闭</Button>
|
||||
<Button
|
||||
icon={<CopyOutlined />}
|
||||
onClick={() => navigator.clipboard.writeText(testOrderResult?.order.order_no || '').then(() => message.success('已复制'))}
|
||||
onClick={() => copyDeliveryLink(testOrderResult?.order.order_no || '')}
|
||||
>
|
||||
复制订单号
|
||||
复制发货链接
|
||||
</Button>
|
||||
<Button type="primary" icon={<LinkOutlined />} href={deliveryTestUrl} target="_blank" rel="noreferrer">
|
||||
发货测试页
|
||||
<Button type="primary" icon={<LinkOutlined />} onClick={() => openDeliveryLink(testOrderResult?.order.order_no || '')}>
|
||||
打开发货页
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
@@ -756,9 +773,9 @@ export default function MerchantCenter() {
|
||||
{testOrderResult.can_ship ? 'can_ship=true' : 'can_ship=false'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="测试页">
|
||||
<Typography.Link href={deliveryTestUrl} target="_blank" rel="noreferrer">
|
||||
{deliveryTestUrl}
|
||||
<Descriptions.Item label="发货链接">
|
||||
<Typography.Link href={buildDeliveryLink(testOrderResult.order.order_no)} target="_blank" rel="noreferrer">
|
||||
{buildDeliveryLink(testOrderResult.order.order_no)}
|
||||
</Typography.Link>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
@@ -918,6 +935,10 @@ function productOptionLabel(item: MerchantProduct) {
|
||||
return name === item.sku ? item.sku : `${name} / ${item.sku}`
|
||||
}
|
||||
|
||||
function buildDeliveryLink(orderNo: string) {
|
||||
return `${deliveryBaseUrl}/delivery/${deliveryChannel}/${encodeURIComponent(orderNo)}`
|
||||
}
|
||||
|
||||
function paymentStatusTag(value: string) {
|
||||
const item = paymentStatusMap[value] || { color: 'default', text: value }
|
||||
return <Tag color={item.color}>{item.text}</Tag>
|
||||
|
||||
Reference in New Issue
Block a user