feat(finance): 完善客服钱包与人工履约成本流水

This commit is contained in:
yml2213
2026-10-24 14:34:28 +08:00
parent f0f8c92e67
commit a96229a106
11 changed files with 359 additions and 78 deletions
@@ -0,0 +1,63 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {
buildManualFulfillmentNote,
buildManualFulfillmentReference,
} from './manual-fulfillment-note.js'
test('人工履约编号同时带工单号与平台单号', () => {
assert.equal(
buildManualFulfillmentReference({
workOrderNo: 'WK26102414033739',
platformOrderId: '2628501763808879',
orderItemId: 10,
}),
'工单 WK26102414033739 · 平台单号 2628501763808879',
)
})
test('人工履约编号在没有工单号时回退平台单号', () => {
assert.equal(
buildManualFulfillmentReference({
workOrderNo: null,
platformOrderId: '2628501763808879',
orderItemId: 10,
}),
'平台单号 2628501763808879',
)
})
test('人工履约编号完全没有单号时回退订单项', () => {
assert.equal(
buildManualFulfillmentReference({
workOrderNo: null,
platformOrderId: '',
orderItemId: 10,
}),
'订单项 #10',
)
})
test('人工履约备注包含商品、编号与客服备注并按上限截断', () => {
const note = buildManualFulfillmentNote({
skuName: '幸运币2个',
reference: '工单 WK26102414033739 · 平台单号 2628501763808879',
note: '已发放',
maxLength: 300,
})
assert.equal(
note,
'人工履约 幸运币2个 · 工单 WK26102414033739 · 平台单号 2628501763808879 · 已发放',
)
assert.equal(
buildManualFulfillmentNote({
skuName: '幸运币2个',
reference: '工单 WK26102414033739',
note: '',
maxLength: 12,
}),
'人工履约 幸运币2个 ·',
)
})