Browse Source

修复拖动目标金额

master
torsenli 3 years ago
parent
commit
9a547f3303
  1. 30
      src/views/contract/exchange-store.vue

30
src/views/contract/exchange-store.vue

@ -94,7 +94,6 @@
<div style="width:47%;">
<div class="usable-box-A">
<span>{{ $t("contract.a3") }}</span>
<!-- accountInfo.account_equity 账户权益accountInfo.usable_balance 可用 -->
<span style="color: #444;"> {{ accountInfo.usable_balance }} USDT
<i
class="el-icon-sort"
@ -527,20 +526,13 @@ export default {
return item.avail_position;
},
activeStep_buy() {
// console.log(this.form.amount_buy , this.maxNum ,'----------')
// if (!this.form.amount_buy || !this.maxNum) return 0;
// let num = (this.form.amount_buy / this.maxNum) * 100;
// return num;
if (!this.form.amount_buy || !this.accountInfo.usable_balance) return 0;
let num = (this.form.amount_buy / this.accountInfo.usable_balance) * 100;
if (!this.form.amount_buy || !this.maxNum) return 0;
let num = (this.form.amount_buy / this.maxNum) * 100;
return num;
},
activeStep_sell() {
// if (!this.form.amount_sell || !this.maxNum) return 0;
// let num = (this.form.amount_sell / this.maxNum) * 100;
// return num;
if (!this.form.amount_sell || !this.accountInfo.usable_balance) return 0;
let num = (this.form.amount_sell / this.accountInfo.usable_balance) * 100;
if (!this.form.amount_sell || !this.maxNum) return 0;
let num = (this.form.amount_sell / this.maxNum) * 100;
return num;
},
//
@ -550,7 +542,7 @@ export default {
// },
amount_buy(){
console.info(this.form.lever_rate)
console.info(this.margin_buy, '买入--保证金')
console.info(this.margin_buy)
if (!this.form.lever_rate || !this.margin_buy) return 0;
let p=this.margin_buy*this.form.lever_rate;
@ -613,16 +605,14 @@ export default {
},
//
sliderChange($ev, operate) {
console.log($ev, '滑块滑起来了')
if(operate=='sell'){
// this.form.amount_sell = Math.round((this.maxNum * $ev) / 100)||'';
this.form.amount_sell = Math.round((this.accountInfo.usable_balance * $ev) / 100)||'';
// console.info(this.form)
this.form.amount_sell = Math.round((this.maxNum * $ev) / 100)||'';
console.info(this.form)
this.margin_sell=this.form.amount_sell/this.form.lever_rate || 0
}else if (operate == 'buy'){
// this.form.amount_buy = Math.round((this.maxNum * $ev) / 100)||'';
this.form.amount_buy = Math.round((this.accountInfo.usable_balance * $ev) / 100)||'';
// console.info(this.form)
this.form.amount_buy = Math.round((this.maxNum * $ev) / 100)||'';
console.info(this.form)
this.margin_buy=this.form.amount_buy/this.form.lever_rate || 0
}
},

Loading…
Cancel
Save