feat: 支持待分配/待抢单修改付款金额并增加价格历史

This commit is contained in:
2026-11-03 10:31:46 +08:00
parent 232ef6ce79
commit 96676841b5
22 changed files with 626 additions and 78 deletions
@@ -64,22 +64,16 @@ test('getUserPaymentFen:空值或非法值不误判成 0 元', () => {
assert.equal(getUserPaymentFen({ material: {}, sourceOrderAmount: 0 }), null)
})
test('用户付款金额仅在待完善(pending_material)可编辑', () => {
assert.equal(canEditUserPaymentAmount({ status: 'pending_material' }), true)
assert.equal(
canEditUserPaymentAmount({ status: 'pending_material', rawStatus: 'pending_material' }),
true,
)
test('用户付款金额在待完善、待分配、待抢单可编辑', () => {
for (const status of ['pending_material', 'unassigned', 'open']) {
assert.equal(
canEditUserPaymentAmount({ status, rawStatus: status }),
true,
`${status} 应允许编辑用户付款金额`,
)
}
for (const status of [
'unassigned',
'open',
'in_progress',
'pending_acceptance',
'problem',
'accepted',
'cancelled',
]) {
for (const status of ['in_progress', 'pending_acceptance', 'problem', 'accepted', 'cancelled']) {
assert.equal(
canEditUserPaymentAmount({ status, rawStatus: status }),
false,
@@ -87,7 +81,11 @@ test('用户付款金额仅在待完善(pending_material)可编辑', () => {
)
}
// rawStatus 是后端原始状态,优先级高于运营态 status
assert.equal(canEditUserPaymentAmount({ status: 'open', rawStatus: 'pending_material' }), true)
assert.equal(canEditUserPaymentAmount({ status: 'pending_material', rawStatus: 'open' }), false)
// 运营态优先:拼单母单 rawStatus 仍是 open,但满额后界面显示代练中/待验收,不能再改
assert.equal(canEditUserPaymentAmount({ status: 'in_progress', rawStatus: 'open' }), false)
assert.equal(canEditUserPaymentAmount({ status: 'pending_acceptance', rawStatus: 'open' }), false)
// 未满额时运营态仍是 open,继续允许
assert.equal(canEditUserPaymentAmount({ status: 'open', rawStatus: 'open' }), true)
// 老数据没有运营态时回退 rawStatus
assert.equal(canEditUserPaymentAmount({ status: '', rawStatus: 'pending_material' }), true)
})