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);