<template>
	<view class="page" style="padding: none!important;">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<view>
			<view class="infoTitle">基本信息</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>姓名</view>
				<view class="d-flex a-center info">{{sysUser.name}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>会员号</view>
				<view class="d-flex a-center info">{{sysUser.id}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>性别</view>
				<view class="d-flex a-center info">{{sysUser.sex}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>职级</view>
				<view class="d-flex a-center info">{{sysUser.jobCode}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>电话</view>
				<view class="d-flex a-center info">{{sysUser.mobile}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>身份证号</view>
				<view class="d-flex a-center info">{{esmUserInternal.identity}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>出生日期</view>
				<view class="d-flex a-center info">{{esmUserInternal.birthday}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>居住地址</view>
				<view class="d-flex a-center info">{{esmUserInternal.addressnow}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>注册时间</view>
				<view class="d-flex a-center info">{{esmUserInternal.intime}}</view>
				<view></view>
			</view>
		</view>
		<view>
			<view class="infoTitle">影像信息</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>影像</view>
				<view class="d-flex a-center info main-text-color" @tap="toAddImageData" >查看</view>
				<view></view>
			</view>
		</view>
		
		<view style="padding-bottom: 30upx;" v-if="showRecommend">
			<view class="infoTitle">业务信息</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>推荐人</view>
				<view class="d-flex a-center info">{{recommenderId}}({{recommenderName}})</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>所属机构</view>
				<view class="d-flex a-center info">{{recommenderComname}}</view>
				<view></view>
			</view>
			<view class="user-set-userinfo-list d-flex a-center j-sb">
				<view>所属团队</view>
				<view class="d-flex a-center info">{{recommenderTeam}}</view>
				<view></view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {mapState} from "vuex"
	export default {
		data() {
			return {
				sysUser:{},
				esmUserInternal:{},
				esmUserAgent:{},
				// 推荐人信息
				showRecommend:false,
				recommenderId:"",
				recommenderName:"",
				recommenderComname:"",
				recommenderTeam:"",
			}
		},
		async onLoad() {
			var sysUser={};
			Object.assign(this.sysUser,this.userInfo.sysUser);
			Object.assign(this.esmUserInternal,this.userInfo.esmUserInternal);
			Object.assign(this.esmUserAgent,this.userInfo.esmUserAgent);

			// 查询推荐人信息
			if(!!this.userCheckInfo.esmUserAgent.recommenderid){
				let res = await this.$http.get('/user/findById?id='+this.userCheckInfo.esmUserAgent.recommenderid);
				if((res.code == '200') && (res.data!= null)){
					this.showRecommend=true;
					this.recommenderId = res.data.id;
					this.recommenderName = res.data.name;
					this.recommenderComname = res.data.comname;
					this.recommenderTeam = res.data.deptname;
				}
			}
			
		},
		computed: {
			...mapState(['userInfo','userCheckInfo']),
		},
		methods: {
			//影像信息
			toAddImageData(){
				this.navigate({
					url: "/pages/user/userInfoImage"
				},"navigateTo",true);
			}
		}
	}
</script>

<style scoped>
.page{
	position:absolute;
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	background-color: #F3F3F3;
}
.infoTitle{
	padding: 20upx;
	font-weight: bold;
	background-color: #F3F3F3;
}
.user-set-userinfo-list{
	background: #FFF;
	padding: 15upx 30upx;
	border-bottom: 1upx solid #F4F4F4;
}
.user-set-userinfo-list>view.info{
	color: #9B9B9B;
	width: 100%;
}
.user-set-userinfo-list>view:first-child{
	width:190upx;
	flex-shrink: 0;
}
.user-set-userinfo-list>view:last-child{
	width:30upx;
	flex-shrink: 0;
}
.user-set-userinfo-list>view:last-child>image{
	width: 80upx;
	height: 80upx;
	border-radius: 100%;
}
.user-set-userinfo-list>view:last-child>input{
	text-align: right;
}
.user-set-userinfo-list>view:last-child>view:last-of-type{
	margin-left: 20upx;
	color: #9B9B9B;
}
</style>
