<template>
	<view class="content">
		<view class="person">
		<!-- {{touxiang}} -->
			<!-- <image class="person_touxiang" v-else v-if="touxiang=='' || touxiang==null" src="../../static/my/touxiang.png"></image> -->
			<image class="person_touxiang" :src="touxiang"></image>
			<!-- <image class="person_touxiang" src="//wxprivate-1251448646.file.myqcloud.com/campus/avatars/26957/tmp/a2aa26a56e684bcbdc3ceb8c1e791a6b.png?sign=ROA9R0Ny4POhoBnYy00uhMkznzthPTEyNTE0NDg2NDYmYj13eHByaXZhdGUmaz1BS0lEcGFEZzNYNFJhWUs2dVZ0NkI4MnFZN1ZrbGJKckhUVk0mZT0xNzIzMTkwNTU0JnQ9MTcyMzE5MDI1NCZyPTEzNTUxMzc4OTYmZj0vMTI1MTQ0ODY0Ni93eHByaXZhdGUvY2FtcHVzL2F2YXRhcnMvMjY5NTcvdG1wL2EyYWEyNmE1NmU2ODRiY2JkYzNjZWI4YzFlNzkxYTZiLnBuZw==">ww</image> -->
			<text class="person_name">{{cardName}}</text>
			<text class="person_phone">{{cardNum}}</text>
			<text class="person_identity">
				<text v-if="cardIdentity=='0'">其他</text>
				<text v-if="cardIdentity=='1'">学生</text>
				<text v-if="cardIdentity=='4'">教职工</text>
				<text v-if="cardIdentity=='5'">校友</text>
				<text v-if="cardIdentity=='7'">临时人员</text>
			</text>
		</view>
		<!-- 第二部分，我的订单 -->
		<view class="my_order">
			<view class="order_title">我的订单</view>
			<view class="order_all" @click="navigateToAll">全部＞</view>
			<view class="item-list">
			  <view class="item-list-one" @click="navigateToDaizhifu">
			    <image src="../../static/my/no_zhifu.svg" class="img-btn"></image>
			    <text class="list-txt">待支付</text>
			  </view>
			  <view class="item-list-one" @click="navigateToDairuzhu">
			    <image src="../../static/my/dairuzhu.svg" class="img-btn"></image>
			    <text class="list-txt">待入住</text>
			  </view>
			  <view class="item-list-one" @click="navigateToYiruzhu">
			    <image src="../../static/my/yiruzhu.svg" class="img-btn"></image>
			    <text class="list-txt">已入住</text>
			  </view>
			  <view class="item-list-one" @click="navigateToYiquxiao">
			    <image src="../../static/my/yiquxiao.svg" class="img-btn"></image>
			    <text class="list-txt">已取消</text>
			  </view>
			</view>
			<view class="item-list">
				<view class="item-list-one" @click="navigateToYiqtuikuan">
				  <image src="../../static/my/yiquxiao.svg" class="img-btn"></image>
				  <text class="list-txt">已退款</text>
				</view>
			  <view class="item-list-one" @click="navigateToDaijiezhang">
			    <image src="../../static/my/no_pay.svg" class="img-btn"></image>
			    <text class="list-txt">待结账</text>
			  </view>
			  <view class="item-list-one" @click="navigateToYiwancheng">
			    <image src="../../static/my/wancheng.svg" class="img-btn"></image>
			    <text class="list-txt">已完成</text>
			  </view>
			</view>
			<view style="height: 10px;"></view>
		</view>
		<!-- 第三部分，我的服务 -->
		<view class="my_help">
			<view class="help_title">我的服务</view>
			<view class="item-list">
			  <view class="item-list-one" @click="telphone(phone)">
			    <image src="../../static/my/person_phone.svg" class="img-btn"></image>
			    <text class="list-txt">人工热线</text>
			  </view>
			   <!-- -->
			  <view class="item-list-one" @click="navigateToLiucheng" v-if="cardIdentity=='4'">
				   <!-- -->
			    <image src="../../static/my/liucheng.png" class="img-btn"></image>
			    <text class="list-txt">流程管理</text>
			  </view>
			   <!-- -->
			  <!-- <view class="item-list-one" @click="navigateToLiucheng2" v-if="cardIdentity=='4'">
			    <image src="../../static/my/liucheng.png" class="img-btn"></image>
			    <text class="list-txt">教师流程</text>
			  </view> -->
			  <view class="item-list-one" @click="navigateToLiucheng3" v-if="manager=='1'">
				   <!-- -->
			    <image src="../../static/my/liucheng.png" class="img-btn"></image>
			    <text class="list-txt">管理员流程</text>
			  </view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getuserinfo,
		apartSet
	} from '../../utils/api_hotel.js'
	export default {
		data() {
			return {
				phone:'',//客服热线电话
				cardName:localStorage.getItem('name'),//用户名
				cardIdentity:localStorage.getItem('department'),//身份
				cardNum:localStorage.getItem('telephone'),//卡号
				touxiang:localStorage.getItem('head_image'),
				manager:localStorage.getItem('manager'),//1管理员，0不是管理员
			}
		},
		onLoad() {
		},
		onShow() {
			// alert(localStorage.getItem('manager'))
			this.getAllset()
			// alert(localStorage.getItem('usersId'),'id')
			// this.getUserInfo()
		},
		mounted() {
		},
		methods: {
			// 授权获取code
						handleAuthCode() {
							alert('aaa')
							let authCode = this.handleUrlCode().code(); // 截取页面code
							let appId = 'wxd87cbe1db0437303'; // 微信公众号的AppId
							let scope = 'snsapi_userinfo' // 授权
							let redirectUri = 'https%3A%2F%2Fchtech.ncjti.edu.cn%2Fhotel%2Fh5%2F%23%2Fpages%2Fmyself%2Fmyself';//回调地址
							let path = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appId +
								'&redirect_uri=' + redirectUri  + '&response_type=code&scope=' + scope +
								'&state=STATE#wechat_redirect';
							if (authCode == null || authCode == '' || authCode == undefined) {
								alert('a')
								window.location.href = path;
							} else {
								alert('b')
								// this.handleOpenId(authCode);
							}
						},
						
						
			// 获取用户信息
			getUserInfo() {
				let _self = this
				var data="?userId="+localStorage.getItem('usersId')
				getuserinfo(data).then((res) => {
					if (res.success) {
						_self.cardName=res.data.userName
						_self.cardIdentity=res.data.idCardInformation
						// _self.touxiang=res.data.headImage
						return;
					} else {
						console.log('获取用户信息失败')
					}
				}).catch((err) => {
					this.$message.error(err.message)
				});
			},
			//公寓整体配置
			getAllset(){
				let _self = this
				_self.roomType = []
				apartSet().then((res) => {
					if (res.success) {
						this.phone=res.data.phoneNumbr
						return;
					} else {
					}
				}).catch((err) => {
					 //  uni.showModal({
						// content:err.message
					 //  })
				});
			},
			//跳转到全部订单
			navigateToAll(){
				uni.navigateTo({
					url:"/pages/my_orderlist/my_orderlist?Inv=6"
				})
			},
			//跳转到待支付订单
			navigateToDaizhifu(){
				uni.navigateTo({ 
					url: "/pages/my_orderlist/my_orderlist?Inv=1",
				})
			},
			//跳转到待入住订单
			navigateToDairuzhu(){
				uni.navigateTo({ 
					url: "/pages/my_orderlist/my_orderlist?Inv=3"
				})
			},
			//跳转到已入住订单
			navigateToYiruzhu(){
				uni.navigateTo({ 
					url: "/pages/my_orderlist/my_orderlist?Inv=4"
				})
			},
			//跳转到已取消订单
			navigateToYiquxiao(){
				uni.navigateTo({ 
					url: "/pages/my_orderlist/my_orderlist?Inv=9"
				})
			},
			//已退款
			navigateToYiqtuikuan(){
				uni.navigateTo({
					url: "/pages/my_orderlist/my_orderlist?Inv=7"
				})
			},
			//跳转到待结账订单
			navigateToDaijiezhang(){
				uni.navigateTo({ 
					url: "/pages/my_orderlist/my_orderlist?Inv=5"
				})
			},
			//跳转到已完成订单
			navigateToYiwancheng(){
				uni.navigateTo({ 
					url: "/pages/my_orderlist/my_orderlist?Inv=8"
				})
			},
			//拨打人工热线
			telphone(phone){
				uni.makePhoneCall({ phoneNumber: phone }) // 传参带入号码即可
			},
			//跳转到临时人员流程管理
			navigateToLiucheng(){
				uni.navigateTo({
					url: "/pages/liuchengO/liu_other"
				})
			},
			//跳转到流程管理
			navigateToLiucheng2(){
				uni.navigateTo({
					url: "/pages/liuchengTeacher/liu_teach"
					// url: "../liuchengO/liu_other"
					// url:"../liuchengManger/liu_manage"
				})
			},
			//跳转到流程管理
			navigateToLiucheng3(){
				uni.navigateTo({
					// url: "../liuchengTeacher/liu_teach"
					// url: "../liuchengO/liu_other"
					url:"/pages/liuchengManger/liu_manage"
				})
			},
			//跳转到房间报修
			navigateToBaoxiu(){
				window.location.href='https://jtishfw.ncjti.edu.cn/baoxiu/repair-h5/#/'
			}
		}
	}
</script>

<style>
	@import url("./css/myself.css");
</style>