Browse Source

手动输入身份证可以识别其他信息(正确)

wangguoyu 3 days ago
parent
commit
29c7520684
1 changed files with 21 additions and 6 deletions
  1. 21 6
      pages/admin/Jiazheng/gerenZiliao.vue

+ 21 - 6
pages/admin/Jiazheng/gerenZiliao.vue

@@ -123,15 +123,17 @@
 				</view>
 			</view>
 
-			<view  class="agree-section-box form-top-margin">
+			<view class="agree-section-box form-top-margin">
 				<checkbox-group @change="handleAgree">
 					<label class="checkbox">
 						<checkbox :checked="formData.agree" color="#3fd2a1" style="transform:scale(0.65)" />
 						<text>已征得本人同意,将其个人资料信息录入平台</text>
 					</label>
 				</checkbox-group>
-				<button type="default" v-if="status =='add'&&isZijiazheng !='true'" @click="goNext" class="phone-green-btn">下一步</button>
-				<button type="default" v-if="status =='edit' &&isZijiazheng !='true'" @click="editSave" class="phone-green-btn">保存</button>
+				<button type="default" v-if="status =='add'&&isZijiazheng !='true'" @click="goNext"
+					class="phone-green-btn">下一步</button>
+				<button type="default" v-if="status =='edit' &&isZijiazheng !='true'" @click="editSave"
+					class="phone-green-btn">保存</button>
 			</view>
 			<uni-popup ref="popupMap" background-color="#fff" :is-mask-click="false" :mask-click="false">
 				<customMap style="100vh" @xuanzeAdress="xuanzeAdress" @currentWeizhi="currentWeizhi" @close="mapClose">
@@ -174,7 +176,7 @@
 			isZijiazheng: {
 				type: String,
 			}
-			
+
 		},
 		data() {
 			return {
@@ -294,7 +296,20 @@
 								this.$emit('idCardBlur', res.data);
 							});
 						} else {
-
+							if(this.formData.idcard.length ==18){
+								const year = this.formData.idcard.substring(6, 10);
+								const month = this.formData.idcard.substring(10, 12);
+								const day = this.formData.idcard.substring(12, 14);
+								this.formData.birthday = `${year}-${month}-${day}`;
+								// 判断性别
+								const genderDigit = this.formData.idcard.charAt(16);
+								this.formData.gender = (parseInt(genderDigit) % 2 === 0) ? 2 : 1;
+							}
+							if(this.formData.idtype ==2){
+								this.formData.birthday  = ''
+								this.formData.gender  = ''
+							}
+				
 						}
 					} else {
 						this.$message.error('');
@@ -676,7 +691,7 @@
 				if (!this.checkAllFields()) {
 					return false
 				}
-				if(this.formData.gender == 0){
+				if (this.formData.gender == 0) {
 					uni.showToast({
 						title: "请选择性别",
 						icon: 'none',