feat: contract account tab, full i18n, male avatar, PC home stretch

- Asset page: add Contract account row + tab, show num_lh balance
- Total Assets = Spot + Contract + Fiat
- All Chinese text eliminated (z-paging, loadmore, colorui, pages)
- Password/payword pages use image captcha instead of OTP
- Home page PC: full-width stretch layout
- Register captcha input type fix, invite code lock
This commit is contained in:
li
2026-04-05 13:05:27 +08:00
parent 4b2acdf0d8
commit 6b02df55ab
19 changed files with 245 additions and 514 deletions
+27 -36
View File
@@ -92,6 +92,17 @@
</view>
</view>
<!-- Contract 余额 -->
<view @click="current=3" class="accountRow" :style="'background-color:'+theme.fu_bg+';color:'+theme.text">
<view class="flex align-center justify-between">
<text class="font-28 bold-font">Contract</text>
<i class="cuIcon-right font-26 color-C3C3C3"></i>
</view>
<view class="margin-t-10">
<text class="font-38 numbold-font">{{ifcover?all.count_lh_usdt:'****'}} <text class="font-24 color-C3C3C3">USDT</text></text>
</view>
</view>
<!-- Fiat 余额 -->
<view @click="current=2" class="accountRow" :style="'background-color:'+theme.fu_bg+';color:'+theme.text">
<view class="flex align-center justify-between">
@@ -119,7 +130,7 @@
</view>
</view>
<!-- Spot / Fiat / 理财 子页面 -->
<!-- Spot / Fiat / Contract / Invest 子页面 -->
<view v-if="current==1||current==2||current==3||current==4" class="">
<view class="padding-w-30 height-90 flex align-center line-height-90">
<u-switch v-model="ifHideCoin" size="30" active-color="#2DD1AF"></u-switch>
@@ -167,7 +178,7 @@
data() {
return {
statusBar: uni.getSystemInfoSync().statusBarHeight,
tabList: ['总览', '现货','法币','理财'],
tabList: ['Overview', 'Spot','Fiat','Contract','Invest'],
current: 0,
userinfo: {},
@@ -239,6 +250,9 @@
case 4:
obj = that.qq
break;
case 5:
obj = that.all
break;
default:
obj = that.all
break;
@@ -276,13 +290,13 @@
break;
case 3:
if(that.ifHideCoin==true){
if(that.lh.lh_arr){
if(that.lh && that.lh.lh_arr){
obj = that.lh.lh_arr.filter((item)=>{
return item.num != 0
})
}
}else{
obj = that.lh.lh_arr
obj = (that.lh && that.lh.lh_arr) ? that.lh.lh_arr : []
}
break;
case 4:
@@ -317,13 +331,13 @@
this.tabList[0]=this.i18n.assets.index.title1
this.tabList[1]=this.i18n.assets.index.title2
this.tabList[2]=this.i18n.assets.index.title3
this.tabList[3]=this.i18n.licai.text1
this.tabList[3]='Contract'
this.tabList[4]=this.i18n.licai.text1
if(uni.getStorageSync('ifHideCoin')){
this.ifHideCoin = uni.getStorageSync('ifHideCoin')
}
this.getWallet()
this.getUserInfo()
this.calcProfit()
},
methods: {
formatNum(val) {
@@ -350,35 +364,8 @@
})
},
calcProfit() {
// 从资金流水计算盈亏
this.post('/wallet/index_detail', {
page: 1,
size: 200,
}).then(res => {
if (res.code == 1) {
let profit = 0
let pnl = 0
let items = res.data.data || res.data || []
items.forEach(item => {
let price = Number(item.price || 0)
let desc = (item.description || '').toLowerCase()
if (desc.indexOf('profit') !== -1 || desc.indexOf('收益') !== -1 || desc.indexOf('盈') !== -1) {
if (item.cart == 1) {
profit += price
} else {
profit -= price
}
}
if (item.cart == 1) {
pnl += price
} else {
pnl -= price
}
})
this.totalProfit = profit
this.totalPnl = pnl
}
})
// totalPnl 固定为 0,不作计算
// totalProfit 由 getWallet 从后端同步
},
getWallet(){
this.post('/wallet/wallet_index').then((res) => {
@@ -389,6 +376,10 @@
this.fb = res.data.fb
this.lh = res.data.lh
this.qq = res.data.qq
// Account Total Profit 与合约交易利润实时同步
this.totalProfit = res.data.total_profit || 0
// Account Total P&L 固定为 0
this.totalPnl = 0
}
})
},
@@ -399,7 +390,7 @@
})
},
tabsChange(index) {
if(index==3){
if(index==4){
uni.navigateTo({
url:'/pages/index/money/index'
})
+58 -27
View File
@@ -99,11 +99,11 @@
zhuanghu: [],
leftObj: {
id: 1,
name: '现货账户'
name: 'Spot'
},
rightObj: {
id: 1,
name: '现货账户'
id: 3,
name: 'Contract'
},
currList: [],
@@ -126,34 +126,34 @@
if(e.id){
if(e.id==1||e.id==0){
this.leftObj.id = 1
this.leftObj.name = this.i18n.assets.transfer.xh
this.rightObj.id = 2
this.rightObj.name = this.i18n.assets.transfer.fb
this.leftObj.name = 'Spot'
this.rightObj.id = 3
this.rightObj.name = 'Contract'
}
if(e.id==2){
this.leftObj.id = e.id
this.leftObj.name = this.i18n.assets.transfer.fb
this.leftObj.name = 'Fiat'
this.rightObj.id = 1
this.rightObj.name = this.i18n.assets.transfer.xh
this.rightObj.name = 'Spot'
}
if(e.id==3){
this.leftObj.id = e.id
this.leftObj.name = this.i18n.assets.transfer.lh
this.leftObj.name = 'Contract'
this.rightObj.id = 1
this.rightObj.name = this.i18n.assets.transfer.xh
this.rightObj.name = 'Spot'
}
if(e.id==4){
this.leftObj.id = e.id
this.leftObj.name = this.i18n.assets.transfer.qq
this.leftObj.name = 'Quantitative'
this.rightObj.id = 1
this.rightObj.name = this.i18n.assets.transfer.xh
this.rightObj.name = 'Spot'
}
}
if(e.rightid){
this.leftObj.id = 1
this.leftObj.name = this.i18n.assets.transfer.xh
this.rightObj.id = e.rightid
this.rightObj.name = this.i18n.assets.transfer.qq
this.leftObj.name = 'Spot'
this.rightObj.id = Number(e.rightid)
this.rightObj.name = this.getAccountName(Number(e.rightid))
}
},
onShow() {
@@ -207,19 +207,33 @@
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 (合约)'
// Spot→Contract:输入BTC/ETH数量,显示USDT等值
return (this.inputNum * rate).toFixed(2) + ' USDT (Contract)'
} else {
// 合约→现货:输入USDT数量,显示BTC/ETH等值
return (this.inputNum / rate).toFixed(8) + ' ' + this.selectCurr.name + ' (现货)'
// Contract→Spot:输入USDT数量,显示BTC/ETH等值
return (this.inputNum / rate).toFixed(8) + ' ' + this.selectCurr.name + ' (Spot)'
}
},
// 根据来源账户过滤可选货币
filteredCurrList() {
if (!this.currList || this.currList.length === 0) return []
if (this.leftObj.id == 3) {
// 合约账户转出 → 只显示USDT
return this.currList.filter(c => {
return c.curr_id == 1 || (c.name || '').toUpperCase() === 'USDT'
})
}
// 现货账户转出 → 只显示 BTC / ETH / USDT
return this.currList.filter(c => {
return ['BTC', 'ETH', 'USDT'].includes((c.name || '').toUpperCase())
})
},
count_obj() {
let obj = [];
var that = this
switch (this.showPoup) {
case 'currency':
obj = that.currList
obj = that.filteredCurrList
break;
case 'accountL':
obj = that.zhuanghu.filter((item) => {
@@ -232,13 +246,18 @@
})
break;
default:
obj = that.currList
obj = that.filteredCurrList
break;
}
return obj
},
},
methods: {
// 账户ID → 英文名称映射
getAccountName(id) {
const map = {1:'Spot', 2:'Fiat', 3:'Contract', 4:'Quantitative'}
return map[id] || 'Account'
},
get_transfer() {
this.post('/wallet/get_transfer').then((res) => {
console.log('划转内容', res)
@@ -247,14 +266,19 @@
// 确保 BTC 和 ETH 始终出现在币种列表中
let names = currData.map(c => (c.name || '').toUpperCase())
if (!names.includes('BTC')) {
currData.push({ curr_id: 'btc_static', name: 'BTC', num: 0, num_fb: 0, num_lh: 0, num_qq: 0 })
currData.push({ curr_id: 3, name: 'BTC', num: 0, num_fb: 0, num_lh: 0, num_qq: 0 })
}
if (!names.includes('ETH')) {
currData.push({ curr_id: 'eth_static', name: 'ETH', num: 0, num_fb: 0, num_lh: 0, num_qq: 0 })
currData.push({ curr_id: 4, name: 'ETH', num: 0, num_fb: 0, num_lh: 0, num_qq: 0 })
}
this.currList = currData
this.transfer_text = res.data.transfer_text
this.zhuanghu = res.data.zhuanghu
// 统一将账户名称英文化
const nameMap = {1:'Spot', 2:'Fiat', 3:'Contract', 4:'Quantitative'}
this.zhuanghu = (res.data.zhuanghu || []).map(item => ({
...item,
name: nameMap[item.id] || item.name
}))
if (this.selectIndex) {
this.selectCurr = this.currList[this.selectIndex]
}
@@ -328,16 +352,23 @@
},
select(index) {
if (this.showPoup == 'accountL') {
this.leftObj = this.count_obj[index]
let item = this.count_obj[index]
this.leftObj = { id: item.id, name: this.getAccountName(item.id) }
// 切换来源账户后清空已选币种
this.selectCurr = ''
this.selectIndex = ''
this.inputNum = ''
console.log(this.leftObj.name)
}
if (this.showPoup == 'accountR') {
this.rightObj = this.count_obj[index]
let item = this.count_obj[index]
this.rightObj = { id: item.id, name: this.getAccountName(item.id) }
this.inputNum = ''
console.log(this.rightObj.name)
}
if (this.showPoup == 'currency') {
this.selectIndex = index
this.selectCurr = this.currList[index]
this.selectCurr = this.filteredCurrList[index]
this.inputNum = ''
console.log(this.selectCurr)
}