feat: 转账页面合约账户支持 + 实时汇率显示

1. 合约账户作为转账选项(原FTKbot改为Contract)
2. BTC/ETH↔合约时显示USDT等值转换提示
3. 合约→现货时显示合约USDT可用余额
This commit is contained in:
li
2026-03-31 10:46:20 +08:00
parent ba0cead3af
commit 86d0f9da49
2 changed files with 43 additions and 6 deletions
+42 -5
View File
@@ -65,7 +65,11 @@
<view v-if="selectCurr.name" class="flex align-center">
<text class="font-26">{{i18n.assets.transfer.usable}}</text>
<u-count-to fontSize="26" :color="theme.text" :endVal="available_num" :decimals="4" :duration="400"></u-count-to>
<text class="font-26">{{selectCurr.name}}</text>
<text class="font-26">{{showConvertUnit}}</text>
</view>
<!-- 合约转换提示 -->
<view v-if="needConversion && inputNum > 0" class="margin-t-10 padding-w-22">
<text class="font-24 color-00C481"> {{convertedDisplay}}</text>
</view>
<!-- <p class="font-26 color-333333">可用 {{available_num}} USDT</p> -->
<view class="borderBox" :style="'background-color: '+theme.fu_bg">
@@ -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
+1 -1
View File
@@ -789,7 +789,7 @@ module.exports = {
loading:'Loading',
xh:'Spot',
fb:'Fiat',
lh:'FTKbot',
lh:'Contract',
confirm:'Confirm',
cancel:'Cancel',
},