<template>
	<view class="vac-form">
		<!-- 展示内容 -->
		<view v-if="edidflag" class="boxa">
			<uni-forms :modelValue="formData" label-width="110" class="boxflex1">
				<!-- 基本信息 -->
				<uni-group title="基本信息" top="0">
					<uni-forms-item required label="身份证号">
						<view class="form_zhan" :class="formData.idCard?'':'nodata'">{{formData.idCard||'暂无信息'}}</view>
					</uni-forms-item>
					<uni-forms-item required label="姓名">
						<view class="form_zhan" :class="formData.userName?'':'nodata'">{{formData.userName||'暂无信息'}}
						</view>
					</uni-forms-item>

					<uni-forms-item label="年龄">
						<view class="form_zhan" :class="formData.age?'':'nodata'">{{formData.age||'暂无信息'}}</view>
					</uni-forms-item>

					<uni-forms-item label="性别">
						<view class="form_zhan" :class="formData.gender?'':'nodata'">{{formData.gender||'暂无信息'}}</view>
					</uni-forms-item>
					<uni-forms-item label="联系号码">
						<view class="form_zhan" :class="formData.phoneNum?'':'nodata'">{{formData.phoneNum||'暂无信息'}}
						</view>
					</uni-forms-item>
					<uni-forms-item label="人员分类">
						<view class="form_zhan" :class="keyIndustries?'':'nodata'">{{keyIndustries||'暂无信息'}}</view>
					</uni-forms-item>
				</uni-group>
				<view>
					<view class="addtit">户籍信息</view>
					<view class="npd15">
						<uni-forms-item required label="户籍地址">
							<view class="form_zhan" :class="birAddress?'':'nodata'">{{birAddress||'暂无信息'}}</view>
						</uni-forms-item>
						<uni-forms-item label="详细地址" label-position="top">
							<view class="form_zhan form_right" :class="formData.nowIn?'':'nodata'">
								{{formData.nowIn||'暂无信息'}}
							</view>
						</uni-forms-item>
					</view>
					<!-- 居住地 -->
					<view>
						<!-- 新增的 -->
						<!-- 多个现居地 -->
						<view v-for="(item,idx) in placeList" :key="idx">
							<view class="npd15">
								<!-- 多个现居地 -->
								<uni-forms-item required label="现居地">
									<view class="form_zhan" v-if="item.province">
										{{item.province + (item.city?item.city : '') + (item.region?item.region:'')+ (item.town?item.town:'') + (item.village?item.village:'')}}
									</view>
									<view class="form_zhan nodata" v-else>暂无信息</view>
								</uni-forms-item>
								<uni-forms-item label="详细地址" label-position="top">
									<view class="form_zhan form_right" :class="item.nowIn?'':'nodata'">
										{{item.nowIn||'暂无信息'}}
									</view>

								</uni-forms-item>
							</view>
							<view class="nowadd">
								<view class="nowaddl" v-if="idx!=0">
									<image :src="ndelimg" class="nowaddlimg"></image>
									<view class="nowaddltit ea0">删除现居地</view>
								</view>
								<view style="flex:1"></view>
								<view class="nowaddl">
									<image :src="naddimg" class="nowaddlimg"></image>
									<view class="nowaddltit b0">新增现居地</view>
								</view>
							</view>
						</view>
					</view>


					<view class="npd15">
						<uni-forms-item label="户主">
							<view class="form_zhan" :class="formData.houseType?'':'nodata'">
								{{formData.houseType||'暂无信息'}}
							</view>
						</uni-forms-item>
						<uni-forms-item required label="户编号">
							<view class="form_zhan" :class="formData.code?'':'nodata'">{{formData.code||'暂无信息'}}</view>
						</uni-forms-item>
						<view class="add_tit">如果不知道户编号，请用户主身份证号(默认是户主身份证号)</view>
						<uni-forms-item required label="与户主关系">
							<view class="form_zhan" :class="formData.yhzgx?'':'nodata'">{{formData.yhzgx||'暂无信息'}}
							</view>
						</uni-forms-item>
						<!-- 网格 -->
						<uni-forms-item label="网格">
							<view class="form_zhan" :class="gridadr?'':'nodata'">{{gridadr||'暂无信息'}}</view>
						</uni-forms-item>
						<!-- 全员核酸 -->
						<uni-forms-item required label="全员核酸">
							<view class="form_zhan" :class="isNucleicAcidFive?'':'nodata'">{{isNucleicAcidFive||'暂无信息'}}
							</view>
						</uni-forms-item>
						<!-- <uni-forms-item label="工作单位">
							<view class="form_zhan" :class="formData.workUnit?'':'nodata'">{{formData.workUnit||'暂无信息'}}
							</view>
						</uni-forms-item> -->

						<uni-forms-item label="备注" label-position="top">
							<view class="form_zhan form_right" :class="formData.remark?'':'nodata'">
								{{formData.remark||'暂无信息'}}
							</view>
						</uni-forms-item>

					</view>
				</view>
				<!-- 站位的 -->
				<!-- <view style="height: 260rpx;"></view> -->

			</uni-forms>
			<view class="addbox">
				<button class="submit_btn btnb margin0-auto" type="primary" @click="getUpdateFn">修改</button>
				<button class="margin0-auto submit_btn btnc"  v-if="typesta == 'edit'&&isnrl!=1&&navidx==1"  type="primary" @click="getDeletFn">变更</button>
			</view>
		</view>
		<!--修改内容 -->
		<view v-else class="boxa">
			<uni-forms :modelValue="formData" label-width="110" class="boxflex1">
				<!-- 基本信息 -->
				<uni-group title="基本信息" top="0">
					<uni-forms-item required label="身份证号">
						<image src="@/static/image/icon_xz_pz.png" @click="takePhoto"
							style="z-index: 100; width: 26px; height: 22px; position: absolute; right: 5px; top: 5px; ">
						</image>
						<uni-easyinput @blur="getIdcardInfo" :inputBorder="false" style="width: 80%; z-index: 80;"
							v-model="formData.idCard" placeholder="请输入身份证号码"></uni-easyinput>
					</uni-forms-item>
					<uni-forms-item required label="姓名">
						<uni-easyinput type="text" :inputBorder="false" v-model="formData.userName" placeholder="请输入姓名">
						</uni-easyinput>
					</uni-forms-item>
					<!-- <uni-forms-item required label="出生日期">
					<uni-easyinput :clearable="false" @focus="showDatePicker" type="text" :inputBorder="false" v-model="formData.birthday" placeholder="请选择出生日期"></uni-easyinput>
				</uni-forms-item> -->
					<uni-forms-item label="年龄">
						<uni-easyinput type="number" :inputBorder="false" v-model="formData.age" placeholder="请输入年龄">
						</uni-easyinput>
					</uni-forms-item>
					<uni-forms-item label="性别">
						<uni-data-checkbox v-model="formData.genderIndex" :localdata="sexRange"></uni-data-checkbox>
					</uni-forms-item>
					<uni-forms-item label="联系号码">
						<uni-easyinput type="text" :inputBorder="false" v-model="formData.phoneNum"
							placeholder="请输入联系号码"></uni-easyinput>
					</uni-forms-item>
					<uni-forms-item label="人员分类">
						<view @click="showPropleSelect" class="pick-line">
							<text v-if='keyIndustries'>{{keyIndustries}}</text>
							<text v-else style="color: grey;">请选择人员分类</text>
						</view>
					</uni-forms-item>
				</uni-group>
				<view>
					<view class="addtit">户籍信息</view>
					<view class="npd15">
						<uni-forms-item required label="户籍地址">
							<view @click="showPicker('hj')" class="pick-line">
								<text v-if='birAddress'>{{birAddress}}</text>
								<text v-else style="color: grey;">请选择户籍地址</text>
							</view>
						</uni-forms-item>
						<uni-forms-item label="详细地址" label-position="top">
							<textarea placeholder="请输入详细地址...." v-model="formData.nowIn"
								style="width: 100%; background: #F2F2F2;height:112rpx;border-radius: 10rpx;" />
						</uni-forms-item>
					</view>
					<!-- 居住地 -->
					<view>
						<!-- 多个现居地 -->

						<!-- <view class="npd15">
							<uni-forms-item required label="现居地">
								<pick-regions class="pick-line" :defaultRegion="defaultRegion" @getRegion="regionPickerChange">
									<view>
										<text
											v-if='formData.province'>{{formData.province + formData.city + formData.region}}</text>
										<text v-else style="color: grey;">请选择省市区</text>
									</view>
								</pick-regions>
							</uni-forms-item>
							<uni-forms-item label="详细地址" label-position="top">
								<textarea placeholder="请输入详细地址...." v-model="formData.nowIn"
									style="width: 100%;background: #F2F2F2;height: 112rpx;border-radius: 10rpx; " />
							</uni-forms-item>
						</view>
						
						<view class="nowadd nowr" >
							<view class="nowaddl" @click="getAddFn">
								<image :src="naddimg" class="nowaddlimg"></image>
								<view class="nowaddltit b0">新增现居地</view>
							</view>
						</view> -->
						<!-- 新增的 -->
						<!-- 多个现居地 -->
						<view v-for="(item,idx) in placeList" :key="idx">
							<view class="npd15">
								<uni-forms-item required label="现居地">
									<view @click="showPicker('xj',idx)" class="pick-line">
										<text
											v-if='item.province'>{{item.province + (item.city?item.city : '') + (item.region?item.region:'')+ (item.town?item.town:'') + (item.village?item.village:'')}}</text>
										<text v-else style="color: grey;">请选择现居地址</text>
									</view>
									<!-- <pick-regions class="pick-line" :defaultRegion="defaultRegion" @getRegion="regionPickerChange(idx)">
										<view>
											<text
												v-if='item.province'>{{item.province + item.city + item.region}}</text>
											<text v-else style="color: grey;">请选择所在区域</text>
										</view>
									</pick-regions> -->
								</uni-forms-item>
								<uni-forms-item label="详细地址" label-position="top">
									<textarea placeholder="请输入详细地址...." v-model="item.nowIn"
										style="width: 100%;background: #F2F2F2;height: 112rpx;border-radius: 10rpx; " />
								</uni-forms-item>
							</view>
							<view class="nowadd">
								<view class="nowaddl" @click="getDelFn(idx)" v-if="idx!=0">
									<image :src="ndelimg" class="nowaddlimg"></image>
									<view class="nowaddltit ea0">删除现居地</view>
								</view>
								<view style="flex:1"></view>
								<view class="nowaddl" @click="getAddFn">
									<image :src="naddimg" class="nowaddlimg"></image>
									<view class="nowaddltit b0">新增现居地</view>
								</view>
							</view>
						</view>
					</view>


					<view class="npd15">
						<uni-forms-item label="户主">
							<uni-data-checkbox v-model="formData.houseTypeValue" @change="changeCode()"
								:localdata="isUPN">
							</uni-data-checkbox>
						</uni-forms-item>
						<uni-forms-item required label="户编号">
							<!-- disabled -->
							<uni-easyinput :inputBorder="false" type="text" v-model="formData.code"
								placeholder="请输入户编号">
							</uni-easyinput>
						</uni-forms-item>
						<view class="add_tit">如果不知道户编号，请用户主身份证号(默认是户主身份证号)</view>
						<!-- 户主关系 -->
						<uni-forms-item required label="与户主关系">
							<view @click="showYhzgxSelect" class="pick-line">
								<text v-if='formData.yhzgx'>{{formData.yhzgx}}</text>
								<text v-else style="color: grey;">请选择与户主关系</text>
							</view>
						</uni-forms-item>
						<!-- 网格 -->
						<uni-forms-item label="网格">
							<view @click="showGridSelect" class="pick-line">
								<text v-if='gridadr'>{{gridadr}}</text>
								<text v-else style="color: grey;">请选择网格</text>
							</view>
						</uni-forms-item>
						<!-- 全员核酸 -->
						<uni-forms-item required label="全员核酸">
							<view @click="showTotalSelect" :class="isNucleicflag?'pick_disable pick-line':'pick-line'">
								<text v-if='isNucleicAcidFive'>{{isNucleicAcidFive}}</text>
								<text v-else style="color: grey;">是否5天一次核酸检测</text>
							</view>
						</uni-forms-item>
						<!-- 	<uni-forms-item label="工作单位">
							<uni-easyinput type="text" :inputBorder="false" v-model="formData.workUnit"
								placeholder="请输入工作单位"></uni-easyinput>
						</uni-forms-item> -->
						<uni-forms-item label="备注" label-position="top">
							<textarea placeholder="请输入备注信息...." v-model="formData.remark"
								style="width: 100%;background: #F2F2F2;height: 160rpx;border-radius: 10rpx;" />
						</uni-forms-item>
					</view>
				</view>

				<!-- <view style="height:196rpx;"></view> -->

			</uni-forms>
			<view class="addbox">
				<button class="submit_btn btna" type="primary" v-if="typesta == 'edit'&&isnrl!=1"
					@click="getSureFn">修改并确认</button>
				<button class="submit_btn" type="primary" @click="$noMultipleClicks(submit)">提交</button>
				<view class="addbox_txt" @click="checkSelect">
					<image :src="selectimg" class="addbox_txta" v-if="selectfalg"></image>
					<image :src="noselectimg" class="addbox_txta" v-else></image>
					<view class="addbox_txta1">勾选即表示同意<text class="addbox_txt2">《用户服务协议》</text>及<text
							class="addbox_txt2">《隐私政策》</text></view>
				</view>
			</view>
		</view>
		<!-- 删除弹窗 -->
		<view class="bgbox" v-if="delfalg"></view>
		<view class="delbox" v-if="delfalg">
			<view class="deltit">变更原因</view>
			<image :src="delimg" class="del_img" @click="getClose"></image>
			<view class="del_list">
				<block v-for="(ite,idx) in deletelist" :key="idx">
					<view class="del_lista" :class="delvalue==ite.value?'act':''" @click="getDeltab(ite.value)" v-if="ite.value!=1"
						>{{ite.label}}</view>
				</block>
				
			</view>
			<view class="del_btn" @click="deletSure">确认</view>
		</view>
		<!-- 时间选择器-->
		<dataTimePicke ref="setpicker" type="date" toolBarTitle="请选择出生日期"></dataTimePicke>

		<!-- 人员分类 -->
		<selectPicker ref="peopleselet" :list="peopleclass" title="选择人员分类" @vacChange="peopleChange"></selectPicker>
		<!-- 户主关系 -->
		<!-- 人员分类 -->
		<selectPicker ref="yhzgxselet" :list="yhzgxclass" title="选择与户主关系" @vacChange="yhzgxChange"></selectPicker>

		<!-- 户籍地选择 -->
		<selectMuPicker ref="birselet" model="muitl-column-auto" :list="birthplace" title="选择户籍地"
			@vacChange="birRegion"></selectMuPicker>
		<areaP ref="area"></areaP>

		<!-- 户籍地选择 -->
		<selectMorePicker ref="picker" :title="auiPicker.title" :layer="auiPicker.layer" :titflag='auiPicker.titflag'
			:data="auiPicker.data" @callback="pickerCallback"></selectMorePicker>
		<!-- 网格选择 -->
		<selectGridPicker ref="gridpicke" :title="gridPicker.title" :layer="gridPicker.layer"
			:titflag='gridPicker.titflag' :data="gridPicker.data" @callback="gridCallback">
		</selectGridPicker>
		<!-- 全员核酸 -->
		<selectPicker ref="totalselet" :list="totallist" title="请选择" @vacChange="vacTotalChange"></selectPicker>
		
	</view>
