feat: 存款/提款/转账页增加BTC和ETH币种选项

- 存款页: 新增Select Coin选择器(USDT/BTC/ETH), 删除Transaction ID(hash)字段
- 提款页: 新增Select Coin选择器(USDT/BTC/ETH)
- 转账页: currList自动补入BTC/ETH确保始终可选
- 三个页面均从API获取币种列表, 缺失BTC/ETH时自动注入
This commit is contained in:
li
2026-03-30 15:13:15 +08:00
parent f36c2fec89
commit 551635da1a
3 changed files with 1423 additions and 0 deletions
+337
View File
@@ -0,0 +1,337 @@
<template>
<view :style="'background-color: '+theme.bg+';color: '+theme.text" style="height: 100vh;">
<myNav :title="i18n.assets.transfer.title" :isRight="true" righturl="/static/imgs/asset/zhuanhuanjilu@2x.png"
@Jump="router.push('/pages/asset/record')"></myNav>
<view class="padding-w-30">
<view class="borderBox" :style="'background-color: '+theme.fu_bg">
<view class="height-260 padding-22 flex align-center justify-between">
<view class="flex-1">
<view @click="showPoup='accountL'"
:class="[animationName?'animation-slide-bottom':'']"
class="width-100b height-110 flex align-center">
<i class="cuIcon-title color-00C481"></i>
<text class="font-32 color-D1D3D8 margin-w-10">{{i18n.assets.transfer.from}}</text>
<text class="font-32">{{leftObj.name}}</text>
</view>
<view class="width-100b height-2 margin-c-4" style="background-color: #D1D3D8;"> </view>
<view @click="showPoup='accountR'"
:class="[animationName?'animation-slide-top':'']"
class="width-100b height-110 flex align-center">
<i class="cuIcon-title color-FF4040"></i>
<text class="font-32 color-D1D3D8 margin-w-10">{{i18n.assets.transfer.to}}</text>
<text class="font-32">{{rightObj.name}}</text>
</view>
</view>
<image @click="exchange" :class="animationName" class="width-62 height-62 margin-l-30"
src="/static/imgs/asset/qiehuan@2x.png" mode=""></image>
</view>
</view>
<view class="borderBox" :style="'background-color: '+theme.fu_bg">
<view @click="showPoup='currency',currType=true" class="padding-22">
<view class="height-65 flex align-center">
<text class="font-32">{{i18n.assets.transfer.curr}}</text>
</view>
<view class="height-65 flex align-center">
<text v-if="selectCurr.curr_id != undefined"
class="font-32 numbold-font">{{selectCurr.name}}</text>
<text v-else class="font-32 color-0165EE">{{i18n.assets.transfer.subtit}}</text>
</view>
</view>
</view>
<view class="borderBox" :style="'background-color: '+theme.fu_bg">
<view class="padding-22">
<view class="height-65 flex align-center">
<text class="font-32">{{i18n.assets.transfer.num}}</text>
</view>
<view class="height-65 flex align-center justify-between">
<input class="height-65 font-26 numbold-font" type="number" v-model="inputNum"
:placeholder="i18n.assets.transfer.inputNum" />
<view class="height-65 line-height-65">
<text @click="allIn" class="font-26 bold-font color-0165EE">{{i18n.assets.transfer.all}}</text>
</view>
</view>
</view>
</view>
<view class="borderBox" :style="'background-color: '+theme.fu_bg">
<view class="padding-22">
<view class="height-65 flex align-center justify-between">
<text class="font-30">{{i18n.assets.transfer.pay_pwd}}</text>
<input class="height-65 font-30 numbold-font text-right" type="text" v-model="pay_pwd" password
:placeholder="i18n.assets.transfer.inputPWD" />
</view>
</view>
</view>
<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>
</view>
<!-- <p class="font-26 color-333333">可用 {{available_num}} USDT</p> -->
<view class="borderBox" :style="'background-color: '+theme.fu_bg">
<view class="padding-22" v-html="transfer_text">
</view>
</view>
<view class="width-600 margin-50-auto">
<button @click="transfer" class="cu-btn loginBtn">{{i18n.assets.transfer.sure}}</button>
</view>
</view>
<u-picker @confirm="select" v-model="currType" mode="selector" :range="count_obj" range-key="name"
:confirm-text="i18n.assets.transfer.confirm" :cancel-text="i18n.assets.transfer.cancel"></u-picker>
</view>
</template>
<script>
export default {
data() {
return {
inputNum: '',
pay_pwd: '',
zhuanghu: [],
leftObj: {
id: 1,
name: '现货账户'
},
rightObj: {
id: 1,
name: '现货账户'
},
currList: [],
selectCurr: '',
selectIndex: '',
showPoup: '',
currType: false,
transfer_text: '',
animationName: '',
flag: true,
theme: '',
}
},
onLoad(e) {
console.log(e)
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
}
if(e.id==2){
this.leftObj.id = e.id
this.leftObj.name = this.i18n.assets.transfer.fb
this.rightObj.id = 1
this.rightObj.name = this.i18n.assets.transfer.xh
}
if(e.id==3){
this.leftObj.id = e.id
this.leftObj.name = this.i18n.assets.transfer.lh
this.rightObj.id = 1
this.rightObj.name = this.i18n.assets.transfer.xh
}
if(e.id==4){
this.leftObj.id = e.id
this.leftObj.name = this.i18n.assets.transfer.qq
this.rightObj.id = 1
this.rightObj.name = this.i18n.assets.transfer.xh
}
}
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
}
},
onShow() {
if (uni.getStorageSync("theme") == "dark") {
this.theme = this.$store.state.darkTheme
} else {
this.theme = this.$store.state.lightTheme
}
this.get_transfer()
},
computed: {
i18n() {
return this.$t('message');
},
available_num() {
if(this.leftObj.id==1){
return this.selectCurr.num || 0 //现货数量
}else if(this.leftObj.id==2){
return this.selectCurr.num_fb || 0 //现货数量
}else if(this.leftObj.id==3){
return this.selectCurr.num_lh || 0 //现货数量
}else if(this.leftObj.id==4){
return this.selectCurr.num_qq || 0 //现货数量
}else{
return 0;
}
},
count_obj() {
let obj = [];
var that = this
switch (this.showPoup) {
case 'currency':
obj = that.currList
break;
case 'accountL':
obj = that.zhuanghu.filter((item) => {
return item.id != that.rightObj.id&&item.id != that.leftObj.id
})
break;
case 'accountR':
obj = that.zhuanghu.filter((item) => {
return item.id != that.leftObj.id&&item.id != that.rightObj.id
})
break;
default:
obj = that.currList
break;
}
return obj
},
},
methods: {
get_transfer() {
this.post('/wallet/get_transfer').then((res) => {
console.log('划转内容', res)
if (res.code == 1) {
let currData = res.data.curr || []
// 确保 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 })
}
if (!names.includes('ETH')) {
currData.push({ curr_id: 'eth_static', 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
if (this.selectIndex) {
this.selectCurr = this.currList[this.selectIndex]
}
}
})
},
allIn() {
if (this.selectCurr.curr_id != undefined) {
this.inputNum = this.available_num
} else {
this.tos(this.i18n.assets.transfer.p0)
}
},
// 划转
transfer() {
if (!this.flag) return
console.log(this.selectCurr.curr_id)
if (this.selectCurr.curr_id == undefined) {
this.tos(this.i18n.assets.transfer.p0)
return
}
if (this.inputNum == '') {
this.tos(this.i18n.assets.transfer.inputNum)
return
}
if (Number(this.inputNum) > Number(this.available_num)) {
this.tos(this.i18n.assets.transfer.maxNum + this.available_num)
return
}
if (this.pay_pwd == '') {
this.tos(this.i18n.assets.transfer.inputPWD)
return
}
uni.showLoading({
title: this.i18n.assets.transfer.loading,
mask:true
})
this.flag = false
this.post('/wallet/transfer_sub', {
left_id: this.leftObj.id,
right_id: this.rightObj.id,
curr_id: this.selectCurr.curr_id,
num: this.inputNum,
pay_pwd: this.pay_pwd,
}).then((res) => {
console.log('划转提交', res)
this.flag = true
uni.hideLoading()
if (res.code == 1) {
this.tos(res.msg)
this.pay_pwd = ''
this.inputNum = ''
setTimeout(() => {
uni.navigateTo({
url: '/pages/asset/record'
})
}, 500)
}
})
},
exchange() {
if (this.animationName) return
this.animationName = 'XZ180'
this.inputNum = ''
let temp = this.leftObj
this.leftObj = this.rightObj
this.rightObj = temp
setTimeout(() => {
this.animationName = ''
}, 500)
},
select(index) {
if (this.showPoup == 'accountL') {
this.leftObj = this.count_obj[index]
console.log(this.leftObj.name)
}
if (this.showPoup == 'accountR') {
this.rightObj = this.count_obj[index]
console.log(this.rightObj.name)
}
if (this.showPoup == 'currency') {
this.selectIndex = index
this.selectCurr = this.currList[index]
this.inputNum = ''
console.log(this.selectCurr)
}
},
}
}
</script>
<style lang="scss">
.borderBox {
width: 690rpx;
// height: 260rpx;
margin: 22rpx auto;
// background: #FFFFFF;
box-shadow: 0rpx 3rpx 6rpx rgba(200, 200, 200, 0.16);
border-radius: 10rpx;
}
.XZ180 {
transition: all 0.5s;
transform: rotate(180deg);
}
.loginBtn {
width: 600rpx;
height: 96rpx;
background: #06C38D !important;
border-radius: 12rpx;
line-height: 96rpx;
color: #FFFFFF;
font-size: 32rpx;
text-align: center;
}
</style>
+488
View File
@@ -0,0 +1,488 @@
<template>
<view :style="'background-color: '+theme.bg+';color: '+theme.text">
<!-- 头部 -->
<view class="width-750 relative flex align-center justify-center"
:style="{height: `calc(${statusBar}px + 110rpx)`}">
<view class="width-750 fixed1 bgimg1"
:style="{paddingTop: statusBar + 'px', height: `calc(${statusBar}px + 110rpx)`}">
<view class="width-750 height-110 padding-w-30 flex align-center justify-center">
<view @click="_goback" class="cuIcon-back font-40 color-white"
style="position: absolute;left: 30rpx;"></view>
<text class="font-36 color-white weight-bold">{{i18n.recharge.title1}}</text>
<image @click="router.push('/pages/index/rechargeRecord')" class="width-36 height-36"
src="/static/imgs/index/jilu.png" style="position: absolute;right: 30rpx;"></image>
</view>
</view>
</view>
<!-- 身体 -->
<view class="width-750">
<view class="height-305 bgimg2 padding-t-10 padding-w-30">
<!-- 币种 -->
<view style="background-color: rgba(255,255,255,0);"
class="width-100b height-96 radiu-20 padding-w-32 flex align-center justify-between">
<view @click="current=2,voucher_image='',voucher_image_up=''" class="padding-w-18 height-78 radiu-20 text-center line-height-78"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<text :class="current==2?'color-0165EE':''" class="font-28">{{i18n.fastRecord.text9}}</text>
</view>
<view @click="current=1,voucher_image='',voucher_image_up=''" class="padding-w-18 height-78 radiu-20 text-center line-height-78"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<text :class="current==1?'color-0165EE':''" class="font-28">{{i18n.fastRecord.tos2}}</text>
</view>
</view>
<view class="">
<view v-if="current==2" :style="'background-color: '+theme.fu_bg+';color: '+theme.text"
class="width-100b radiu-20 padding-w-32 margin-t-20">
<view @click="bankshow=true" class="height-80 flex align-center justify-between">
<text class="font-28 weight-bold">{{bank.bank_name}} ({{bank.bank_user}})</text>
<i class="cuIcon-right font-28"></i>
</view>
<view class="height-70 flex align-center justify-between">
<text class="font-28 weight-bold">{{bank.card_num}}</text>
<i @click="copy(bank.card_num)" class='cuIcon-copy font-30 color-0165EE'></i>
</view>
<view v-if="current==2" class="height-58 line-height-58">
<text class="font-24">{{i18n.recharge.huilv}} {{bank.exchange}} USDT</text>
</view>
</view>
<!-- 币种选择 -->
<view v-if="current==1" class="width-100b radiu-20 padding-w-32 padding-b-20 margin-t-20"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="height-90 padding-t-27 font-28 weight-bold">Select Coin</view>
<view class="flex align-center flex-wrap">
<view @click="changeCoinType(item)" v-for="(item,index) in coinTypes" :key="item.id"
:class="currid==item.id?'onbox':'offbox'" class="numbold-font margin-r-14">{{item.name}}
</view>
</view>
</view>
<!-- 链类型 -->
<view v-if="current==1" class="width-100b radiu-20 padding-w-32 padding-b-20 margin-t-20"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="height-90 padding-t-27 font-28 weight-bold">{{i18n.recharge.text2}}
</view>
<view class="flex align-center flex-wrap">
<view @click="changelian(item,index)" v-for="(item,index) in detail"
:class="index==lian?'onbox':'offbox'" class="numbold-font margin-r-14">{{item.lian}}
</view>
</view>
</view>
<!-- 二维码 -->
<view v-if="current==1" class="codebox" :style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="flex align-center justify-center">
<text class="font-28 weight-bold">{{i18n.recharge.text3}}</text>
</view>
<view class="margin-t-30 flex align-center justify-center">
<view class="width-260 height-260 radiu-10 flex align-center justify-center"
style="border: 4rpx solid #52F3C9;">
<image class="width-242 height-242" :src="image?image:'/static/APEClogo@2x.png'"
mode=""></image>
</view>
</view>
<!-- <view @click="saveImage()"
class="width-240 height-66 radiu-33 flex align-center justify-center margin-0-auto margin-t-38"
style="border: 1px solid #0165EE;">
<text class="font-28 color-0165EE weight-bold">{{i18n.recharge.text4}}</text>
</view> -->
<view class="font-26 nummedium-font margin-20-auto text-center">{{zhuan_address}}</view>
<view @click="copy(zhuan_address)"
class="width-240 height-66 radiu-33 flex align-center justify-center margin-0-auto"
style="border: 1px solid #52F3C9;">
<text class="font-28 color-0165EE weight-bold">{{i18n.recharge.text6}}</text>
</view>
</view>
<view class="radiu-20 margin-t-10" :style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="width-100b height-160 padding-w-32 padding-c-27 flex direction-column justify-between">
<view class="flex align-center justify-between">
<text v-if="current==1" class="font-28 weight-bold">{{i18n.recharge.title4}}</text>
<text v-if="current==2" class="font-28 weight-bold">{{i18n.recharge.new1}}</text>
<text v-if="current==2" class="font-26">{{i18n.recharge.text9}}{{Number(num*bank.exchange).toFixed(4)}}</text>
</view>
<input class="font-28" :placeholder="current==1?i18n.recharge.title8:i18n.recharge.new2" type="number" v-model="num" />
</view>
<view v-if="current==1" class="width-100b height-160 padding-w-32 padding-c-27 flex direction-column justify-between">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.recharge.title5}}</text>
</view>
<input class="font-28" :placeholder="i18n.recharge.title9" type="text" v-model="address" />
</view>
<!-- <view v-if="current==2" class="width-100b height-160 padding-w-32 padding-c-27 flex direction-column justify-between">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.recharge.title15}}</text>
</view>
<input class="font-28" :placeholder="i18n.recharge.title18" type="text" v-model="bank_name" />
</view> -->
<!-- <view v-if="current==2" class="width-100b height-160 padding-w-32 padding-c-27 flex direction-column justify-between">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.recharge.title16}}</text>
</view>
<input class="font-28" :placeholder="i18n.recharge.title19" type="number" v-model="card_num" />
</view> -->
<view class="width-100b height-160 padding-w-32 padding-c-27 flex direction-column justify-between">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.recharge.title7}}</text>
</view>
<input class="font-28" password :placeholder="i18n.recharge.title11" type="text"
v-model="pay_pwd" />
</view>
<view class="width-100b padding-w-32 padding-c-27 flex direction-column justify-between">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.recharge.title17}}</text>
</view>
<view class="height-200 flex align-center justify-center">
<view @click="chooseImage()"
class="width-200 height-200 flex align-center justify-center radiu-20"
:style="'background-color: '+theme.bg">
<image v-if="voucher_image" class="width-200 height-200" :src="voucher_image" mode=""></image>
<i v-else class='cuIcon-add font-50 weight-bold'></i>
</view>
</view>
</view>
</view>
<view class="width-600 margin-0-auto margin-t-30">
<u-button v-if="current==1" @click="chongzhi" class="custom-style" type="primary" style="background-color: #3ECEB2;">{{i18n.appeal.text1}}
</u-button>
<u-button v-if="current==2" @click="yinhangka()" class="custom-style" type="primary" style="background-color: #3ECEB2; margin-top: 300rpx;">{{i18n.appeal.text1}}
</u-button>
</view>
</view>
<!-- 空盒子 -->
<view class="height-40"></view>
</view>
</view>
<!-- 币种弹窗 -->
<u-popup v-model="show" mode="bottom" border-radius="20">
<view class="height-437 padding-w-30 padding-b-36"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="flex align-center justify-between padding-c-32">
<text class="font-28">{{i18n.recharge.text7}}</text>
<text @click.stop="show=false" class="font-26 color-C3C3C3">{{i18n.recharge.text8}}</text>
</view>
<view class="height-278">
<scroll-view scroll-y="true" class="height-220">
<view @click.stop="changecurr(item)" v-for="(item,index) in list"
class="height-72 padding-w-30 flex align-center margin-b-17 font-28">
{{item.name}}
</view>
</scroll-view>
</view>
</view>
</u-popup>
<!-- 银行弹窗 -->
<u-popup v-model="bankshow" mode="bottom" border-radius="20">
<view class="height-517 padding-w-30 padding-b-36"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="flex align-center justify-between padding-c-32">
<text class="font-28">{{i18n.fastRecord.text9}}</text>
<text @click.stop="bankshow=false" class="font-26 color-C3C3C3">{{i18n.recharge.text8}}</text>
</view>
<view class="height-358">
<scroll-view scroll-y="true" class="height-300">
<view @click.stop="changebank(item)" v-for="(item,index) in bankList"
class="height-72 flex align-center margin-b-17">
<image class="width-38 height-38 radiu-50b margin-r-18" :src="item.logo_image" mode=""></image>
<text class="font-28">{{item.curr_name}} {{item.name}} ({{item.bank_user}})</text>
</view>
</scroll-view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import clipboard from "@/components/clipboard.js"
export default {
data() {
return {
statusBar: uni.getSystemInfoSync().statusBarHeight,
current: 2,
show: false,
bankshow:false,
list: [],
lian: 0,
curr: '',
currid: '',
detail: [],
zhuan_address: '',
image: '',
xieyi: '',
theme: '',
num: '',
address: '',
hash: '',
pay_pwd: '',
flag: true,
coinTypes: [],
bankList:[],
bank: {},
voucher_image: '',
voucher_image_up: '',
// card_num: '',
// bank_name: '',
}
},
computed: {
i18n() {
return this.$t('message');
}
},
onLoad(e) {
if(e.current==2){
this.current = e.current
}
},
onShow() {
if (uni.getStorageSync("theme") == "dark") {
this.theme = this.$store.state.darkTheme
} else {
this.theme = this.$store.state.lightTheme
}
this.getcurrlist()
},
methods: {
chongzhi() {
if (!this.flag) return
if (this.num == '') return this.tos(this.i18n.recharge.title8)
if (this.address == '') return this.tos(this.i18n.recharge.title9)
if (this.paypwd == '') return this.tos(this.i18n.recharge.title11)
this.post('/wallet/recharge_sub', {
type:1,
num: this.num,
address: this.address,
hash: this.hash,
pay_pwd: this.pay_pwd,
voucher_image: this.voucher_image_up
}).then(res => {
console.log(res)
if (res.code == 1) {
this.tos(res.msg)
this.paypwd = ''
setTimeout(() => {
uni.navigateTo({
url: '/pages/index/rechargeRecord'
})
}, 500)
}
})
},
copy(data) {
// #ifndef H5
clipboard.setText(data);
// #endif
// #ifdef H5
let result
let textarea = document.createElement("textarea")
textarea.value = data
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, data.length)
result = document.execCommand("copy")
textarea.remove()
// #endif
this.tos(this.i18n.mine.share.copySuceed)
},
saveImage(image) {
var that = this;
uni.saveImageToPhotosAlbum({
filePath: that.image,
success(res) {
that.tos(that.i18n.mine.share.codeSuceed)
}
})
},
// 获取充值内容
getdetails(id) {
this.post('/wallet/get_wallet_address', {
id: id
},true).then(res => {
console.log(res)
if (res.code == 1) {
this.bank = res.data.bank[0]
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
}
})
},
// 获取币种
getcurrlist() {
this.post('/wallet/reg_curr').then(res => {
console.log(res)
if (res.code == 1) {
this.list = res.data
// 构建币种选择列表,确保包含 BTC 和 ETH
let types = [...res.data]
let names = types.map(t => t.name.toUpperCase())
if (!names.includes('BTC')) {
types.push({ id: 'btc_static', name: 'BTC' })
}
if (!names.includes('ETH')) {
types.push({ id: 'eth_static', name: 'ETH' })
}
this.coinTypes = types
this.curr = res.data[0].name
this.currid = res.data[0].id
this.getdetails(this.currid)
}
})
},
changeCoinType(item) {
if (this.currid == item.id) return
this.curr = item.name
this.currid = item.id
this.voucher_image = ''
this.voucher_image_up = ''
this.getdetails(this.currid)
},
changecurr(item) {
this.curr = item.name
this.currid = item.id
this.getdetails(this.currid)
this.show = false
},
changebank(item){
this.bank = item
this.bankshow = false
},
changelian(item, index) {
if (this.lian != index) {
this.lian = index
this.image = item.qrcode
this.zhuan_address = item.address
}
},
yinhangka() {
if (!this.flag) return
if (this.num == '') return this.tos(this.i18n.recharge.title8)
// if (this.bank_name == '') return this.tos(this.i18n.recharge.title18)
// if (this.card_num == '') return this.tos(this.i18n.recharge.title19)
if (this.paypwd == '') return this.tos(this.i18n.recharge.title11)
this.post('/wallet/recharge_sub', {
type:2,
num: this.num,
bank_id: this.bank.id,
pay_pwd: this.pay_pwd,
// bank_name: this.bank_name,
// card_num: this.card_num,
voucher_image: this.voucher_image_up
}).then(res => {
console.log(res)
if (res.code == 1) {
this.tos(res.msg)
this.paypwd = ''
setTimeout(() => {
uni.navigateTo({
url: '/pages/index/rechargeRecord'
})
}, 500)
}
})
},
chooseImage() {
let self = this
uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
self.voucher_image = tempFilePaths[0]
uni.showLoading({
mask:true
})
uni.uploadFile({
url: this.upload + '/publics/image_upload',
filePath: tempFilePaths[0],
name: 'file',
success: (res) => {
let data = JSON.parse(res.data)
if (data.code == 1) {
self.voucher_image_up = data.data.url
}
},
complete:() =>{
uni.hideLoading()
}
})
}
})
},
}
}
</script>
<style lang="scss">
.fixed1 {
position: fixed;
top: 0;
z-index: 1000;
// background-color: #FFFFFF;
}
.bgimg1 {
// background-image: url(../../static/imgs/index/bgimg1.png);
// background-repeat: repeat;
// background-size: 100% 100%;
background: linear-gradient(180deg, #52F3C9 0%, #3ECEB2 100%);
}
.bgimg2 {
// background-image: url(../../static/imgs/index/bgimg2.png);
// background-repeat: repeat;
// background-size: 100% 100%;
background: linear-gradient(180deg, #3ECEB2 0%, #52F3C9 100%);
}
.onbox {
height: 56rpx;
padding: 0 24rpx;
background: linear-gradient(180deg, #52F3C9 0%, #3ECEB2 100%);
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-size: 28rpx;
color: #FFFFFF;
}
.offbox {
height: 56rpx;
padding: 0 24rpx;
background: rgba(139, 153, 162, 0.2);
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-size: 28rpx;
color: #8B99A2;
}
.codebox {
width: 690rpx;
height: 500rpx;
// background: #FFFFFF;
box-shadow: 0rpx 0rpx 0rpx #EBF0F6;
opacity: 1;
border-radius: 20rpx;
margin-top: 20rpx;
padding: 27rpx 32rpx 39rpx;
}
</style>
+598
View File
@@ -0,0 +1,598 @@
<template>
<view :style="'background-color: '+theme.bg+';color: '+theme.text" style="height: 100vh;">
<!-- 头部 -->
<myNav :title="i18n.withdraw.title1" isRight righturl="/static/imgs/index/tbjl.png"
@Jump="router.push('/pages/index/withdrawalRecord')"></myNav>
<!-- 身体 -->
<view class="width-750 padding-t-10 padding-b-40 padding-w-30">
<!-- 币种 -->
<!-- <view @click="show=true"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text"
class="width-100b height-96 radiu-20 padding-w-32 flex align-center justify-between">
<text class="font-28 weight-bold">{{i18n.withdraw.text1}}</text>
<view class="flex align-center">
<text class="font-28 numbold-font color-0165EE">{{curr}}</text>
<u-icon name="arrow-right" color="#0165EE" size="28"></u-icon>
</view>
</view> -->
<view style="background-color: rgba(255,255,255,0);"
class="width-100b height-96 radiu-20 padding-w-32 flex align-center justify-center">
<view @click="current=1" class="width-150 height-78 radiu-20 text-center line-height-78"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<text :class="current==1?'color-0165EE':''" class="font-28">{{i18n.fastRecord.tos2}}</text>
</view>
<!-- <view @click="current=2" class="width-150 height-78 radiu-20 text-center line-height-78"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<text :class="current==2?'color-0165EE':''" class="font-28">{{i18n.fastRecord.text9}}</text>
</view> -->
</view>
<view v-if="current==2" :style="'background-color: '+theme.fu_bg+';color: '+theme.text"
class="width-100b radiu-20 padding-w-32 margin-t-20">
<view class="height-80 flex align-center justify-between">
<text v-if="bank" @click="bankshow=true" class="flex-1 font-28 weight-bold">{{bank.bank_name}}({{bank.username}})</text>
<text v-else @click="router.push('/pages/my/safety/payment')" class="flex-1 font-28 weight-bold">{{i18n.mine.safety.add}}</text>
<i class="cuIcon-right font-28"></i>
</view>
<view v-if="bank" class="height-70 flex align-center justify-between">
<text class="font-28 weight-bold">{{bank.card_num}}</text>
<!-- <i @click="copy(bank.card_num)" class='cuIcon-copy font-30 color-0165EE'></i> -->
</view>
</view>
<!-- 币种选择 -->
<view v-if="current==1" class="width-100b radiu-20 padding-w-32 padding-b-20 margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="height-116 padding-t-27 font-28 weight-bold">Select Coin</view>
<view class="flex align-center flex-wrap">
<view @click="changeCoinType(item)" v-for="(item,index) in coinTypes" :key="item.id"
:class="currid==item.id?'onbox':'offbox'" class="numbold-font margin-r-14">{{item.name}}</view>
</view>
</view>
<!-- 链类型 -->
<view v-if="current==1" class="width-100b radiu-20 padding-w-32 padding-b-20 margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="height-116 padding-t-27 font-28 weight-bold">{{i18n.withdraw.text2}}</view>
<view class="flex align-center flex-wrap">
<view @click="changelian(item,index)" v-for="(item,index) in detail"
:class="index==lian?'onbox':'offbox'" class="numbold-font margin-r-14">{{item}}</view>
</view>
</view>
<!-- 地址 -->
<view v-if="current==1"
class="width-100b height-192 radiu-20 padding-w-32 padding-c-27 flex direction-column justify-between margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.withdraw.text3}}</text>
<image @click="show1=true" class="width-32 height-32" src="/static/imgs/index/shaixuan@2x.png"
mode=""></image>
</view>
<input class="font-28" :placeholder="i18n.withdraw.tos5" type="text" v-model="address" />
</view>
<!-- 数量 -->
<view class="width-100b height-249 padding-w-32 radiu-20 margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="height-96 flex align-center font-28 weight-bold">{{i18n.withdraw.text4}}
</view>
<view class="height-153 padding-t-27 padding-b-23 flex direction-column justify-between">
<view class="flex align-center justify-between">
<input class="flex-1 padding-r-50 font-28" type="number" v-model="number"
:placeholder="i18n.withdraw.tos2" />
<view class="flex align-center">
<text class="font-28 weight-bold">{{curr}}</text>
<view class="width-2 height-23 bj-8B99A2 margin-w-10"></view>
<text @click="number=data.num"
class="font-28 color-0165EE weight-bold">{{i18n.withdraw.text5}}</text>
</view>
</view>
<text class="font-24 numbold-font">{{i18n.withdraw.text6}}{{data.num}} {{curr}}</text>
</view>
</view>
<!-- 手续费 -->
<view class="width-100b height-96 radiu-20 padding-w-32 flex align-center justify-between margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<text class="font-28 weight-bold">{{i18n.withdraw.text7}}</text>
<view v-if="current==1" class="flex align-center">
<text class="font-28 color-0165EE weight-bold">{{lian==0?data.erc_process:data.process}}</text>
<text class="font-28 numbold-font margin-l-10">{{curr}}</text>
</view>
<view v-if="current==2" class="flex align-center">
<text class="font-28 color-0165EE weight-bold">{{data.yhk_process}}</text>
<text class="font-28 numbold-font margin-l-10">{{curr}}</text>
</view>
</view>
<!-- 折合 -->
<!-- <view class="margin-t-20 padding-w-32 flex align-center font-28 color-333333">
<text>折合</text>
<text class="color-0165EE nummedium-font margin-w-5">{{data.apt_process}}</text>
<text class="nummedium-font">APT</text>
</view> -->
<!-- 提示 -->
<view class="padding-w-32 margin-t-31" v-html="data.withdraw_text"></view>
<!-- 提币按钮 -->
<view class="width-600 margin-0-auto margin-t-65">
<u-button v-if="current==1" @click="openshow1" class="custom-style" type="primary">
{{i18n.withdraw.text10}}</u-button>
<u-button v-if="current==2" @click="openshow2" class="custom-style" type="primary">
{{i18n.withdraw.text10}}</u-button>
</view>
</view>
<!-- 币种弹窗 -->
<u-popup v-model="show" mode="bottom" border-radius="20">
<view class="height-437 padding-w-30 padding-b-36"
:style="'background-color: '+theme.bg+';color: '+theme.text">
<view class="flex align-center justify-between padding-c-32">
<text class="font-28">{{i18n.withdraw.text11}}</text>
<text @click.stop="show=false" class="font-26 color-C3C3C3">{{i18n.withdraw.text12}}</text>
</view>
<view class="height-278">
<scroll-view scroll-y="true" class="height-250">
<view @click.stop="changecurr(item)" v-for="(item,index) in list"
class="height-72 padding-w-30 flex align-center margin-b-17 font-28">
{{item.name}}
</view>
</scroll-view>
</view>
</view>
</u-popup>
<!-- 银行弹窗 -->
<u-popup v-model="bankshow" mode="bottom" border-radius="20">
<view class="height-517 padding-w-30 padding-b-36"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="flex align-center justify-between padding-c-32">
<text class="font-28">{{i18n.fastRecord.text9}}</text>
<text @click.stop="bankshow=false" class="font-26 color-C3C3C3">{{i18n.recharge.text8}}</text>
</view>
<view class="height-358">
<scroll-view scroll-y="true" class="height-300">
<view @click.stop="changebank(item)" v-for="(item,index) in bankList"
class="height-72 flex align-center margin-b-17">
<text class="font-28">{{item.bank_name}}({{item.username}})</text>
</view>
</scroll-view>
</view>
</view>
</u-popup>
<!-- 地址弹窗 -->
<u-popup v-model="show1" mode="bottom" border-radius="20">
<view class="height-437 padding-w-30 padding-b-36"
:style="'background-color: '+theme.bg+';color: '+theme.text">
<view class="flex align-center justify-between padding-c-32">
<text class="font-28">{{i18n.withdraw.text3}}</text>
<text @click.stop="show1=false" class="font-26 color-C3C3C3">{{i18n.withdraw.text12}}</text>
</view>
<view class="height-278">
<scroll-view scroll-y="true" class="height-278">
<view @click="address=item.address,show1=false" v-for="(item,index) in list1" class="addressbox"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="height-70 flex align-center font-28" style="word-break: break-all;">
{{item.address}}</view>
<view class="height-30 line-height-30 font-24 color-C3C3C3">{{item.notice}}</view>
</view>
</scroll-view>
</view>
</view>
</u-popup>
<!-- 确认提币弹窗 -->
<u-popup :mask-close-able="false" v-model="show2" mode="bottom" border-radius="20">
<view class="padding-b-50 padding-w-30" :style="'background-color: '+theme.bg+';color: '+theme.text">
<!-- 标题 -->
<view class="flex align-center justify-between padding-c-32">
<text class="font-28">{{i18n.withdraw.text16}}</text>
<text @click.stop="show2=false" class="font-26 color-C3C3C3">{{i18n.withdraw.text12}}</text>
</view>
<!-- 交易密码 -->
<view
class="width-100b height-192 radiu-20 padding-w-32 padding-c-27 flex direction-column justify-between"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="font-28 weight-bold">{{i18n.withdraw.text8}}</view>
<input class="font-28" :placeholder="i18n.withdraw.tos3" type="text" v-model="paypwd" password />
</view>
<!-- 邮箱验证 -->
<!-- <view v-if="email!=''"
class="width-100b height-192 radiu-20 padding-w-32 padding-c-27 flex direction-column justify-between margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.withdraw.text17}}</text>
<text>{{email}}</text>
</view>
<view class="flex align-center justify-between">
<input class="font-28 flex-1 padding-r-24" :placeholder="i18n.withdraw.tos9" type="text"
v-model="code" />
<text @click="cutTime()" class="font-28 color-0165EE weight-bold">{{codeText}}</text>
</view>
</view> -->
<!-- 手机验证 -->
<!-- <view v-if="mobile!=''"
class="width-100b height-192 radiu-20 padding-w-32 padding-c-27 flex direction-column justify-between margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.withdraw.text18}}</text>
<text>{{mobile}}</text>
</view>
<view class="flex align-center justify-between">
<input class="font-28 flex-1 padding-r-24" :placeholder="i18n.withdraw.tos10" type="text"
v-model="code_m" />
<text @click="cutTime2()" class="font-28 color-0165EE weight-bold">{{codeText2}}</text>
</view>
</view> -->
<!-- 谷歌验证 -->
<!-- <view v-if="google" class="width-100b height-192 radiu-20 padding-w-32 padding-c-27 flex direction-column justify-between margin-t-24"
:style="'background-color: '+theme.fu_bg+';color: '+theme.text">
<view class="font-28 weight-bold flex align-center justify-between">
<text>{{i18n.withdraw.text19}}</text>
</view>
<view class="flex align-center justify-between">
<input class="font-28 flex-1 padding-r-24" :placeholder="i18n.withdraw.tos11" type="text"
v-model="code_g" />
</view>
</view> -->
<view class="width-600 margin-0-auto margin-t-65">
<u-button @click="getwithdraw" class="custom-style" type="primary">{{i18n.withdraw.text10}}
</u-button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import clipboard from "@/components/clipboard.js"
export default {
data() {
return {
statusBar: uni.getSystemInfoSync().statusBarHeight,
current: 1,
list: [],
list1: [],
coinTypes: [],
lian: 0,
curr: '',
currid: '',
detail: [],
data: '',
show: false,
show1: false,
show2: false,
address: '',
number: '',
paypwd: '',
code: '',
code_m: '',
code_g: '',
flag: true,
time: '获取验证码',
timeFlag: true,
time2: '获取验证码',
timeFlag2: true,
email: '',
mobile: '',
google: false,
theme: '',
bankList: [],
bank: {},
bankshow: false
}
},
computed: {
i18n() {
return this.$t('message');
},
codeText() {
if (this.time > 0) {
return this.time + " S"
} else {
return this.i18n.withdraw.text13
}
},
codeText2() {
if (this.time2 > 0) {
return this.time2 + " S"
} else {
return this.i18n.withdraw.text13
}
}
},
onLoad(e) {
this.time = this.i18n.withdraw.text13
if (e.type == 'saoma') {
this.address = e.result
}
},
onShow() {
this.getbank()
if (uni.getStorageSync("theme") == "dark") {
this.theme = this.$store.state.darkTheme
} else {
this.theme = this.$store.state.lightTheme
}
this.getcurrlist()
this.getaddresslist()
// this.getEmail()
},
methods: {
openshow1() {
if (this.address == '') return this.tos(this.i18n.withdraw.tos1)
if (this.number == '') return this.tos(this.i18n.withdraw.tos2)
this.show2 = true
},
openshow2() {
if (this.number == '') return this.tos(this.i18n.withdraw.tos2)
this.show2 = true
},
// 提交
getwithdraw() {
if (this.paypwd == '') return this.tos(this.i18n.withdraw.tos3)
// if (this.email != '') {
// if (this.code == '') return this.tos(this.i18n.withdraw.tos9)
// }
// if (this.mobile != '') {
// if (this.code_m == '') return this.tos(this.i18n.withdraw.tos10)
// }
// if (this.google) {
// if (this.code_g == '') return this.tos(this.i18n.withdraw.tos11)
// }
if (!this.flag) {
return
} else {
this.flag = false
let obj = {}
if (this.current == 1) {
obj = {
type: 1,
address: this.address,
lian: this.detail[this.lian],
num: this.number,
pay_pwd: this.paypwd,
code: this.code,
code_m: this.code_m,
code_g: this.code_g
}
}
if (this.current == 2) {
obj = {
type: 2,
coll_id: this.bank.id,
num: this.number,
pay_pwd: this.paypwd,
code: this.code,
code_m: this.code_m,
code_g: this.code_g
}
}
console.log(obj)
this.post('/wallet/withdraw', obj, true).then(res => {
console.log(res)
this.flag = true
if (res.code == 1) {
this.tos(res.msg)
this.paypwd = ''
this.show2 = false
setTimeout(() => {
uni.navigateTo({
url: '/pages/index/withdrawalRecord'
})
}, 500)
}
})
}
},
// 获取提币内容
getdetails(id) {
this.post('/wallet/get_withdraw', {
id: id
}).then(res => {
console.log(res)
if (res.code == 1) {
this.detail = res.data.lian
this.data = res.data
this.lian = 0
this.email = res.data.email
this.mobile = res.data.mobile
this.google = res.data.is_google
}
})
},
// 获取币种
getcurrlist() {
this.post('/wallet/wid_curr').then(res => {
console.log(res)
if (res.code == 1) {
this.list = res.data
// 构建币种选择列表,确保包含 BTC 和 ETH
let types = [...res.data]
let names = types.map(t => t.name.toUpperCase())
if (!names.includes('BTC')) {
types.push({ id: 'btc_static', name: 'BTC' })
}
if (!names.includes('ETH')) {
types.push({ id: 'eth_static', name: 'ETH' })
}
this.coinTypes = types
this.curr = res.data[0].name
this.currid = res.data[0].id
this.getdetails(this.currid)
}
})
},
changeCoinType(item) {
if (this.currid == item.id) return
this.curr = item.name
this.currid = item.id
this.address = ''
this.number = ''
this.getdetails(this.currid)
},
// 获取地址
getaddresslist() {
this.post('/my/address_list').then(res => {
console.log(res)
if (res.code == 1) {
this.list1 = res.data
}
})
},
getbank() {
this.post('/my/collection_list').then(res => {
console.log('银行卡', res)
if (res.code == 1) {
this.bankList = res.data
this.bank = res.data[0]
}
})
},
changebank(item) {
this.bank = item
this.bankshow = false
},
changecurr(item) {
this.curr = item.name
this.currid = item.id
this.getdetails(this.currid)
this.show = false
},
changelian(item, index) {
if (this.lian != index) {
this.lian = index
console.log(this.detail[this.lian])
}
},
getEmail() {
this.post('/my/get_userinfo').then(res => {
console.log(res)
if (res.code == 1) {
this.email = res.data.email
}
})
},
cutTime() {
if (!this.timeFlag) return
uni.showLoading({
title: '',
})
this.timeFlag = false
this.post('/ems/send', {
email: this.email,
event: "withdraw",
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
this.tos(this.i18n.withdraw.tos7)
this.time = 120
var that = this
let timeName = setInterval(() => {
if (that.time > 0) {
that.time--
} else {
that.time = that.i18n.withdraw.text13
that.timeFlag = true
clearInterval(timeName)
}
}, 1000)
} else {
this.timeFlag = true
}
})
},
cutTime2() {
if (!this.timeFlag2) return
uni.showLoading({
title: '',
})
this.timeFlag2 = false
this.post('/sms/send', {
mobile: this.mobile,
event: "withdraw",
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
this.tos(this.i18n.withdraw.tos7)
this.time2 = 120
var that = this
let timeName2 = setInterval(() => {
if (that.time2 > 0) {
that.time2--
} else {
that.time2 = that.i18n.withdraw.text13
that.timeFlag2 = true
clearInterval(timeName2)
}
}, 1000)
} else {
this.timeFlag2 = true
}
})
},
copy(data) {
// #ifndef H5
clipboard.setText(data);
// #endif
// #ifdef H5
let result
let textarea = document.createElement("textarea")
textarea.value = data
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, data.length)
result = document.execCommand("copy")
textarea.remove()
// #endif
this.tos(this.i18n.mine.share.copySuceed)
},
}
}
</script>
<style lang="scss">
.onbox {
height: 56rpx;
padding: 0 24rpx;
background: linear-gradient(180deg, #52F3C9 0%, #3ECEB2 100%);
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-size: 30rpx;
color: #FFFFFF;
white-space: nowrap;
}
.offbox {
height: 56rpx;
padding: 0 24rpx;
background: rgba(139, 153, 162, 0.2);
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-size: 30rpx;
color: #8B99A2;
white-space: nowrap;
}
.custom-style {
width: 600rpx;
height: 86rpx;
background: linear-gradient(180deg, #52F3C9 0%, #3ECEB2 100%);
border-radius: 20rpx;
font-size: 32rpx;
color: #FFFFFF;
}
.addressbox {
width: 690rpx;
height: 120rpx;
border-radius: 20rpx;
// background-color: rgba(0, 0, 0, 0.1);
margin-bottom: 10rpx;
padding: 10rpx 30rpx;
}
</style>