diff --git a/pages/index/recharge.vue b/pages/index/recharge.vue index c740759..3381e2b 100644 --- a/pages/index/recharge.vue +++ b/pages/index/recharge.vue @@ -49,7 +49,7 @@ - Select Coin + {{i18n.recharge.text1}} {{item.name}} @@ -57,13 +57,13 @@ - - + {{i18n.recharge.text2}} - {{item.lian}} @@ -152,7 +152,7 @@ {{i18n.appeal.text1}} - {{i18n.appeal.text1}} + {{i18n.appeal.text1}} @@ -243,6 +243,28 @@ computed: { i18n() { return this.$t('message'); + }, + // 根据当前选中币种过滤链列表 + // BTC: 只保留名称含 "BTC" 的链(或空) + // ETH: 过滤掉 TRC-20,只保留 ERC-20 + // USDT: 保留全部 + filteredDetail() { + if (!this.detail || this.detail.length === 0) return [] + const name = (this.curr || '').toUpperCase() + if (name === 'BTC') { + // BTC 不需要链选择,只取第一条直接显示地址 + return this.detail.slice(0, 1) + } + if (name === 'ETH') { + // ETH 只保留 ERC-20,过滤掉 TRC-20 + const erc = this.detail.filter(item => { + const lian = (item.lian || '').toUpperCase() + return !lian.includes('TRC') + }) + return erc.length > 0 ? erc : this.detail.slice(0, 1) + } + // USDT 及其他:保留全部 + return this.detail } }, onLoad(e) { @@ -321,8 +343,17 @@ this.bankList = res.data.bank this.detail = res.data.curr this.lian = 0 - this.image = res.data.curr[0].qrcode - this.zhuan_address = res.data.curr[0].address + // 根据当前币种过滤后取第一条链的地址显示 + const name = (this.curr || '').toUpperCase() + let firstChain = res.data.curr[0] + if (name === 'ETH' && res.data.curr.length > 0) { + const erc = res.data.curr.filter(item => { + return !(item.lian || '').toUpperCase().includes('TRC') + }) + if (erc.length > 0) firstChain = erc[0] + } + this.image = firstChain ? firstChain.qrcode : '' + this.zhuan_address = firstChain ? firstChain.address : '' } }) }, @@ -354,6 +385,21 @@ this.currid = item.id this.voucher_image = '' this.voucher_image_up = '' + this.lian = 0 + // 静态条目(btc_static / eth_static)没有真实 API id + // 不调用 getdetails,改为构造占位链数据 + if (item.id === 'btc_static') { + this.detail = [{ lian: 'BTC', qrcode: '', address: '' }] + this.image = '' + this.zhuan_address = '' + return + } + if (item.id === 'eth_static') { + this.detail = [{ lian: 'ERC-20', qrcode: '', address: '' }] + this.image = '' + this.zhuan_address = '' + return + } this.getdetails(this.currid) }, changecurr(item) {