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.
274 lines
6.7 KiB
274 lines
6.7 KiB
<template>
|
|
<view class="ac">
|
|
<navigation :showBack="true" :bgnum="true" class="aaa">
|
|
<text class="big_title">
|
|
{{info.coinList[0].name2}} Transfer
|
|
</text>
|
|
<image src="../../../../static/tongyonh/erwei.png" mode="aspectFit" class="renYou2" slot="logo"
|
|
@click="chooseImage()"></image>
|
|
</navigation>
|
|
<view class="main">
|
|
<view class="item">
|
|
<view class="title">
|
|
Collection address
|
|
</view>
|
|
<view class="inputcon">
|
|
<input type="text" value="" :placeholder="addValue" placeholder-style="color:#D0D0D2" class="input"
|
|
v-model="toAddress" />
|
|
<image src="../../../../static/tongyonh/lu.png" mode="aspectFit" class="img" @click="goAddress">
|
|
</image>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="title flex">
|
|
<text>Amount of Money</text>
|
|
<text class="all" @click="toAll">ALL</text>
|
|
</view>
|
|
<view class="inputcon2">
|
|
<view class="input_con">
|
|
<input type="text" value="" placeholder="0" placeholder-style="color:#D0D0D2" class="input2"
|
|
v-model="toValue" />
|
|
<!-- <input type="text" value="" placeholder="Remark" placeholder-style="color:#D0D0D2" class="input1"/> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="item minitem flex">
|
|
<text>Miner's fee</text>
|
|
<view class="imgcon">
|
|
<image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="rimg"></image>
|
|
</view>
|
|
</view> -->
|
|
<view class="btn" @click="next">
|
|
Next step
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
<view class="bottom_con" v-if="show">
|
|
<view class="title_con">
|
|
Payment details
|
|
</view>
|
|
<view class="money_con">
|
|
<image src="../../../../static/tongyonh/xg.png" mode="aspectFit" class="img" @click="show=false">
|
|
</image>
|
|
<view class="money">
|
|
<text class="tex1">{{toValue}}</text>
|
|
<text class="tex2">{{info.coinList[0].name2}}</text>
|
|
</view>
|
|
<view class="info_con">
|
|
<view class="item">
|
|
<text class="text1">Payment information</text>
|
|
<text class="text2">{{info.coinList[0].name2}} transfer</text>
|
|
</view>
|
|
<view class="item">
|
|
<text class="text1">Collection address</text>
|
|
<text class="text2">{{toAddress}}</text>
|
|
</view>
|
|
<view class="item">
|
|
<text class="text1">Payment address</text>
|
|
<text class="text2">{{info.address}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="btn" @click="toNext">
|
|
Next step
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<view class="bottom_con" v-if="show2">
|
|
<view class="title_con">
|
|
Password
|
|
</view>
|
|
<view class="money_con money_con2">
|
|
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="img2" @click="back"></image>
|
|
<u-input placeholder="Wallet password" v-model="value" :type="type" :border="border"
|
|
:password-icon="passwordIcon" @input="btnco()" />
|
|
</view>
|
|
<view class="btn2" :class="btntype?'btncolor':'btncolor2'" @click="confirm()">
|
|
Next step
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<u-mask :show="show" z-index="10"></u-mask>
|
|
<u-mask :show="show2" z-index="10"></u-mask>
|
|
</view>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import cont from "@/components/navigation/navigation.vue"
|
|
export default {
|
|
data() {
|
|
return {
|
|
btntype: false,
|
|
addValue: '',
|
|
info: {},
|
|
toAddress: '',
|
|
toValue: null,
|
|
show: false,
|
|
show2: false,
|
|
value: '',
|
|
type: 'password',
|
|
passwordIcon: true,
|
|
border: true,
|
|
}
|
|
},
|
|
methods: {
|
|
toNext() {
|
|
this.show = false;
|
|
this.show2 = true;
|
|
},
|
|
back() {
|
|
this.show2 = false;
|
|
this.show = true
|
|
},
|
|
btnco() {
|
|
if (this.value.length == 0) {
|
|
this.btntype = false;
|
|
return;
|
|
}
|
|
this.btntype = true;
|
|
},
|
|
toAll() {
|
|
this.toValue = this.info.balance
|
|
},
|
|
succ(a, b) {
|
|
console.log(a, 4545)
|
|
console.log(b, 45646)
|
|
},
|
|
next() {
|
|
if (this.toAddress == '') {
|
|
uni.showToast({
|
|
title: 'Transfer receiving address cannot be blank',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if (this.toValue == null) {
|
|
uni.showToast({
|
|
title: 'Please enter the transfer amount',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if (this.toValue <= 0) {
|
|
uni.showToast({
|
|
title: 'The transfer amount cannot be less than or equal to zero',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
this.show = true;
|
|
|
|
},
|
|
confirm() {
|
|
if (this.value != this.info.password) {
|
|
uni.showToast({
|
|
title: 'Password error',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
if (this.info.coinList[0].xname == 'Ethereum') {
|
|
this.$EthUtil.transaction(this.info.address, this.toAddress, this.toValue, this.info.privateKey).then((
|
|
res) => {
|
|
console.log(res, '钱包')
|
|
this.show2 = false;
|
|
uni.reLaunch({
|
|
url: '../transfer2/index'
|
|
})
|
|
}).catch(err => {
|
|
console.log(err)
|
|
})
|
|
|
|
}
|
|
if (this.info.coinList[0].xname == 'TRON') {
|
|
if (!this.contractAddress) {
|
|
this.$TronUtil.sendTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue, )
|
|
.then((res) => {
|
|
uni.showToast({
|
|
title: 'Successfully',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
this.show2 = false;
|
|
uni.reLaunch({
|
|
url: '/pages/menu/wallet/index'
|
|
})
|
|
}).catch(err => {
|
|
uni.showToast({
|
|
title: err,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
})
|
|
}else{
|
|
this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue,'',this.contractAddress )
|
|
.then((res) => {
|
|
uni.showToast({
|
|
title: 'Successfully',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
this.show2 = false;
|
|
uni.reLaunch({
|
|
url: '/pages/menu/wallet/index'
|
|
})
|
|
}).catch(err => {
|
|
console.log(err)
|
|
uni.showToast({
|
|
title: err,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
}
|
|
},
|
|
goAddress() {
|
|
uni.navigateTo({
|
|
url: '../address/index'
|
|
})
|
|
},
|
|
// 唤醒摄像头
|
|
chooseImage() {
|
|
var _this = this
|
|
uni.chooseImage({
|
|
count: 1, //默认9
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ['album', 'camera'], //从相册选择、摄像头
|
|
success: function(res) {
|
|
_this.imgShow = res.tempFilePaths[0]
|
|
}
|
|
});
|
|
// ass()
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
this.contractAddress = option.contractAddress;
|
|
this.info = uni.getStorageSync('wallet');
|
|
this.addValue = this.info.coinList[0].xname + ' Address'
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
|
|
</style>
|
|
|
|
<style>
|
|
@import './index.css';
|
|
</style>
|
|
|