fix(cost): 派生费用可随退款重算,成本版本与基线禁止追溯

- 平台费/支付费允许 estimated→estimated 按净收入重算;采购与打手报酬保持固化
- 创建成本版本时拒绝早于当前时间的 effectiveFrom
- 已有快照后禁止导入价格基线;基线生效时间改为当前
- 删除基线导入中前移现有版本生效时间的逻辑
This commit is contained in:
yml2213
2026-11-01 15:21:50 +08:00
parent 045ac98479
commit 9e154cb16d
4 changed files with 226 additions and 150 deletions
@@ -356,9 +356,10 @@ test('比例费用按退款后的净收入计算', () => {
assert.equal(withRefund[0]?.totalAmountFen, 180)
})
test('历史订单成本固化:只有预估→实际允许替换', () => {
test('历史订单成本固化:只有预估→实际与派生费用允许替换', () => {
assert.equal(shouldSupersedeSnapshot(null, 'estimated'), true)
assert.equal(shouldSupersedeSnapshot('estimated', 'estimated'), false)
assert.equal(shouldSupersedeSnapshot('estimated', 'estimated', true), true)
assert.equal(shouldSupersedeSnapshot('estimated', 'actual'), true)
assert.equal(shouldSupersedeSnapshot('actual', 'estimated'), false)
assert.equal(shouldSupersedeSnapshot('actual', 'actual'), false)