</template>

<script>
	import selectMuPicker from '@/_components/picker/selectMutilPicker.vue'
	import selectMorePicker from '@/_components/picker/selectMorePicker.vue'
	import selectGridPicker from '@/_components/picker/selectGridPicker.vue'
	import selectPicker from '@/_components/picker/selectPicker.vue'
	import dataTimePicke from '@/_components/picker/dataTimePicke.vue'
	import areaP from '@/_components/picker/areaP.vue'


	import senSetPicker from '@/_components/picker/dateTimePicker.vue'
	import hUploadImage from '@/_components/hUploadImage.vue'
	import hostUrl from "@/util/url";


	import hModal from '@/_components/hModal.vue'




	import pickRegions from '@/components/pick-regions/pick-regions.vue' //地址弹窗
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'

	let {
		host,
		imgDomain
	} = hostUrl

	export default {
		components: {
			uniPopup,
			uniPopupDialog,
			pickRegions,
			senSetPicker,
			hUploadImage,
			selectPicker,
			hModal,
			selectMuPicker,
			dataTimePicke,
			areaP,
			selectMorePicker,
			selectGridPicker
		},
		data() {
			return {
				delimg: require("@/static/image/del.png"),
				naddimg: require("@/static/image/nowadd.png"),
				ndelimg: require("@/static/image/nowdel.png"),
				selectimg: require("@/static/image/select.png"),
				noselectimg: require("@/static/image/noselect.png"),
				placeList: [{
					"deptId": 0, //所选居住地最后一级的id
					"provinceId": 0, //居住地的省份
					"province": "", //居住地的省份
					"cityId": 0, //居住地的城市
					"city": "", //居住地的城市
					"regionId": 0, //居住地的区
					"region": "", //居住地的区
					"townId": 0, //居住地的镇
					"town": "", //居住地的镇
					"villageId": 0, //居住地的村
					"village": "", //居住地的村
					"nowIn": "", //居住地的详细地址
				}],
				selectfalg: true,
				delfalg: false,
				birAddress: '',
				jiciOption: [], // 剂次选项
				curItem: {},
				curIndex: 0,
				noClick: true, // $noMultipleClicks变量
				defaultRegion: ['安徽省', '安庆市', '潜山市'], // 初始值必须为空，否则更换默认值时不能生效
				searchRegion: [],
				formData: {
					"id": '',
					'villageTowns': '',
					'village': '',
					'birthday': '',
					'age': '',
					'code': '',
					'villagerGroup': '',
					'houseTypeValue': 1,
					'houseType': '',
					"yhzgx": "", //与户主关系必填
					// 'domicile': '',
					'province': '', //户籍地的省份
					'city': '',
					'region': '',
					'userName': '',
					'genderIndex': 0,
					'idCard': '',
					'phoneNum': '',


					'nowIn': '', //户籍地的详细地址
					"remark": "",
					"czrkJzdzList": [], //详细地址
					"deptId": 0, //所选户籍地最后一级的id
					"workUnit": "", //工作单位
					'queryType': '', //新增类型
				},
				areaList: [],
				inputValue: '',
				shixian: false,
				imageValue: {},
				sexRange: [{
					"value": 0,
					"text": "男"
				}, {
					"value": 1,
					"text": "女"
				}], // 性别
				isUPN: [{
					"value": 0,
					"text": "是"
				}, {
					"value": 1,
					"text": "否"
				}], // 是否户主
				vaccination: [{
					"value": 0,
					"text": "是"
				}, {
					"value": 1,
					"text": "否"
				}], // 是否接种
				birthplace: [], // 户籍地
				delvalue: '', //删除原因
				peopleclass: [], //人员分类，
				keyIndustries: '',
				deletelist: [], //删除字典
				edidflag: false,
				codefalg: false, //
				yhzgxclass: [], //户主关系
				yhzgx: '',
				auiPicker: {
					title: '选择区域',
					layer: null,
					titflag: false,
					data: []
				},
				gridPicker: {
					title: '选择区域',
					layer: null,
					titflag: false,
					data: []
				},
				showtype: '',
				showidx: 0,
				peoplelist: [],
				typesta: '', //判断新增还是修改,
				gridadr: '', //网格显示,
				isNucleicAcidFive:'',//全员核酸
				totalselet:false,
				totallist:[],
				familyflag: false, //是否是家庭成员
				code: '', //户编号,
				optiontype: '',
				isnrl:0,
				navidx:1,
				isNucleicflag:false,//全员核酸 3 禁止操作
			}
		},
		methods: {
			// 新增
			getAddFn() {
				var obj = {
					"deptId": 0, //所选居住地最后一级的id
					"provinceId": 0, //居住地的省份
					"province": "", //居住地的省份
					"cityId": 0, //居住地的城市
					"city": "", //居住地的城市
					"regionId": 0, //居住地的区
					"region": "", //居住地的区
					"townId": 0, //居住地的镇
					"town": "", //居住地的镇
					"villageId": 0, //居住地的村
					"village": "", //居住地的村
					"nowIn": "", //居住地的详细地址
				}
				this.placeList.push(obj)
			},
			// 户籍选择
			//显示picker多级联动弹窗
			showPicker(e, idx) {
				// var num=0;
				// if(this.showtype==e){
				// 	if(idx&&(this.showidx!=idx)){
				// 		num=1
				// 	}else{
				// 		this.showidx=idx||0
				// 	}
				// }else{
				// 	this.showtype=e;//户籍还是什么
				// 	this.showidx=idx||0;
				// 	num=1
				// }
				this.showtype = e; //户籍还是什么
				this.showidx = idx || 0;
				this.$refs.picker.open(1).then(function() {

				});
			},
			//picker多级联动回调
			pickerCallback(e) {
				const that = this;
				let result = '';
				if (that.showtype == 'hj') {
					// 置空
					that.formData.provinceId = null;
					that.formData.province = null;
					that.formData.cityId = null;
					that.formData.city = null;
					that.formData.regionId = null;
					that.formData.region = null;
					that.formData.villageTownsId = null;
					that.formData.villageTowns = null;
					that.formData.villageId = null;
					that.formData.village = null;
					that.formData.villagerGroupId = null;
					that.formData.villagerGroup = null;
					e.data.forEach(function(item, index) {
						if (index == 0) {
							result += item.name;
						} else {
							result += '/' + item.name;
						}
						switch (index) {
							case 0:
								that.formData.provinceId = e.data[0].areaid;
								that.formData.province = e.data[0].name;
								break;
							case 1:
								that.formData.cityId = e.data[1].areaid;
								that.formData.city = e.data[1].name;
								break;
							case 2:
								that.formData.regionId = e.data[2].areaid;
								that.formData.region = e.data[2].name;
								break;
							case 3:
								that.formData.villageTownsId = e.data[3].areaid;
								that.formData.villageTowns = e.data[3].name;
								break;
							case 4:
								that.formData.villageId = e.data[4].areaid;
								that.formData.village = e.data[4].name;
								break;
							case 5:
								that.formData.villagerGroupId = e.data[5].areaid;
								that.formData.villagerGroup = e.data[5].name;
								break;
							default:
								break;
						}
					});
					that.formData.deptId = e.data[e.data.length - 1].areaid
					that.birAddress = result;
				} else {
					var idx = that.showidx;
					var params = {}
					e.data.forEach(function(item, index) {
						switch (index) {
							case 0:
								params.provinceId = e.data[0].areaid;
								params.province = e.data[0].name;
								break;
							case 1:
								params.cityId = e.data[1].areaid;
								params.city = e.data[1].name;
								break;
							case 2:
								params.regionId = e.data[2].areaid;
								params.region = e.data[2].name;
								break;
							case 3:
								params.townId = e.data[3].areaid;
								params.town = e.data[3].name;
								break;
							case 4:
								params.villageId = e.data[4].areaid;
								params.village = e.data[4].name;
								break;
							case 5:
								params.villagerGroupId = e.data[5].areaid;
								params.villagerGroup = e.data[5].name;
								break;
							default:
								break;
						}
					});
					that.$nextTick(function() {
						params.nowIn = this.placeList[idx].nowIn
						params.deptId = e.data[e.data.length - 1].areaid
						that.placeList.splice(idx, 1, params)
					})

				}
			},
			//网格回调
			gridCallback(e) {
				var that = this;
				var result = ''
				e.data.forEach(function(item, index) {
					if (index == 0) {
						result += item.name;
					} else {
						result += '/' + item.name;
					}
				})
				that.gridadr = result;
				that.formData.gridId = e.data[e.data.length - 1].pid
			},
			getDelFn(idx) {
				var that = this;
				uni.showModal({
					title: '提示',
					content: "是否确认删除",
					success: function(res) {
						if (res.confirm) {
							that.placeList.splice(idx, 1)
							// console.log('用户点击确定');
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});

			},
			getClose() {
				this.delfalg = false
			},
			changeCode() {
				if (this.formData.houseTypeValue == 0) {

					// if (this.familyflag) {
					// 	this.formData.code = this.formData.idCard;
					// 	return
					// }
					if (!this.formData.code) {
						this.formData.code = this.formData.idCard
					}
				}
			},
			takePhoto() {
				console.log('---------')
				var that = this
				uni.chooseImage({
					count: 1,
					sourceType: 'camera',
					success(res) {
						var file = res.tempFilePaths[0]
						that.ocrParse(file)
					}
				})
			},
			ocrParse(filePath) {
				var url = host + '/boman-file/ocrIdCard'
				var token = uni.getStorageSync('token')
				// var token = "df057579-73c8-4bdd-8312-f64db8efd699"
				uni.showLoading()
				uni.uploadFile({
					url: url,
					filePath: filePath,
					name: 'file',
					header: {
						// 'Content-type': 'multipart/form-data',
						'Authorization': token
					},
					success: res => {
						uni.hideLoading()
						// console.log(JSON.stringify(res))
						var data = JSON.parse(res.data)
						this.formData.idCard = data.data.id
						this.formData.userName = data.data.name
						this.formData.age = this.getAge(data.data.birth)
						this.formData.gender = data.data.gender
						if (this.formData.gender == '男') {
							this.formData.genderIndex = 0
						} else {
							this.formData.genderIndex = 1
						}
					},
					fail: err => {
						uni.hideLoading();
						// console.log(JSON.stringify(err))
						uni.showToast({
							title: err.errMsg,
							icon: "none"
						})
					}
				})
			},

			checkSelect() {
				this.selectfalg = !this.selectfalg
			},
			getSureFn() {
				if (!this.formData.idCard) {
					uni.showToast({
						title: '请输入身份证号码',
						icon: "none"
					})
					return
				}
				let _IDRe18 =
					/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
				let _IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/


				// 验证护照号
				let _IDreh1 = /^[a-zA-Z]{5,17}$/;
				let _IDreh2 = /^[a-zA-Z0-9]{5,17}$/;
				/** 港澳通行证验证   */
				let _IDreh3 = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/;
				/** 台湾通行证验证   */
				let _IDreh4 = /^[0-9]{8}$/;
				let _IDreh5 = /^[0-9]{10}$/;

				// 校验身份证：
				if (_IDRe18.test(this.formData.idCard) || _IDre15.test(this.formData.idCard) || _IDreh1.test(this.formData
						.idCard) || _IDreh2.test(this.formData.idCard) || _IDreh3.test(this.formData.idCard) || _IDreh4
					.test(this.formData.idCard) || _IDreh5.test(this.formData.idCard)) {
					// 校验身份证：
					// if( _IDRe18.test( this.formData.idCard ) || _IDre15.test( this.formData.idCard )  ) {

				} else {
					uni.showToast({
						title: '请输入正确的身份证号',
						icon: 'none'
					})
					return
				}
				// let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
				// if (reg.test(this.formData.idCard)) {
				// 	// 获取身份证信息
				// } else {

				// }
				if (!this.formData.userName) {
					uni.showToast({
						title: '请输入姓名',
						icon: "none"
					})
					return
				}

				// 验证手机号
				let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
				// 座机号
				let reg1=/^(0\d{2,3})-?(\d{7,8})$/
				if (this.formData.phoneNum && !regphone.test(this.formData.phoneNum)) {
					uni.showToast({
						title: '请输入正确的联系方式',
						icon: "none"
					})
					return
				}

				if (!this.birAddress) {
					uni.showToast({
						title: '请选择户籍地址',
						icon: "none"
					})
					return
				}
				if (this.formData.houseTypeValue == 0) {
					this.formData.houseType = '是'
					//户主
				} else {
					this.formData.houseType = '否'
				}
				if (this.formData.genderIndex == 0) {
					this.formData.gender = '男'
				} else {
					this.formData.gender = '女'
				}


				// 
				var newArr = []
				this.placeList.forEach((item, idx) => {
					if (item.nowIn || item.province) {
						newArr.push(item)
					}
				})
				if (newArr.length < 1) {
					uni.showToast({
						title: '请填写现居住地',
						icon: "none"
					})
					return
				} else {
					this.formData.czrkJzdzList = JSON.parse(JSON.stringify(newArr))
				}
				if (!this.formData.code) {
					uni.showToast({
						title: '请输入户编号',
						icon: "none"
					})
					return
				}

				if (!this.formData.yhzgx) {
					uni.showToast({
						title: '请选择与户主关系',
						icon: "none"
					})
					return
				}
				if (!this.formData.isNucleicAcidFive) {
					uni.showToast({
						title: '请选择全员核酸',
						icon: "none"
					})
					return
				}

				if (!this.selectfalg) {
					uni.showToast({
						title: '请勾选同意下方协议',
						icon: "none"
					})
					return
				}
				var tempArr = []
				// console.log(JSON.stringify(this.formData))
				var form = JSON.parse(JSON.stringify(this.formData))
				form.isConfirm = 'Y'
				
				this.$http.post('boman-web-core/core/czrk/editCzrk', form).then(res => {
					if (res.code == 200) {
						uni.navigateTo({
							url: '/add/pages/addvacfrom/submit'
						})
					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						})
					}
				})

			},
			submit() {
				if (!this.formData.idCard) {
					uni.showToast({
						title: '请输入身份证号码',
						icon: "none"
					})
					return
				}
				let _IDRe18 =
					/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
				let _IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/


				// 验证护照号
				let _IDreh1 = /^[a-zA-Z]{5,17}$/;
				let _IDreh2 = /^[a-zA-Z0-9]{5,17}$/;
				/** 港澳通行证验证   */
				let _IDreh3 = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/;
				/** 台湾通行证验证   */
				let _IDreh4 =  /^[0-9]{8}$/;
				let _IDreh5 = /^[0-9]{10}$/;

				// 校验身份证：
				if (_IDRe18.test(this.formData.idCard) || _IDre15.test(this.formData.idCard) || _IDreh1.test(this.formData
						.idCard) || _IDreh2.test(this.formData.idCard) || _IDreh3.test(this.formData.idCard) || _IDreh4
					.test(this.formData.idCard) || _IDreh5.test(this.formData.idCard)) {

				} else {
					uni.showToast({
						title: '请输入正确的身份证号',
						icon: 'none'
					})
					return
				}


				// let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
				// if (reg.test(this.formData.idCard)) {
				// 	// 获取身份证信息
				// } else {

				// }
				if (!this.formData.userName) {
					uni.showToast({
						title: '请输入姓名',
						icon: "none"
					})
					return
				}
				//验证手机号
				let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
				let reg1=/^(0\d{2,3})-?(\d{7,8})$/
				if (this.formData.phoneNum && !regphone.test(this.formData.phoneNum)) {
					uni.showToast({
						title: '请输入正确的联系方式',
						icon: "none"
					})
					return
				}

				if (!this.birAddress) {
					uni.showToast({
						title: '请选择户籍地址',
						icon: "none"
					})
					return
				}
				if (this.formData.houseTypeValue == 0) {
					this.formData.houseType = '是'
					//户主
				} else {
					this.formData.houseType = '否'
				}
				if (this.formData.genderIndex == 0) {
					this.formData.gender = '男'
				} else {
					this.formData.gender = '女'
				}


				// 
				var newArr = []
				this.placeList.forEach((item, idx) => {
					if (item.nowIn || item.province) {
						newArr.push(item)
					}
				})
				if (newArr.length < 1) {
					uni.showToast({
						title: '请填写现居住地',
						icon: "none"
					})
					return
				} else {
					this.formData.czrkJzdzList = JSON.parse(JSON.stringify(newArr))
				}
				if (!this.formData.code) {
					uni.showToast({
						title: '请输入户编号',
						icon: "none"
					})
					return
				}

				if (!this.formData.yhzgx) {
					uni.showToast({
						title: '请选择与户主关系',
						icon: "none"
					})
					return
				}
				if (!this.formData.isNucleicAcidFive) {
					uni.showToast({
						title: '请选择全员核酸',
						icon: "none"
					})
					return
				}
				if (!this.selectfalg) {
					uni.showToast({
						title: '请勾选同意下方协议',
						icon: "none"
					})
					return
				}
				var tempArr = []
				// console.log(JSON.stringify(this.formData))
				var form = JSON.parse(JSON.stringify(this.formData))
				form.isConfirm = 'Y'
				if (this.typesta == 'edit') {
					// 修改
					if(this.isnrl==1){
						// 未认领
						this.$http.post('boman-web-core/core/ryrl/editRlry',form).then(res => {
							if (res.code == 200) {
								uni.navigateTo({
									url: '/add/pages/addvacfrom/submit'
								})
							} else {
								uni.showToast({
									title: res.msg,
									icon: "none"
								})
							}
						})
					}else{
						this.$http.post('boman-web-core/core/czrk/editCzrk', form).then(res => {
							if (res.code == 200) {
								uni.navigateTo({
									url: '/add/pages/addvacfrom/submit'
								})
							} else {
								uni.showToast({
									title: res.msg,
									icon: "none"
								})
							}
						})
					}
				} else {
					// 新增
					this.$http.post('boman-web-core/core/czrk/addCzrk', form).then(res => {
						if (res.code == 200) {
							uni.navigateTo({
								url: '/add/pages/addvacfrom/submit'
							})
							// uni.showToast({
							// 	title: '提交成功',
							// 	icon: "none"
							// })
							// setTimeout(function() {
							// 	uni.navigateBack()
							// }, 1000)
						} else {
							uni.showToast({
								title: res.msg,
								icon: "none"
							})
						}
					})
				}
			},
			// 修改
			getUpdateFn() {
				this.edidflag = false
			},
			//删除
			getDeletFn() {
				this.delfalg = true;
			},
			deletSure() {
				var that = this;
				if(!this.delvalue){
					uni.showToast({
						title:"请选择变更原因",
						icon:'none'
					})
					return
				}
				var params = {
					id: this.formData.id,
					status: this.delvalue
				}
				this.$http.post('boman-web-core/core/czrk/changeCzrk', params).then(res => {
					if (res.code == 200) {
						uni.showToast({
							title: '变更成功',
							icon: "none"
						})
						setTimeout(function() {
							// 让上个页面进行刷新
							uni.$emit('refreshData');
							uni.navigateBack()
						}, 1000)
					} else {
						this.delfalg = false;
						uni.showToast({
							title: res.msg,
							icon: "none"
						})
					}
				})
			},
			delete() {
				// this.$http.post('boman-web-core/core/ryrl/editRlry', this.formData).then(res=>{
				// 	if(res.code == 200 ) {
				// 		uni.showToast({
				// 			title: '提交成功',
				// 			icon: "none"
				// 		})
				// 		setTimeout(function() {
				// 			uni.navigateBack()
				// 		}, 1000)
				// 	}
				// })
			},
			regionPickerChange(region) {
				this.searchRegion = region
				// console.log(this.searchRegion, 'searchRegion')
				var codeArray = this.searchRegion.map(item => item ? item.code : undefined)
				var nameArray = this.searchRegion.map(item => item ? item.name : undefined)
				this.formData.province = nameArray[0]
				this.formData.city = nameArray[1]
				this.formData.region = nameArray[2]
			},
			/* 获取户籍地 */
			getBirthplace() {
				this.$http.post('boman-system/chinaArea/treeSelect', {
					pid: 0
				}).then(res => {
					this.auiPicker.data = res.data
				})
			},

			/* 初始化 */
			init() {
				// 人员分类
				this.getPeopleClass();
				//地址列表 
				this.getBirthplace();
				//删除原因
				this.getDelectList();
				this.gethouseTypeList();
				//网格
				this.getGridplace();
				//全员核酸
				this.getTotalFive()
			},
			// 回显数据字典
			selectDictLabel(datas, value) {
				var actions = [];
				Object.keys(datas).some((key) => {
					if (datas[key].dictValue == ('' + value)) {
						actions.push(datas[key].dictLabel);
						return true;
					}
				})
				return actions.join('');
			},

			getDetail() {
				this.$http.get('boman-web-core/core/czrk/getById/' + this.formData.id).then(res => {
					if (res.code == 200) {
						this.init()

						this.formData = res.data;
						if(res.data.isNucleicAcidFive&&res.data.isNucleicAcidFive=='3'){
							this.isNucleicflag=true
						}else{
							this.isNucleicflag=false
						}
						this.gridadr = res.data.gridName;
						if (this.formData.houseType == '是') {
							this.formData.houseTypeValue = 0
						} else {
							this.formData.houseTypeValue = 1;
							this.formData.houseType = '否'
						}
						if (this.formData.gender == '男') {
							this.formData.genderIndex = 0
						} else {
							this.formData.genderIndex = 1
						}
						if (this.formData.czrkJzdzList && this.formData.czrkJzdzList.length) {
							this.placeList = JSON.parse(JSON.stringify(this.formData.czrkJzdzList))
						}


						// 疫苗
						// if (this.formData.isVaccination == '是') {
						// 	this.formData.isVaccinationValue = 0
						// } else {
						// 	this.formData.isVaccinationValue = 1
						// }
						this.birAddress = ''

						if (this.formData.province) {
							this.birAddress += this.formData.province
						}
						if (this.formData.city) {
							this.birAddress += this.formData.city
						}
						if (this.formData.region) {
							this.birAddress += this.formData.region
						}
						if (this.formData.villageTowns) {
							this.birAddress += this.formData.villageTowns
						}
						if (this.formData.village) {
							this.birAddress += this.formData.village
						}
						if (this.formData.villagerGroup) {
							this.birAddress += this.formData.villagerGroup
						}
					}
				})
			},

			getDelectList() {
				// 删除显示
				var that = this;
				this.$http.get('system/dict/data/type/person_type').then(res => {
					if (res.code == 200) {
						// this.delvalue = res.data[0].dictValue
						this.deletelist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
			},
			getDeltab(e) {
				this.delvalue = e;
			},
			//gethouseTypeList
			//与户主关系
			gethouseTypeList() {
				//户主关系
				var that = this;
				this.$http.get('boman-system/dict/data/type/yuhuzhuguanxi').then(res => {
					if (res.code == 200) {
						if (that.formData.yhzgx) {

							// that.yhzgx = that.selectDictLabel(res.data, that.formData.yhzgx)
						}

						this.yhzgxclass = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
			},
			showYhzgxSelect() {
				this.$refs.yhzgxselet.show()
			},
			yhzgxChange(e) {
				var label = e[0].label;
				// this.yhzgx = e[0].label;
				// this.formData.yhzgx = e[0].value;
				this.formData.yhzgx = label;
			},
			getGridplace() {
				var that = this
				this.$http.post('boman-web-core/gridInfo/treeSelect', {
					pid: 0
				}).then(res => {
					that.gridPicker.data = res.data.data || res.data

				})
			},
			getTotalFive() {
				var that = this;
				this.$http.get('system/dict/data/type/nucleic_acid').then(res => {
					if (res.code == 200) {
						if (that.formData.isNucleicAcidFive) {
							that.isNucleicAcidFive = that.selectDictLabel(res.data, that.formData.isNucleicAcidFive)
						}else{
							that.isNucleicAcidFive=res.data[0].dictLabel
							that.formData.isNucleicAcidFive=res.data[0].dictValue
						}
						this.totallist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
			},
			showTotalSelect() {
				if(!this.isNucleicflag){
					this.$refs.totalselet.show()
				}
			},
			vacTotalChange(e){
				this.isNucleicAcidFive=e[0].label
				this.formData.isNucleicAcidFive=e[0].value;
			},
			// 网格
			showGridSelect() {
				this.$refs.gridpicke.open().then(function() {

				});
			},


			// 人员分类
			getPeopleClass() {
				var that = this;
				this.$http.get('system/dict/data/type/renyuanfenlei').then(res => {
					if (res.code == 200) {
						if (that.formData.keyIndustries) {
							that.keyIndustries = that.selectDictLabel(res.data, that.formData.keyIndustries)
						}
						that.peoplelist = res.data;
						this.peopleclass = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
			},
			// 显示人员分类
			showPropleSelect() {
				// if (this.formData.id != undefined && this.formData.id != "") {
				// 	return
				// }
				// this.curIndex = index
				this.$refs.peopleselet.show()
			},
			peopleChange(e) {
				var label = e[0].label;
				this.keyIndustries = e[0].label;
				this.formData.keyIndustries = e[0].value;
			},
			/* 上传后端获取身份证信息 */
			getIdcardInfo(val) {
				var that = this;
				if (this.formData == undefined) {
					return
				}
				if (this.formData.idCard == undefined || this.formData.idCard == '') {
					return
				}
				// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
				let _IDRe18 =
					/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
				let _IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/
				// 校验身份证：
				if (_IDRe18.test(this.formData.idCard) || _IDre15.test(this.formData.idCard)) {
					// 获取身份证信息
					var idCard = this.formData.idCard
					this.$http.post('boman-web-core/core/czrk/findHjInfo', {
						idCard: this.formData.idCard
					}).then(res => {
						if (res.code == 200) {
							for(var i in res.data){
								if(res.data[i]!=null){
									this.formData[i]=res.data[i]
								}
							}
							// this.formData = res.data
							this.formData.idCard = idCard;
				 		if (res.data.houseType != '是' && this.familyflag) {
								this.formData.code = this.code
								this.formData.houseTypeValue = 1;
								this.formData.houseType = '否';
							}
							if (res.data.houseType != '是' && this.optiontype == 'house') {
								this.formData.houseTypeValue = 0;
								this.formData.houseType = '是';
							}
							if (this.formData.houseTypeValue == 0 && !this.formData.code) {
								this.formData.code = this.formData.idCard
							}

							


							this.birAddress = ''

							if (this.formData.province) {
								this.birAddress += this.formData.province

				 		}
							if (this.formData.city) {
								this.birAddress += this.formData.city

							}
							if (this.formData.region) {
								this.birAddress += this.formData.region

							}
							if (this.formData.villageTowns) {
				 			this.birAddress += this.formData.villageTowns

							}
							if (this.formData.village) {
								this.birAddress += this.formData.village

							}
							if (this.formData.villagerGroup) {
								this.birAddress += this.formData.villagerGroup

							}
							if (this.formData.gender == '男') {
								this.formData.genderIndex = 0
							} else {
								this.formData.genderIndex = 1
							}
							if (that.formData.keyIndustries) {
								that.keyIndustries = that.selectDictLabel(that.peoplelist, that.formData.keyIndustries)
							} else {
								that.keyIndustries = ''
							}
							if (that.formData.isNucleicAcidFive) {
								that.isNucleicAcidFive = that.selectDictLabel(that.totallist, that.formData.isNucleicAcidFive)
							} else {
								that.isNucleicAcidFive=''
								that.formData.isNucleicAcidFive=''
							}
							if (this.formData.houseType == '是') {
								this.formData.houseTypeValue = 0
							} else {
								this.formData.houseTypeValue = 1;
								this.formData.houseType = '否'
							}
							if (this.formData.czrkJzdzList && this.formData.czrkJzdzList.length) {
								this.placeList = JSON.parse(JSON.stringify(this.formData.czrkJzdzList))
							} else {
								this.placeList = [];
								this.getAddFn()
							}
						}
					})
				} else {
					// 判断是不是护照号
					// 验证护照号
					let _IDreh1 = /^[a-zA-Z]{5,17}$/;
					let _IDreh2 = /^[a-zA-Z0-9]{5,17}$/;
					/** 港澳通行证验证   */
					let _IDreh3 = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/;
					/** 台湾通行证验证   */
					let _IDreh4 = /^[0-9]{8}$/;
					let _IDreh5 = /^[0-9]{10}$/;
					// 校验身份证：
					if (_IDreh1.test(this.formData.idCard)|| _IDreh2.test(this.formData.idCard) || _IDreh3.test(this.formData.idCard) || _IDreh4.test(this.formData.idCard) || _IDreh5.test(this.formData.idCard)) {

					} else {
						uni.showToast({
							title: '请输入正确的身份证号',
							icon: 'none'
						})
					}


				}
				// let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
				// if (reg.test(this.formData.idCard)) {

				// } else {
				// 	uni.showToast({
				// 		title: '请输入正确的身份证号',
				// 		icon: 'none'
				// 	})
				// }


				// this.$http.post('boman-web-core/core/info/findHjInfo', {
				// 	idCard: this.formData.idCard
				// }).then(res => {
				// 	if (res.code == 200) {
				// 		this.formData.userName = res.data.userName
				// 		this.formData.age = res.data.age
				// 		this.formData.gender = res.data.gender
				// 		if (this.formData.gender == '男') {
				// 			this.formData.genderIndex = 0
				// 		} else {
				// 			this.formData.genderIndex = 1
				// 		}
				// 	}
				// })
			},
			/* 户籍地选择组件 */
			showbirPicker() {
				this.$refs.birselet.show()
			},
			/* 成功选择户籍 */
			birRegion(e) {
				console.log('---------' + JSON.stringify(e))
				this.formData.villageTowns = e[1].label
				this.formData.village = e[2].label
				this.formData.villagerGroup = e[3].label
				this.birAddress = this.formData.villageTowns + this.formData.village + this.formData.villagerGroup
			},
			/* 出生日期组件 */
			showDatePicker() {
				this.$refs.setpicker.show();

			},
			getAge(strAge) {
				var birArr = strAge.split("-");
				var birYear = birArr[0];
				var birMonth = birArr[1];
				var birDay = birArr[2];

				d = new Date();
				var nowYear = d.getFullYear();
				var nowMonth = d.getMonth() + 1; //记得加1
				var nowDay = d.getDate();
				var returnAge;

				if (birArr == null) {
					return false
				};
				var d = new Date(birYear, birMonth - 1, birDay);
				if (d.getFullYear() == birYear && (d.getMonth() + 1) == birMonth && d.getDate() == birDay) {
					if (nowYear == birYear) {
						returnAge = 0; // 
					} else {
						var ageDiff = nowYear - birYear; // 
						if (ageDiff > 0) {
							if (nowMonth == birMonth) {
								var dayDiff = nowDay - birDay; // 
								if (dayDiff < 0) {
									returnAge = ageDiff - 1;
								} else {
									returnAge = ageDiff;
								}
							} else {
								var monthDiff = nowMonth - birMonth; // 
								if (monthDiff < 0) {
									returnAge = ageDiff - 1;
								} else {
									returnAge = ageDiff;
								}
							}
						} else {
							return "出生日期晚于今天，数据有误"; //返回-1 表示出生日期输入错误 晚于今天
						}
					}
					return returnAge;
				} else {
					return ("输入的日期格式错误！");
				}
			}
		},
		onLoad(option) {
			// console.log('onLoad')
			if (option.code) {
				// 添加家庭成员
				this.formData.code = option.code;
				this.formData.houseTypeValue = 1;
				this.formData.houseType = '否';
				this.code = option.code
				this.familyflag = true;
				this.edidflag = false;
				this.typesta = 'add'
				uni.setNavigationBarTitle({
					title: '新增'
				})
				this.init()
			} else if (option.id) {
				//修改
				this.formData.id = option.id;
				this.edidflag = true;
				this.typesta = 'edit'
				this.isnrl=option.isnrl;
				this.navidx=option.navidx
				// 禁止所以的操作
				uni.setNavigationBarTitle({
					title: '修改'
				})
				this.getDetail()
			} else {
				this.edidflag = false;
				this.typesta = 'add'
				uni.setNavigationBarTitle({
					title: '新增'
				})
				this.init();
				if (option.type == 'house') {
					// 新增户主
					this.formData.houseTypeValue = 0;
					this.formData.houseType = '是';
					this.optiontype = option.type
					// 是户主
					return
				}
				uni.showModal({
					title: '提示',
					content: "此页面最好新增户主,如若不知户编号,想新增家庭成员,请到人员信息户籍列表,根据户主身份证查询,再点击查看添加家庭成员",
					success: function(res) {
						if (res.confirm) {} else if (res.cancel) {

						}
					}
				})
			}
		},
		mounted() {
			// if (this.formData.id) { // “编辑”模式下，先获取详情，再获取选项列表
			// 	this.getDetail()
			// } else { // “新增”模式下，获取选项列表
			// 	this.init()
			// }
		}
	}
</script>

<style>
	.vac-form textarea {
		display: block;
		padding: 16rpx 36rpx;
		font-size: 28rpx;
		box-sizing: border-box;

	}
</style>

<style scoped lang="scss">
	// 新修改的
	.add_tit {
		font-size: 22rpx;
		color: #f00;
		margin-bottom: 16rpx;
	}

	.npd15 {
		padding: 15px;
		background-color: #FFFFFF;
	}

	.addtit {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		padding-left: 15px;
		height: 40px;
		background-color: $uni-bg-color-grey;
		font-weight: normal;
		color: $uni-text-color;
	}

	.nowadd {
		display: flex;
		align-items: center;
		background: #F2F2F2;
		padding: 0px 15px;
		justify-content: space-between;
		height: 84rpx;

		&.nowr {
			justify-content: flex-end;
		}

		.nowaddl {
			display: flex;
			align-items: center;

			.nowaddlimg {
				width: 32rpx;
				height: 32rpx;
				margin-right: 16rpx;
			}

			.nowaddltit {
				font-size: 28rpx;

				&.ea0 {
					color: #EA0606;
				}

				&.b0 {
					color: #00B034;
				}
			}
		}
	}

	.boxa {
		display: flex;
		flex-direction: column;
		height: 100vh;
	}

	.boxflex1 {
		flex: 1;
		overflow-y: auto;
	}

	.addbox {
		padding: 20rpx 34rpx;
		z-index: 1;
		background: #ffffff;
		box-shadow: 0 14rpx 40rpx 12rpx rgba(218, 218, 218, 1);
		flex: 0 0 auto;
	}

	.submit_btn {
		width: 100%;
		height: 96rpx;

		border-radius: 6rpx;
		font-size: 34rpx;
	}

	.btna {
		background: #009FE8;
		margin-bottom: 20rpx;
	}

	.btnb {

		background: #00B034;
	}

	.btnc {
		margin-top: 20rpx;
		background: #EA2929;
	}

	// .submit_btns {

	// 	width: 684rpx;
	// 	height: 98rpx;
	// 	border-radius: 6rpx;
	// 	font-size: 34rpx;

	// }

	.bgbox {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.2);
		z-index: 3;
	}

	.delbox {
		width: 580rpx;
		background: #FFFFFF;
		border-radius: 14px;
		position: fixed;
		top: 50%;
		left: 80rpx;
		right: 80rpx;
		padding: 48rpx 34rpx 72rpx;
		box-sizing: border-box;
		z-index: 5;
		margin-top: -210rpx;

		.deltit {
			font-size: 28rpx;
			font-weight: bold;
			color: #343434;
			text-align: center;
			line-height: 40rpx;
		}

		.del_img {
			width: 34rpx;
			height: 34rpx;
			position: absolute;
			right: 34rpx;
			top: 44rpx;
		}

		.del_btn {
			width: 100%;
			height: 76rpx;
			background: #00B034;
			border-radius: 6rpx;
			font-size: 28rpx;
			font-weight: bold;
			color: #FFFFFF;
			text-align: center;
			line-height: 76rpx;
		}

		.del_list {
			display: flex;
			padding: 60rpx 0 40rpx;
			flex-wrap: wrap;

			.del_lista {
				width: 116rpx;
				height: 64rpx;
				background: #CACACA;
				border-radius: 32rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #FFFFFF;
				text-align: center;
				line-height: 64rpx;
				margin: 0 10rpx 20rpx 0;

				&.act {
					background-color: #019FE8;
				}
			}
		}
	}

	.form_zhan {
		flex: 1;
		width: 100%;
		display: flex;
		box-sizing: border-box;
		min-height: 72rpx;
		flex-direction: row;
		align-items: center;
		font-size: 28rpx;
		color: #343434;

		&.nodata {
			color: #999999;
		}

		&.form_right {
			background-color: rgb(242, 242, 242);
			height: 120rpx;
			padding: 10rpx;
			align-items: flex-start;
		}
	}





	.pick-line {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-left: 20rpx;
	}

	.from_image {
		width: 30rpx;
		height: 30rpx;
	}

	.delPop {
		z-index: 2;
		top: -10rpx;
		right: -10rpx;

		.circleRed {
			width: 40rpx;
			height: 40rpx;
			background-color: red;
			border-radius: 50%;

			&::after,
			&::before {
				content: '';
				width: 25rpx;
				height: 5rpx;
				position: absolute;
				background-color: white;
				top: 50%;
				left: 50%;
				// transform-origin:center;
			}

			&::after {
				transform: translate(-50%, -50%) rotate(45deg);
			}

			&::before {
				transform: translate(-50%, -50%) rotate(-45deg);
			}
		}
	}

	.img-add {
		width: 120rpx;
		height: 120rpx;
		margin: 10rpx 3% 10rpx 0;
		border-radius: 10rpx;
		overflow: hidden;
		background-color: #f7f7f7;
		display: flex;
		flex-direction: column;
		justify-content: center;

		.add {
			padding-top: 0rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			image {}

			.font {
				color: #8a8a8a;
				font-size: 26rpx;
			}
		}

	}

	.addbox_txt {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 24rpx;

		.addbox_txta {
			width: 28rpx;
			height: 28rpx;
			margin-right: 14rpx;
		}

		.addbox_txta1 {
			font-size: 24rpx;
			color: #666666;

			.addbox_txt2 {
				color: #009FE8;
			}
		}
	}
	.pick_disable{background-color: #f5f7fa;color: #c0c4cc;}
</style>
