From 0bd0c70c91a36516158be3efad69dded2eaedd62 Mon Sep 17 00:00:00 2001 From: liaoxinyu Date: Thu, 13 Mar 2025 16:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E7=BA=A6=E4=BF=9D?= =?UTF-8?q?=E8=AF=81=E9=87=91=E4=B8=BA2=E4=BD=8D=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E7=82=B9=E3=80=81=E4=BB=A5=E5=8F=8A=E5=90=88=E7=BA=A6=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E9=97=AE=E9=A2=98=E5=92=8C=E7=94=B3=E8=B4=AD=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/class/date.js | 3 ++- src/views/contract/exchange-store.vue | 22 ++++++++++++++++++---- src/views/contract/handicap.vue | 6 ++++-- src/views/contract/index.vue | 16 +++++++++++++--- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/utils/class/date.js b/src/utils/class/date.js index 72b7ef7..32f0970 100644 --- a/src/utils/class/date.js +++ b/src/utils/class/date.js @@ -236,7 +236,8 @@ function convertTo12HourFormat(dateTimeStr) { // hours = String(hours % 12 || 12).padStart(2, '0'); // 0转换为12 // 格式化输出 - return `${day}-${month}-${year} ${hours}:${minutes}:${seconds} ${ampm}`; + return `${day}-${month}-${year}`; + // return `${day}-${month}-${year} ${hours}:${minutes}:${seconds} ${ampm}`; } /** diff --git a/src/views/contract/exchange-store.vue b/src/views/contract/exchange-store.vue index f28be0d..9cd329c 100644 --- a/src/views/contract/exchange-store.vue +++ b/src/views/contract/exchange-store.vue @@ -101,6 +101,7 @@ class="form-control" v-model="marginBuy" :placeholder="tips" + @input="inputEnter(false)" title="" /> +
{{ maxNum }}
{{ $t("contract.e1") }}
@@ -518,7 +521,7 @@ export default { // console.info(this.form.lever_rate) // console.info(this.margin) if (!this.form.lever_rate || !this.marginBuy) return 0; - let p=this.marginBuy*this.form.lever_rate; + let p = Math.round(this.marginBuy*this.form.lever_rate); this.buyform.amount=p; return p @@ -527,13 +530,24 @@ export default { // console.info(this.form.lever_rate) // console.info(this.margin) if (!this.form.lever_rate || !this.marginSell) return 0; - let p=this.marginSell*this.form.lever_rate; + let p = Math.round(this.marginSell*this.form.lever_rate); this.sellform.amount=p; return p } }, 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) { if (!this.isLogin) return; @@ -548,7 +562,7 @@ export default { // if (!this.form.lever_rate) { // this.form.lever_rate = res.lever_rate; // } - if (this.form.lever_rate && !boo) { + if (this.form.lever_rate) { this.openNum(); } }); diff --git a/src/views/contract/handicap.vue b/src/views/contract/handicap.vue index 53899a0..6657dcf 100644 --- a/src/views/contract/handicap.vue +++ b/src/views/contract/handicap.vue @@ -199,6 +199,7 @@ export default { bus.$on('collapse', msg => { this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); this.$emit("input", this.newPriceObj); + localStorage.setItem("price",this.newPriceObj.price) }); }, // 获取盘口 @@ -215,7 +216,8 @@ export default { this.tradeList = res.swapTradeList; this.newPriceObj = this.tradeList[0]; this.$emit("input", this.newPriceObj); - this.$store.commit('SET_PRICE', this.newPriceObj.price); + // this.$store.commit('SET_PRICE', this.newPriceObj.price); + localStorage.setItem("price",this.newPriceObj.price) }); }, // 计算深度 @@ -268,7 +270,7 @@ export default { this.tradeList.pop(); // this.newPriceObj = data; // this.$emit("input", this.newPriceObj); - this.$store.commit('SET_PRICE', this.newPriceObj.price); + // this.$store.commit('SET_PRICE', this.newPriceObj.price); } else if (type == "ping" ||cmd == "ping") { this.ws.send({ cmd: "pong" diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index f76e68a..18dac5f 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -20,7 +20,8 @@ decreace2: activeContract.increase < 0, increase: activeContract.increase >= 0 }"> - {{ activeContract.price }} + + {{price1}}