完善拼单状态与份额验收流程
This commit is contained in:
@@ -45,6 +45,7 @@ import ImageUpload from '@/components/files/ImageUpload'
|
||||
import ImagePreviewList from '@/components/files/ImagePreviewList'
|
||||
import {
|
||||
acceptAdminWorkOrder,
|
||||
acceptAdminWorkOrderShare,
|
||||
acceptAdminWorkOrders,
|
||||
assignAdminWorkOrderToWorker,
|
||||
cancelAdminWorkOrder,
|
||||
@@ -741,16 +742,18 @@ export default function WorkOrdersPanel() {
|
||||
{
|
||||
title: '状态',
|
||||
width: 150,
|
||||
render: (_, row) => (
|
||||
<Space wrap size={4}>
|
||||
<Tag color={resolveStatusColor(row.status)}>{formatStatus(row.status)}</Tag>
|
||||
{row.status === 'open' && row.pinnedAt ? (
|
||||
<Tag color="gold" icon={<PushpinOutlined />}>
|
||||
置顶
|
||||
</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
render: (_, row) => {
|
||||
return (
|
||||
<Space wrap size={4}>
|
||||
<Tag color={resolveStatusColor(row.status)}>{formatStatus(row.status)}</Tag>
|
||||
{row.rawStatus === 'open' && row.pinnedAt ? (
|
||||
<Tag color="gold" icon={<PushpinOutlined />}>
|
||||
置顶
|
||||
</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '打手',
|
||||
@@ -768,6 +771,16 @@ export default function WorkOrdersPanel() {
|
||||
render: (_, row) => {
|
||||
const isVipAutoAcceptance = row.acceptance?.reviewMode === 'vip_auto'
|
||||
const evidencePending = row.acceptance?.evidenceStatus === 'pending'
|
||||
if (row.sharing?.enabled) {
|
||||
return (
|
||||
<Button type="link" size="small" onClick={() => openSharingConfigModal(row)}>
|
||||
查看拼单验收图
|
||||
{row.sharingProgress?.pendingSubmissionCount
|
||||
? `(${row.sharingProgress.pendingSubmissionCount}人待提交)`
|
||||
: ''}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<Space direction="vertical" size={4}>
|
||||
<ImagePreviewList
|
||||
@@ -791,37 +804,37 @@ export default function WorkOrdersPanel() {
|
||||
render: (_, row) => (
|
||||
<Space wrap>
|
||||
<Button onClick={() => openDetailDrawer(row)}>详情</Button>
|
||||
{['pending_material', 'unassigned', 'open'].includes(row.status) ? (
|
||||
{row.capabilities?.canEdit ? (
|
||||
<Button icon={<EditOutlined />} onClick={() => openEditModal(row)}>
|
||||
编辑
|
||||
</Button>
|
||||
) : null}
|
||||
{['pending_material', 'unassigned', 'cancelled'].includes(row.status) ? (
|
||||
{row.capabilities?.canDelete ? (
|
||||
<Button danger icon={<DeleteOutlined />} onClick={() => requestDeleteWorkOrder(row)}>
|
||||
删除
|
||||
</Button>
|
||||
) : null}
|
||||
{['pending_material', 'unassigned', 'open'].includes(row.status) ? (
|
||||
{row.sharing?.enabled || row.capabilities?.canConfigureSharing ? (
|
||||
<Button icon={<TeamOutlined />} onClick={() => openSharingConfigModal(row)}>
|
||||
拼单配置
|
||||
{row.sharing?.enabled && !row.capabilities?.canConfigureSharing ? '拼单明细' : '拼单配置'}
|
||||
</Button>
|
||||
) : null}
|
||||
{['unassigned', 'open'].includes(row.status) ? (
|
||||
{row.capabilities?.canAssign ? (
|
||||
<Button icon={<UserAddOutlined />} onClick={() => openAssignModal(row)}>
|
||||
指派并核销
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'in_progress' && row.worker ? (
|
||||
{row.capabilities?.canCancel ? (
|
||||
<Button danger icon={<UndoOutlined />} onClick={() => openCancelModal(row)}>
|
||||
撤单
|
||||
</Button>
|
||||
) : null}
|
||||
{['pending_material', 'in_progress'].includes(row.status) ? (
|
||||
{row.capabilities?.canUpdateMaterial ? (
|
||||
<Button icon={<FormOutlined />} onClick={() => openMaterialModal(row)}>
|
||||
{row.status === 'in_progress' ? '更新资料' : '补资料'}
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'unassigned' ? (
|
||||
{row.capabilities?.canPublish ? (
|
||||
<Button
|
||||
icon={<SendOutlined />}
|
||||
disabled={Number(row.rewardAmount || 0) <= 0}
|
||||
@@ -833,7 +846,7 @@ export default function WorkOrdersPanel() {
|
||||
发布并核销
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'open' ? (
|
||||
{row.capabilities?.canPin ? (
|
||||
<Button
|
||||
icon={<PushpinOutlined />}
|
||||
title={row.pinnedAt ? '取消置顶' : '置顶后抢单大厅优先展示'}
|
||||
@@ -847,7 +860,7 @@ export default function WorkOrdersPanel() {
|
||||
{row.pinnedAt ? '取消置顶' : '置顶'}
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'open' ? (
|
||||
{row.capabilities?.canUnpublish ? (
|
||||
<Button
|
||||
danger
|
||||
onClick={() => {
|
||||
@@ -864,7 +877,7 @@ export default function WorkOrdersPanel() {
|
||||
下架
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'pending_acceptance' ? (
|
||||
{row.capabilities?.canAccept ? (
|
||||
<Button
|
||||
icon={<CheckOutlined />}
|
||||
type="primary"
|
||||
@@ -873,17 +886,17 @@ export default function WorkOrdersPanel() {
|
||||
验收
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'accepted' && Number(row.pendingUnfreezeAmount || 0) > 0 ? (
|
||||
{row.capabilities?.canDeduct && Number(row.pendingUnfreezeAmount || 0) > 0 ? (
|
||||
<Button icon={<WarningOutlined />} danger onClick={() => openDeductModal(row)}>
|
||||
扣押金
|
||||
</Button>
|
||||
) : null}
|
||||
{['in_progress', 'pending_acceptance'].includes(row.status) ? (
|
||||
{row.capabilities?.canMarkProblem ? (
|
||||
<Button icon={<WarningOutlined />} danger onClick={() => setProblemOrder(row)}>
|
||||
问题单
|
||||
</Button>
|
||||
) : null}
|
||||
{row.status === 'problem' ? (
|
||||
{row.capabilities?.canResolveProblem ? (
|
||||
<Button icon={<FormOutlined />} onClick={() => setResolutionOrder(row)}>
|
||||
处置
|
||||
</Button>
|
||||
@@ -1572,13 +1585,14 @@ export default function WorkOrdersPanel() {
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={`拼单配置 · ${sharingOrder?.productName || ''}`}
|
||||
title={`${sharingOrder?.capabilities?.canConfigureSharing ? '拼单配置' : '拼单明细'} · ${sharingOrder?.productName || ''}`}
|
||||
open={Boolean(sharingOrder)}
|
||||
onCancel={() => {
|
||||
setSharingOrder(null)
|
||||
sharingForm.resetFields()
|
||||
}}
|
||||
onOk={() => sharingForm.submit()}
|
||||
footer={sharingOrder?.capabilities?.canConfigureSharing ? undefined : null}
|
||||
destroyOnHidden
|
||||
width={720}
|
||||
>
|
||||
@@ -1593,6 +1607,7 @@ export default function WorkOrdersPanel() {
|
||||
unitReward: 0,
|
||||
}}
|
||||
onFinish={submitSharingConfig}
|
||||
disabled={!sharingOrder.capabilities?.canConfigureSharing}
|
||||
>
|
||||
<Form.Item
|
||||
label="启用拼单"
|
||||
@@ -1689,6 +1704,54 @@ export default function WorkOrdersPanel() {
|
||||
render: (_, share) =>
|
||||
share.submittedAt ? formatAdminDateTime(share.submittedAt) : '-',
|
||||
},
|
||||
{
|
||||
title: '验收图',
|
||||
width: 150,
|
||||
render: (_, share) => (
|
||||
<ImagePreviewList
|
||||
files={Array.isArray(share.acceptance?.files) ? share.acceptance.files : []}
|
||||
imageUrls={Array.isArray(share.acceptance?.imageUrls) ? share.acceptance.imageUrls : []}
|
||||
size={44}
|
||||
maxVisible={2}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
render: (_, share) => String(share.acceptance?.note || '').trim() || '-',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_, share) =>
|
||||
share.status === 'submitted' ? (
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
void runAction(
|
||||
() => acceptAdminWorkOrderShare(sharingOrder.workOrderId, share.shareId),
|
||||
'该拼单参与者已验收',
|
||||
).then((succeeded) => {
|
||||
if (succeeded) {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
'admin-worker-platform-order-sharing',
|
||||
sharingOrder.workOrderId,
|
||||
],
|
||||
})
|
||||
}
|
||||
})
|
||||
}}
|
||||
>
|
||||
单独验收
|
||||
</Button>
|
||||
) : share.status === 'accepted' ? (
|
||||
<Tag color="green">已验收</Tag>
|
||||
) : (
|
||||
<Typography.Text type="secondary">待提交</Typography.Text>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
@@ -1796,8 +1859,7 @@ function ProductNameEditableCell({
|
||||
const savingRef = useRef(false)
|
||||
const clickTimerRef = useRef<number | null>(null)
|
||||
|
||||
const editable =
|
||||
['pending_material', 'unassigned', 'open'].includes(order.status) && !order.worker
|
||||
const editable = order.capabilities?.canEdit === true
|
||||
|
||||
function handleClick() {
|
||||
if (clickTimerRef.current) window.clearTimeout(clickTimerRef.current)
|
||||
@@ -1880,8 +1942,7 @@ function AmountEditableCell({
|
||||
const [draft, setDraft] = useState<number | null>(null)
|
||||
const savingRef = useRef(false)
|
||||
|
||||
const editable =
|
||||
['pending_material', 'unassigned', 'open'].includes(order.status) && !order.worker
|
||||
const editable = order.capabilities?.canEdit === true
|
||||
const currentFen = Number(order[field] || 0)
|
||||
const currentYuan = currentFen / 100
|
||||
const paymentFen = field === 'rewardAmount' ? getUserPaymentFen(order) : null
|
||||
|
||||
Reference in New Issue
Block a user