<template>
	<view class="page">
		<nav-bar :title="$t('SelectNetwork.title')" bgColor="#fff"></nav-bar>
		<view style="width: 92%; margin: 10px auto; background-color: #F8F8F8; padding: 15px 10px;">
			<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: 14px;">
						{{$t('SelectNetwork.text1')}}
					</view>
				</uni-col>
			</uni-row>
			<view style="clear: both;"></view>
		</view>
		<view style="width: 92%; margin: 10px auto; padding: 15px 10px;">
			<uni-row @click.native="switchnetwork('TRC-20')">
				<uni-col :span="4">
					<image style="width: 33px; height: 33px; margin: 10px 5px;" src="/static/images/s1.png" fit="cover"></image>
				</uni-col>
				<uni-col :span="18">
					<view style="color: #999; font-size: 14px;">
						<view style="font-weight: 600;font-size: 16px;color: #333333;">Tron(TRC20)</view>
						<view style="font-weight: 400;font-size: 14px;color: #999;" v-if="page=='recharge'">{{$t('SelectNetwork.text2')}}: {{recharge_minimum}} USDT</view>
						<view style="font-weight: 400;font-size: 14px;color: #999;" v-if="page=='putforward'">{{$t('SelectNetwork.text3')}}: {{withdrawl_minimum['TRC-20']}} USDT</view>
						<view style="font-weight: 400;font-size: 14px;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: 40px;" @click.native="switchnetwork('BEP-20')">
			  <uni-col :span="4">
				  <image style="width: 33px; height: 33px; margin: 10px 5px;" src="/static/images/s2.png" fit="cover"></image>
			  </uni-col>
			  <uni-col :span="18">
					<view style="color: #999; font-size: 14px;">
						<view style="font-weight: 600;font-size: 16px;color: #333333;">BSC-BNB Smart Chain(BEP20)</view>
						<view style="font-weight: 400;font-size: 14px;color: #999;" v-if="page=='recharge'">{{$t('SelectNetwork.text2')}}: {{recharge_minimum}} USDT</view>
						<view style="font-weight: 400;font-size: 14px;color: #999;" v-if="page=='putforward'">{{$t('SelectNetwork.text3')}}: {{withdrawl_minimum['BEP-20']}} USDT</view>
						<view style="font-weight: 400;font-size: 14px;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+""
				});
			},
			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: 16px;color: #999999;line-height: 23px; text-align: center; margin-top: 30px;
	}
	.rechargeNet{
		font-weight: 600;font-size: 20px;color: #333;line-height: 23px; text-align: center; margin-top: 20px;
	}
</style>