<template>
	<view>
		<view class="head">
			<view class="portrait">
				<image class="image" src="../../static/images/login/logo.png" mode="scaleToFill"></image>
			</view>
			<view>
				<view class="nickname">{{nickname}}</view>
				<view>
					<text v-show="user_type===3" class="wddz">网店店主</text>
					<text v-show="user_type===2" class="zgcj">直供厂家</text>
				</view>
			</view>
			<view class="invite">
				<view class="invite-code">邀请码：H00000164</view>
				<view class="invite-progress">
					<view class="item active"></view>
					<view class="item active"></view>
					<view class="item active"></view>
					<view class="item"></view>
					<view class="item"></view>
				</view>
				<view class="invite-notes">再邀请3人获得代理会员</view>
			</view>
		</view>
		<view class="body">
			<view class="money">
				<view class="row">
					<view class="col">可提现金额(元)：<text class="warning">8.86</text></view>
					<view class="col"><button class="btn tixian-btn">立即提现</button></view>
				</view>
				<view class="row">
					<view class="col">保证金(元)：<text>0.00</text><text class="tips">（保证金2000元）</text></view>
					<view class="col"><button class="btn jiaona-btn">立即缴纳</button></view>
				</view>
			</view>
			<view class="vip-center">
				<view class="text">代理会员中心<text class="sub">（特权独享）</text></view>
			</view>

			<view class="menu">
				<view class="menu-item">
					<view class="icon">
						<image class="image" src="../../static/images/menu/b8.png" mode="scaleToFill"></image>
					</view>
					<view class="name">账单明细</view>
				</view>
				<view class="menu-item">
					<navigator url="/pages/order/order" open-type="navigate">
						<view class="icon">
							<image class="image" src="../../static/images/menu/b7.png" mode=""></image>
						</view>
						<view class="name">订单管理</view>
					</navigator>
				</view>
				<view>
					<navigator url="/pages/product/my-product" open-type="navigate">
						<view class="icon">
							<image class="image" src="../../static/images/menu/b2.png" mode=""></image>
						</view>
						<view class="name">我的商品</view>
					</navigator>
				</view>
				<view>
					<navigator url="/pages/user/strategy" open-type="navigate">
						<view class="icon">
							<image class="image" src="../../static/images/menu/b1.png" mode=""></image>
						</view>
						<view class="name">新手攻略</view>
					</navigator>
				</view>
			</view>
			<view class="menu">
				<view>
					<navigator url="/pages/user/problem" open-type="navigate">
						<view class="icon">
							<image class="image" src="../../static/images/menu/b3.png" mode=""></image>
						</view>
						<view class="name">常见问题</view>
					</navigator>
				</view>
				<view>
					<navigator url="/pages/user/kefu" open-type="navigate">
						<view class="icon">
							<image class="image" src="../../static/images/menu/b4.png" mode=""></image>
						</view>
						<view class="name">联系客服</view>
					</navigator>
				</view>
				<view>
					<navigator url="/pages/user/notice" open-type="navigate">
						<view class="icon">
							<image class="image" src="../../static/images/menu/b5.png" mode=""></image>
						</view>
						<view class="name">官方公告</view>
					</navigator>
				</view>
				<view>
					<view class="icon">
						<image class="image" src="../../static/images/menu/b6.png" mode=""></image>
					</view>
					<view class="name">意见反馈</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'

	export default {
		data() {
			return {
				balance: '',
				deposit: ''
			};
		},
		computed: mapState({
			nickname: state => state.user.nickname,
			user_type: state => state.user.group_id
		}),
		onNavigationBarButtonTap(e) {
			// console.log(e)
			switch (e.index) {
				case 0:
					uni.navigateTo({
						url: '/pages/user/setting'
					});
					break;
				case 1:
					uni.navigateTo({
						url: '/pages/message/message'
					});
					break;
				default:
					break;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.head {
		background: $primary-color;
		display: flex;
		align-items: center;
		padding-bottom: 140upx;
		padding-top: 20upx;
	}

	.portrait {
		margin: 0 20upx;

		.image {
			width: 128upx;
			height: 128upx;
			background: white;
			border-radius: 128upx;
			border: 10upx solid rgba(255, 255, 255, 0.2);
		}
	}

	.nickname {
		font-size: 30upx;
		color: white;
		margin-bottom: 10upx;
	}

	.wddz,
	.zgcj {
		font-size: 24upx;
		color: white;
		border: 2upx solid white;
		border-radius: 20upx;
		width: 140upx;
		height: 36upx;
		line-height: 36upx;
		text-align: center;
		text-indent: 20upx;
		display: inline-block;
		padding: 0;
		background: url(../../static/images/do.png) no-repeat;
		background-size: 21upx 21upx;
		background-position: 10upx;
	}

	.invite {
		text-align: right;
		flex-grow: 1;
		margin-right: 20upx;
		color: white;

		.invite-code {
			font-size: 30upx;
		}

		.invite-notes {
			font-size: 24upx;
		}

		.invite-progress {
			.item {
				border: 2upx solid white;
				display: inline-block;
				width: 36upx;
				transform: scaleX(0.9);
				font-size: 0;
				border-radius: 2upx;

				&.active {
					border-color: yellow;
				}
			}

			&::after {
				content: "";
				background: url(../../static/images/vip.png) no-repeat;
				background-size: 42upx 42upx;
				width: 42upx;
				height: 42upx;
				display: inline-block;
				position: relative;
				top: 16upx;
			}

			margin-bottom: 20upx;
		}
	}

	.body {
		padding: 20upx;
		position: relative;
		top: -120upx;

		.money {
			background: white;
			border-radius: 20upx;
			padding: 20upx;

			.row {
				color: #333;
				display: flex;
				align-items: center;
				margin-bottom: 20upx;

				.warning {
					color: $primary-color;
					font-weight: bold;
				}

				.tips {
					color: #CCC;
					font-size: 24upx;
				}

				&:last-child {
					margin-bottom: 0;
				}

				& .col:first-child {
					flex-grow: 1;
					font-size: 28upx;
				}

				& .col:last-child {
					text-align: right;
					font-size: 28upx;
				}
			}

			.btn {
				background-color: $primary-color;
				color: white;
				font-size: 26upx;
				padding: 5upx 20upx;
				border-radius: 40upx;
				line-height: normal;
			}
		}
	}

	.vip-center {
		background: url(../../static/images/center5.png) no-repeat;
		background-size: 710upx 78upx;
		color: #EEEEEE;
		padding: 0 20upx;
		margin-top: 20upx;

		.text {
			margin-left: 50upx;
			background-color: #ff5454;
			font-weight: bold;
			line-height: 76upx;

			.sub {
				font-size: 24upx;
			}
		}
	}

	.menu {
		display: flex;
		background: white;
		border-radius: 20upx;
		padding: 30upx 20upx;
		margin-top: 20upx;
		justify-content: space-between;

		.name {
			font-size: 28upx;
			margin-top: 10upx;
		}

		.icon {
			text-align: center;
		}

		.icon .image {
			width: 50upx;
			height: 50upx;
		}
	}
</style>
