<template>
	<view>
		<view class="bgPerson">
			<view class="person_info">
				<image class="hread" :src="userInfo.userImage"></image>
				<view class="info">
					<view>{{userInfo.userName}}</view>
					<view>{{userInfo.phoneNumber}}</view>
				</view>

			</view>
		</view>
		<view class="info">
			<view class="orderManage" @click="clickOrderManager" v-if="userInfoQuery.parentId==0">
				<view class="fix" >
					<image class="image" src="../../static/tabar/ic_order_manager.png"></image>
					<view class="title">订单管理</view>
				</view>
				<view>
					<image class="left" src="../../static/tabar/ic_left.png"></image>
				</view>
			</view>
			<u-line class="line" length="90%" v-if="userInfoQuery.parentId==0"></u-line>
			<view class="orderManage" @click="afterSalesOrder" v-if="userInfoQuery.parentId==0">
				<view class="fix">
					<image class="image" src="../../static/tabar/ic_after_sales_order.png"></image>
					<view class="title">售后订单</view>
				</view>
				<view>
					<image class="left" src="../../static/tabar/ic_left.png"></image>
				</view>
			</view>
			<u-line class="line" length="90%" v-if="userInfoQuery.parentId==0"></u-line>
			<view class="orderManage" @click="settlement" v-if="userInfoQuery.parentId==0">
				<view class="fix">
					<image class="image" src="../../static/tabar/ic_settlement_manage.png"></image>
					<view class="title">结算管理</view>
				</view>
				<view>
					<image class="left" src="../../static/tabar/ic_left.png"></image>
				</view>
			</view>
			<u-line class="line" length="90%" v-if="userInfoQuery.parentId==0"></u-line>
			<view class="orderManage" @click="changePassword">
				<view class="fix">
					<image class="image" src="../../static/tabar/ic_change_password.png"></image>
					<view class="title">修改密码</view>
				</view>
				<view>
					<image class="left" src="../../static/tabar/ic_left.png"></image>
				</view>
			</view>
			<u-line class="line" length="90%"></u-line>
			<view class="excLogin" @click="excLogin">退出登录</view>
		</view>
		<!-- <tabBar :pageIndex="pageVal" :textType="1" @toTab="toTab"></tabBar> -->
	</view>
</template>

<script>
	// import tabBar from '@/components/Madman-tabBar/tabBar.nvue';
	export default {
		components: {
			// tabBar
		},
		data() {
			return {
				pageVal: "",
				userInfo:{},
				userInfoQuery:{}
			}
		},
		// onLoad(opt) {
		// 	this.pageVal = opt.id ? Number(opt.id) : ''	
		// },
		mounted() {
			this.userInfoQuery=uni.getStorageSync('userInfo')
			this.getuserInfo()
		},
		onShow() {
			
		},
		methods: {
			getuserInfo(){
				this.$http.get('/api/store/personalCenter/userInfo').then(res=>{
					this.userInfo = res.data
				})
			},
		

			toTab(data) {
				console.log(data);
				uni.switchTab({
					url: data.pageUrl,
					complete: (res) => {
						console.log(res,'tab');
					}
				})
			},
			clickOrderManager() {
				uni.navigateTo({
					url: '/pages/orderManagement/orderManagement'
				})
			},
			afterSalesOrder() {
				uni.navigateTo({
					url: '/pages/afterSalesOrder/afterSalesOrder'
				})
			},
			settlement() {
				uni.navigateTo({
					url: '/pages/settlementManagement/settlementManagement'
				})
			},
			changePassword() {
				uni.navigateTo({
					url: '/pages/changePassword/changePassword'
				})
			},
			excLogin(){
				uni.clearStorageSync()
				uni.reLaunch({
					url: '/pages/login/login'
				})
			}
		}
	}
</script>

<style lang="scss">
	.excLogin{
		text-align: center;
		width: 702rpx;
		height: 100rpx;
		background: linear-gradient( 90deg, #FF4502 0%, #FF8903 100%);
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		color: white;
		line-height: 100rpx;
		position: absolute;
		bottom: 10%;
	}
	.info {
		padding: 24rpx;
	}

	.left {
		width: 10rpx;
		height: 20rpx;
		padding-right: 40rpx;
	}

	.line {
		padding-left: 20rpx;
		padding-top: 10rpx;
	}

	.orderManage {
		padding: 24rpx;
		display: flex;
		justify-content: space-between;
		text-align: center;

		.fix {
			display: flex;

			.image {
				width: 39rpx;
				height: 39rpx;
			}

			.title {
				padding-left: 10rpx;
				font-size: 28rpx;
				color: #333333;
			}
		}

	}

	.bgPerson {
		width: 100%;
		height: 500rpx;
		background-size: 100% 100%;
		background-image: url('/static/bg/bg_preson.png');

		.person_info {
			padding-top: 151rpx;
			display: flex;
			padding-left: 24rpx;

			.info {
				padding-left: 20rpx;
				font-size: 32rpx;
				color: #FFFFFF;
			}
		}

		.hread {
			height: 126rpx;
			width: 126rpx;
		}
	}
</style>