feat:拼单明细管理加一个撤份额的功能,指定数量
This commit is contained in:
@@ -34,6 +34,18 @@ function formatStatusLabel(status: string) {
|
||||
return STATUS_LABELS[status] || status || '未知'
|
||||
}
|
||||
|
||||
/** 份额级问题单处置动作中文名(与后台弹窗的四个选项一一对应) */
|
||||
const SHARE_PROBLEM_ACTION_LABELS: Record<string, string> = {
|
||||
return_to_worker: '退回打手继续处理',
|
||||
reopen: '取消该份额并退回接单大厅',
|
||||
cancel_release: '取消该份额并退还押金',
|
||||
cancel_deduct: '取消该份额并扣除押金',
|
||||
}
|
||||
|
||||
function formatShareProblemAction(action: string) {
|
||||
return SHARE_PROBLEM_ACTION_LABELS[action] || ''
|
||||
}
|
||||
|
||||
function readPayload(event: WorkOrderEvent, key: string): string {
|
||||
const value = event.payload?.[key]
|
||||
if (value === undefined || value === null) return ''
|
||||
@@ -311,6 +323,88 @@ export function formatWorkOrderEvent(event: WorkOrderEvent): EventNodeStyle {
|
||||
}
|
||||
case 'sharing_config_updated':
|
||||
return { title: '更新了拼单配置', color: 'default' }
|
||||
case 'sharing_joined': {
|
||||
const workerLabel = resolveEventWorkerLabel(event)
|
||||
const quantity = readPayloadAmount(event, 'quantity')
|
||||
const deadlineAt = readPayload(event, 'deadlineAt')
|
||||
const timeoutMinutes = readPayloadAmount(event, 'timeoutMinutes')
|
||||
const deadlineText = deadlineAt
|
||||
? `截止 ${dayjs(deadlineAt).format('MM-DD HH:mm')}`
|
||||
: timeoutMinutes > 0
|
||||
? `限时 ${Math.round(timeoutMinutes)} 分钟`
|
||||
: '不限时'
|
||||
return {
|
||||
title: workerLabel ? `打手参与拼单(${workerLabel})` : '打手参与拼单',
|
||||
description: [quantity > 0 ? `参与 ${quantity} 份` : '', deadlineText]
|
||||
.filter(Boolean)
|
||||
.join(' · '),
|
||||
color: 'purple',
|
||||
}
|
||||
}
|
||||
case 'sharing_share_quantity_reduced': {
|
||||
const workerLabel = resolveEventWorkerLabel(event)
|
||||
const fromQuantity = readPayloadAmount(event, 'fromQuantity')
|
||||
const toQuantity = readPayloadAmount(event, 'toQuantity')
|
||||
const reduceQuantity = readPayloadAmount(event, 'reduceQuantity')
|
||||
const details = [
|
||||
fromQuantity > 0 && toQuantity > 0 ? `${fromQuantity} 份 → ${toQuantity} 份` : '',
|
||||
reduceQuantity > 0 ? `撤销 ${reduceQuantity} 份` : '',
|
||||
note ? `原因:${note}` : '',
|
||||
'撤掉的份数已退回接单大厅,押金保持冻结',
|
||||
].filter(Boolean)
|
||||
return {
|
||||
title: workerLabel ? `撤销部分拼单份额(${workerLabel})` : '撤销部分拼单份额',
|
||||
description: details.join(';'),
|
||||
color: 'orange',
|
||||
}
|
||||
}
|
||||
case 'sharing_share_marked_problem': {
|
||||
const workerLabel = resolveEventWorkerLabel(event)
|
||||
return {
|
||||
title: workerLabel ? `标记拼单份额问题单(${workerLabel})` : '标记拼单份额问题单',
|
||||
description: note
|
||||
? `原因:${note};仅该份额受影响,母单状态不变`
|
||||
: '未填备注;仅该份额受影响,母单状态不变',
|
||||
color: 'red',
|
||||
}
|
||||
}
|
||||
case 'sharing_share_problem_disposed': {
|
||||
const workerLabel = resolveEventWorkerLabel(event)
|
||||
const actionLabel = formatShareProblemAction(readPayload(event, 'action'))
|
||||
const depositAmount = readPayloadAmount(event, 'depositAmount')
|
||||
const details = [
|
||||
actionLabel ? `处理方式:${actionLabel}` : '',
|
||||
depositAmount > 0 ? `涉及押金 ${formatFenAmount(depositAmount)}` : '',
|
||||
note ? `备注:${note}` : '',
|
||||
].filter(Boolean)
|
||||
return {
|
||||
title: workerLabel ? `处置拼单份额问题单(${workerLabel})` : '处置拼单份额问题单',
|
||||
description: details.length > 0 ? details.join(';') : undefined,
|
||||
color: 'orange',
|
||||
}
|
||||
}
|
||||
case 'sharing_acceptance_draft_saved':
|
||||
case 'sharing_acceptance_updated': {
|
||||
const workerLabel = resolveEventWorkerLabel(event)
|
||||
const imageCount = readPayloadAmount(event, 'imageCount')
|
||||
const hasVideo = Boolean(event.payload?.hasVideo)
|
||||
const details = [
|
||||
imageCount > 0 ? `验收图 ${imageCount} 张` : '',
|
||||
hasVideo ? '含验收视频' : '',
|
||||
].filter(Boolean)
|
||||
return {
|
||||
title:
|
||||
type === 'sharing_acceptance_draft_saved'
|
||||
? workerLabel
|
||||
? `保存了拼单验收草稿(${workerLabel})`
|
||||
: '保存了拼单验收草稿'
|
||||
: workerLabel
|
||||
? `更新了拼单验收资料(${workerLabel})`
|
||||
: '更新了拼单验收资料',
|
||||
description: details.length > 0 ? details.join(' · ') : undefined,
|
||||
color: 'purple',
|
||||
}
|
||||
}
|
||||
case 'price_synced_from_rule': {
|
||||
const rewardAmount = Number(readPayload(event, 'rewardAmount') || 0)
|
||||
const unitReward = Number(readPayload(event, 'sharingUnitReward') || 0)
|
||||
|
||||
Reference in New Issue
Block a user