<template>
	<view class="">
		<navigation :showBack="true" :bgnum="true">
			<text class="big_title">
				Manage wallet
			</text>
			<text class="renYou" @click="goMwallet">Add to</text>
		</navigation>
		<view class="main flexx">
			<view class="imgcon">
				<image @click="getHeight('one')" id="one"  src="../../../../static/tongyonh/filter-left.png" mode="aspectFit" class="letConimg"></image>
			    <image @click="getHeight('btc')" id="btc" src="../../../../static/tongyonh/bye.png" mode="aspectFit" class="letConimg"></image>
			<image @click="getHeight('eth')" id="eth" src="../../../../static/tongyonh/Frame3299.png" mode="aspectFit" class="letConimg"></image>
			<image @click="getHeight('trx')" id="trx" src="../../../../static/tongyonh/tron1.png" mode="aspectFit" class="letConimg"></image>
			</view>
			
			
			
       <view class="bot_con"> 
	   <view class="tiao" id="tiao">
	   	<!--  -->
	   </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)"></image>	 
		0.00
		 </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)"></image>
	0.00
	 </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)"></image>
		0.00
		 </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:{},
						}
		},
		methods: {
			getHeight(type){
				if(type=='one'){
					var a=document.getElementById('one').offsetTop;
					var b=a-57;
					document.getElementById('tiao').style.top=b+"px";
					this.typeBoll=false;
				}
				if(type=='eth'){
					var a=document.getElementById('eth').offsetTop;
					var b=a-57;
					document.getElementById('tiao').style.top=b+"px";
					this.type='eth'
					this.typeBoll=true;
				}
			if(type=='btc'){
				var a=document.getElementById('btc').offsetTop;
				var b=a-57;
				document.getElementById('tiao').style.top=b+"px";
				this.type='btc'
				this.typeBoll=true;
			}
			if(type=='trx'){
				var a=document.getElementById('trx').offsetTop;
				var b=a-57;
				document.getElementById('tiao').style.top=b+"px";
				this.type='trx'
				this.typeBoll=true;
			}
			},
			goMwallet(){
				uni.navigateTo({
					url:'../add/index'
				})
			},
			setStorage() {
				// this.walletInfo.walletPassword = this.$store.state.noBackupWalletInfo.walletPassword
				this.walletInfo = 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){
				console.log(itemm)
				let item = JSON.stringify(itemm)
				uni.navigateTo({
					url:'../../../menu/wallet/mwallet/manage/index?item='+item
				})
			},
			
			
			
		},
		onLoad() {
			var walletInfo = new Object();
			walletInfo =uni.getStorageSync('walletInfo')
			if(walletInfo == ''){
				uni.reLaunch({
					url:'/pages/register/index'
				})
			}
			this.setStorage()
		}
	};
</script>
<style scoped>
	page{
		background: #FAFAFA;
	}
</style>

<style>

	@import './index.css';

</style>
