<template>
	<view class="">
		<navigation :showBack="true" :bgnum="true">
				Receive 
		</navigation>
		<view class="main">
		    <view class="main_con">
		    	<image src="../../../static/tongyonh/bye.png" mode="aspectFit" class="logoimg" v-if="addressInfo.type=='BTC'"></image>
		      <image src="../../../static/tongyonh/tron1.png" mode="aspectFit" class="logoimg" v-if="addressInfo.type=='TRX'"></image>
			  <image src="../../../static/tongyonh/Frame3299.png" mode="aspectFit" class="logoimg"  v-if="addressInfo.type=='ETH'"></image>
			 <view class="title">
		     	{{addressInfo.type}} Receiving address
		     </view>
			 <view class="code_con">
			 	<tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit" :background="background"
			 		:foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval" :loadMake="loadMake"
			 		:showLoading="showLoading" :loadingText="loadingText" :icon="icon" class="test" />		
			 	</view>
			  <view class="text1">
			  	Scan the QR code to transfer to the asset
			  </view>
			  <view class="bottom_con">
			  <view class="text2">
			  	{{addressInfo.address}}
			  </view>
			  <view class="text3 copy" @click="copyTextMethod">
				  <image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
			 Copy address
			  </view>
			 <!-- <view class="text3">
				  <image src="../../../static/tongyonh/Frame58.png" mode="aspectFit" class="copyImg"></image>
			  Switching address
			  </view> -->
			    </view>
			</view>
			<view class="info_con green"  :class="toTop?'goTop':''">
				<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
				Copy address Successful!
				
				</view>
		</view>
	
		
   
	</view>

</template>

<script>
	import cont from "@/components/navigation/navigation.vue"
	import tkiQrcode from "tki-qrcode"
	export default {
		components: {
			tkiQrcode
		},
		data() {
			return {
	          addressInfo:{},
			  toTop:false,
			  // 二维码的数据
			  showErweiMask: false,
			  ercodeText: '',
			  size: 400,
			  background: '#ffffff',
			  foreground: '#000000',
			  pdground: '#000000',
			  iconsize: 30,
			  lv: 3,
			  onval: true,
			  unit: 'upx',
			  loadMake: true,
			  icon: '',
			  showLoading: true,
			  loadingText: 'One moment please',
			  // 二维码的数据
						}
		},
		methods: {
	copyTextMethod() {
	// #ifdef H5
	    this.$copyText(this.addressInfo.address).then(res => {
	   this.toTop=true;
	   setTimeout(()=>{
	   				 this.toTop=false;
	   },1500)
		
	    })
	    // #endif
	    // #ifdef APP-PLUS
		var that=this
		  console.log(123132)
	    uni.setClipboardData({
	     data: this.addressInfo.address,
	     success() {
			uni.hideToast()
			  that.toTop=true;
			 setTimeout(()=>{
				  that.toTop=false;
			 },1500)
	     }
	    })
	    // #endif
	},
		},
		onLoad(item) {
			this.addressInfo=	uni.getStorageSync('infoWallet')
			console.log(this.addressInfo,111)
		}
	};
</script>
<style scoped>
	page{
		background: #FAFAFA;
		
	}
</style>

<style>

	@import './index.css';

</style>
