<template>
	<view>
		<view class="person_box">
			<image :src="userInfo.avatar" class="avatar"></image>
			<view class="nickname">{{userInfo.username}}</view>
		</view>
		<view class="cnt-box">
			<view class="title">用户功能</view>
			<view class="li_box" @click="returnOrder">
				<view class="li_left">
					<image src="../../../static/image/icon-order.png" style="width: 40rpx; height: 40rpx;margin-right: 13rpx;"></image>
					我的订单
				</view>
				<image src="../../../static/image/icon-arrow-right.png" style="width: 40rpx; height: 40rpx;"></image>
			</view>
			<view class="li_box" @click="returnAddress">
				<view class="li_left">
					<image src="../../../static/image/icon-address.png" style="width: 40rpx; height: 40rpx;margin-right: 13rpx;"></image>
					收货地址管理
				</view>
				<image src="../../../static/image/icon-arrow-right.png" style="width: 40rpx; height: 40rpx;"></image>
			</view>
			<view class="li_box" @click="returnContact">
				<view class="li_left">
					<image src="../../../static/image/icon-contact.png" style="width: 40rpx; height: 40rpx;margin-right: 13rpx;"></image>
					售货服务
				</view>
				<image src="../../../static/image/icon-arrow-right.png" style="width: 40rpx; height: 40rpx;"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {}
			}
		},
		onShow() {
			let userInfo = uni.getStorageSync('userInfo');
			if (userInfo) {
				this.userInfo = JSON.parse(userInfo);
				if(this.userInfo.id == undefined) {
					this.userInfo.avatar = this.userInfo.avatarUrl;
					this.userInfo.username = this.userInfo.nickName;
				}
			}
		},
		methods: {
			returnOrder(){
				uni.navigateTo({
					url:"/pages/pages_zhentou/order/order"
				})
			},
			returnContact(){
				uni.navigateTo({
					url:"/pages/pages_zhentou/myPage/address"
				})
			},
			returnAddress(){
				uni.navigateTo({
					url:"/pages/pages_zhentou/myPage/address"
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.person_box{
	display: flex;
	align-items: center;
	margin: 30rpx;
	padding: 30rpx;
	background-color: #fff;
	border-radius: 30rpx;
	.avatar{
		width: 100rpx;
		height: 100rpx;
		background: #D6D6D6;
		border-radius: 20rpx;
		margin-right: 30rpx;
	}
	.nickname{
		color: #333;
		font-size: 32rpx;
		font-weight: bold;
		font-family: PingFang SC-Bold, PingFang SC;
	}
}
.cnt-box{
	min-height: calc(100vh - 220rpx - 30rpx);
	background-color: #fff;
	margin: 0 30rpx;
	border-radius: 30rpx;
	.title{
		font-size: 28rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #333333;
		line-height: 40rpx;
		padding: 30rpx 30rpx 42rpx 30rpx;
	}
}
.li_box{
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 26rpx;
	font-family: PingFang SC-Bold, PingFang SC;
	font-weight: bold;
	color: #333333;
	line-height: 37rpx;
	margin: 0 16rpx 52rpx 30rpx;
	.li_left{
		display: flex;
		align-items: center;
	}
}
</style>
