You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

404 lines
11 KiB

<template>
<view class="main">
<!-- nav -->
<navigation>{{ i18n.AddAddress }} </navigation>
<view class="body">
<!-- coin选择框 -->
<view class="choose-item">
<u-input class="input" v-model="coinInfo.coinCode" color="#fff" fontSize="32rpx" border="none"
:placeholder="i18n.PleaseChooseCoin">
</u-input>
<view class="selectCoinBtn" @click="USDTPopupShow = true">{{coinInfo.coinCode}}
</view>
</view>
<view class="addressBody">
<view class="address-title">{{ i18n.Address }}</view>
<view class="input-item">
<u-input class="input" v-model="coinInfo.address" color="#fff" fontSize="32rpx" border="none"
:placeholder="i18n.enterAddressTips">
</u-input>
</view>
<view class="address-title">{{ i18n.Remarks }}</view>
<view class="input-item">
<u-input class="input" v-model="coinInfo.remarks" color="#fff" fontSize="32rpx" border="none"
:placeholder="i18n.enterRemarksTips">
</u-input>
</view>
</view>
<u-button class="button" color="#00E8A2" throttleTime="500" :disabled="btnIsCanClick" @click="save">{{ i18n.Confirm }}
</u-button>
<!-- USDT按钮通知弹出层 -->
<u-popup class="USDTPopup" :show="USDTPopupShow" round="40rpx" mode="bottom" @close="USDTPopupShow = false"
@open="USDTPopupShow = true" bgColor="#211F32">
<view class="content">
<view class="close" @click="USDTPopupShow = false"></view>
<scroll-view scroll-y="true" style="height: 432rpx;" scroll-with-animation="true" @touchmove.stop.prevent="">
<radio-group class="radioGroup" @change="USDTRadioChange" v-model="USDTRadioValue">
<label class="checkBox" v-for="(item, index) in withdrawInfo.coins" :key="index"
@click="radioChange(item)">
<view class="icon">
<u-icon :name="baseURL+'/coins/'+item.code+'.png'" size="52rpx" width="52rpx">
</u-icon>
</view>
<view class="iconName">
<view class="top">{{item.enname}}</view>
<view class="bottom">{{item.useCapital}}{{" "}}{{item.code}}</view>
</view>
<radio color="#00E8A2" shape="square" :checked="coinInfo.coinCode==item.enname"></radio>
</label>
</radio-group>
</scroll-view>
<u-button class="button" color="#00E8A2" throttleTime="500" @click="USDTPopupShow = false">OK
</u-button>
</view>
</u-popup>
</view>
</view>
</template>
<script>
import uniCopy from '@/utils/uni-copy'
import KeyValueRow from '../../components/KeyValueRow/KeyValueRow.vue';
import api from '@/utils/api'
import constant from '@/utils/constant.js';
export default {
components: { KeyValueRow },
name: "withdrawal",
data() {
return {
baseURL:'',
// 选择的币种信息
selectCoinInfo: {},
coinInfo: {
coinCode:null,
address:null,
remarks:null,
},
// 提现配置信息
withdrawInfo: {},
coin: '',
address: '',
USDTRadioValue: '',
USDTPopupShow: false,
};
},
computed: {
i18n() {
return this.$t("withdrawal");
},
btnIsCanClick() { // 按钮是否可以点击
if (this.coinInfo.coinCode && this.coinInfo.address && this.coinInfo.remarks) {
return false; // 有值才可以点
}else{
return true
}
}
},
onLoad() {
this.baseURL = constant.BASE_URL
this.getWithConfig()
// 监听事件
uni.$on('coinAddressChang', (data) => {
this.coinAddress = data.coinAddress
})
},
onUnload() {
// 移除监听事件
uni.$off('coinAddressChang');
},
onShow() { },
methods: {
// 保存地址
save(){
api.withdrawAddressAdd({
coinCode:this.coinInfo.coinCode2,
address:this.coinInfo.address,
remarks:this.coinInfo.remarks,
}).then(res => {
uni.$u.toast(this.$t("login").Savesucceeded)
setTimeout(()=>{
this.coinInfo={
coinCode:null,
address:null,
remarks:null,
coinCode2:null,
}
},1200)
})
},
// 获取币种
radioChange(e) {
this.selectCoinInfo = e
this.coinInfo.coinCode = e.enname
this.coinInfo.coinCode2 = e.code
},
// 获取提现配置
getWithConfig() {
api.withdrawConfig({
type: 'crypto'
}).then(res => {
if (res) {
// 进来默认选中第一个币
this.withdrawInfo = res
this.coinInfo.coinCode = this.withdrawInfo.coins[0].enname
this.coinInfo.coinCode2 = this.withdrawInfo.coins[0].code
}
})
},
goto(page) {
// console.log(page);
let url = '';
switch (page) {
case 'withdrawalRecord':
url = '/pages/withdrawal/withdrawalRecord'
break;
case 'chooseAddress':
url = '/pages/withdrawal/chooseAddress?form=withdrawal'
break;
default:
break;
}
if (url) {
// console.log(url);
uni.navigateTo({
url,
});
}
},
USDTRadioChange(e) {
console.log(e);
},
copyAddress(value = "") {
console.log(value)
uniCopy({
content: value,
success: (res) => {
uni.showToast({
title: "复制成功",
duration: 3000,
})
},
error: (e) => {
uni.showToast({
title: e,
icon: 'none',
duration: 2000,
})
}
})
},
},
}
</script>
<style lang="scss" scoped>
.main {
.right {
position: absolute;
right: 32rpx;
font-size: 24rpx;
}
.body {
margin-top: 200rpx;
padding: 32rpx;
}
.choose-item {
overflow: hidden;
position: relative;
height: 124rpx;
line-height: 124rpx;
background: #211F32;
margin-bottom: 48rpx;
border-radius: 32rpx;
padding: 0 40rpx;
/deep/.u-form-item__body {
padding: 0;
}
.input {
width: 460rpx;
height: 124rpx;
display: inline-block;
}
.selectCoinBtn {
position: absolute;
height: 54rpx;
top: 36rpx;
right: 80rpx;
line-height: 56rpx;
font-size: 36rpx;
padding: 0;
color: #fff;
&::after {
display: block;
position: absolute;
content: '';
background-image: url(../../static/me/ic_input_arrow_down.png);
background-repeat: no-repeat;
background-size: 32rpx;
width: 32rpx;
height: 32rpx;
top: 12rpx;
right: -50rpx;
}
}
.all {
position: absolute;
display: inline;
font-size: 20rpx;
color: #00E8A2;
top: 0rpx;
right: 30rpx;
}
}
.addressBody {
overflow: hidden;
background: #211F32;
border-radius: 32rpx;
padding: 32rpx;
.address-title {
font-size: 32rpx;
color: #A1A0A8;
margin-bottom: 20rpx;
}
.input-item {
height: 112rpx;
background: #323045;
border-radius: 32rpx;
padding-left: 40rpx;
margin-bottom: 20rpx;
.input {
height: 112rpx;
}
}
}
.button {
position: fixed;
bottom: 40rpx;
width: 686rpx;
box-sizing: border-box;
height: 112rpx;
background: #00E8A2;
border-radius: 32rpx;
font-weight: 700;
font-size: 32rpx;
color: #15141F !important;
}
.USDTPopup {
.content {
height: 730rpx;
.close {
margin: 48rpx 346rpx;
width: 58rpx;
height: 20rpx;
background-image: url(../../static/charity/Turn.png);
background-repeat: no-repeat;
background-size: 58rpx 20rpx;
}
.radioGroup {
height: 432rpx;
.checkBox {
height: 84rpx;
width: 670rpx;
display: flex;
align-items: center;
margin: 0 40rpx 32rpx;
.icon {
width: 64rpx;
height: 64rpx;
border-radius: 20rpx;
overflow: hidden;
display: inline-block;
box-sizing: border-box;
margin-right: 20rpx;
}
.iconName {
width: 520rpx;
.top {
font-size: 32rpx;
color: #fff;
}
.bottom {
font-size: 24rpx;
color: #A1A0A8;
}
}
/deep/.uni-radio-input {
width: 48rpx;
height: 48rpx;
border-radius: 16rpx;
background: #323045;
}
/deep/.uni-radio-input-checked::before {
font-size: 36rpx;
}
}
}
.button {
width: 654rpx;
margin: 40rpx 48rpx;
border-radius: 32rpx;
height: 112rpx;
font-weight: 600;
line-height: 112rpx;
color: #15141F !important;
}
}
}
}
</style>