From 5474eec50a45503723aad9dac46258d23f09483b Mon Sep 17 00:00:00 2001 From: j1ack <1209452658@qq.com> Date: Mon, 19 Sep 2022 18:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entrustOrderList/entrustOrderList.vue | 114 ++++++++++-------- manifest.json | 23 +++- pages/markets/contractOrder.vue | 9 +- 3 files changed, 91 insertions(+), 55 deletions(-) diff --git a/components/entrustOrderList/entrustOrderList.vue b/components/entrustOrderList/entrustOrderList.vue index 93e03ae..a436c29 100644 --- a/components/entrustOrderList/entrustOrderList.vue +++ b/components/entrustOrderList/entrustOrderList.vue @@ -2,7 +2,7 @@ - + {{ i18n.Position }} {{ i18n.Closed }} @@ -23,7 +23,7 @@ {{ i18n.close }} - + @@ -48,41 +48,42 @@ {{item.fee}} {{ i18n.StsPrice }} {{item.lossStopPrice}} - + - + {{ i18n.StopLimit }} - + {{ i18n.CurrentPrice }} {{marketDetail.close}} - {{ i18n.ROE }} - - - {{getValue(item.direction=='buy'?(marketDetail.close-item.openedPrice)*item.hand/item.bondAmount:(item.openedPrice-marketDetail.close)*item.hand/item.bondAmount)}}% + + {{getValue(item.direction=='buy'?(marketDetail.close-item.openedPrice)*item.hand/item.bondAmount:(item.openedPrice-marketDetail.close)*item.hand/item.bondAmount)}}% - + {{ i18n.ExpectProfit }} {{getItem(item.direction=='buy'?(marketDetail.close-item.openedPrice)*item.hand:(item.openedPrice-marketDetail.close)*item.hand)}} 0 - + {{ i18n.close }} - + @@ -90,10 +91,11 @@ {{item.closedPrice}} {{ i18n.ROE }} - - - {{getValue(item.profitAmount/item.bondAmount)}}% - + + + {{getValue(item.profitAmount/item.bondAmount)}}% + {{ i18n.PL }} @@ -105,13 +107,13 @@ - {{ i18n.PL }} - 0 + 0 @@ -155,13 +157,13 @@ - - - + + + + :title="i18n.Margincall" :content='i18n.WarmTipsText' @confirm="stopConfirm" + @cancel="stopModalShowZui = false" confirmColor="#00E8A2" cancelColor="#96959E"> {{ i18n.AmountTrue }} @@ -175,7 +177,7 @@ - + @@ -237,7 +239,7 @@ closeModalShow: false, stopModalShow: false, type: 1, - stopModalShowZui:false, + stopModalShowZui: false, test: 0, dealList: [{ dealType: 'long' @@ -291,23 +293,35 @@ }, methods: { // 获取百分比位数 - getValue(e){ - let data = e*100 - data = parseFloat(data.toPrecision(10)) - data = String(data) - return data.substring(0, data.indexOf(".") + 3); + getValue(e) { + let data = e * 100 + data = parseFloat(data) + data = String(data) + if (data.indexOf(".") != -1) { + return data.substring(0, data.indexOf(".") + 3); + } else { + return data + } + }, + // 获取位数 getPrice(s) { - var i=s; + var i = s; /* js 数字精度问题 */ - i = parseFloat(i.toPrecision(10)) + i = parseFloat(i) i = String(i) - return i.substring(0, i.indexOf(".") + 5); + // return i.substring(0, i.indexOf(".") + 5); + if (i.indexOf(".") != -1) { + return i.substring(0, i.indexOf(".") + 5); + } else { + return i + } + }, - + stopModalChange() { if (this.stopLimitData.direction === 'buy') { if (this.styValue) @@ -341,14 +355,14 @@ this.loss = 0 }, // 设置保证金 - Margincall(i){ - this.stopLimitData = i - this.stopModalShowZui=true - this.styValue = 0; - this.stsValue = 0; - this.profit = 0 - this.loss = 0 - }, + Margincall(i) { + this.stopLimitData = i + this.stopModalShowZui = true + this.styValue = 0; + this.stsValue = 0; + this.profit = 0 + this.loss = 0 + }, // 获取撤销订单 closeItem(item, i) { this.itemData = item @@ -380,7 +394,7 @@ * @param {*} type */ onChangeType(type = 0) { - this.list=[]; + this.list = []; this.type = type if (this.type == 0) { this.status = 'undone' @@ -429,7 +443,7 @@ * stop确认弹窗 */ stopConfirm() { - if(this.stopModalShow){ + if (this.stopModalShow) { if (this.styValue < 0 || this.stsValue < 0) { uni.showToast({ title: this.i18n.lessThan, @@ -451,8 +465,8 @@ }, 800) }); } - - if(this.stopModalShowZui){ + + if (this.stopModalShowZui) { if (this.styValue < 0) { uni.showToast({ title: this.i18n.lessThan, @@ -472,9 +486,9 @@ this.getContractOrderList() }, 800) }); - + } - + }, /** * styValue值变化 @@ -530,10 +544,11 @@