feat(fulfillment): 工作台拆分直接兑换/预售两个入口
- 直接兑换和预售独立 Tab,按 sale_mode 查询 - 直接兑换不显示预售台账列和同步按钮,流程在工作台完成 - 预售绑定成功后才显示/启用同步到斗鱼预售台账 - 台账页面、菜单、按钮统一改名斗鱼预售台账 - 取消销售模式下拉,队列筛选按 Tab 动态展示
This commit is contained in:
@@ -1743,8 +1743,8 @@ export default function DouyuCollabPage() {
|
||||
return (
|
||||
<Space direction="vertical" size={12} style={{ width: '100%' }}>
|
||||
<div>
|
||||
<h2 style={{ margin: 0 }}>斗鱼订单台账</h2>
|
||||
<Text type="secondary">系统正常订单由直播账号履约工作台维护;这里记录财务、异常和人工补登记</Text>
|
||||
<h2 style={{ margin: 0 }}>斗鱼预售台账</h2>
|
||||
<Text type="secondary">预售订单在直播账号履约工作台绑定完成后同步到这里;这里记录财务、异常和人工补登记</Text>
|
||||
</div>
|
||||
|
||||
<Row gutter={[8, 8]}>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import dayjs from 'dayjs';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import { Alert, Button, Card, Col, DatePicker, Descriptions, Drawer, Empty, Image, Input, InputNumber, Modal, QRCode, Row, Segmented, Select, Space, Switch, Table, Tag, Timeline, Typography } from 'antd';
|
||||
import { Alert, Button, Card, Col, DatePicker, Descriptions, Drawer, Empty, Image, Input, InputNumber, Modal, QRCode, Row, Segmented, Select, Space, Switch, Table, Tabs, Tag, Timeline, Typography } from 'antd';
|
||||
import { CheckCircleOutlined, CopyOutlined, CreditCardOutlined, DownloadOutlined, GiftOutlined, LinkOutlined, QrcodeOutlined, ReloadOutlined, SettingOutlined, ShoppingOutlined, SyncOutlined, UndoOutlined, UserSwitchOutlined } from '@ant-design/icons';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { douyuApi, platformFulfillmentApi } from '../api/modules';
|
||||
@@ -123,7 +123,16 @@ const MANUAL_REASON_LABELS: Record<string, string> = {
|
||||
const QUEUE_BUCKET_OPTIONS = [
|
||||
{ value: 'current', label: '当前待办' },
|
||||
{ value: 'pending_mapping', label: '待映射' },
|
||||
{ value: 'ready_for_fulfillment', label: '可履约' },
|
||||
{ value: 'needs_action', label: '需要人工' },
|
||||
{ value: 'completed', label: '已完成' },
|
||||
{ value: 'cancelled', label: '已取消' },
|
||||
];
|
||||
|
||||
const PRESALE_QUEUE_BUCKET_OPTIONS = [
|
||||
{ value: 'current', label: '当前待办' },
|
||||
{ value: 'presale_waiting', label: '预售待开放' },
|
||||
{ value: 'pending_mapping', label: '待映射' },
|
||||
{ value: 'ready_for_fulfillment', label: '可履约' },
|
||||
{ value: 'needs_action', label: '需要人工' },
|
||||
{ value: 'completed', label: '已完成' },
|
||||
@@ -454,7 +463,7 @@ export default function PlatformFulfillmentPage() {
|
||||
const navigate = useNavigate();
|
||||
const { can } = usePermissions(user);
|
||||
const [queueBucket, setQueueBucket] = useState('current');
|
||||
const [saleModeFilter, setSaleModeFilter] = useState('');
|
||||
const [saleModeTab, setSaleModeTab] = useState<'direct' | 'presale'>('direct');
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
@@ -549,7 +558,7 @@ export default function PlatformFulfillmentPage() {
|
||||
const result = await platformFulfillmentApi.listTasks({
|
||||
status: queueBackedStatus,
|
||||
queue_bucket: backendBucket,
|
||||
sale_mode: saleModeFilter || undefined,
|
||||
sale_mode: saleModeTab,
|
||||
keyword: keyword.trim() || undefined,
|
||||
page,
|
||||
page_size: pageSize,
|
||||
@@ -561,7 +570,7 @@ export default function PlatformFulfillmentPage() {
|
||||
} finally {
|
||||
if (!silent) setLoading(false);
|
||||
}
|
||||
}, [keyword, page, pageSize, queueBucket, saleModeFilter]);
|
||||
}, [keyword, page, pageSize, queueBucket, saleModeTab]);
|
||||
|
||||
const loadDetail = useCallback(async (taskId: number, silent = false) => {
|
||||
if (!silent) setDetailLoading(true);
|
||||
@@ -709,7 +718,7 @@ export default function PlatformFulfillmentPage() {
|
||||
const result = await platformFulfillmentApi.syncCollab(taskIds);
|
||||
const syncedOrderNo =
|
||||
result.items.find((item) => item.action === 'created' || item.action === 'updated')?.orderNo || '';
|
||||
const summary = `订单台账同步完成:新增 ${result.created},更新 ${result.updated}${
|
||||
const summary = `斗鱼预售台账同步完成:新增 ${result.created},更新 ${result.updated}${
|
||||
taskIds.length === 1 && syncedOrderNo ? `,订单 ${syncedOrderNo}` : ''
|
||||
}`;
|
||||
if (result.failed || result.skipped) {
|
||||
@@ -1410,7 +1419,7 @@ export default function PlatformFulfillmentPage() {
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '订单台账',
|
||||
title: '斗鱼预售台账',
|
||||
key: 'collab',
|
||||
width: 150,
|
||||
render: (_, task) =>
|
||||
@@ -1454,21 +1463,23 @@ export default function PlatformFulfillmentPage() {
|
||||
<Button size="small" onClick={() => setSelectedId(task.id)}>
|
||||
详情
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
type={task.collabOrder ? 'default' : 'primary'}
|
||||
icon={<LinkOutlined />}
|
||||
loading={rowCollabSyncingId === task.id}
|
||||
disabled={
|
||||
!can('platform_fulfillment:use') ||
|
||||
task.bindingStatus !== 'bound' ||
|
||||
collabSyncing ||
|
||||
(rowCollabSyncingId !== null && rowCollabSyncingId !== task.id)
|
||||
}
|
||||
onClick={() => void performCollabSync([task.id], task.id)}
|
||||
>
|
||||
同步到订单台账
|
||||
</Button>
|
||||
{saleModeTab === 'presale' ? (
|
||||
<Button
|
||||
size="small"
|
||||
type={task.collabOrder ? 'default' : 'primary'}
|
||||
icon={<LinkOutlined />}
|
||||
loading={rowCollabSyncingId === task.id}
|
||||
disabled={
|
||||
!can('platform_fulfillment:use') ||
|
||||
task.bindingStatus !== 'bound' ||
|
||||
collabSyncing ||
|
||||
(rowCollabSyncingId !== null && rowCollabSyncingId !== task.id)
|
||||
}
|
||||
onClick={() => void performCollabSync([task.id], task.id)}
|
||||
>
|
||||
同步到斗鱼预售台账
|
||||
</Button>
|
||||
) : null}
|
||||
{task.executionStatus === 'pending_mapping' ? (
|
||||
<Button size="small" type="primary" icon={<LinkOutlined />} disabled={!can('platform_fulfillment:admin')} onClick={() => void openMapping(task)}>
|
||||
配置映射
|
||||
@@ -1531,11 +1542,13 @@ export default function PlatformFulfillmentPage() {
|
||||
},
|
||||
];
|
||||
|
||||
const centeredColumns = columns.map((column) => ({
|
||||
...column,
|
||||
align: 'center' as const,
|
||||
onHeaderCell: () => ({ style: { textAlign: 'center' as const } }),
|
||||
}));
|
||||
const centeredColumns = columns
|
||||
.filter((column) => saleModeTab !== 'direct' || column.key !== 'collab')
|
||||
.map((column) => ({
|
||||
...column,
|
||||
align: 'center' as const,
|
||||
onHeaderCell: () => ({ style: { textAlign: 'center' as const } }),
|
||||
}));
|
||||
|
||||
const selectedCollabReady =
|
||||
selectedRowKeys.length > 0 &&
|
||||
@@ -1644,19 +1657,21 @@ export default function PlatformFulfillmentPage() {
|
||||
<Button icon={<LinkOutlined />} disabled={!can('platform_fulfillment:admin')} onClick={() => void openMapping()}>
|
||||
商品映射
|
||||
</Button>
|
||||
<Button
|
||||
icon={<LinkOutlined />}
|
||||
loading={collabSyncing}
|
||||
disabled={
|
||||
!can('platform_fulfillment:use') ||
|
||||
selectedRowKeys.length === 0 ||
|
||||
!selectedCollabReady ||
|
||||
rowCollabSyncingId !== null
|
||||
}
|
||||
onClick={() => void syncCollab()}
|
||||
>
|
||||
同步到订单台账{selectedRowKeys.length > 0 ? `(${selectedRowKeys.length})` : ''}
|
||||
</Button>
|
||||
{saleModeTab === 'presale' ? (
|
||||
<Button
|
||||
icon={<LinkOutlined />}
|
||||
loading={collabSyncing}
|
||||
disabled={
|
||||
!can('platform_fulfillment:use') ||
|
||||
selectedRowKeys.length === 0 ||
|
||||
!selectedCollabReady ||
|
||||
rowCollabSyncingId !== null
|
||||
}
|
||||
onClick={() => void syncCollab()}
|
||||
>
|
||||
同步到斗鱼预售台账{selectedRowKeys.length > 0 ? `(${selectedRowKeys.length})` : ''}
|
||||
</Button>
|
||||
) : null}
|
||||
<Button type="primary" loading={syncing} icon={<SyncOutlined />} onClick={() => void sync()}>
|
||||
同步待履约订单
|
||||
</Button>
|
||||
@@ -1664,6 +1679,23 @@ export default function PlatformFulfillmentPage() {
|
||||
</Space>
|
||||
</Card>
|
||||
|
||||
<Tabs
|
||||
activeKey={saleModeTab}
|
||||
onChange={(value) => {
|
||||
const next = value === 'presale' ? 'presale' : 'direct';
|
||||
setSaleModeTab(next);
|
||||
if (next === 'direct' && queueBucket === 'presale_waiting') {
|
||||
setQueueBucket('current');
|
||||
}
|
||||
setSelectedRowKeys([]);
|
||||
setPage(1);
|
||||
}}
|
||||
items={[
|
||||
{ key: 'direct', label: '直接兑换' },
|
||||
{ key: 'presale', label: '预售' },
|
||||
]}
|
||||
/>
|
||||
|
||||
<Card size="small">
|
||||
<Space wrap style={{ marginBottom: 16 }}>
|
||||
<Input.Search
|
||||
@@ -1678,24 +1710,13 @@ export default function PlatformFulfillmentPage() {
|
||||
/>
|
||||
<Segmented
|
||||
value={queueBucket}
|
||||
options={QUEUE_BUCKET_OPTIONS}
|
||||
options={saleModeTab === 'presale' ? PRESALE_QUEUE_BUCKET_OPTIONS : QUEUE_BUCKET_OPTIONS}
|
||||
onChange={(value) => {
|
||||
setQueueBucket(String(value));
|
||||
setSelectedRowKeys([]);
|
||||
setPage(1);
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
value={saleModeFilter}
|
||||
options={[
|
||||
{ value: '', label: '全部销售模式' },
|
||||
...Object.entries(SALE_MODE_LABELS).map(([value, label]) => ({ value, label })),
|
||||
]}
|
||||
onChange={(value) => {
|
||||
setSaleModeFilter(value);
|
||||
setPage(1);
|
||||
}}
|
||||
style={{ width: 150 }}
|
||||
/>
|
||||
<Button icon={<ReloadOutlined />} onClick={() => void loadTasks()}>
|
||||
刷新
|
||||
</Button>
|
||||
@@ -1844,7 +1865,7 @@ export default function PlatformFulfillmentPage() {
|
||||
{bindingStatusLabel(selected.bindingStatus)}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="订单台账" span={2}>
|
||||
<Descriptions.Item label="斗鱼预售台账" span={2}>
|
||||
{selected.collabOrder
|
||||
? `${selected.collabOrder.orderNo} · ${collabStatusLabel(selected.collabOrder.status)}`
|
||||
: '未同步'}
|
||||
|
||||
Reference in New Issue
Block a user