Browse Source

修改合约保证金为2位小数点、以及合约价格问题

master
liaoxinyu 9 months ago
parent
commit
a96d35eb76
  1. 15
      src/views/contract/exchange-store.vue
  2. 2
      src/views/contract/handicap.vue
  3. 18
      src/views/contract/index.vue

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

@ -99,6 +99,8 @@
class="form-control" class="form-control"
v-model="marginBuy" v-model="marginBuy"
:placeholder="tips" :placeholder="tips"
@input="inputEnter(false)"
title=""
/> />
<!-- <div class="input-group-append"> <!-- <div class="input-group-append">
<span class="input-group-text">{{ $t("contract.e2") }}</span> <span class="input-group-text">{{ $t("contract.e2") }}</span>
@ -222,6 +224,8 @@
class="form-control" class="form-control"
v-model="marginSell" v-model="marginSell"
:placeholder="tips" :placeholder="tips"
@input="inputEnter(true)"
title=""
/> />
<!-- <div class="input-group-append"> <!-- <div class="input-group-append">
<span class="input-group-text">{{ $t("contract.e2") }}</span> <span class="input-group-text">{{ $t("contract.e2") }}</span>
@ -525,6 +529,17 @@ export default {
} }
}, },
methods: { methods: {
inputEnter(boll) {
if(boll){
this.marginSell = this.marginSell
.replace(/[^\d.]/g, "") //
.replace(/^(\d*\.?\d{0,2}).*$/, "$1"); //
}else{
this.marginBuy = this.marginBuy
.replace(/[^\d.]/g, "") //
.replace(/^(\d*\.?\d{0,2}).*$/, "$1"); //
}
},
// //
contractAccount(boo) { contractAccount(boo) {
if (!this.isLogin) return; if (!this.isLogin) return;

2
src/views/contract/handicap.vue

@ -198,6 +198,7 @@ export default {
bus.$on('collapse', msg => { bus.$on('collapse', msg => {
this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
this.$emit("input", this.newPriceObj); this.$emit("input", this.newPriceObj);
localStorage.setItem("price",this.newPriceObj.price)
}); });
}, },
// //
@ -214,6 +215,7 @@ export default {
this.tradeList = res.swapTradeList; this.tradeList = res.swapTradeList;
this.newPriceObj = this.tradeList[0]; this.newPriceObj = this.tradeList[0];
this.$emit("input", this.newPriceObj); this.$emit("input", this.newPriceObj);
localStorage.setItem("price",this.newPriceObj.price)
}); });
}, },
// //

18
src/views/contract/index.vue

@ -20,7 +20,8 @@
decreace2: activeContract.increase < 0, decreace2: activeContract.increase < 0,
increase: activeContract.increase >= 0 increase: activeContract.increase >= 0
}"> }">
{{ activeContract.price }} <!-- {{ activeContract.price }} -->
{{price1}}
</div> </div>
<!-- <div class="title mb-1 text-secondary"> <!-- <div class="title mb-1 text-secondary">
{{ $t("contract.h6") }} {{ $t("contract.h6") }}
@ -117,7 +118,7 @@
</div> </div>
</div> </div>
<div class="text-right width-32"> <div class="text-right width-32">
{{ item.close }} {{item.symbol == activeSymbol ? price1 : item.price}}
</div> </div>
<div class="text-right width-32" :class="item.increase < 0 ? 'decreace' : 'increase'"> <div class="text-right width-32" :class="item.increase < 0 ? 'decreace' : 'increase'">
{{ item.increaseStr }} {{ item.increaseStr }}
@ -257,7 +258,9 @@ export default {
symbolDetail:{}, symbolDetail:{},
currentIcon: '', currentIcon: '',
filterCoin: "", filterCoin: "",
contractListFilter: [] contractListFilter: [],
price1:0,
intervalId:''
}; };
}, },
computed: { computed: {
@ -327,8 +330,7 @@ export default {
if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price
}) })
}); });
this.startWatchingPrice();
}, },
// //
mounted: function () { mounted: function () {
@ -337,6 +339,12 @@ export default {
}, 2000) }, 2000)
}, },
methods: { methods: {
startWatchingPrice(){
this.intervalId = setInterval(() => {
let newPrice = localStorage.getItem('price');
this.price1 = newPrice;
}, 10); //
},
ispopover1(item){ ispopover1(item){
this.activeSymbol=item; this.activeSymbol=item;
// this.$refs.popover.showPopper = false; // this.$refs.popover.showPopper = false;

Loading…
Cancel
Save