<template>
	<view class="">
		<navigation :showBack="true" :bgnum="true">
			<text class="big_title">
				Manage wallet
			</text>
			<text class="renYou" @click="goMwallett()">Add to</text>
		</navigation>
		<view class="main flexx">
			<view class="imgcon">
				<image @click="getHeight('one')" ref="one"   src="../../../../static/tongyonh/filter-left.png" mode="aspectFit" class="letConimg"></image>
			    <image @click="getHeight('btc')" ref="btc" src="../../../../static/tongyonh/bye.png" mode="aspectFit" class="letConimg"></image>
			<image @click="getHeight('eth')"  ref="eth"  src="../../../../static/tongyonh/Frame3299.png" mode="aspectFit" class="letConimg"></image>
			<image @click="getHeight('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" v-for="item,index in walletInfoBTC" v-if="type=='btc' || typeBoll==false">
		 <view class="left flex">
		 	<image src="../../../../static/tongyonh/btc_icon.png" mode="aspectFit" class="img1"></image>
		   <view class="textcon"> 
		   	<view class="text1">
		   		{{item.coinList[0].name}}
		   	</view>
			<view class="text2">
				{{item.address}}
			</view>
		   </view>
		 </view>	
		 <view class="rig">
<image src="../../../../static/tongyonh/ellipsis.png" mode="aspectFit" class="img1" @click="goManager(item,index)"></image>	 
  {{item.balance}}
		 </view>
		</view>
		
	<view class="item flexx pur"   v-for="item,index in walletInfoETH" v-if="type=='eth' || typeBoll==false">
	 <view class="left flex">
	 	<image src="../../../../static/tongyonh/ETH_icon.png" mode="aspectFit" class="img1"></image>
	   <view class="textcon"> 
	   	<view class="text1">
	   	{{item.coinList[0].name}}
	   	</view>
		<view class="text2">
		{{item.address}}
		</view>
	   </view>
	 </view>	
	 <view class="rig">
		 <image src="../../../../static/tongyonh/ellipsis.png" mode="aspectFit" class="img1"  @click="goManager(item,index)"></image>
	 {{item.balance}}
	 </view>
	
	</view>
	
		
		<view class="item flexx red" v-for="item,index in walletInfoTRX" v-if="type=='trx' || typeBoll==false">
		 <view class="left flex">
		 	<image src="../../../../static/tongyonh/tron_icon.png" mode="aspectFit" class="img1"></image>
		   <view class="textcon"> 
		   	<view class="text1">
		 {{item.coinList[0].name}}
		   	</view>
			<view class="text2">
			{{item.address}}
			</view>
		   </view>
		 </view>	
		 <view class="rig">
			 <image src="../../../../static/tongyonh/ellipsis.png" mode="aspectFit" class="img1"  @click="goManager(item,index)"></image>
		{{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,
				walletInfoBTC:[],
				walletInfoETH:[],
				walletInfoTRX:[],
				walletInfo:{},
				walletInfo2:{},
						}
		},
		methods: {
			goMwallett(){
				console.log(1111)
				uni.navigateTo({
					url:'../add/index'
				})
			},
		getHeight(type){
			console.log(111)
			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() {
				// this.walletInfo.walletPassword = this.$store.state.noBackupWalletInfo.walletPassword
				this.walletInfo = uni.getStorageSync('walletInfo');
				this.walletInfo2 = uni.getStorageSync('walletInfo');
				this.walletInfoBTC=this.walletInfo.BTC;
				for(var i=0;i<this.walletInfoBTC.length;i++){
			this.walletInfoBTC[i].address = this.walletInfoBTC[i].address.substring(0, 6)+'...'+this.walletInfoBTC[i].address.substring(25,this.walletInfoBTC[i].address.length);		
				}
				this.walletInfoETH=this.walletInfo.ETH;
				for(var i=0;i<this.walletInfoETH.length;i++){
				this.walletInfoETH[i].address = this.walletInfoETH[i].address.substring(0, 6)+'...'+this.walletInfoETH[i].address.substring(25,this.walletInfoETH[i].address.length);		
					}
				this.walletInfoTRX=this.walletInfo.TRON;
				for(var i=0;i<this.walletInfoTRX.length;i++){
				this.walletInfoTRX[i].address = this.walletInfoTRX[i].address.substring(0, 6)+'...'+this.walletInfoTRX[i].address.substring(25,this.walletInfoTRX[i].address.length);		
					}
				console.log(this.walletInfo,111111)
			},
			goManager(itemm,index){
				uni.setStorageSync('nameIndex',index)
				if(itemm.coinList[0].xname=='Bitcoin'){
					let item = JSON.stringify(this.walletInfo2.BTC[index])
					uni.navigateTo({
						url:'../../../menu/wallet/mwallet/manage/index?item='+item
					})
				}
			if(itemm.coinList[0].xname=='Ethereum'){
				let item = JSON.stringify(this.walletInfo2.ETH[index])
				uni.navigateTo({
					url:'../../../menu/wallet/mwallet/manage/index?item='+item
				})
			}
			if(itemm.coinList[0].xname=='TRON'){
				let item = JSON.stringify(this.walletInfo2.TRON[index])
				uni.navigateTo({
					url:'../../../menu/wallet/mwallet/manage/index?item='+item
				})
			}
			},
			
			
			
		},
		onLoad() {
			this.setStorage()
		}
	};
</script>
<style scoped>
	page{
		background: #FAFAFA;
	}
</style>

<style>

	@import './index.css';

</style>
