feat(swaptrade): 收益互换界面金额固定两位小数

- 新增 inputFormatInterestAmount 配置对象,精度为2位小数,支持负数显示和尾随零保留
- 在保证金列表中将 InterestAmount 和 InterestFee 字段的格式化从 inputFormatEqvNotional 替换为 inputFormatInterestAmount
- 在利息列表中将 InterestAmount 和 InterestFee 字段的格式化从 inputFormatEqvNotional 替换为 inputFormatInterestAmount
- 保持原有的双向数据绑定和事件监听功能不变
This commit is contained in:
张名锐
2026-08-05 09:52:22 +08:00
parent 6e523de2c0
commit 269807cc44
2 changed files with 5 additions and 4 deletions
+4 -4
View File
@@ -93,10 +93,10 @@
<tr v-for="item in marginList">
<td :class="item.InterestDirection==1?'swapget':'swappay'">{{item.InterestDirection==1?"收取":"支付"}}</td>
<td>
<vue-number-input v-model="item.InterestAmount" v-bind:format="inputFormatEqvNotional" v-on:input="changeInterestAmount(item)"></vue-number-input>
<vue-number-input v-model="item.InterestAmount" v-bind:format="inputFormatInterestAmount" v-on:input="changeInterestAmount(item)"></vue-number-input>
</td>
<td>
<vue-number-input v-model="item.InterestFee" v-bind:format="inputFormatEqvNotional" v-on:input="changeInterestAmount(item)"></vue-number-input>
<vue-number-input v-model="item.InterestFee" v-bind:format="inputFormatInterestAmount" v-on:input="changeInterestAmount(item)"></vue-number-input>
</td>
<td>{{item.InterestClosePnL}}</td>
</tr>
@@ -121,10 +121,10 @@
<tr v-for="item in interestList">
<td :class="item.InterestDirection==1?'swapget':'swappay'">{{item.InterestDirection==1?"收取":"支付"}}</td>
<td>
<vue-number-input v-model="item.InterestAmount" v-bind:format="inputFormatEqvNotional" v-on:input="changeInterestAmount(item)"></vue-number-input>
<vue-number-input v-model="item.InterestAmount" v-bind:format="inputFormatInterestAmount" v-on:input="changeInterestAmount(item)"></vue-number-input>
</td>
<td>
<vue-number-input v-model="item.InterestFee" v-bind:format="inputFormatEqvNotional" v-on:input="changeInterestAmount(item)"></vue-number-input>
<vue-number-input v-model="item.InterestFee" v-bind:format="inputFormatInterestAmount" v-on:input="changeInterestAmount(item)"></vue-number-input>
</td>
<td>{{item.InterestClosePnL}}</td>
</tr>
@@ -5,6 +5,7 @@ const inputFormatSwapRate = Object.freeze({ precision: otcformat.trading.premium
const inputFormatTradePrice = Object.freeze({ precision: otcformat.trading.tradePrice.precision, append: '' });
const inputFormatTradeAmount = Object.freeze({ precision: otcformat.trading.notional.precision, append: '' });
const inputFormatEqvNotional = Object.freeze({ precision: otcformat.trading.StockEqvNotional.precision, append: '', negative: true });
const inputFormatInterestAmount = Object.freeze({ precision: 2, append: '', negative: true, trimTailZeros: false });
const inputFormatDividend = Object.freeze({ precision: 2, append: '', negative: true });
const inputFormatMarginRate = Object.freeze({ precision: otcformat.trading.marginRateP.precision, append: '%' });
const inputFormatMarginRateNoPercent = Object.freeze({ precision: otcformat.trading.umpriceP.precision, append: '', percent: true });