<template>
	<view class="phone-jianli-page">
		<view class="icon-title-navBar-box">
			<view @click="goUpPage" class="nav-bar-icon"></view>
			<text class="nav-bar-title">家政人员信息</text>
		</view>
		<view class="jianli-wrap-box">
			<view class="jianli-head-box">
				<view class="head-img-box">
					<img class="head-img" :src="jianliInfo.icon" v-if="jianliInfo.icon">
					<icon class="phone-default-userImg" v-else></icon>
					<view class="head-status">{{jianliInfo.zhuangtai}}</view>
				</view>
				<view class="head-content-box">
					<view class="name-row">{{jianliInfo.realName}}</view>
					<view>
						{{jianliInfo.jiguanShengName === jianliInfo.jiguanShiName ? jianliInfo.jiguanShengName  : `${jianliInfo.jiguanShengName} ${jianliInfo.jiguanShiName}`}}人
					</view>
					<view>
						<text>{{jianliInfo.nianling}}岁</text>
						<text v-if="jianliInfo.jingyan"> | {{jianliInfo.jingyan}}</text>
					</view>
				</view>
			</view>

			<view class="jianli-body-box">
				<view class="leixing-row">
					<view class="jbxx-label">类 型：</view>
					<text class="leixing-content">{{jianliInfo.leixing}}</text>
				</view>
				<view class="body-jbxx-box">
					<view class="jbxx-title">基本信息</view>
					<view>
						<view class="jbxx-label">学 历：</view>{{jianliInfo.xueli}}
					</view>
					<view>
						<view class="jbxx-label">民 族：</view>{{jianliInfo.minzu}}
					</view>
					<view>
						<view class="jbxx-label">属 相：</view>{{jianliInfo.shuxiang}}
					</view>
					<view>
						<view class="jbxx-label">星 座：</view>{{jianliInfo.xingzuo}}
					</view>
					<view>
						<view class="jbxx-label">性 别：</view>{{jianliInfo.gender}}
					</view>
					<view>
						<view class="jbxx-label">婚姻状况：</view>{{jianliInfo.hunyin}}
					</view>
					<view>
						<view class="jbxx-label">现住地址：</view>{{jianliInfo.juzhuDizhi}}
					</view>
					<view>
						<view class="jbxx-label">家政公司：</view>{{jianliInfo.jzName}}
					</view>
					<view class="jbxx-tip">{{jianliInfo.tips}} </view>
				</view>
			</view>
			<view class="jianli-bottom-box">
				<view @click="goJiazhengManage">
					<icon class="bottom-icon zl-icon"></icon>
					<text class="bottom-text">资料编辑</text>
				</view>
				<view @click="callPhone">
					<icon class="bottom-icon tel-icon"></icon>
					<text class="bottom-text">拨打电话</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		ref
	} from "vue";
	import {
		getJiazhengJianli
	} from "@/api/jiazheng.js";
	export default {
		data() {
			return {
				pageInfo: {},
				jianliInfo: {}
			}
		},
		components: {

		},
		onLoad(options) {
			let data = JSON.parse(options.pageInfo)
			this.pageInfo.status = data.status
			this.pageInfo.id = data.id
			this.pageInfo.userId = data.userId
			this.pageInfo.from = data.from
			this.getJianliInfo()
		},
		methods: {
			getJianliInfo() {
				let req = {
					id: this.pageInfo.id,
					userId: this.pageInfo.userId
				}
				getJiazhengJianli(req).then(res => {
					console.log('res', res);
					if (res.code == 0) {
						this.jianliInfo = {
							...res.data
						};
					}
				})
			},
			callPhone() {
				if (this.jianliInfo.userName) {
					uni.makePhoneCall({
						phoneNumber: this.jianliInfo.userName
					});
				} else {
					uni.showToast({
						title: `无电话号`,
						icon: 'none',
						duration: 2000
					})
					return false
				}

			},
			goJiazhengManage() {
				let pageInfo = {
					status: 'edit',
					id: this.pageInfo.id,
					userId: this.pageInfo.userId
				}
				uni.redirectTo({
					url: "/pages/admin/Jiazheng/jiazhengUserManager?pageInfo=" + JSON.stringify(pageInfo)
				})
			},
			goUpPage() {
				if(this.pageInfo.from =='banzheng'){
					uni.redirectTo({
						url: "/pages/admin/banzheng/list"
					})
				}else{
					uni.redirectTo({
						url: "/pages/admin/Jiazheng/index"
					})
				}
			
			},

		}
	}
</script>