303 lines
7.5 KiB
Vue
303 lines
7.5 KiB
Vue
<template>
|
||||
|
|
<view class="content">
|
|||
|
|
<TopSafe bgColor="#fff"></TopSafe>
|
|||
|
|
<Header bgColor="#fff" title="兑换区块链数字积分" />
|
|||
|
|
<view class="setting-view">
|
|||
|
|
<text class="text-32 text-fu" style="margin:54rpx 0 32rpx">兑换地址</text>
|
|||
|
|
<view class="input-box" style="">
|
|||
|
|
<input style="flex:1"
|
|||
|
|
placeholder="请输入或选择地址"
|
|||
|
|
placeholder-style="color:#999;font-weight:400;"
|
|||
|
|
border="0" v-model="inputOne" :customStyle="inputCss"></input>
|
|||
|
|
<image src="@/static/new/right_icon.png" class="right-img" @click="onSelectAddress"></image>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
<text class="text-32 text-fu" style="margin:54rpx 0 32rpx">主网络</text>
|
|||
|
|
<view class="input-box" style="marign-top:32rpx">
|
|||
|
|
<text class="text-32" :style="{color:inputTwo ? '#333' : '#C1C5C9'}">{{inputTwo ? inputTwo : '请选择网络'}}</text>
|
|||
|
|
<u-icon name="arrow-right" color="#999" size="14" class="select-icon"></u-icon>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
<text class="text-32 text-fu" style="margin:54rpx 0 32rpx">兑换金额</text>
|
|||
|
|
<view class="input-box" style="marign-top:32rpx">
|
|||
|
|
<input style="flex:1"
|
|||
|
|
placeholder="请输入兑换金额(最低1TBC)"
|
|||
|
|
placeholder-style="color:#999;font-weight:400;"
|
|||
|
|
@input="onInput"
|
|||
|
|
border="0" v-model="inputThree" :customStyle="inputCss"></input>
|
|||
|
|
<text class="text-zi text-32" @click="onAll">全部</text>
|
|||
|
|
</view>
|
|||
|
|
<text class="text-28 text-fu" style="margin-top:28rpx">余额 {{money}} TBC</text>
|
|||
|
|
|
|||
|
|
<text class="text-32 text-fu" style="margin:54rpx 0 32rpx">支付密码</text>
|
|||
|
|
<view class="input-box" style="marign-top:32rpx;margin-bottom:32rpx" >
|
|||
|
|
<input style="flex:1"
|
|||
|
|
:type="isEve ? 'text' : 'password'"
|
|||
|
|
placeholder="请输入支付密码"
|
|||
|
|
placeholder-style="color:#999;font-weight:400;"
|
|||
|
|
@input="onInputTwo"
|
|||
|
|
border="0" v-model="inputFour" :customStyle="inputCss"></input>
|
|||
|
|
|
|||
|
|
<image @click="onIsSys" :src="`/static/new/eye_${isEve}.png`" class="right-img"></image>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
<view class="bottom-btn">
|
|||
|
|
<view class="bottom-top">
|
|||
|
|
<image src="/static/new/icon.png"></image>
|
|||
|
|
<text class="text-24 text-zi">为了保障用户体验感,额外赠送0.0001主网gas</text>
|
|||
|
|
</view>
|
|||
|
|
<view class="bottom-view">
|
|||
|
|
<view class="bottom-left">
|
|||
|
|
<text class="text-24 text-fu1">到账数量</text>
|
|||
|
|
<text class="text-32 text-zu text-bold">{{inputThree || 0}}
|
|||
|
|
<text class="text-26">TBC</text>
|
|||
|
|
</text>
|
|||
|
|
<text class="text-24 text-fu1">网络手续费 0 TBC</text>
|
|||
|
|
</view>
|
|||
|
|
<MyBtn text="兑换" @ok="onC" wd="346rpx" br="8rpx"></MyBtn>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
<SelectLian :itemShow="addressShow" :itemData="addressList" @ok="onOk" @add="onAdd"
|
|||
|
|
@close="onClose"></SelectLian>
|
|||
|
|
<up-toast ref="uToastRef"></up-toast>
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
|
|||
|
|
import { getExchUsers,exchTransfer } from '@/api/finance.js';
|
|||
|
|
import Header from '@/components/common/header.vue';
|
|||
|
|
import { clear } from '@/utils/auth.js';
|
|||
|
|
import TopSafe from '@/components/common/top-safe.nvue'
|
|||
|
|
import MyBtn from '@/components/common/my-btn.vue'
|
|||
|
|
import func from '@/utils/func.js';
|
|||
|
|
import SelectLian from './components/select-lian.vue'
|
|||
|
|
import CryptoJS from "crypto-js";
|
|||
|
|
|
|||
|
|
export default {
|
|||
|
|
components: { Header, TopSafe,MyBtn,SelectLian },
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
money:'',
|
|||
|
|
isEve:0,
|
|||
|
|
inputOne:'',
|
|||
|
|
inputTwo:'BNB Smart Chain(BEP20)',
|
|||
|
|
addressList:[],
|
|||
|
|
addressShow:false,
|
|||
|
|
inputThree:'',
|
|||
|
|
inputFour:'',
|
|||
|
|
inputCss: {
|
|||
|
|
"height": '80rpx',
|
|||
|
|
"background": "#F3F3F3FF",
|
|||
|
|
"border-radius": "30rpx",
|
|||
|
|
"border": "0rpx",
|
|||
|
|
"padding-left": "12rpx",
|
|||
|
|
},
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
onLoad(option) {
|
|||
|
|
if(option && option.money){
|
|||
|
|
this.money = Number(option.money);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
onShow(){
|
|||
|
|
this.getExchUsersList();
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
getExchUsersList(){
|
|||
|
|
getExchUsers({name:'WALLET'}).then(res=>{
|
|||
|
|
if (res.bizcode === 100) {
|
|||
|
|
this.addressList = [];
|
|||
|
|
this.addressList = res.data.entitys;
|
|||
|
|
} else {
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: res.msg,
|
|||
|
|
});
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
onC(){
|
|||
|
|
if(!this.inputOne){
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: '地址不可为空',
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if(this.inputOne[0] != 0 || (this.inputOne[1] != 'x' && this.inputOne[1] != 'X') || this.inputOne.length != 42){
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: '请输入/选择正确的地址',
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if(!this.inputThree){
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: '请输入金额',
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if(Number(this.inputThree) < 1){
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: '最低1TBC',
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if(this.inputFour.length < 6){
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: '请输入6位密码',
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
let params = {
|
|||
|
|
category:'vcoin',
|
|||
|
|
name:'WALLET',
|
|||
|
|
password:CryptoJS.MD5(this.inputFour).toString(),
|
|||
|
|
amount:this.inputThree,
|
|||
|
|
network:this.inputTwo,
|
|||
|
|
address:this.inputOne
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
// CryptoJS.MD5(form.password).toString();
|
|||
|
|
exchTransfer(params).then(res=>{
|
|||
|
|
if (res.bizcode === 100) {
|
|||
|
|
uni.redirectTo({
|
|||
|
|
url:`/pages/rwa_package/account/shuSuccess?money=${this.inputThree}`
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
this.$refs.uToastRef.show({
|
|||
|
|
type: 'error',
|
|||
|
|
message: res.msg,
|
|||
|
|
});
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
onSelectAddress(){
|
|||
|
|
this.addressShow = true;
|
|||
|
|
},
|
|||
|
|
onClose(){
|
|||
|
|
this.addressShow = false;
|
|||
|
|
},
|
|||
|
|
onOk(item){
|
|||
|
|
this.inputOne = item.account;
|
|||
|
|
this.onClose();
|
|||
|
|
},
|
|||
|
|
onAdd(){
|
|||
|
|
this.onClose();
|
|||
|
|
uni.navigateTo({
|
|||
|
|
url:'/pages/rwa_package/account/shuAdd'
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
onAll(){
|
|||
|
|
this.inputThree = this.money;
|
|||
|
|
},
|
|||
|
|
onInputTwo(e){
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
this.inputFour = func.checkInputNum(e.detail.value,null,6);
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
onInput(e){
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
this.inputThree = func.checkInputPrice(e.detail.value,this.money);
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
onIsSys(){
|
|||
|
|
this.isEve = this.isEve == 1?0:1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style lang="scss" scoped>
|
|||
|
|
.bottom-btn{
|
|||
|
|
width: 100%;
|
|||
|
|
// margin-bottom:230rpx;
|
|||
|
|
height:230rpx;
|
|||
|
|
min-height:230rpx;
|
|||
|
|
background-color: #fff;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
align-items: center;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
position: relative;
|
|||
|
|
.bottom-view{
|
|||
|
|
width:100%;
|
|||
|
|
height:136rpx;
|
|||
|
|
min-height:136rpx;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: center;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
padding: 0 32rpx;
|
|||
|
|
background-color: #fff;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
border-top:1rpx solid #ECECEC;
|
|||
|
|
.bottom-left{
|
|||
|
|
height:110rpx;
|
|||
|
|
min-height:110rpx;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
.bottom-top{
|
|||
|
|
width:100%;
|
|||
|
|
display: flex;
|
|||
|
|
height:68rpx;
|
|||
|
|
min-height:68rpx;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: center;
|
|||
|
|
background: rgba(121,52,246,0.05);
|
|||
|
|
padding: 0 32rpx;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
image{
|
|||
|
|
width:24rpx;
|
|||
|
|
height:24rpx;
|
|||
|
|
margin-right:10rpx;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
.setting-view {
|
|||
|
|
width: 100%;
|
|||
|
|
height: calc(100% - 88rpx - 230rpx - var(--status-bar-height));
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
overflow-y: auto;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
position: relative;
|
|||
|
|
background-color: #fff;
|
|||
|
|
padding: 0 32rpx;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
.input-box{
|
|||
|
|
width:100%;
|
|||
|
|
height:100rpx;
|
|||
|
|
min-height:100rpx;
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
background: #F5F5F5;
|
|||
|
|
border-radius: 16rpx;
|
|||
|
|
padding: 0 32rpx;
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
position: relative;
|
|||
|
|
|
|||
|
|
.right-img{
|
|||
|
|
width:44rpx;
|
|||
|
|
height:44rpx;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
</style>
|