Browse Source

修改合约保证金为2位小数点

master
liaoxinyu 1 year ago
parent
commit
f0b46e5bfb
  1. 12
      pages/base/index.vue
  2. 14
      pages/exchange/open-position.vue

12
pages/base/index.vue

@ -94,12 +94,12 @@ export default {
// icon: "static/img/base_qukuai_0.png", // icon: "static/img/base_qukuai_0.png",
// activeIcon: "static/img/base_qukuai_1.png", // activeIcon: "static/img/base_qukuai_1.png",
// }, // },
{ // {
label: this.$t("purchase.a5"), // label: this.$t("purchase.a5"),
tel: "purchase", // tel: "purchase",
icon: "static/img/base_qukuai_0.png", // icon: "static/img/base_qukuai_0.png",
activeIcon: "static/img/base_qukuai_1.png", // activeIcon: "static/img/base_qukuai_1.png",
}, // },
{ {
label: this.$t("base.d2"), label: this.$t("base.d2"),
tel: "mine", tel: "mine",

14
pages/exchange/open-position.vue

@ -173,7 +173,7 @@
</v-input> --> </v-input> -->
<v-input <v-input
v-model="margin" v-model="margin"
@input="sliderActive=-1" @input="inputEnter"
:placeholder="$t('exchange.c5')" style="border: 1px solid #202020;"> :placeholder="$t('exchange.c5')" style="border: 1px solid #202020;">
<template #right> <template #right>
<view class="color-light fn-bold" style="margin-right: 10px;"> <view class="color-light fn-bold" style="margin-right: 10px;">
@ -1074,7 +1074,7 @@ export default {
watch: { watch: {
maxNum(n) { maxNum(n) {
this.form.amount = Math.round((this.maxNum * this.sliderActive1) / 100); this.form.amount = Math.round((this.maxNum * this.sliderActive1) / 100);
this.margin = (this.form.amount / this.form.lever_rate).toFixed(5) this.margin = (this.form.amount / this.form.lever_rate).toFixed(2)
}, },
symbol() { symbol() {
this.$emit("symbols", this.symbol) this.$emit("symbols", this.symbol)
@ -1151,6 +1151,14 @@ export default {
} }
}, },
methods: { methods: {
inputEnter(e){
this.$nextTick(()=> {
this.margin = e
.replace(/[^\d.]/g, "") //
.replace(/^(\d*\.?\d{0,2}).*$/, "$1"); //
this.sliderActive=-1
})
},
onRefresh() { onRefresh() {
if (this.refreshing) return; if (this.refreshing) return;
this.refreshing = true; this.refreshing = true;
@ -1574,7 +1582,7 @@ export default {
this.form.amount = Math.round((this.maxNum * n) / 100); this.form.amount = Math.round((this.maxNum * n) / 100);
this.sliderActive = i this.sliderActive = i
this.sliderActive1 = n this.sliderActive1 = n
this.margin = (this.form.amount / this.form.lever_rate).toFixed(5) this.margin = (this.form.amount / this.form.lever_rate).toFixed(2)
}, },
pingChange(n, i) { pingChange(n, i) {
// console.log(n) // console.log(n)

Loading…
Cancel
Save