Browse Source

入住人bug修复

17755135699 9 months ago
parent
commit
507b102d9f
3 changed files with 56 additions and 37 deletions
  1. 31 19
      http/index.js
  2. 18 15
      pages/house/createOrder.vue
  3. 7 3
      pages/house/stayCheck.vue

+ 31 - 19
http/index.js

@@ -120,21 +120,21 @@ const apiList = [
 ]
 //解密脱敏处理
 function dealJmTmData(data, isTm) {
-	if(!data) return;
+	if (!data) return;
 	let keys = Object.keys(data);
-	keys.forEach(k=>{
-		let _t = tmList.find(t=>t.prop==k);
-		if(_t){
-			data[k] = data[k]?(decrypt(data[k])||data[k]):'';
-			if(isTm) data[k] = tmRules(data[k],_t.type);
+	keys.forEach(k => {
+		let _t = tmList.find(t => t.prop == k);
+		if (_t) {
+			data[k] = data[k] ? (decrypt(data[k]) || data[k]) : '';
+			if (isTm) data[k] = tmRules(data[k], _t.type);
 		}
-		
-		if(typeof data[k] === 'object'){
-			dealJmTmData(data[k],isTm);
-		}else if(Array.isArray(data[k])){
-			data[k].forEach(dk=>{
-				if(typeof dk === 'object'){
-					dealJmTmData(dk,isTm);
+
+		if (typeof data[k] === 'object') {
+			dealJmTmData(data[k], isTm);
+		} else if (Array.isArray(data[k])) {
+			data[k].forEach(dk => {
+				if (typeof dk === 'object') {
+					dealJmTmData(dk, isTm);
 				}
 			})
 		}
@@ -187,12 +187,24 @@ export const $http = (url, method, data, json, isAuth, isBuffer) => {
 
 		uni.hideLoading()
 		//数据解密脱敏处理
-		if(response.data&&response.data.data){
-			let t = apiList.find(a=>url.indexOf(a)>-1);
-			if(!t) dealJmTmData(response.data.data,true);
-			else dealJmTmData(response.data.data,false);
+		if (response.data && response.data.data) {
+			if (url.indexOf('/merchant/hotel/order/getOrderDetail/') > -1) {
+				//房态入住人不脱敏不加密数据备份
+				console.log(response.data.data)
+				let checkInPersonList = response.data.data.detailFormList[0].checkInPersonList;
+				if (checkInPersonList.length != 0) {
+					checkInPersonList.forEach((ele, i) => {
+						ele.checkInName2 = ele.checkInName;
+						ele.idCard2 = ele.idCard;
+						ele.checkInPhone2 = ele.checkInPhone;
+					})
+				}
+			}
+			let t = apiList.find(a => url.indexOf(a) > -1);
+			if (!t) dealJmTmData(response.data.data, true);
+			else dealJmTmData(response.data.data, false);
 		}
-		
+
 		if ((response.data && response.data.code && response.data.code === 401) ||
 			(response.data && response.data.msg && (response.data.msg.indexOf('未授权') > -1 ||
 				response.data.msg.indexOf('重新登录') > -1))) {
@@ -229,7 +241,7 @@ export const $http = (url, method, data, json, isAuth, isBuffer) => {
 				})
 			}
 		}
-		
+
 		return response;
 	}
 	return http.request({

+ 18 - 15
pages/house/createOrder.vue

@@ -234,7 +234,7 @@
 				currentDate: '',
 				today: '',
 				//加密备用
-				tempCheckInPersonList: null,
+				tempCheckInPersonList: [],
 				tempGuestName: null,
 				tempGuestPhone: null
 			}
@@ -387,7 +387,7 @@
 			delPer(index) {
 				this.dataForm.detailFormList[0].checkInPersonList.splice(index, 1)
 			},
-			confirmOrder(orderStatus) {		
+			confirmOrder(orderStatus) {
 				if (!this.dataForm.guestName) {
 					this.$showToast('请输入姓名');
 					return
@@ -404,11 +404,11 @@
 					this.$showToast('请选择来源');
 					return
 				}
-				if (!this.dataForm.detailFormList[0].checkInPersonList || this.dataForm.detailFormList[0].checkInPersonList
-					.length == 0) {
-					this.$showToast('请添加入住人');
-					return
-				}
+				// if (!this.dataForm.detailFormList[0].checkInPersonList || this.dataForm.detailFormList[0].checkInPersonList
+				// 	.length == 0) {
+				// 	this.$showToast('请添加入住人');
+				// 	return
+				// }
 				//orderStatus//预约入住 1,直接入住2
 				if (orderStatus) {
 					this.dataForm.orderStatus = orderStatus;
@@ -453,27 +453,27 @@
 					//姓名 checkInName,idCard,checkInPhone
 					//新增直接加密,编辑判断是否修改
 					if (
-						(!this.tempCheckInPersonLis) ||
+						(this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||
 						element.checkInName &&
 						element.checkInName != this.tempCheckInPersonList[i].checkInName
 					) {
 						element.checkInName = encrypt(element.checkInName);
 					} else {
-						element.checkInName = null;
+						element.checkInName = this.tempCheckInPersonList[i].checkInName2;
 					}
 					//身份证
 					if (
-						(!this.tempCheckInPersonLis) ||
+						(this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||
 						element.idCard &&
 						element.idCard != this.tempCheckInPersonList[i].idCard
 					) {
 						element.idCard = encrypt(element.idCard);
 					} else {
-						element.idCard = null;
+						element.idCard = this.tempCheckInPersonList[i].idCard2;
 					}
 					//手机号
 					if (
-						(!this.tempCheckInPersonLis) ||
+						(this.tempCheckInPersonList.length == 0) || (!this.tempCheckInPersonList[i]) ||
 						element.checkInPhone &&
 						element.checkInPhone != this.tempCheckInPersonList[i].checkInPhone
 					) {
@@ -481,7 +481,7 @@
 							element.checkInPhone
 						);
 					} else {
-						element.checkInPhone = null;
+						element.checkInPhone = this.tempCheckInPersonList[i].checkInPhone2;
 					}
 				});
 				newDataForm.detailFormList[0].checkInPersonList = checkInPersonList;
@@ -531,8 +531,11 @@
 							...res.data.data,
 						};
 						//加密备用
-						this.tempCheckInPersonList =
-							this.dataForm.detailFormList[0].checkInPersonList || []; //入住人集合
+						if (this.dataForm.detailFormList[0].checkInPersonList.length != 0) {
+							this.tempCheckInPersonList = JSON.parse(
+								JSON.stringify(this.dataForm.detailFormList[0].checkInPersonList)
+							);
+						} //入住人集合
 						this.tempGuestName = this.dataForm.guestName;
 						this.tempGuestPhone = this.dataForm.guestPhone;
 						this.compareDate(this.dataForm.arriveDate);

+ 7 - 3
pages/house/stayCheck.vue

@@ -150,13 +150,17 @@
 			},
 			conform() {
 				this.checkInPersonList.forEach((item) => {
+					if (!item.checkInName) {
+						this.$showToast('请输入姓名');
+						return false
+					}
 					let checkInPhone = item.checkInPhone;
 					if (checkInPhone.indexOf("**") > -1) {
 						checkInPhone = checkInPhone.replace(/\*/g, "5");
 					}
 					if (!this.$u.test.mobile(checkInPhone)) {
 						this.$showToast('请输入正确手机号');
-						return
+						return false
 					}
 					let idCard = item.idCard;
 					if (idCard.indexOf("**") > -1) {
@@ -164,9 +168,9 @@
 					}
 					if (!this.$u.test.idCard(idCard)) {
 						this.$showToast('请输入正确身份证号');
-						return
+						return false
 					}
-					let list = this.checkInPersonList.filter((item) => item.idCard && item.checkInName);
+					let list = this.checkInPersonList.filter((item) => item.idCard && item.checkInName&& item.checkInPhone);
 					this.getOpenerEventChannel().emit('addSuccess', {
 						'data': list
 					});