add:新增同一个工单同一人可以多次拼单

This commit is contained in:
2026-10-23 14:26:41 +08:00
parent 72a758fd7c
commit bfd2325ac5
28 changed files with 1332 additions and 347 deletions
@@ -77,18 +77,25 @@ export async function createWorkerAcceptanceAdminNotification(input: {
productName: string
workerName: string
imageCount: number
/** 拼单份额:每份提交各生成一条待办(按 shareId 去重) */
shareId?: number | null
}) {
const shareId = Number(input.shareId || 0)
return createConfiguredWorkerPlatformNotification('acceptance_submitted', {
notificationType: 'worker_acceptance_submitted',
priority: 'normal',
entityType: 'work_order',
entityId: input.workOrderId,
dedupeKey: acceptanceNotificationKey(input.workOrderId),
dedupeKey:
shareId > 0
? acceptanceNotificationKey(input.workOrderId, shareId)
: acceptanceNotificationKey(input.workOrderId),
title: '有订单待验收',
body: [
`订单:${input.workOrderNo || input.workOrderId}`,
`商品:${input.productName || '-'}`,
`打手:${input.workerName || '-'}`,
...(shareId > 0 ? [`份额:#${shareId}`] : []),
`验收图片:${input.imageCount} 张`,
].join(';'),
actionPath: `${ADMIN_WORKER_PLATFORM_PATH}?tab=orders`,
@@ -96,6 +103,28 @@ export async function createWorkerAcceptanceAdminNotification(input: {
})
}
/** 整单(含拼单全部份额)验收完成:单独一条完成通知,不与待验收待办混用。 */
export async function createWorkOrderFullyAcceptedAdminNotification(input: {
workOrderId: number
workOrderNo: string
productName: string
}) {
return createConfiguredWorkerPlatformNotification('order_accepted', {
notificationType: 'worker_order_accepted',
priority: 'normal',
entityType: 'work_order',
entityId: input.workOrderId,
dedupeKey: `work_order_accepted:${input.workOrderId}`,
title: '订单已全部验收',
body: [
`订单:${input.workOrderNo || input.workOrderId}`,
`商品:${input.productName || '-'}`,
].join(';'),
actionPath: `${ADMIN_WORKER_PLATFORM_PATH}?tab=orders`,
now: new Date().toISOString(),
})
}
export async function createWorkerCancelRequestAdminNotification(input: {
requestId: number
workOrderId: number
@@ -279,8 +308,10 @@ async function createConfiguredWorkerPlatformNotification(
return notification
}
function acceptanceNotificationKey(workOrderId: number) {
return `work_order_acceptance:${workOrderId}`
function acceptanceNotificationKey(workOrderId: number, shareId = 0) {
return shareId > 0
? `work_order_acceptance:${workOrderId}:share:${shareId}`
: `work_order_acceptance:${workOrderId}`
}
function formatAmount(amountFen: number) {