refactor(web): 平仓页收付方向符号显式化unwindLegSign.js+4例单测——裸三元(x==1?±1:∓1)抽为命名函数并冻结业务事实:利息盈亏与保证金返还本金对同一InterestDirection枚举必须反号(利息=买方持有标的向交易商融资的成本,保证金返还=退客户自己交的钱,业务确认非笔误),不变量断言两符号之和恒0,顺手统一必挂;interestPnlSign对利息/保证金两腿通用(changeInterestAmount模板对两类行都绑定,已核实);另删死代码:this.ratio/this.shortRatio数据属性+赋值全库无读取(模板亦无绑定)及注释掉的历史三元;SwapUnwind.cshtml补script标签,两个执行型测试沙箱喂真实模块;行为等价(Number===1与==1对实际入参等价已验证),全套315例绿

This commit is contained in:
hjhan
2026-08-21 07:17:20 +08:00
parent 6e76f1c10d
commit e8d0a76442
6 changed files with 104 additions and 11 deletions
@@ -155,6 +155,8 @@ function loadVueApp(model, mockPost) {
roundExitYtm(v) { return v; },
applyManualEdit(s) { return s; }
},
// 收付方向符号:纯函数零依赖,直接喂真实模块(映射冻结由 unwindLegSign.test.js 覆盖)
UnwindLegSign: require('../wwwroot/Scripts/app/swaptrade/unwindLegSign.js'),
_: {
round(value, precision) {
return Number(Number(value || 0).toFixed(precision || 0));