fix(swaptrade): 互换开平仓事件流水 小数点精度调整

- 将事件列表中的价格字段格式化统一为两位小数或九位小数
- 替换原有的otcformat.trading.umprice格式化方法
- 在前端JavaScript中添加EventTwoDecimalFormat和EventNineDecimalFormat函数
- 修改后端C#代码中的OtcFormat调用改为OtcFormatMoney并调整精度参数
- 为事件列表脚本添加版本参数以确保缓存更新
This commit is contained in:
张名锐
2026-07-27 13:17:39 +08:00
parent b1c91bca34
commit bf6b27ba19
3 changed files with 38 additions and 26 deletions
@@ -372,16 +372,16 @@ namespace YLErp.Modules.SwapModule
exportModel.PositionType = item.PositionType==1?"多头":"空头";
exportModel.UnderlyingCode = item.UnderlyingCode;
exportModel.MatuirityDate = item.MatuirityDate.OtcFormatDate();
exportModel.TradingAmountAvg = item.TradingAmountAvg.OtcFormat(OtcFormatFlag.umprice);
exportModel.TradingAmountFeeAvg = item.TradingAmountFeeAvg.OtcFormat(OtcFormatFlag.umprice);
exportModel.TradingAmountAvg = item.TradingAmountAvg.OtcFormatMoney(grouping: false);
exportModel.TradingAmountFeeAvg = item.TradingAmountFeeAvg.OtcFormatMoney(grouping: false);
exportModel.Quantity = item.Quantity.OtcFormatMoney(false, 4);
exportModel.TradingAmount = item.TradingAmount.OtcFormatMoney(false, 4);
exportModel.TradingAmount = item.TradingAmount.OtcFormatMoney(false, 2);
exportModel.ContractSize = item.ContractSize.ToString();
exportModel.TradingFee = item.TradingFee.OtcFormatMoney(false, 4);
exportModel.TradingFeePending = item.TradingFeePending.OtcFormatMoney(false, 4);
exportModel.DividendPending = item.DividendPending.OtcFormatMoney(false, 4);
exportModel.MarkClosePnl = item.MarkClosePnl.OtcFormatMoney(false, 4);
exportModel.DividendIn = item.DividendIn.OtcFormatMoney(false, 4);
exportModel.TradingFee = item.TradingFee.OtcFormatMoney(false, 2);
exportModel.TradingFeePending = item.TradingFeePending.OtcFormatMoney(false, 2);
exportModel.DividendPending = item.DividendPending.OtcFormatMoney(false, 2);
exportModel.MarkClosePnl = item.MarkClosePnl.OtcFormatMoney(false, 2);
exportModel.DividendIn = item.DividendIn.OtcFormatMoney(false, 2);
exportModel.OptLog = item.OptLog;
exportModel.InitYtm = item.InitYtm;
list.Add(exportModel);
+2 -2
View File
@@ -12,7 +12,7 @@
</script>
<script src="~/front/calendar?v=@(HtmlUtil.JsVersion)"></script>
<script src="~/Scripts/app/tradeHelper.js?v=@HtmlUtil.JsVersion"></script>
<script src="~/Scripts/app/swaptrade/eventlist.js?v=@HtmlUtil.JsVersion"></script>
<script src="~/Scripts/app/swaptrade/eventlist.js?v=@HtmlUtil.JsVersion&eventPriceFormatV=2"></script>
}
<div id="eventVue">
<div class="searchdiv">
@@ -28,4 +28,4 @@
</div>
<form target="_blank" method="post" id="exportForm" action="">
<input type="hidden" name="" value="" />
</form>
</form>
@@ -176,36 +176,31 @@ var getColModelGrid = function () {
label: '成交全价',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'TradingAmountFeeAvg',
label: '成交全价(含费)',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'TradingAmountNetAvg',
label: '成交净价',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'InitYtm',
label: '成交收益率',
width: 90,
align: 'center',
formatter: function (cellValue, options, rowObject) {
if (cellValue == null) {
return "";
}
return otcformat.trading.premiumRateP(cellValue);
}
formatter: EventNineDecimalFormat
}, {
name: 'TradingAmountNetFeeAvg',
label: '成交净价(含费)',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'Quantity',
label: '成交数量/张数',
@@ -217,7 +212,7 @@ var getColModelGrid = function () {
label: '成交金额(元)',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'ContractSize',
label: '乘数',
@@ -230,31 +225,31 @@ var getColModelGrid = function () {
label: '交易费用佣金',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'TradingFeePending',
label: '待结算交易费用佣金',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'DividendPending',
label: '待结算分红收益',
width: 90,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'MarkClosePnl',
label: '浮动端平仓盈亏·浮动',
width: 160,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}, {
name: 'DividendIn',
label: '浮动端平仓盈亏·分红',
width: 160,
align: 'center',
formatter: otcformat.trading.umprice
formatter: EventTwoDecimalFormat
}
];
return col;
@@ -262,6 +257,23 @@ var getColModelGrid = function () {
var colModelGrid = getColModelGrid();
function EventTwoDecimalFormat(cellValue) {
if (cellValue === null || cellValue === undefined || cellValue === '') {
return '';
}
var price = Number(cellValue);
return isFinite(price) ? price.toFixed(2) : cellValue;
}
function EventNineDecimalFormat(cellValue) {
if (cellValue === null || cellValue === undefined || cellValue === '') {
return '';
}
var price = Number(cellValue);
return isFinite(price) ? price.toFixed(9) : cellValue;
}
function gridComplete() {
$('.ui-jqgrid-bdiv', '#gbox_listGrid').floatingScroll();
}