feat(fulfillment): 工作台拆分直接兑换/预售两个入口

- 直接兑换和预售独立 Tab,按 sale_mode 查询
- 直接兑换不显示预售台账列和同步按钮,流程在工作台完成
- 预售绑定成功后才显示/启用同步到斗鱼预售台账
- 台账页面、菜单、按钮统一改名斗鱼预售台账
- 取消销售模式下拉,队列筛选按 Tab 动态展示
This commit is contained in:
yml
2026-11-24 22:21:15 +08:00
parent 56e9568fed
commit ad74fdb743
3 changed files with 77 additions and 56 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ export default function MainLayout({ onLogout }: { onLogout?: () => void }) {
// 外部单协作:权限独立,客服没有 douyu:task 也要能进共享台账。 // 外部单协作:权限独立,客服没有 douyu:task 也要能进共享台账。
if (can('douyu:collab:view')) { if (can('douyu:collab:view')) {
douyuItems.push({ key: '/douyu/collab', label: '订单台账', icon: <FileExcelOutlined /> }); douyuItems.push({ key: '/douyu/collab', label: '斗鱼预售台账', icon: <FileExcelOutlined /> });
} }
if (can('platform_fulfillment:view')) { if (can('platform_fulfillment:view')) {
douyuItems.push({ key: '/platform-fulfillment', label: '直播账号履约', icon: <ThunderboltOutlined /> }); douyuItems.push({ key: '/platform-fulfillment', label: '直播账号履约', icon: <ThunderboltOutlined /> });
+2 -2
View File
@@ -1743,8 +1743,8 @@ export default function DouyuCollabPage() {
return ( return (
<Space direction="vertical" size={12} style={{ width: '100%' }}> <Space direction="vertical" size={12} style={{ width: '100%' }}>
<div> <div>
<h2 style={{ margin: 0 }}>斗鱼订单台账</h2> <h2 style={{ margin: 0 }}>斗鱼预售台账</h2>
<Text type="secondary">系统正常订单由直播账号履约工作台维护;这里记录财务、异常和人工补登记</Text> <Text type="secondary">预售订单在直播账号履约工作台绑定完成后同步到这里;这里记录财务、异常和人工补登记</Text>
</div> </div>
<Row gutter={[8, 8]}> <Row gutter={[8, 8]}>
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import type { 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 { 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 type { ColumnsType } from 'antd/es/table';
import { douyuApi, platformFulfillmentApi } from '../api/modules'; import { douyuApi, platformFulfillmentApi } from '../api/modules';
@@ -123,7 +123,16 @@ const MANUAL_REASON_LABELS: Record<string, string> = {
const QUEUE_BUCKET_OPTIONS = [ const QUEUE_BUCKET_OPTIONS = [
{ value: 'current', label: '当前待办' }, { value: 'current', label: '当前待办' },
{ value: 'pending_mapping', 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: 'presale_waiting', label: '预售待开放' },
{ value: 'pending_mapping', label: '待映射' },
{ value: 'ready_for_fulfillment', label: '可履约' }, { value: 'ready_for_fulfillment', label: '可履约' },
{ value: 'needs_action', label: '需要人工' }, { value: 'needs_action', label: '需要人工' },
{ value: 'completed', label: '已完成' }, { value: 'completed', label: '已完成' },
@@ -454,7 +463,7 @@ export default function PlatformFulfillmentPage() {
const navigate = useNavigate(); const navigate = useNavigate();
const { can } = usePermissions(user); const { can } = usePermissions(user);
const [queueBucket, setQueueBucket] = useState('current'); const [queueBucket, setQueueBucket] = useState('current');
const [saleModeFilter, setSaleModeFilter] = useState(''); const [saleModeTab, setSaleModeTab] = useState<'direct' | 'presale'>('direct');
const [keyword, setKeyword] = useState(''); const [keyword, setKeyword] = useState('');
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(20); const [pageSize, setPageSize] = useState(20);
@@ -549,7 +558,7 @@ export default function PlatformFulfillmentPage() {
const result = await platformFulfillmentApi.listTasks({ const result = await platformFulfillmentApi.listTasks({
status: queueBackedStatus, status: queueBackedStatus,
queue_bucket: backendBucket, queue_bucket: backendBucket,
sale_mode: saleModeFilter || undefined, sale_mode: saleModeTab,
keyword: keyword.trim() || undefined, keyword: keyword.trim() || undefined,
page, page,
page_size: pageSize, page_size: pageSize,
@@ -561,7 +570,7 @@ export default function PlatformFulfillmentPage() {
} finally { } finally {
if (!silent) setLoading(false); if (!silent) setLoading(false);
} }
}, [keyword, page, pageSize, queueBucket, saleModeFilter]); }, [keyword, page, pageSize, queueBucket, saleModeTab]);
const loadDetail = useCallback(async (taskId: number, silent = false) => { const loadDetail = useCallback(async (taskId: number, silent = false) => {
if (!silent) setDetailLoading(true); if (!silent) setDetailLoading(true);
@@ -709,7 +718,7 @@ export default function PlatformFulfillmentPage() {
const result = await platformFulfillmentApi.syncCollab(taskIds); const result = await platformFulfillmentApi.syncCollab(taskIds);
const syncedOrderNo = const syncedOrderNo =
result.items.find((item) => item.action === 'created' || item.action === 'updated')?.orderNo || ''; 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}` : '' taskIds.length === 1 && syncedOrderNo ? `,订单 ${syncedOrderNo}` : ''
}`; }`;
if (result.failed || result.skipped) { if (result.failed || result.skipped) {
@@ -1410,7 +1419,7 @@ export default function PlatformFulfillmentPage() {
), ),
}, },
{ {
title: '订单台账', title: '斗鱼预售台账',
key: 'collab', key: 'collab',
width: 150, width: 150,
render: (_, task) => render: (_, task) =>
@@ -1454,21 +1463,23 @@ export default function PlatformFulfillmentPage() {
<Button size="small" onClick={() => setSelectedId(task.id)}> <Button size="small" onClick={() => setSelectedId(task.id)}>
详情 详情
</Button> </Button>
<Button {saleModeTab === 'presale' ? (
size="small" <Button
type={task.collabOrder ? 'default' : 'primary'} size="small"
icon={<LinkOutlined />} type={task.collabOrder ? 'default' : 'primary'}
loading={rowCollabSyncingId === task.id} icon={<LinkOutlined />}
disabled={ loading={rowCollabSyncingId === task.id}
!can('platform_fulfillment:use') || disabled={
task.bindingStatus !== 'bound' || !can('platform_fulfillment:use') ||
collabSyncing || task.bindingStatus !== 'bound' ||
(rowCollabSyncingId !== null && rowCollabSyncingId !== task.id) collabSyncing ||
} (rowCollabSyncingId !== null && rowCollabSyncingId !== task.id)
onClick={() => void performCollabSync([task.id], task.id)} }
> onClick={() => void performCollabSync([task.id], task.id)}
同步到订单台账 >
</Button> 同步到斗鱼预售台账
</Button>
) : null}
{task.executionStatus === 'pending_mapping' ? ( {task.executionStatus === 'pending_mapping' ? (
<Button size="small" type="primary" icon={<LinkOutlined />} disabled={!can('platform_fulfillment:admin')} onClick={() => void openMapping(task)}> <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) => ({ const centeredColumns = columns
...column, .filter((column) => saleModeTab !== 'direct' || column.key !== 'collab')
align: 'center' as const, .map((column) => ({
onHeaderCell: () => ({ style: { textAlign: 'center' as const } }), ...column,
})); align: 'center' as const,
onHeaderCell: () => ({ style: { textAlign: 'center' as const } }),
}));
const selectedCollabReady = const selectedCollabReady =
selectedRowKeys.length > 0 && selectedRowKeys.length > 0 &&
@@ -1644,19 +1657,21 @@ export default function PlatformFulfillmentPage() {
<Button icon={<LinkOutlined />} disabled={!can('platform_fulfillment:admin')} onClick={() => void openMapping()}> <Button icon={<LinkOutlined />} disabled={!can('platform_fulfillment:admin')} onClick={() => void openMapping()}>
商品映射 商品映射
</Button> </Button>
<Button {saleModeTab === 'presale' ? (
icon={<LinkOutlined />} <Button
loading={collabSyncing} icon={<LinkOutlined />}
disabled={ loading={collabSyncing}
!can('platform_fulfillment:use') || disabled={
selectedRowKeys.length === 0 || !can('platform_fulfillment:use') ||
!selectedCollabReady || selectedRowKeys.length === 0 ||
rowCollabSyncingId !== null !selectedCollabReady ||
} rowCollabSyncingId !== null
onClick={() => void syncCollab()} }
> onClick={() => void syncCollab()}
同步到订单台账{selectedRowKeys.length > 0 ? `(${selectedRowKeys.length})` : ''} >
</Button> 同步到斗鱼预售台账{selectedRowKeys.length > 0 ? `(${selectedRowKeys.length})` : ''}
</Button>
) : null}
<Button type="primary" loading={syncing} icon={<SyncOutlined />} onClick={() => void sync()}> <Button type="primary" loading={syncing} icon={<SyncOutlined />} onClick={() => void sync()}>
同步待履约订单 同步待履约订单
</Button> </Button>
@@ -1664,6 +1679,23 @@ export default function PlatformFulfillmentPage() {
</Space> </Space>
</Card> </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"> <Card size="small">
<Space wrap style={{ marginBottom: 16 }}> <Space wrap style={{ marginBottom: 16 }}>
<Input.Search <Input.Search
@@ -1678,24 +1710,13 @@ export default function PlatformFulfillmentPage() {
/> />
<Segmented <Segmented
value={queueBucket} value={queueBucket}
options={QUEUE_BUCKET_OPTIONS} options={saleModeTab === 'presale' ? PRESALE_QUEUE_BUCKET_OPTIONS : QUEUE_BUCKET_OPTIONS}
onChange={(value) => { onChange={(value) => {
setQueueBucket(String(value)); setQueueBucket(String(value));
setSelectedRowKeys([]);
setPage(1); 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 icon={<ReloadOutlined />} onClick={() => void loadTasks()}>
刷新 刷新
</Button> </Button>
@@ -1844,7 +1865,7 @@ export default function PlatformFulfillmentPage() {
{bindingStatusLabel(selected.bindingStatus)} {bindingStatusLabel(selected.bindingStatus)}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="订单台账" span={2}> <Descriptions.Item label="斗鱼预售台账" span={2}>
{selected.collabOrder {selected.collabOrder
? `${selected.collabOrder.orderNo} · ${collabStatusLabel(selected.collabOrder.status)}` ? `${selected.collabOrder.orderNo} · ${collabStatusLabel(selected.collabOrder.status)}`
: '未同步'} : '未同步'}