Browse Source

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

master
liaoxinyu 11 months ago
parent
commit
66a9abc9f0
  1. 6
      src/views/contract/exchange-store.vue
  2. 2
      src/views/contract/handicap.vue
  3. 16
      src/views/contract/index.vue

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

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

2
src/views/contract/handicap.vue

@ -206,6 +206,7 @@ export default {
// }
this.newPriceObj.price = msg.close;
this.$emit("input", this.newPriceObj);
localStorage.setItem("price",this.newPriceObj.price)
// console.log(this.newPriceObj.price, 'this.newPriceObj.price-----')
// const closeStr = msg.close.toString();
// this.newPriceObj.price = this.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4);
@ -228,6 +229,7 @@ export default {
this.newPriceObj = this.tradeList[0];
// }
this.$emit("input", this.newPriceObj);
localStorage.setItem("price",this.newPriceObj.price)
});
},
//

16
src/views/contract/index.vue

@ -47,7 +47,7 @@
<div style="font-weight: 500;color: #000;">{{ item.symbol }}/{{ parent.coin_name }}</div>
</td>
<td class="w-7/24 " :class="item.increase < 0 ? 'decreace' : 'increace'" style="font-weight: bold;">
{{ item.price }}
{{item.symbol == activeSymbol ? price1 : item.price}}
</td>
<td class="w-7/24" :class="item.increase < 0 ? 'decreace' : 'increace'" style="font-weight: bold;">
{{ item.increaseStr }}
@ -60,7 +60,8 @@
</el-popover>
</div>
<div class="price border-right" style="padding: 0px 30px;" :class="{ decreace: activeContract.increase < 0, increace: activeContract.increase >= 0 }">
<div class="current">{{ activeContract.price }}$</div>
<!-- <div class="current">{{ activeContract.price }}$</div> -->
<div class="current">{{price1}}$</div>
<div class="zf">{{ activeContract.increaseStr }}</div>
</div>
<!-- 币种价值数据 -->
@ -198,7 +199,9 @@ export default {
symbolDetail:{},
currentIcon: '',
imge:[],
Liste:[]
Liste:[],
price1:0,
intervalId:''
};
},
computed: {
@ -245,6 +248,7 @@ export default {
if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price
})
});
this.startWatchingPrice();
},
//
mounted: function () {
@ -254,6 +258,12 @@ export default {
}, 2000)
},
methods: {
startWatchingPrice(){
this.intervalId = setInterval(() => {
let newPrice = localStorage.getItem('price');
this.price1 = newPrice;
}, 10); //
},
ispopover1(item){
this.activeSymbol=item;
this.getMarketList();

Loading…
Cancel
Save