<template>
	<view class="page">
		<uni-nav-bar @clickLeft="goto(1, 1)" left-icon="back"  :border="false" :shadow="false" :fixed="true"
		:title="$t('SelectNetwork.title')" backgroundColor="#fff"></uni-nav-bar>
		<view style="width: 92%; margin: 20rpx auto; background-color: #F8F8F8; padding: 30rpx 20rpx;">
			<uni-row :gutter="0">
				<uni-col :span="2">
					<image src='/static/images/a1.png' style="width: 30rpx; height: 30rpx; margin-top: 4rpx;"></image>
				</uni-col>
				<uni-col :span="22">
					<view style="color: #999; font-size: 28rpx;">
						{{$t('SelectNetwork.text1')}}
					</view>
				</uni-col>
			</uni-row>
			<view style="clear: both;"></view>
		</view>
		<view style="width: 92%; margin: 20rpx auto; padding: 30rpx 20rpx;">
			<uni-row @click.native="switchnetwork('TRC-20')">
				<uni-col :span="4">
					<image style="width: 66rpx; height: 66rpx; margin: 20rpx 10rpx;" src="/static/images/s1.png" fit="cover"></image>
				</uni-col>
				<uni-col :span="18">
					<view style="color: #999; font-size: 28rpx;">
						<view style="font-weight: 600;font-size: 32rpx;color: #333333;">Tron(TRC20)</view>
						<view style="font-weight: 400;font-size: 28rpx;color: #999;" v-if="page=='recharge'">{{$t('SelectNetwork.text2')}}: {{recharge_minimum}} USDT</view>
						<view style="font-weight: 400;font-size: 28rpx;color: #999;" v-if="page=='putforward'">{{$t('SelectNetwork.text3')}}: {{withdrawl_minimum['TRC-20']}} USDT</view>
						<view style="font-weight: 400;font-size: 28rpx;color: #999;">{{$t('SelectNetwork.text4')}}</view>
					</view>
				</uni-col>
				<uni-col :span="2">
					<uni-icons type="checkbox-filled" size="20" v-if="onchick=='TRC-20'" style="color: rgb(64, 158, 255); margin-top: 40rpx;"></uni-icons>
				</uni-col>
			</uni-row>
			<uni-row style="margin-top: 80rpx;" @click.native="switchnetwork('BEP-20')">
			  <uni-col :span="4">
				  <image style="width: 66rpx; height: 66rpx; margin: 20rpx 10rpx;" src="/static/images/s2.png" fit="cover"></image>
			  </uni-col>
			  <uni-col :span="18">
					<view style="color: #999; font-size: 28rpx;">
						<view style="font-weight: 600;font-size: 32rpx;color: #333333;">BSC-BNB Smart Chain(BEP20)</view>
						<view style="font-weight: 400;font-size: 28rpx;color: #999;" v-if="page=='recharge'">{{$t('SelectNetwork.text2')}}: {{recharge_minimum}} USDT</view>
						<view style="font-weight: 400;font-size: 28rpx;color: #999;" v-if="page=='putforward'">{{$t('SelectNetwork.text3')}}: {{withdrawl_minimum['BEP-20']}} USDT</view>
						<view style="font-weight: 400;font-size: 28rpx;color: #999;">{{$t('SelectNetwork.text4')}}</view>
					</view>
			  </uni-col>
			  <uni-col :span="2">
					<uni-icons type="checkbox-filled" size="20" v-if="onchick=='BEP-20'" style="color: rgb(64, 158, 255); margin-top: 40rpx;"></uni-icons>
			  </uni-col>
			</uni-row>
		</view>
	</view>
</template>

<script>
	import zPrompt from '@/components/common/prompt';
	import Popup from '@/components/common/popup';
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		components: {
			Popup,
			zPrompt
		},
		data() {
			return {
				onchick:'TRC-20',
				page:"",
				withdrawl_minimum: 0,
				recharge_minimum: 0,
			};
		},
		computed: {
			...mapState(['userInfo'])
		},
		//第一次加载
		onLoad(e) {
			if(e.network != typeof(undefined)){
				this.onchick=e.network;
			}
			this.page=e.page;
			this.$http.get('/api/common/init?lang='+this.$i18n.locale).then(res => {
				if(this.page=='recharge'){
					this.recharge_minimum = res.data.recharge_minimum;
				}else if(this.page=="putforward"){
					this.withdrawl_minimum = res.data.withdrawl_minimum;
				}
			});
		},
		//页面显示
		onShow() {},
		//方法
		methods: {
			onPageJump(url) {
				uni.navigateTo({
					url: url+""
				});
			},
			goto(url, type) {
			    if (type == 2) {
			        return uni.switchTab({ url: url })
			    }
			    if (type == 1) {
			        return uni.navigateBack({ delta: url });
			    }
			    uni.navigateTo({
			        url: url
			    })
			},
			onTokenJump(url) {
				this.judgeLogin(() => {
					uni.navigateTo({
						url: url
					});
				});
			},
			switchnetwork(network){
				this.onchick = network;
				uni.navigateTo({
					url: "/pages/wallet/"+this.page+"?network="+network
				});
			}
		},
		//页面隐藏
		onHide() {},
		//页面卸载
		onUnload() {},
		//页面下来刷新
		onPullDownRefresh() {},
		//页面上拉触底
		onReachBottom() {},
		//用户点击分享
		onShareAppMessage(e) {
			return this.wxShare();
		}
	};
</script>
<style lang="scss" scoped>
	@import '@/style/mixin.scss';
	body{background-color: #fff;}
	.rechargeTitle{
		font-weight: 400;font-size: 32rpx;color: #999999;line-height: 46rpx; text-align: center; margin-top: 60rpx;
	}
	.rechargeNet{
		font-weight: 600;font-size: 40rpx;color: #333;line-height: 46rpx; text-align: center; margin-top: 40rpx;
	}
</style>