Browse Source

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

master
liaoxinyu 11 months ago
parent
commit
12246e52dd
  1. 7
      src/views/contract/exchange-store.vue
  2. 14
      src/views/contract/handicap.vue
  3. 14
      src/views/contract/index.vue

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

@ -97,6 +97,8 @@
class="form-control"
v-model="margin"
:placeholder="tips"
@input="inputEnter"
title=""
/>
<!-- <div class="input-group-append">
<span class="input-group-text">{{ $t("contract.e2") }}</span>
@ -344,6 +346,11 @@ export default {
}
},
methods: {
inputEnter() {
this.margin = this.margin
.replace(/[^\d.]/g, "") //
.replace(/^(\d*\.?\d{0,2}).*$/, "$1"); //
},
//
contractAccount(boo) {
if (!this.isLogin) return;

14
src/views/contract/handicap.vue

@ -199,8 +199,9 @@ export default {
this.linkSocket();
}
bus.$on('collapse', msg => {
// this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
// this.newPriceObj.price = msg.close;
this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
this.newPriceObj.price = msg.close;
localStorage.setItem("price",this.newPriceObj.price)
// this.$emit("input", this.newPriceObj);
// console.log(this.newPriceObj.price, 'this.newPriceObj.price-----')
});
@ -217,10 +218,11 @@ export default {
this.sellList = res.swapSellList;
this.buyList = res.swapBuyList;
this.tradeList = res.swapTradeList;
if(this.tradeList.length>0){
// if(this.tradeList.length>0){
this.newPriceObj = this.tradeList[0];
}
// }
this.$emit("input", this.newPriceObj);
localStorage.setItem("price",this.newPriceObj.price)
});
},
//
@ -272,8 +274,8 @@ export default {
// console.log('if (sub == this.msg.trade)', this.msg.trade)
this.tradeList.unshift(data);
this.tradeList.pop();
this.newPriceObj = data;
this.$emit("input", this.newPriceObj);
// this.newPriceObj = data;
// this.$emit("input", this.newPriceObj);
} else if (type == "ping" ||cmd == "ping") {
this.ws.send({
cmd: "pong"

14
src/views/contract/index.vue

@ -59,7 +59,7 @@
class="w-7/24 "
:class="item.increase < 0 ? 'decreace' : 'increace'"
>
{{ item.price }}
{{item.symbol == activeSymbol ? price1 : item.price}}
</td>
<td
class="w-7/24"
@ -81,7 +81,8 @@
increace: activeContract.increase >= 0
}"
>
<span class="current">{{ activeContract.price }}$</span>
<!-- <span class="current">{{ activeContract.price }}$</span> -->
<span class="current">{{price1}}$</span>
&nbsp;
<span class="zf">{{ activeContract.increaseStr }}</span>
</div>
@ -231,6 +232,8 @@ export default {
contractOpen: false,
contractAgreement: {},
symbolDetail:{},
price1:0,
intervalId:''
};
},
computed: {
@ -277,6 +280,7 @@ export default {
if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price
})
});
this.startWatchingPrice();
},
//
mounted: function () {
@ -286,6 +290,12 @@ export default {
}, 2000)
},
methods: {
startWatchingPrice(){
this.intervalId = setInterval(() => {
let newPrice = localStorage.getItem('price');
this.price1 = newPrice;
}, 10); //
},
ispopover1(item){
this.activeSymbol=item;
this.$refs.popover.showPopper = false;

Loading…
Cancel
Save