<template>
	<view class="container">
		<view class="title">
		   <view>
				<text class="line"></text>从业经历
			</view>
		   <text class="page_mark">2/8</text>
		 </view>
		 <view class="content">
			<view class="contentDetail employ">
			   <view class="contentItem">
			    <text>职业类型</text>
				<picker @change="changeIndustry" :value="industryName" :range="industry"
				range-key="industryName">
					<view class="uni-input">{{industry[industryIdx]['industryName']}}
						<text class="iconfont icon-youjiantou"></text>
					</view>
				</picker>
			   </view>
			</view>
		    <view class="contentDetail employ">
		      <view class="contentItem">
		        <text>最近一次工作单位</text>
		        <input type="text" class="form-control" placeholder="非必填" v-model="applyParam.workingCompany" />
		      </view>
			  <view class="contentItem">
			    <text>职位</text>
			    <input type="text" class="form-control" placeholder="非必填" v-model="applyParam.position"/>
			  </view>
			  <view class="contentItem">
			    <text>任职开始时间</text>
			    <picker mode="date" :value="applyParam.workingStart" @change="bindWorkingStart">
			    	<view v-if="!applyParam.workingStart">请选择<text class="iconfont icon-youjiantou"></text></view>
					<view class="uni-input" v-if="applyParam.workingStart">{{applyParam.workingStart}}<text class="iconfont icon-youjiantou"></text></view>
			    </picker>
			  </view>
			  <view class="contentItem">
			    <text>结束时间</text>
			    <picker mode="date" :value="applyParam.workingEnd" @change="bindWorkingEnd">
			    	<view v-if="!applyParam.workingEnd">请选择<text class="iconfont icon-youjiantou"></text></view>
			    	<view class="uni-input" v-if="applyParam.workingEnd">{{applyParam.workingEnd}}<text class="iconfont icon-youjiantou"></text></view>
			    </picker>
			  </view>
			  <view class="contentItem" style="border: 0;">
			    <text>荣誉证书</text>
			  </view>
		    </view>
			<view class="photo_wrapper" >
			  <text class="iconfont icon-weibiaoti553"></text>
			  <view style="margin-top: 10px;">点击添加荣誉证书照片</view>
			</view>
			<view class="tips">
			  <view>（jpg,png 文件大小不大于1mb）</view>
			</view>
		</view>
		 <view class="fixed" @click="saveInfo()">
		   保存并下一步
		 </view>
	</view>
</template>

<script>
	import api from '../../api/api';
	export default{
		data(){
			return {
				industry:[{industryName:'请选择',industryId:null}],
				industryIdx:0,
				applyParam:{
					workingCategoryId:'',
					workingCompany:'',
					position:'',
					workingStart:'',
					workingEnd:'',
					certificate:'',
				}
			}
		},
		components:{},
		onLoad(){
			this.occupationQry();
		},
		methods:{
			changeIndustry: function(e){
				this.industryIdx = e.detail.value;
				// this.workingCategory = this.industry[this.industryIdx]['industryName'];
				this.applyParam.workingCategoryId = this.industry[this.industryIdx]['industryId'];
			},
			bindWorkingStart:function(e){
				this.applyParam.workingStart = e.detail.value;
			},
			bindWorkingEnd:function(e){
				this.applyParam.workingEnd = e.detail.value;
			},
			occupationQry(){
				api.occupationQry({insurerId:2}).then((res)=>{
					if(res['success']){
						console.log(res['data']['industry'])
						this.industry = this.industry.concat(res['data']['industry']);
					}else{
						this.industry = [{industryName:'请选择',industryId:null}];
					}
				})
			},
			saveInfo(){
				uni.setStorageSync('applyParam',JSON.stringify(this.applyParam))
				uni.navigateTo({
					url:'id-card'
				})
			}
		}
	}
</script>

<style lang="scss">
	@import 'applyCommon.scss';
</style>