diff --git a/layout/vDropdwon.vue b/layout/vDropdwon.vue
index 07b6f4d..15521f5 100644
--- a/layout/vDropdwon.vue
+++ b/layout/vDropdwon.vue
@@ -64,8 +64,7 @@ export default {
this.$nextTick(() => {
this.text=this.list[newVal].label;
})
- },
- immediate: true,
+ }
},
},
methods: {
diff --git a/pages/exchange/open-position.vue b/pages/exchange/open-position.vue
index 9a4c401..17cfc56 100644
--- a/pages/exchange/open-position.vue
+++ b/pages/exchange/open-position.vue
@@ -132,10 +132,11 @@
+
@@ -159,7 +160,7 @@
:class="sliderActive==index?'color-theme-1 active':''">
{{item}}%
-->
-
+
0%
25%
@@ -832,11 +833,9 @@ export default {
tradeList: [],
show: false,
accountInfo: {},
- // 杠杆倍数
- lever_rage: [],
- leverShow: '',
- // 最多可开张数
- maxNum: 0,
+ lever_rage: [],// 杠杆倍数
+ leverShow: '',// 杠杆倍数索引
+ maxNum: 0,// 最多可开张数
form: {
type: 1,
entrust_price: "",
@@ -867,7 +866,8 @@ export default {
progress: [25, 50, 75, 100],
progressPing: [25, 50, 75, 100],
sliderActive: -1,
- sliderActive1: 0,
+ sliderValue: 0,
+ showSliderNum: '0%',
pingActive: 3,
contract: "0",
// contract:"0",
@@ -889,8 +889,7 @@ export default {
refreshing: false,
pingAmount: '',
imgurl: '',
- bao: 0,
- showSliderNum: '0%'
+ bao: 0
};
},
computed: {
@@ -912,8 +911,8 @@ export default {
// activeCommission() {
// return this.commissionTypes.find((item) => this.form.type == item.value);
// },
- // 保证金
- margin() {
+ marginCALCU() {
+ console.log(this.form.amount, this.unit_amount, this.form.lever_rate, '-------');
return math.omitTo(
(this.form.amount * this.unit_amount) / this.form.lever_rate,
0
@@ -922,7 +921,16 @@ 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)
@@ -950,8 +958,9 @@ export default {
},
watch: {
maxNum(n) {
- this.form.amount = Math.round((this.maxNum * this.sliderActive1) / 100);
- this.margin = (this.form.amount / this.form.lever_rate).toFixed(5)
+ // this.form.amount = Math.round((this.maxNum * this.sliderValue) / 100);
+ // 保证金随着杠杆变换而变换
+ // this.margin = (this.form.amount / this.form.lever_rate).toFixed(5)
},
symbol() {
this.$emit("symbols", this.symbol)
@@ -1355,6 +1364,12 @@ export default {
label: item,
value: item,
}));
+ for(let item =0;item {
this.maxNum = res.data;
});
@@ -1439,15 +1454,16 @@ export default {
// this.openNum()
});
},
- // 设置数量
+ // 保证金设置数量
sliderChangeN(e){
console.log('value 发生变化:' + e.detail.value);
let num = e.detail.value;
- 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)
+ 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)
},
// sliderChange($ev) {
// this.form.amount = Math.round((this.maxNum * $ev) / 100)||'';
@@ -1462,6 +1478,20 @@ 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);