fix(consignment): 手动匹配寄卖后刷新工单列表并展示寄卖价格

This commit is contained in:
2026-11-07 15:57:39 +08:00
parent 8920afa0e5
commit 0e9087c8bb
11 changed files with 712 additions and 75 deletions
@@ -1834,6 +1834,32 @@ export default function WorkOrdersPanel() {
<AmountEditableCell order={row} field="rewardAmount" onSaved={refreshAll} />
),
},
{
title: '寄卖价格',
width: 120,
render: (_, row) => {
// 拼单的价格按份额展示在「拼单明细」,主列不汇总,避免口径混淆。
if (row.sharing?.enabled) {
return <Typography.Text type="secondary">-</Typography.Text>
}
const totalPriceFen = Number(row.consignmentSaleTotalFen || 0)
if (totalPriceFen <= 0) {
return <Typography.Text type="secondary">-</Typography.Text>
}
const unitPriceFen = Number(row.consignmentSalePriceFen || 0)
const quantity = Math.max(1, Number(row.consignmentSaleQuantity || 1))
return (
<Space direction="vertical" size={0}>
<Typography.Text strong>{formatMoney(totalPriceFen)}</Typography.Text>
{quantity > 1 ? (
<Typography.Text type="secondary" style={{ fontSize: 11 }}>
单价 {formatMoney(unitPriceFen)} × {quantity}
</Typography.Text>
) : null}
</Space>
)
},
},
{
title: '押金',
width: 130,
@@ -2055,11 +2081,16 @@ export default function WorkOrdersPanel() {
{canFulfillConsignment &&
['internal_matching', 'unassigned', 'open'].includes(String(row.status || '')) ? (
<Button
type={String(row.status || '') === 'internal_matching' ? 'primary' : 'default'}
icon={<ThunderboltOutlined />}
onClick={() => setConsignmentMatchOrder(row)}
title="按寄卖配置精确匹配库存;拼单工单可选多条库存一起拼"
title={
String(row.status || '') === 'internal_matching'
? '手动选择寄卖库存并立即匹配;拼单必须一次拼满'
: '按寄卖配置精确匹配库存;拼单工单可选多条库存一起拼'
}
>
内部库存匹配
{String(row.status || '') === 'internal_matching' ? '手动匹配寄卖' : '内部库存匹配'}
</Button>
) : null}
{canCustomerRefund &&
@@ -2471,7 +2502,7 @@ export default function WorkOrdersPanel() {
setPageSize(nextPageSize)
},
})}
scroll={{ x: 1240 }}
scroll={{ x: 1360 }}
/>
</Card>
<Drawer
@@ -3693,7 +3724,7 @@ export default function WorkOrdersPanel() {
loading={sharingQuery.isFetching}
pagination={false}
tableLayout="fixed"
scroll={{ x: 1914 }}
scroll={{ x: 2038 }}
rowClassName={(share) =>
share.problemMarked
? 'admin-share-row-problem'
@@ -3716,6 +3747,25 @@ export default function WorkOrdersPanel() {
align: 'right',
render: (_, share) => formatMoney(share.shareReward),
},
{
title: '寄卖价格',
width: 124,
align: 'right',
render: (_, share) => {
if (!share.consignmentInventoryId) return '-'
const unitPriceFen = Number(share.consignmentSalePriceFen || 0)
if (unitPriceFen <= 0) return '-'
const quantity = Math.max(1, Number(share.quantity || 1))
return (
<Space direction="vertical" size={0} style={{ alignItems: 'flex-end' }}>
<span>{formatMoney(unitPriceFen)}/份</span>
<Typography.Text type="secondary" style={{ fontSize: 11 }}>
合计 {formatMoney(unitPriceFen * quantity)}
</Typography.Text>
</Space>
)
},
},
{
title: '状态',
// 状态 + 取消原因两个 Tag 纵向排列;宽度按最长原因「后台取消部分」留足,
@@ -4567,9 +4617,13 @@ export default function WorkOrdersPanel() {
workOrderId={consignmentMatchOrder?.workOrderId ?? null}
onClose={() => setConsignmentMatchOrder(null)}
onMatched={() => {
void queryClient.invalidateQueries({ queryKey: ['admin-work-orders'] })
void queryClient.invalidateQueries({ queryKey: ['admin-work-orders-stats'] })
void queryClient.invalidateQueries({ queryKey: ['admin-consignment-inventories'] })
void refreshAll()
const matchedOrderId = consignmentMatchOrder?.workOrderId
if (matchedOrderId) {
void queryClient.invalidateQueries({
queryKey: ['admin-worker-platform-order-sharing', matchedOrderId],
})
}
}}
/>
@@ -4586,7 +4640,7 @@ export default function WorkOrdersPanel() {
: null
}
onMatched={() => {
void ordersQuery.refetch()
void refreshAll()
}}
/>