From 035ee36bc514af2f94f9bb8d6cf62652ad6c1e9b Mon Sep 17 00:00:00 2001 From: liaoxinyu Date: Thu, 13 Mar 2025 14:09:14 +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=E5=8F=AA=E8=83=BD=E8=BE=93=E5=85=A52?= =?UTF-8?q?=E4=BD=8D=E5=B0=8F=E6=95=B0=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/base/mine.vue | 20 ++++++++++++++++---- pages/exchange/open-position.vue | 21 ++++++++++++++++++--- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/pages/base/mine.vue b/pages/base/mine.vue index c19f201..100a248 100644 --- a/pages/base/mine.vue +++ b/pages/base/mine.vue @@ -40,8 +40,10 @@ --> - {{filterMoney(account.total_assets_btc, true)}} - ≈{{ filterMoney(account.total_assets_usd, false) }} USDT + + {{price1(account.total_assets_btc, 8)}} + ≈ ${{ price1(account.total_assets_usd, 2) }} @@ -187,7 +189,8 @@ - ≈{{ omitTo(account.funds_account_usd,2) }} + + ≈{{ price1(account.funds_account_usd,2) }} {{ $t("base.d6") }}(USDT) @@ -298,7 +301,8 @@ - {{ filterMoney(account.contract_account_usd)}}{{ account.symbol }} + + {{ price1(account.contract_account_usd,2)}}{{ account.symbol }} @@ -420,6 +424,14 @@ export default { } }, methods: { + price1(item,index){ + if (item) { + let price = item.toFixed(index).toString(); + let parts = price.split("."); + parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); + return parts.join("."); + } + }, tohome(){ this._router.push("/pages/base/index"); // this.tabChange('home') diff --git a/pages/exchange/open-position.vue b/pages/exchange/open-position.vue index 7b5ad8a..f02ad9c 100644 --- a/pages/exchange/open-position.vue +++ b/pages/exchange/open-position.vue @@ -173,7 +173,7 @@ --> + @@ -1074,7 +1081,7 @@ export default { watch: { maxNum(n) { 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() { this.$emit("symbols", this.symbol) @@ -1151,6 +1158,14 @@ export default { } }, methods: { + inputEnter(e){ + this.$nextTick(()=> { + this.margin = e + .replace(/[^\d.]/g, "") // 移除非数字、非小数点的字符 + .replace(/^(\d*\.?\d{0,2}).*$/, "$1"); // 限制最多两位小数 + this.sliderActive=-1 + }) + }, onRefresh() { if (this.refreshing) return; this.refreshing = true; @@ -1574,7 +1589,7 @@ export default { this.form.amount = Math.round((this.maxNum * n) / 100); this.sliderActive = i 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) { // console.log(n)