<template>
	<view class="">
		<navigation :showBack="false" :bgnum="true" class="navbg">
			<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()"></image>
			<text class="big_title">
			{{i18n.cwallet}}
			</text>
			<text class="renYou" @click="goMwallet()">{{i18n.manage}}</text>
		</navigation>
		<view class="main flexx">
			<view class="imgcon">
				<image @click="getHeight('one'),setStorage()" ref="one"   src="../../../../static/tongyonh/filter-left.png" mode="aspectFit" class="letConimg"></image>
			    <image @click="getHeight('btc'),setStorage('BTC')" ref="btc" src="../../../../static/tongyonh/bye.png" mode="aspectFit" class="letConimg"></image>
			<image @click="getHeight('eth'),setStorage('ETH')"  ref="eth"  src="../../../../static/tongyonh/Frame3299.png" mode="aspectFit" class="letConimg"></image>
			<image @click="getHeight('trx'),setStorage('TRX')" ref="trx"  src="../../../../static/tongyonh/tron1.png" mode="aspectFit" class="letConimg"></image>
			</view>
			
			
			
    <view class="bot_con">
    	   <view class="tiao" ref="tiao" :class="{'ethh': type=='eth','btch': type=='btc','trxh': type=='trx'}">
    	   	<!--  -->
    	   </view>
    		<view  class="item flexx" @click="gou(item)" v-for="item,index in walletInfo"  :class="{'pur': item.type=='ETH','red':  item.type=='TRX'}">
    		 <view class="left flex">
    		 	<image src="../../../../static/tongyonh/btc_icon.png" mode="aspectFit" class="img1" v-if="item.type=='BTC'"></image>
				<image src="../../../../static/tongyonh/ETH_icon.png" mode="aspectFit" class="img1" v-if="item.type=='ETH'"></image>
				<image src="../../../../static/tongyonh/tron_icon.png" mode="aspectFit" class="img1" v-if="item.type=='TRX'"></image>
    		   <view class="textcon"> 
    		   	<view class="text1">
    		   		{{item.name}}
    		   	</view>
    			<view class="text2">
    				{{item.ellipsisAddress}}
    			</view>
    		   </view>
    		 </view>
				 <view class="gou" v-if="num==item.address">
				 	<image src="../../../../static/tongyonh/Shape.png" mode="aspectFit" class="img"></image>
				 </view>
    		 <view class="rig">
    		 {{item.balance}}
    		 </view>
    		</view>
    		
    
    		
    	
    
           </view>
    	
	
	

	</view>
		</view>
</template>

<script>
	import cont from "@/components/navigation/navigation.vue"
	import tabBar from "@/components/tabBar/tabBar.vue"
	export default {
		data() {
			return {
				type:'',
				typeBoll:false,
				walletInfo:{},
				walletInfo2:{},
				num:'',
						}
		},
		methods: {
			back(){
			uni.redirectTo({
				url:'../index'
			})
			},
			gou(item){
				var address=item.address;
				var type=item.type; 
				this.$walletUtil.selectWallet(type,address)
				uni.reLaunch({
					url:'../index'
				})
			
		
			},
				goMwallet(){
				uni.navigateTo({
					url:'../mwallet/index'
				})
			},
			getHeight(type){
				if(type=='one'){
				this.type='none'
					this.typeBoll=false;
				}
				if(type=='eth'){
					this.type='eth'
					this.typeBoll=true;
				
				}
			if(type=='btc'){
				this.type='btc'
				this.typeBoll=true;
			}
			if(type=='trx'){
				this.type='trx'
				this.typeBoll=true;
			}
			},

			setStorage(type) {
				if(type){
					this.walletInfo=this.$walletUtil.getWalletList(type)
					console.log(this.walletInfo,22222)
					console.log(this.walletInfo)
				}else{
					this.walletInfo=this.$walletUtil.getWalletList()
					console.log(this.walletInfo,22222)
				}
		
			},
	
			
			
			
		},
		async onLoad() {
			// this.$walletUtil.updateBalance();
			//var a=await this.$EthUtil.getBalance('0x6a851246689eb8fc77a9bf68df5860f13f679fa0');
			// console.log(a)
			this.setStorage()
			if(uni.getStorageSync('walleti')){
				// 存入勾选的
				this.num=uni.getStorageSync('walleti')
			}else{
				// 存入首次勾选的
				this.num=this.walletInfo[0].address
			}
		
		},
		computed: {
			i18n() {
				return this.$t('index')
			},
		}
	};
</script>
<style scoped>
	page{
		background: #FAFAFA;
	}
</style>

<style>

	@import './index.css';

</style>
