<template>
	<view class="pad-x120">
		<!-- 头部 -->
		<status-nav navBarTitle="工人详情"></status-nav>
		<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
			<!-- 工人信息 -->
			<view class="enter-detail font26">
				<view class="item">
					<view class="title">姓名</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.real_name:workerDtail.real_name}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.real_name!==workerDtail.check_info.real_name">
							{{workerDtail.real_name}}
						</text>
					</view>
				</view>
				<view class="item">
					<view class="title">电话</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.mobile:workerDtail.mobile}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.mobile!==workerDtail.check_info.mobile">
							{{workerDtail.mobile}}
						</text>
					</view>
				</view>
				<view class="item">
					<view class="title">身份证</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.card_number:workerDtail.card_number}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.card_number!==workerDtail.check_info.card_number">
							{{workerDtail.card_number}}
						</text>
					</view>
				</view>
				<view class="item item-other">
					<view class="title">身份证正面</view>
					<view class="msg">
						<image @tap="previewImageEv(workerDtail.check_info!==''?baseHttps+workerDtail.check_info.id_front:baseHttps+workerDtail.id_front)" :src="workerDtail.check_info.id_front!==''?baseHttps+workerDtail.check_info.id_front:baseHttps+workerDtail.id_front" mode="widthFix"></image>
						<view class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.id_front!==workerDtail.check_info.id_front">
							<image @tap="previewImageEv(baseHttps+workerDtail.id_front)" :src="baseHttps+workerDtail.id_front" mode="widthFix"></image>
						</view>
					</view>
				</view>
				<view class="item item-other">
					<view class="title">身份证反面</view>
					<view class="msg">
						<image @tap="previewImageEv(workerDtail.check_info!==''?baseHttps+workerDtail.check_info.id_back:baseHttps+workerDtail.id_back)" :src="workerDtail.check_info.id_back!==''?baseHttps+workerDtail.check_info.id_back:baseHttps+workerDtail.id_back" mode="widthFix"></image>
						<view class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.id_back!==workerDtail.check_info.id_back">
							<image @tap="previewImageEv(baseHttps+workerDtail.id_back)" :src="baseHttps+workerDtail.id_back" mode="widthFix"></image>
						</view>
					</view>
				</view>
				<view class="item">
					<view class="title">紧急联系人</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.emergency_contact:workerDtail.emergency_contact}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.emergency_contact!==workerDtail.check_info.emergency_contact">
							{{workerDtail.emergency_contact}}
						</text>
					</view>
				</view>
				<view class="item">
					<view class="title">联系人电话</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.emergency_phone:workerDtail.emergency_phone}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.emergency_phone!==workerDtail.check_info.emergency_phone">
							{{workerDtail.emergency_phone}}
						</text>
					</view>
				</view>
				<view class="item">
					<view class="title">银行卡户名</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.bank_card_name:workerDtail.bank_card_name}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.bank_card_name!==workerDtail.check_info.bank_card_name">
							{{workerDtail.bank_card_name}}
						</text>
					</view>
				</view>
				<view class="item">
					<view class="title">银行卡号</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.bank_card_number:workerDtail.bank_card_number}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.bank_card_number!==workerDtail.check_info.bank_card_number">
							{{workerDtail.bank_card_number}}
						</text>
					</view>
				</view>
				<view class="item">
					<view class="title">开户行</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.bank_name:workerDtail.bank_name}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.bank_name!==workerDtail.check_info.bank_name">
							{{workerDtail.bank_name}}
						</text>
					</view>
				</view>
				<view class="item item-other">
					<view class="title">银行卡照片</view>
					<view class="msg">
						<image @tap="previewImageEv(workerDtail.check_info.bank_card_img!==''?baseHttps+workerDtail.check_info.bank_card_img:baseHttps+workerDtail.bank_card_img)" :src="workerDtail.check_info.bank_card_img!==''?baseHttps+workerDtail.check_info.bank_card_img:baseHttps+workerDtail.bank_card_img" mode="widthFix"></image>
						<view class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.bank_card_img!==workerDtail.check_info.bank_card_img">
							<image @tap="previewImageEv(baseHttps+workerDtail.bank_card_img)" :src="baseHttps+workerDtail.bank_card_img" mode="widthFix"></image>
						</view>
					</view>
				</view>
				<view class="item">
					<view class="title">技术岗位</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.position_name:workerDtail.position_name}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.position_name!==workerDtail.check_info.position_name">
							{{workerDtail.position_name}}
						</text>
					</view>
				</view>
				<view class="item" v-if="workerDtail.certificate!==''">
					<view class="title">证书名称</view>
					<view class="msg font24">
						{{workerDtail.certificate}}
					</view>
				</view>
				<view class="item">
					<view class="title">工资</view>
					<view class="msg font24">
						{{workerDtail.check_info!==''?workerDtail.check_info.pay:workerDtail.pay}}
						<text class="director-arrow" v-if="workerDtail.is_register!==1 && workerDtail.status==0 && workerDtail.pay!==workerDtail.check_info.pay">
							{{workerDtail.pay}}
						</text>元
					</view>
				</view>
				<view class="item item-other">
					<view class="title">工作经验</view>
					<view class="msg font24">
						{{workerDtail.work_experience}}
					</view>
				</view>
				<view class="item">
					<view class="title">现住地址</view>
					<view class="msg font24">
						{{workerDtail.province+workerDtail.city+workerDtail.area+workerDtail.address_now}}
					</view>
				</view>
				<view class="item">
					<view class="title">加入时间</view>
					<view class="msg font24">{{workerDtail.created_at}}</view>
				</view>
			</view>
			<!-- 审核按钮 -->
			<view class="enter-detail-btns color-white font30" v-if="workerDtail.status==0">
				<view class="btn" @tap="submitEv(1)">确认</view>
				<view class="btn" @tap="ifReason=true">退回</view>
			</view>
		</view>
		<!-- 退回理由 -->
		<view class="pop-up-bg" v-if="ifReason">
			<view class="edit-box bg-white">
				<image class="close-btn" src="/static/icon/icon-close-btn.png" mode="aspectFit" @tap="closeReason"></image>
				<view class="title font36">退回理由</view>
				<!-- 其他显示 -->
				<input class="input font26" type="text" v-model="reasonMsg" placeholder="请输入退回理由" placeholder-style="color:rgba(51,51,51,.4)">
				<view class="submit-btn font30 color-white" @tap="submitEv(0)">确认</view>
			</view>
		</view>
		<!-- 尾部 -->
		<tabbar :userType="userType" current="2"></tabbar>
	</view>
</template>
<script>
	import tabbar from '@/components/tabbar/tabbar';
	export default {
		components:{
			tabbar
		},
		data() {
			return {
				statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
				userType:'director', //账户类型 工人：worker 负责人：director
				baseHttps:`${getApp().globalData.hostapi}`,
				workerDtail:{}, //工人信息
				reasonMsg:'', //退回理由
				ifReason:false, //是否退回
				id:0, //工人id
			}
		},
		onLoad(op) {
			if(op.id){
				this.id = op.id;
			}
			if(op.userType){
				this.userType = op.userType;
			}
			// 获取工人信息
			this.getWorkerDetail();
		},
		onShow() {
			
		},
		methods: {
			// 获取工人信息
			getWorkerDetail(){
				this.$requst.post('/api/v1/user/detail',{id:this.id}).then(res=>{
					if(res.code == 0){
						console.log(res,'工人信息');
						this.workerDtail = res.data;
					}
				})
			},
			
			// 图片预览
			previewImageEv(url) {
				//uniapp预览轮播图
				uni.previewImage({
					current: 0, //预览图片的下标
					urls: [url] //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
		}
	}
</script>
<style scoped>
	
</style>