From 86d0f9da4998075ec730ab54cec2066bb4357dcc Mon Sep 17 00:00:00 2001 From: li Date: Tue, 31 Mar 2026 10:46:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BD=AC=E8=B4=A6=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=90=88=E7=BA=A6=E8=B4=A6=E6=88=B7=E6=94=AF=E6=8C=81=20+=20?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E6=B1=87=E7=8E=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 合约账户作为转账选项(原FTKbot改为Contract) 2. BTC/ETH↔合约时显示USDT等值转换提示 3. 合约→现货时显示合约USDT可用余额 --- pages/asset/transfer.vue | 47 +++++++++++++++++++++++++++++++++++----- static/locales/en-US.js | 2 +- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/pages/asset/transfer.vue b/pages/asset/transfer.vue index 5221626..0d6764e 100644 --- a/pages/asset/transfer.vue +++ b/pages/asset/transfer.vue @@ -65,7 +65,11 @@ {{i18n.assets.transfer.usable}} - {{selectCurr.name}} + {{showConvertUnit}} + + + + ≈ {{convertedDisplay}} @@ -164,19 +168,52 @@ i18n() { return this.$t('message'); }, + // 是否涉及合约账户且非USDT(需要汇率转换) + needConversion() { + if (!this.selectCurr || !this.selectCurr.name) return false + const isContract = this.leftObj.id == 3 || this.rightObj.id == 3 + const isUSDT = this.selectCurr.curr_id == 1 || (this.selectCurr.name || '').toUpperCase() === 'USDT' + return isContract && !isUSDT + }, + // 可用余额 — 合约→现货时显示合约USDT余额 available_num() { + if (this.needConversion && this.leftObj.id == 3) { + // 从合约转出:显示合约USDT余额 + let usdtItem = this.currList.find(c => c.curr_id == 1 || (c.name || '').toUpperCase() === 'USDT') + return usdtItem ? (usdtItem.num_lh || 0) : 0 + } if(this.leftObj.id==1){ - return this.selectCurr.num || 0 //现货数量 + return this.selectCurr.num || 0 }else if(this.leftObj.id==2){ - return this.selectCurr.num_fb || 0 //现货数量 + return this.selectCurr.num_fb || 0 }else if(this.leftObj.id==3){ - return this.selectCurr.num_lh || 0 //现货数量 + return this.selectCurr.num_lh || 0 }else if(this.leftObj.id==4){ - return this.selectCurr.num_qq || 0 //现货数量 + return this.selectCurr.num_qq || 0 }else{ return 0; } }, + // 显示可用余额的单位 + showConvertUnit() { + if (this.needConversion && this.leftObj.id == 3) { + return 'USDT' + } + return this.selectCurr.name || '' + }, + // 转换后显示 + convertedDisplay() { + if (!this.needConversion || !this.inputNum || this.inputNum <= 0) return '' + let rate = parseFloat(this.selectCurr.exchange) || 0 + if (rate <= 0) return '' + if (this.rightObj.id == 3) { + // 现货→合约:输入BTC/ETH数量,显示USDT等值 + return (this.inputNum * rate).toFixed(2) + ' USDT (合约)' + } else { + // 合约→现货:输入USDT数量,显示BTC/ETH等值 + return (this.inputNum / rate).toFixed(8) + ' ' + this.selectCurr.name + ' (现货)' + } + }, count_obj() { let obj = []; var that = this diff --git a/static/locales/en-US.js b/static/locales/en-US.js index 48feca5..66d94ad 100644 --- a/static/locales/en-US.js +++ b/static/locales/en-US.js @@ -789,7 +789,7 @@ module.exports = { loading:'Loading', xh:'Spot', fb:'Fiat', - lh:'FTKbot', + lh:'Contract', confirm:'Confirm', cancel:'Cancel', },