1. 寄售仓库手动匹配订单扩充支持 open 状态工单,增强 WO 工单号与纯数字的模糊/前缀搜索,修复工单搜不到的问题并在卡片高亮展示内部工单号与状态; 2. 接单工单操作列全面支持【手动匹配寄售】,允许从接单工单主动调起寄售匹配弹窗; 3. 寄售现货筛选支持通过 SUB 提报单号、INV 仓库号、供货打手等快速搜索; 4. 完善规格冲突下的强制匹配确认与必填原因提交机制,确保履约全流程留痕合规。
73 lines
3.0 KiB
TypeScript
73 lines
3.0 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import {
|
|
canSubmitManualMatch,
|
|
describeManualMatchType,
|
|
filterManualMatchOptions,
|
|
resolveManualMatchRequirement,
|
|
} from '../src/utils/consignment-manual-match.ts'
|
|
|
|
test('精确匹配不需要任何确认,直接可提交', () => {
|
|
assert.deepEqual(resolveManualMatchRequirement('exact'), {
|
|
needsPartialConfirm: false,
|
|
needsMismatchConfirm: false,
|
|
needsNote: false,
|
|
})
|
|
assert.equal(canSubmitManualMatch({ matchType: 'exact' }), true)
|
|
})
|
|
|
|
test('非精确匹配必须勾选确认,但不用写原因', () => {
|
|
assert.equal(resolveManualMatchRequirement('partial').needsNote, false)
|
|
assert.equal(canSubmitManualMatch({ matchType: 'partial' }), false)
|
|
assert.equal(canSubmitManualMatch({ matchType: 'partial', confirmedPartial: true }), true)
|
|
})
|
|
|
|
test('规格冲突必须勾选确认**并且**填原因', () => {
|
|
assert.equal(resolveManualMatchRequirement('conflict').needsNote, true)
|
|
assert.equal(canSubmitManualMatch({ matchType: 'conflict', confirmedMismatch: true }), false)
|
|
assert.equal(
|
|
canSubmitManualMatch({ matchType: 'conflict', confirmedMismatch: true, matchNote: ' ' }),
|
|
false,
|
|
)
|
|
assert.equal(
|
|
canSubmitManualMatch({
|
|
matchType: 'conflict',
|
|
confirmedMismatch: true,
|
|
matchNote: '订单规格录错,已与买家确认',
|
|
}),
|
|
true,
|
|
)
|
|
})
|
|
|
|
test('匹配状态文案与色调:绿/橙/红三档,冲突要一眼看出来', () => {
|
|
assert.equal(describeManualMatchType('exact').tone, 'ok')
|
|
assert.equal(describeManualMatchType('partial').tone, 'warning')
|
|
assert.equal(describeManualMatchType('conflict').tone, 'danger')
|
|
assert.equal(describeManualMatchType('conflict').label, '规格冲突')
|
|
})
|
|
|
|
test('关键词过滤:现货能按寄卖单号/物品名搜到,大小写与空格无关', () => {
|
|
const list = [
|
|
{ submissionNo: 'SUB26091711256110', itemName: '苹果微信暗潮2钻' },
|
|
{ submissionNo: 'SUB26091519501248', itemName: '安卓QQ苍龙4钻' },
|
|
]
|
|
const pick = (item: (typeof list)[number]) => [item.submissionNo, item.itemName]
|
|
|
|
assert.equal(filterManualMatchOptions(list, '', pick).length, 2)
|
|
assert.equal(filterManualMatchOptions(list, ' sub260917 ', pick).length, 1)
|
|
assert.equal(filterManualMatchOptions(list, '苍龙', pick).length, 1)
|
|
assert.equal(filterManualMatchOptions(list, '不存在', pick).length, 0)
|
|
})
|
|
|
|
test('待指派/待补资料/大厅待抢的订单均能手动指定现货(与后端前置校验同口径)', async () => {
|
|
const { isManuallyMatchableOrderStatus } =
|
|
await import('../src/utils/consignment-manual-match.ts')
|
|
assert.equal(isManuallyMatchableOrderStatus('unassigned'), true)
|
|
assert.equal(isManuallyMatchableOrderStatus('pending_material'), true)
|
|
assert.equal(isManuallyMatchableOrderStatus('open'), true)
|
|
for (const status of ['in_progress', 'pending_acceptance', 'accepted', 'cancelled', 'disputed']) {
|
|
assert.equal(isManuallyMatchableOrderStatus(status), false, `${status} 不该给手动匹配入口`)
|
|
}
|
|
})
|