From 8bd97eea1c8687a119b1c7f0c0e0c8c3e0ad2989 Mon Sep 17 00:00:00 2001 From: torsenli Date: Fri, 16 Jun 2023 23:29:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/currency/index.vue | 6 +++--- pages/exchange/exchange-transaction.vue | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/currency/index.vue b/pages/currency/index.vue index 4d17a69..c21ddda 100644 --- a/pages/currency/index.vue +++ b/pages/currency/index.vue @@ -36,7 +36,7 @@ USDT @@ -51,12 +51,12 @@ USDT - {{$t("currency.b1")}} ≈¥{{price_cny}} + {{$t("currency.b1")}} ≈${{price_cny}} diff --git a/pages/exchange/exchange-transaction.vue b/pages/exchange/exchange-transaction.vue index a5c700e..68e2e42 100644 --- a/pages/exchange/exchange-transaction.vue +++ b/pages/exchange/exchange-transaction.vue @@ -63,7 +63,7 @@ input-width="61%" step="0.01" /> - ≈ ¥{{ omitTo(form.entrust_price*price_cny,2) }} + ≈ ${{ omitTo(form.entrust_price*price_cny,2) }} From 8cd16ecbcb1bd5ef6ca14b2e69502a1c93126999 Mon Sep 17 00:00:00 2001 From: torsenli Date: Fri, 16 Jun 2023 23:58:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/exchange/open-position.vue | 77 ++++++++++---------------------- 1 file changed, 23 insertions(+), 54 deletions(-) diff --git a/pages/exchange/open-position.vue b/pages/exchange/open-position.vue index a77031a..9a4c401 100644 --- a/pages/exchange/open-position.vue +++ b/pages/exchange/open-position.vue @@ -132,11 +132,10 @@ - @@ -160,7 +159,7 @@ :class="sliderActive==index?'color-theme-1 active':''"> {{item}}% --> - + 0% 25% @@ -833,9 +832,11 @@ export default { tradeList: [], show: false, accountInfo: {}, - lever_rage: [],// 杠杆倍数 - leverShow: '',// 杠杆倍数索引 - maxNum: 0,// 最多可开张数 + // 杠杆倍数 + lever_rage: [], + leverShow: '', + // 最多可开张数 + maxNum: 0, form: { type: 1, entrust_price: "", @@ -866,8 +867,7 @@ export default { progress: [25, 50, 75, 100], progressPing: [25, 50, 75, 100], sliderActive: -1, - sliderValue: 0, - showSliderNum: '0%', + sliderActive1: 0, pingActive: 3, contract: "0", // contract:"0", @@ -889,7 +889,8 @@ export default { refreshing: false, pingAmount: '', imgurl: '', - bao: 0 + bao: 0, + showSliderNum: '0%' }; }, computed: { @@ -911,8 +912,8 @@ export default { // activeCommission() { // return this.commissionTypes.find((item) => this.form.type == item.value); // }, - marginCALCU() { - console.log(this.form.amount, this.unit_amount, this.form.lever_rate, '-------'); + // 保证金 + margin() { return math.omitTo( (this.form.amount * this.unit_amount) / this.form.lever_rate, 0 @@ -921,16 +922,7 @@ export default { amount() { if (this.margin == 0){ this.margin=''; - this.sliderValue = '0'; - this.showSliderNum = '0%'; - }else if(this.margin>(+this.accountInfo.usable_balance) || this.margin==this.accountInfo.usable_balance){ - this.margin = (+this.accountInfo.usable_balance / this.form.lever_rate).toFixed(5); - this.sliderValue = 100; - this.showSliderNum = '100%'; - }else{ - this.sliderValue = Math.floor(this.margin * this.form.lever_rate * 100 / this.accountInfo.usable_balance); - this.showSliderNum = '≈'+this.sliderValue.toFixed(0)+'%'; - } + } if (!this.form.lever_rate || !this.margin) return 0; let p = this.margin * this.form.lever_rate; p = p.toFixed(0) @@ -958,9 +950,8 @@ export default { }, watch: { maxNum(n) { - // this.form.amount = Math.round((this.maxNum * this.sliderValue) / 100); - // 保证金随着杠杆变换而变换 - // this.margin = (this.form.amount / this.form.lever_rate).toFixed(5) + this.form.amount = Math.round((this.maxNum * this.sliderActive1) / 100); + this.margin = (this.form.amount / this.form.lever_rate).toFixed(5) }, symbol() { this.$emit("symbols", this.symbol) @@ -1339,8 +1330,7 @@ export default { }; Contract.contractAccount(data, {loading: !boo, toast: false}).then((res) => { // console.info(res) - // res.data.account_equity = (parseInt(res.data.account_equity)).toFixed(2) - res.data.account_equity = (+res.data.account_equity).toFixed(2) + res.data.account_equity = (parseInt(res.data.account_equity)).toFixed(2) res.data.usable_balance = (res.data.usable_balance).toFixed(2) this.accountInfo = res.data; if (!boo) { @@ -1365,12 +1355,6 @@ export default { label: item, value: item, })); - for(let item =0;item { this.maxNum = res.data; }); @@ -1455,16 +1439,15 @@ export default { // this.openNum() }); }, - // 保证金设置数量 + // 设置数量 sliderChangeN(e){ console.log('value 发生变化:' + e.detail.value); let num = e.detail.value; - this.showSliderNum = num.toFixed(0)+"%"; - this.form.amount = Math.round((this.accountInfo.usable_balance * num) / 100); - // this.sliderActive = this.sliderValue - console.log(this.form.amount, this.form.lever_rate); - this.sliderValue = num; - this.margin = (this.form.amount / this.form.lever_rate).toFixed(2) + this.showSliderNum = num+"%"; + this.form.amount = Math.round((this.maxNum * num) / 100); + // this.sliderActive = i + this.sliderActive1 = num + this.margin = (this.form.amount / this.form.lever_rate).toFixed(5) }, // sliderChange($ev) { // this.form.amount = Math.round((this.maxNum * $ev) / 100)||''; @@ -1479,20 +1462,6 @@ export default { this.sliderActive1 = n this.margin = (this.form.amount / this.form.lever_rate).toFixed(5) }, - // 输入保证金数量 - marginInput(e){ - this.sliderValue = Math.floor(this.margin * this.form.lever_rate * 100 / this.accountInfo.usable_balance) - // console.log(this.sliderValue, 2); - if(this.sliderValue==0){ - this.showSliderNum = '0%'; - }else if(this.sliderValue>100 || this.sliderValue==100){ - this.margin = (+this.accountInfo.usable_balance / this.form.lever_rate).toFixed(5); - this.sliderValue = 100; - this.showSliderNum = '100%'; - }else{ - this.showSliderNum = '≈'+this.sliderValue.toFixed(0)+'%'; - } - }, pingChange(n, i) { console.log(n) this.pingAmount = Math.round((this.activeItem.avail_position * n) / 100);