diff --git a/YLErpDAL/Modules/SystemModule/ClientDataModel.cs b/YLErpDAL/Modules/SystemModule/ClientDataModel.cs
index 0d00ea90..3252d15c 100644
--- a/YLErpDAL/Modules/SystemModule/ClientDataModel.cs
+++ b/YLErpDAL/Modules/SystemModule/ClientDataModel.cs
@@ -1536,11 +1536,6 @@ namespace YLErp.Modules.SystemModule
Text = SwapTypeEnum.普通.ToString(),
Value = SwapTypeEnum.普通.ToString()
},
- new SelectItem
- {
- Text = SwapTypeEnum.多空组合.ToString(),
- Value = SwapTypeEnum.多空组合.ToString()
- }
};
}
diff --git a/YLErpWeb/Controllers/SwapTrade2Controller.cs b/YLErpWeb/Controllers/SwapTrade2Controller.cs
index 78d7b2e2..2f282b7b 100644
--- a/YLErpWeb/Controllers/SwapTrade2Controller.cs
+++ b/YLErpWeb/Controllers/SwapTrade2Controller.cs
@@ -351,36 +351,6 @@ namespace YLErp.Web.Controllers
return View(model);
}
///
- /// 收益互换 多空组合平仓
- ///
- ///
- ///
- public ActionResult SwapLongShortUnwind(string enid, bool isUseApproval = false)
- {
- var intid = DecryptInt(enid);
- var model = new SwapDealService(CurUser).InitLongShortUnwind(intid, SwapEventTypeEnum.平仓);
- ViewBag.isUseApproval = isUseApproval;
- var hasProcess = new SwapDealService(CurUser).HasTradeProcess();
- //需要审批或者复核的交易都会显示行权审核提交按钮
- ViewBag.IsShowReCheckClose = (valuedateBLL.SystemDate.CloseReCheck == 1) || (valuedateBLL.SystemDate.CloseReApprove == 1 && hasProcess);
- return View(model);
- }
- ///
- /// 收益互换 多空组合互换
- ///
- ///
- ///
- public ActionResult SwapLongShortSwap(string enid, bool isUseApproval = false)
- {
- var intid = DecryptInt(enid);
- var model = new SwapDealService(CurUser).InitLongShortUnwind(intid, SwapEventTypeEnum.互换);
- ViewBag.isUseApproval = isUseApproval;
- var hasProcess = new SwapDealService(CurUser).HasTradeProcess();
- //需要审批或者复核的交易都会显示行权审核提交按钮
- ViewBag.IsShowReCheckClose = (valuedateBLL.SystemDate.CloseReCheck == 1) || (valuedateBLL.SystemDate.CloseReApprove == 1 && hasProcess);
- return View(model);
- }
- ///
/// 操作历史
///
///
@@ -456,26 +426,6 @@ namespace YLErp.Web.Controllers
return JsonSuccess("平仓成功");
}
///
- ///多空组合 平仓
- ///
- ///
- ///
- public JsonResult SwapLongShortUnwindJson(UnwindData unwindData)
- {
- new SwapDealService(CurUser).SwapLongShortUnwind(unwindData);
- return JsonSuccess("平仓成功");
- }
- ///
- ///多空组合 互换
- ///
- ///
- ///
- public JsonResult SwapLongShortJson(UnwindData unwindData)
- {
- new SwapDealService(CurUser).SwapLongShort(unwindData);
- return JsonSuccess("互换成功");
- }
- ///
/// 互换
///
///
diff --git a/YLErpWeb/Views/SwapTrade2/SwapLongShortSwap.cshtml b/YLErpWeb/Views/SwapTrade2/SwapLongShortSwap.cshtml
deleted file mode 100644
index 4df23cf7..00000000
--- a/YLErpWeb/Views/SwapTrade2/SwapLongShortSwap.cshtml
+++ /dev/null
@@ -1,126 +0,0 @@
-@model UnwindData
-@{
- ViewBag.Title = "交易 | 收益结算";
- Layout = "~/Views/Shared/_InfoLayout.cshtml";
- bool isUseApproval = ViewBag.isUseApproval;
- bool isShowReCheckClose = ViewBag.IsShowReCheckClose;
-}
-@section CSS{
-
-}
-@section JS
- {
-
-
-
-
-
-
-}
-
-
-
-
-
-
-
-
-
- | 收支方向 |
- 利息金额 |
- 其他费用 |
- 预付金/预付金平仓盈亏 |
-
-
- | {{item.InterestDirection==1?"收取":"支付"}} |
-
-
- |
-
-
- |
- {{formatAmount(item.InterestClosePnL)}} |
-
-
-
-
-
-
-
-
-
-
-
- | 收支方向 |
- 利息金额 |
- 其他费用 |
- 利息端平仓盈亏 |
-
-
- | {{item.InterestDirection==1?"收取":"支付"}} |
-
-
- |
-
-
- |
- {{formatAmount(item.InterestClosePnL)}} |
-
-
-
-
-
- @if (isUseApproval)
- {
-
-
- }
- else
- {
-
-
- }
-
-
-
-
-
diff --git a/YLErpWeb/Views/SwapTrade2/SwapLongShortUnwind.cshtml b/YLErpWeb/Views/SwapTrade2/SwapLongShortUnwind.cshtml
deleted file mode 100644
index bdbc1601..00000000
--- a/YLErpWeb/Views/SwapTrade2/SwapLongShortUnwind.cshtml
+++ /dev/null
@@ -1,138 +0,0 @@
-@model UnwindData
-@{
- ViewBag.Title = "交易 | 交易平仓";
- Layout = "~/Views/Shared/_InfoLayout.cshtml";
- bool isUseApproval = ViewBag.isUseApproval;
- bool isShowReCheckClose = ViewBag.IsShowReCheckClose;
-}
-@section CSS{
-
-}
-@section JS
- {
-
-
-
-
-
-
-}
-
-
-
-
-
-
-
-
-
- | 收支方向 |
- 资金类别 |
- 应返还本金 |
- 利息金额 |
- 预付金/预付金平仓盈亏 |
-
-
- | {{item.InterestDirection==1?"收取":"支付"}} |
- {{item.InterestModeStr}} |
-
-
- |
-
-
- |
- {{formatAmount(item.InterestClosePnL)}} |
-
-
-
-
-
-
-
-
-
-
-
- | 收支方向 |
- 利息金额 |
- 利息端平仓盈亏 |
-
-
- | {{item.InterestDirection==1?"收取":"支付"}} |
-
-
- |
- {{formatAmount(item.InterestClosePnL)}} |
-
-
-
-
-
- @if (isUseApproval)
- {
-
-
- }
- else
- {
-
-
- }
-
-
-
-
-
diff --git a/YLErpWeb/Views/SwapTrade2/header.cshtml b/YLErpWeb/Views/SwapTrade2/header.cshtml
index 54a70d94..227c3f1e 100644
--- a/YLErpWeb/Views/SwapTrade2/header.cshtml
+++ b/YLErpWeb/Views/SwapTrade2/header.cshtml
@@ -141,10 +141,6 @@
{
@MyControls.Btn("平仓", string.Format("unWindSwapTrade('{0}')", tradeModel.EncryptId))
}
- if (longShort && !hasPosition && tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_交易平仓)
- {
- @MyControls.Btn("平仓", string.Format("unWindSwapLongShort('{0}')", tradeModel.EncryptId))
- }
if (tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_收益互换)
{
@MyControls.Btn("展期信息", string.Format("extensionTime('{0}')", tradeModel.EncryptId))
@@ -153,10 +149,6 @@
{
@MyControls.Btn("收益结算", string.Format("unWindSwap('{0}')", tradeModel.EncryptId))
}
- if (longShort && hasPosition && tradeModel.CanSwapTradeUnwind() && CurUser.交易管理_收益互换)
- {
- @MyControls.Btn("收益结算", string.Format("unWindLongShortSwap('{0}')", tradeModel.EncryptId))
- }
@if (CurUser.交易管理_交易续作)
{
@MyControls.Btn("续作", string.Format("renewTrade('{0}')", tradeModel.EncryptId))
diff --git a/YLErpWeb/fe-tests/fixtures/historical_swap_events.json b/YLErpWeb/fe-tests/fixtures/historical_swap_events.json
index f84e52d5..16cec7a2 100644
--- a/YLErpWeb/fe-tests/fixtures/historical_swap_events.json
+++ b/YLErpWeb/fe-tests/fixtures/historical_swap_events.json
@@ -43,43 +43,5 @@
"SwapMarginRebatePnl": 200,
"SwapMarginAmount": 40000
}
- },
- {
- "id": "LONGSHORT_UNWIND",
- "desc": "多空组合平仓(unwindLongShort):从0起,不含浮动盈亏(FloatPnlSum=0)",
- "eventType": 4,
- "deal": { "CloseQty": 0 },
- "floatPosition": { "FloatPnlSum": 0, "PositionType": 1, "PayDirection": 1, "TradingFee": 0 },
- "interestList": [],
- "marginList": [
- { "InterestClosePnL": 150, "InterestDirection": 1, "InterestPrincipal": 20000 }
- ],
- "expected": {
- "SwapCloseAmount": 150,
- "SwapRealizedPnL": 150,
- "SwapMarginRebatePnl": 150,
- "SwapMarginAmount": -20000
- }
- },
- {
- "id": "LONGSHORT_SWAP",
- "desc": "多空组合互换(swapLongShort):SwapMarginAmount 用裸 InterestPrincipal(无符号) —— 已知差异",
- "eventType": 5,
- "deal": { "CloseQty": 0 },
- "floatPosition": { "FloatPnlSum": 0, "PositionType": 1, "PayDirection": 1, "TradingFee": 0 },
- "interestList": [],
- "marginList": [
- { "InterestClosePnL": 100, "InterestDirection": 1, "InterestPrincipal": 18000 }
- ],
- "expected": {
- "SwapCloseAmount": 100,
- "SwapRealizedPnL": 100,
- "SwapMarginRebatePnl": 100,
- "SwapMarginAmount": 18000
- },
- "knownDiscrepancies": {
- "SwapMarginAmount": 36000
- }
- }
- ]
+ } ]
}
diff --git a/YLErpWeb/fe-tests/swapPrecisionConfig.test.js b/YLErpWeb/fe-tests/swapPrecisionConfig.test.js
index 05fc793d..ecef4b39 100644
--- a/YLErpWeb/fe-tests/swapPrecisionConfig.test.js
+++ b/YLErpWeb/fe-tests/swapPrecisionConfig.test.js
@@ -163,8 +163,6 @@ describe('swap price precision common wiring', () => {
edit: read('wwwroot/Scripts/app/swaptrade/swapTradeEdit.js'),
income: read('wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js'),
unwind: read('wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js'),
- longShort: read('wwwroot/Scripts/app/swaptrade/swapLongShort.js'),
- unwindLongShort: read('wwwroot/Scripts/app/swaptrade/unwindLongShort.js'),
view: read('wwwroot/Scripts/app/swaptrade/swapTradeView.js'),
flow: read('wwwroot/Scripts/app/swaptrade/SwapflowList.js'),
helper: precisionHelperSrc
diff --git a/YLErpWeb/wwwroot/Scripts/app/riskHedging/riskIndex2.js b/YLErpWeb/wwwroot/Scripts/app/riskHedging/riskIndex2.js
index df78ce5d..b6097e32 100644
--- a/YLErpWeb/wwwroot/Scripts/app/riskHedging/riskIndex2.js
+++ b/YLErpWeb/wwwroot/Scripts/app/riskHedging/riskIndex2.js
@@ -2000,9 +2000,6 @@ const subView = (function (jqGridMgr) {
if (tradeType === "收益互换") {
srcurl = "/swaptrade2/SwapUnwind/?enid=" + encryptId;
- if (StructureType=="多空组合") {
- srcurl = "/swaptrade2/SwapLongShortUnwind/?enid=" + encryptId;
- }
area = ["1300px", "720px"];
}
if (tradeType.indexOf("远期") >= 0) {
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapLongShort.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapLongShort.js
deleted file mode 100644
index 05adcab6..00000000
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapLongShort.js
+++ /dev/null
@@ -1,228 +0,0 @@
-//otcformat禁止千分位分组
-window.otcformat.options.disableGrouping = true;
-const inputFormatEqvNotional = swapPricePrecision.getCommonInputFormat('amount', { append: '' });
-const swapInstrumentType = (model.FlowEvents || []).find(item => item && item.UnderlyingInstrumentType)?.UnderlyingInstrumentType || model.UnderlyingInstrumentType || '';
-const formatSwapAmount = value => swapPricePrecision.normalizeCommon('amount', value);
-const formatSwapQuantity = value => swapPricePrecision.normalizeCommon('quantity', value, swapInstrumentType);
-let ValueDate = model.ValueDate;
-const vue = new Vue({
- el: '#vueDiv',
- data: {
- deal: model,
- interestList: [],
- marginList: [],
- },
- computed: {
- maxUnwindDate() {
- return ValueDate;
- },
- minStartDate() {
- return this.deal.StartDate;
- }
- },
- created() {
- this.initDeal();
- this.setValueDate();
- },
- methods: {
- formatAmount(value) {
- return swapPricePrecision.formatCommon('amount', value);
- },
- formatQuantity(value) {
- return swapPricePrecision.formatCommon('quantity', value, swapInstrumentType);
- },
- initDeal() {
- this.interestList = model.FlowEvents.filter((item) => {
- return item.InterestMode == 1 || item.InterestMode == 2 || item.InterestMode == 9;
- });
- this.marginList = model.FlowEvents.filter((item) => {
- return item.InterestMode == 5 || item.InterestMode == 6;
- });
- },
- setValueDate(e) {//修改平仓日期
- if (e) {
- this.deal.ValueDate = e;
- this.deal.UnwindDate = e;
- }
- if (!isUseApproval) {
- this.getInterestList();
- } else {
- this.dataFormat();
- }
- },
- dataFormat() {
- this.deal.NotionalValue = formatSwapAmount(this.deal.NotionalValue);
- this.deal.PosiNotionalValue = formatSwapAmount(this.deal.PosiNotionalValue);
- this.deal.NotionalQty = formatSwapQuantity(this.deal.NotionalQty);
- this.deal.PositionQty = formatSwapQuantity(this.deal.PositionQty);
- this.deal.SwapCloseAmount = formatSwapAmount(this.deal.SwapCloseAmount);
- this.interestList.forEach(x => {
- //x.Principal = formatSwapAmount(x.Principal);
- //x.Rate = otcformat.fixed6(x.Rate);
- x.InterestFee = formatSwapAmount(x.InterestFee);
- x.InterestAmount = formatSwapAmount(x.InterestAmount);
- x.InterestClosePnL = formatSwapAmount(x.InterestClosePnL);
- //x.InterestStartDate = x.InterestStartDate ? x.InterestStartDate.substr(0, 10) : "";
- //x.InterestEndDate = x.InterestEndDate ? x.InterestEndDate.substr(0, 10) : "";
- });
- this.marginList.forEach(x => {
- x.InterestFee = formatSwapAmount(x.InterestFee);
- x.InterestAmount = formatSwapAmount(x.InterestAmount);
- x.InterestClosePnL = formatSwapAmount(x.InterestClosePnL);
- });
- },
- changeInterestAmount(item) {//修改利息金额
- let interestRatio = item.InterestDirection == 1 ? 1 : -1;
- item.InterestClosePnL = formatSwapAmount(parseFloat(item.InterestAmount) * interestRatio + parseFloat(item.InterestFee));
- this.calcCloseAmount();
- },
- calcCloseAmount() {//计算平仓总额=浮动收取+利息收取-浮动支付-利息支付
- let thisObj = this;
- thisObj.deal.SwapCloseAmount = 0;
- thisObj.deal.SwapRealizedPnL = 0;
- thisObj.deal.SwapMarginRebatePnl = 0;
- thisObj.deal.SwapMarginAmount = 0;
- this.interestList.forEach(x => {
- /*let interestRatio = x.InterestDirection == 1 ? 1 : -1;*/
- let interestAmount = parseFloat(x.InterestClosePnL);
- thisObj.deal.SwapCloseAmount = parseFloat(thisObj.deal.SwapCloseAmount) + interestAmount;
- thisObj.deal.SwapRealizedPnL = parseFloat(thisObj.deal.SwapRealizedPnL) + interestAmount;
- });
- this.marginList.forEach(x => {
- let interestAmount = parseFloat(x.InterestClosePnL);
- thisObj.deal.SwapCloseAmount = parseFloat(thisObj.deal.SwapCloseAmount) + interestAmount;
- thisObj.deal.SwapMarginRebatePnl = parseFloat(thisObj.deal.SwapMarginRebatePnl) + interestAmount;
- thisObj.deal.SwapRealizedPnL = parseFloat(thisObj.deal.SwapRealizedPnL) + interestAmount;
- thisObj.deal.SwapMarginAmount = parseFloat(thisObj.deal.SwapMarginAmount) + parseFloat(x.InterestPrincipal);
- });
- thisObj.deal.SwapCloseAmount = formatSwapAmount(thisObj.deal.SwapCloseAmount);
- thisObj.deal.SwapRealizedPnL = formatSwapAmount(thisObj.deal.SwapRealizedPnL);
- thisObj.deal.SwapMarginRebatePnl = formatSwapAmount(thisObj.deal.SwapMarginRebatePnl);
- thisObj.deal.SwapMarginAmount = formatSwapAmount(thisObj.deal.SwapMarginAmount);
- },
- getInterestList() {//根据平仓日期获取利息腿信息
- var thisObj = this;
- var postData = { valueDate: thisObj.deal.ValueDate, unwindDate: thisObj.deal.UnwindDate, tradeId: thisObj.deal.SwapTradeId, closePercent: 1, eventType: 3 }
- main.post("/swaptrade2/GetUnwindInterestList", postData, { async: true }).done(function (resp) {
- thisObj.interestList = resp.obj.filter((item) => {
- return item.InterestMode == 1 || item.InterestMode == 2 || item.InterestMode == 9;
- });
- thisObj.marginList = resp.obj.filter((item) => {
- return item.InterestMode == 5 || item.InterestMode == 6;
- });
- thisObj.calcCloseAmount();
- thisObj.dataFormat();
- });
- },
- incomeTrade() {//互换
- var thisObj = this;
- if (main.isEmpty(thisObj.deal.ValueDate)) {
- main.message("请输入平仓日期");
- return;
- }
- let reqObj = _.cloneDeep(thisObj.deal);
- let marginCloneList = _.cloneDeep(thisObj.marginList);
-
- reqObj.FlowEvents = _.cloneDeep(thisObj.interestList);
- marginCloneList.forEach((item) => {
- reqObj.FlowEvents.push(item);
- })
- var postData = { unwindData: reqObj };
- var msg = "确认提交收益结算?";
- var postUrl = "/swaptrade2/SwapLongShortJson";
- if (g_isShowReCheckClose) {
- msg = "确认提交收益结算审核?";
- postUrl = "/swaptrade2/ApplyUnwind";
- postData.eventType = 3;//互换3,平仓2
- }
- main.confirm(msg,
- function () {
- //重新计算百分比
- var thisObj2 = thisObj;
- main.post(postUrl, { unwindData: reqObj }).done(function (res) {
- if (res.success) {
- thisObj2.closetrade_cashWindow();
- }
- else {
- try {
- thisObj2.closetrade_cashWindow();
- } catch (e) {
- }
- }
- });
- });
- },
- getSumbitText: function () {
- return g_isShowReCheckClose ? "审核提交" : "保存";
- },
- submitApproval(status) {
- var pop = '';
- if (status === 'pass') {
- pop = "确认通过审批?";
- }
- if (status === 'reject') {
- pop = "确认拒绝?";
- }
- var confirmFunc = function (additionalProcessing) {
- var pData = { tradeId: trade.id, status: status, text: "" };
- if (!main.isEmpty(additionalProcessing)) {
- pData.additionalProcessing = additionalProcessing;
- }
- var thisObj2 = thisObj;
- main.post("/processtradelog/UpdateTradeProcessLog", pData).done(
- function (data) {
- if (data.obj && data.obj.proccessType == "AdditionalProcessing") {
- if (data.obj.type == "LackOfMoney") {
- var htmlContent = `${data.obj.message}
`;
- var lackMoneyConfirmLayer = main.open2("提示",
- htmlContent,
- {
- area: ["430px", "175px"],
- btn: ['交易特批', '取消'],
- yes: function (index, layero) {
- var layerIndex = lackMoneyConfirmLayer;
- main.confirm("客户资金或授信不足,强制成交会导致本机构产生风险!要继续审批通过?", function () {
- layer.close(layerIndex);
- confirmFunc("LackOfMoney");
- });
- },
- cancel: function (index, layero) {
- if (window.parent && window.parent.reloadtrade) {
- thisObj2.closetrade_cashWindow();
- }
- (parent || window).layer.closeAll();
- }
- });
- }
- return;
- }
- (parent || window).main.message(data.msg);
- try { thisObj2.closetrade_cashWindow(); }
- catch (e) { }
- if (parent) {
- parent.layer.closeAll();
- }
- });
- }
- main.confirm(pop, confirmFunc);
- },
- closetrade_cashWindow: function () {
- layer.closeMe('reloadData');
- },
- closeCurrentWindow: function () {
- try {
- if (window.parent && window.parent.reload) window.parent.reload();
- } catch (e) {
- }
- try {
- var layer = window.parent.layer;
- layer.close(layer.getFrameIndex(window.name));
- } catch (e) {
- }
- }
- },
- components: {
- 'vue-datepicker': FastVue.vueDatePicker(),
- 'vue-number-input': FastVue.vueNumberInput(),
- }
-});
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js
index 0cd7bc04..2f4b1d8b 100644
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js
+++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js
@@ -330,46 +330,6 @@ function unWindSwap(id) {
}
});
}
-function unWindSwapLongShort(id) {
- var title = "交易平仓";
- var srcurl = "/swaptrade2/SwapLongShortUnwind/?enid=" + id;
- main.post("/swaptrade2/CheckEodTrade?enid=" + id).done(function (res) {
- if (res.success) {
- main.open(title,
- srcurl,
- {
- area: ["1300px", "780px"],
- end: function () {
- if (window.parent && window.parent.reloadtrade) {
- window.parent.reloadtrade();
- }
- }
- });
- } else {
- main.message(res.message);
- }
- });
-}
-function unWindLongShortSwap(id) {
- var title = "期间互换";
- var srcurl = "/swaptrade2/SwapLongShortSwap/?enid=" + id;
- main.post("/swaptrade2/CheckEodTrade?enid=" + id).done(function (res) {
- if (res.success) {
- main.open(title,
- srcurl,
- {
- area: ["1300px", "780px"],
- end: function () {
- if (window.parent && window.parent.reloadtrade) {
- window.parent.reloadtrade();
- }
- }
- });
- } else {
- main.message(res.message);
- }
- });
-}
function extensionTime(id) {
var title = "展期信息";
var srcurl = "/swaptrade2/ExtensionTime/?enid=" + id;
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindLongShort.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindLongShort.js
deleted file mode 100644
index fc8ab9b9..00000000
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindLongShort.js
+++ /dev/null
@@ -1,197 +0,0 @@
-//otcformat禁止千分位分组
-window.otcformat.options.disableGrouping = true;
-const inputFormatEqvNotional = swapPricePrecision.getCommonInputFormat('amount', { append: '' });
-const swapInstrumentType = (model.FlowEvents || []).find(item => item && item.UnderlyingInstrumentType)?.UnderlyingInstrumentType || model.UnderlyingInstrumentType || '';
-const formatSwapAmount = value => swapPricePrecision.normalizeCommon('amount', value);
-const formatSwapQuantity = value => swapPricePrecision.normalizeCommon('quantity', value, swapInstrumentType);
-let dealDate = model.DealDate;
-const vue = new Vue({
- el: '#vueDiv',
- data: {
- deal: model,
- interestList: [],
- marginList: [],
- oriClosePercent: model.ClosePercent
- },
- computed: {
- minStartDate() {
- return dealDate;
- }
- },
- created() {
- this.initDeal();
- this.calcCloseAmount();
- this.dataFormat();
- },
- methods: {
- formatAmount(value) {
- return swapPricePrecision.formatCommon('amount', value);
- },
- formatQuantity(value) {
- return swapPricePrecision.formatCommon('quantity', value, swapInstrumentType);
- },
- initDeal() {
- this.interestList = model.FlowEvents.filter((item) => {
- return item.InterestMode == 1 || item.InterestMode == 2 || item.InterestMode == 9;
- });
- this.marginList = model.FlowEvents.filter((item) => {
- return item.InterestMode == 5 || item.InterestMode == 6;
- });
- },
- dataFormat() {
- this.deal.NotionalValue = formatSwapAmount(this.deal.NotionalValue);
- this.deal.PosiNotionalValue = formatSwapAmount(this.deal.PosiNotionalValue);
- this.deal.NotionalQty = formatSwapQuantity(this.deal.NotionalQty);
- this.deal.SwapCloseAmount = formatSwapAmount(this.deal.SwapCloseAmount);
- this.deal.PositionQty = formatSwapQuantity(this.deal.PositionQty);
- this.interestList.forEach(x => {
- //x.Principal = formatSwapAmount(x.Principal);
- //x.Rate = otcformat.fixed6(x.Rate);
- x.InterestAmount = formatSwapAmount(x.InterestAmount);
- x.InterestClosePnL = formatSwapAmount(x.InterestClosePnL);
- //x.InterestStartDate = x.InterestStartDate ? x.InterestStartDate.substr(0, 10) : "";
- //x.InterestEndDate = x.InterestEndDate ? x.InterestEndDate.substr(0, 10) : "";
- });
- this.marginList.forEach(x => {
- x.InterestAmount = formatSwapAmount(x.InterestAmount);
- x.InterestClosePnL = formatSwapAmount(x.InterestClosePnL);
- });
- },
- changeInterestAmount(item) {//修改利息金额
- let interestRatio = item.InterestDirection == 1 ? 1 : -1;
- item.InterestClosePnL = formatSwapAmount(parseFloat(item.InterestAmount) * interestRatio+ parseFloat(item.InterestFee));
- this.calcCloseAmount();
- },
- calcCloseAmount() {//计算平仓总额=浮动收取+利息收取-浮动支付-利息支付
- let thisObj = this;
- thisObj.deal.SwapCloseAmount = 0;
- thisObj.deal.SwapRealizedPnL = 0;
- thisObj.deal.SwapMarginRebatePnl = 0;
- thisObj.deal.SwapMarginAmount = 0;
- this.interestList.forEach(x => {
- /*let interestRatio = x.InterestDirection == 1 ? 1 : -1;*/
- let interestAmount = parseFloat(x.InterestClosePnL);
- thisObj.deal.SwapCloseAmount = parseFloat(thisObj.deal.SwapCloseAmount) + interestAmount;
- thisObj.deal.SwapRealizedPnL = parseFloat(thisObj.deal.SwapRealizedPnL) + interestAmount;
- });
- this.marginList.forEach(x => {
- let interestAmount = parseFloat(x.InterestClosePnL);
- let interestRatio = x.InterestDirection == 1 ? -1 : 1;
- thisObj.deal.SwapCloseAmount = parseFloat(thisObj.deal.SwapCloseAmount) + interestAmount;
- thisObj.deal.SwapMarginRebatePnl = parseFloat(thisObj.deal.SwapMarginRebatePnl) + interestAmount;
- thisObj.deal.SwapRealizedPnL = parseFloat(thisObj.deal.SwapRealizedPnL) + interestAmount;
- thisObj.deal.SwapMarginAmount = parseFloat(thisObj.deal.SwapMarginAmount) + parseFloat(x.InterestPrincipal) * interestRatio;
- });
- thisObj.deal.SwapCloseAmount = formatSwapAmount(thisObj.deal.SwapCloseAmount);
- thisObj.deal.SwapRealizedPnL = formatSwapAmount(thisObj.deal.SwapRealizedPnL);
- thisObj.deal.SwapMarginRebatePnl = formatSwapAmount(thisObj.deal.SwapMarginRebatePnl);
- thisObj.deal.SwapMarginAmount = formatSwapAmount(thisObj.deal.SwapMarginAmount);
- },
- closeTrade() {//平仓
- var thisObj = this;
- let reqObj = _.cloneDeep(thisObj.deal);
- let marginCloneList = _.cloneDeep(thisObj.marginList);
- reqObj.FlowEvents = _.cloneDeep(thisObj.interestList);
- marginCloneList.forEach((item) => {
- reqObj.FlowEvents.push(item);
- })
- var postData = { unwindData: reqObj };
- var msg = "确认提交平仓?";
- var postUrl = "/swaptrade2/SwapLongShortUnwindJson";
- if (g_isShowReCheckClose) {
- msg = "确认提交平仓审核?";
- postUrl = "/swaptrade2/ApplyUnwind";
- postData.eventType = 2;//互换3,平仓2
- }
- main.confirm(msg,
- function () {
- //重新计算百分比
- var thisObj2 = thisObj;
- main.post(postUrl, postData).done(function (res) {
- if (res.success) {
- thisObj2.closetrade_cashWindow();
- }
- else {
- try {
- thisObj2.closetrade_cashWindow();
- } catch (e) {
- }
- }
- });
- });
- },
- getSumbitText: function () {
- return g_isShowReCheckClose ? "审核提交" : "保存";
- },
- submitApproval(status) {
- var pop = '';
- if (status === 'pass') {
- pop = "确认通过审批?";
- }
- if (status === 'reject') {
- pop = "确认拒绝?";
- }
- let thisObj = this;
- var confirmFunc = function (additionalProcessing) {
- var pData = { tradeId: thisObj.deal.SwapTradeId, status: status, text: "" };
- if (!main.isEmpty(additionalProcessing)) {
- pData.additionalProcessing = additionalProcessing;
- }
- var thisObj2 = thisObj;
- main.post("/processtradelog/UpdateTradeProcessLog", pData).done(
- function (data) {
- if (data.obj && data.obj.proccessType == "AdditionalProcessing") {
- if (data.obj.type == "LackOfMoney") {
- var htmlContent = `${data.obj.message}
`;
- var lackMoneyConfirmLayer = main.open2("提示",
- htmlContent,
- {
- area: ["430px", "175px"],
- btn: ['交易特批', '取消'],
- yes: function (index, layero) {
- var layerIndex = lackMoneyConfirmLayer;
- main.confirm("客户资金或授信不足,强制成交会导致本机构产生风险!要继续审批通过?", function () {
- layer.close(layerIndex);
- confirmFunc("LackOfMoney");
- });
- },
- cancel: function (index, layero) {
- if (window.parent && window.parent.reloadtrade) {
- thisObj2.closetrade_cashWindow();
- }
- (parent || window).layer.closeAll();
- }
- });
- }
- return;
- }
- (parent || window).main.message(data.msg);
- try { thisObj2.closetrade_cashWindow(); }
- catch (e) { }
- if (parent) {
- parent.layer.closeAll();
- }
- });
- }
- main.confirm(pop, confirmFunc);
- },
- closetrade_cashWindow: function () {
- layer.closeMe('reloadData');
- },
- closeCurrentWindow: function () {
- try {
- if (window.parent && window.parent.reload) window.parent.reload();
- } catch (e) {
- }
- try {
- var layer = window.parent.layer;
- layer.close(layer.getFrameIndex(window.name));
- } catch (e) {
- }
- }
- },
- components: {
- 'vue-datepicker': FastVue.vueDatePicker(),
- 'vue-number-input': FastVue.vueNumberInput(),
- }
-});
diff --git a/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js b/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js
index ecbd7a7d..21bd8878 100644
--- a/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js
+++ b/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js
@@ -731,9 +731,6 @@ function passorreinfo(eid, tradeType, status, isGroup, StructureType) {
else if (tradeType === "收益互换") {
weight = "95%";
url = "/swaptrade2/SwapUnwind/?enid=" + eid + "&isUseApproval=" + true;
- if (StructureType == "多空组合") {
- url = "/swaptrade2/SwapLongShortUnwind/?enid=" + eid + "&isUseApproval=" + true;
- }
height = "800px";
}
else {
@@ -744,9 +741,6 @@ function passorreinfo(eid, tradeType, status, isGroup, StructureType) {
weight = "95%";
title = "互换审批";
url = "/swaptrade2/SwapIncome/?enid=" + eid + "&isUseApproval=" + true;
- if (StructureType == "多空组合") {
- url = "/swaptrade2/SwapLongShortSwap/?enid=" + eid + "&isUseApproval=" + true;
- }
height = "800px";
}
else if (status === "行权待复核") {
@@ -883,9 +877,6 @@ function unWindSelect(id, tradeType, isReCheck, StructureType) {
});
} else if (tradeType == "收益互换") {
var url = "/swaptrade2/SwapUnwind/?enid=" + id + "&isUseApproval=" + true;;
- if (StructureType == "多空组合") {
- url = "/swaptrade2/SwapLongShortUnwind/?enid=" + id + "&isUseApproval=" + true;;
- }
main.open(title, url, {
area: ["1300px", "720px"],
end: function () {