Bladeren bron

opt:认证比对时根据用户参数来选择是否动态比对

Tohka-lcj 9 maanden geleden
bovenliggende
commit
6c4b1ad062
1 gewijzigde bestanden met toevoegingen van 46 en 27 verwijderingen
  1. 46 27
      subpkg/addGuest/addGuest.vue

+ 46 - 27
subpkg/addGuest/addGuest.vue

@@ -12,7 +12,7 @@
 					<view class="guest-form-bottom">
 						<view class="guest-form-bottom-left">
 							<u-form-item class="" :label="uploadPicTip" prop="guest.pic" labelWidth="160rpx">
-								<image v-if="userInfo.facePreCheck" style="width: 160rpx; height: 160rpx; "
+								<image v-if="userInfo.dynamicFaceCheck" style="width: 160rpx; height: 160rpx; "
 									:src="'data:image/jpeg;base64,' + guest.picBase64" @click="gotoPreCheck(guest)">
 								</image>
 								<u-upload v-else :fileList="guest.pic" @afterRead="afterRead" @delete="deletePic"
@@ -95,8 +95,6 @@
 				needInitHotelList: false,
 				addGuestButtonDisabled: false,
 				checkinButtonDisabled: false,
-				pic: '',
-				guestIdNavigateToPreCheck: 0
 			};
 		},
 		computed: {
@@ -115,10 +113,9 @@
 			},
 			gotoPreCheck(guest) {
 				console.log(guest)
-				this.guestIdNavigateToPreCheck = guest.id
-				console.log("id", id, "guestId", this.guestIdNavigateToPreCheck)
 				uni.navigateTo({
-					url: '/subpkg/dynamicFaceCheck/dynamicFaceCheck?guestId=' + guest.id + "&idNumber=" + guest.idNumber + "&name=" + guest.name
+					url: '/subpkg/dynamicFaceCheck/dynamicFaceCheck?guestId=' + guest.id + "&idNumber=" + guest
+						.idNumber + "&name=" + guest.name
 				})
 			},
 			addGuest() {
@@ -218,7 +215,9 @@
 			},
 			async checkin() {
 				//云极
-				if (this.hotelParams.wx === null || this.hotelParams.wx === undefined || this.hotelParams.wx === 0) {
+				if (this.hotelParams.wx === null || this.hotelParams.wx === undefined || this.hotelParams.wx === 0 ||
+					this.hotelParams.alipay === null || this.hotelParams.alipay === undefined || this.hotelParams
+					.alipay === 0) {
 					//检查姓名、证件号是否填入,上传图片是否通过检查
 					if (this.guestList.length < 1) {
 						uni.$showMsg('请添加入住人!')
@@ -226,18 +225,31 @@
 					} else {
 						let isEmpty = false;
 						let allPicValid = true;
-						this.guestList.forEach((guest) =>
-							Object.keys(guest).forEach(key => {
-								console.log(key + ' + ' + guest[key])
+						let fieldsToCheck = ['name', 'idNumber', 'picBase64']
+						this.guestList.forEach((guest) => {
 								if (!guest.picValid) {
 									allPicValid = false
-								}
-								if (guest[key] === null || guest[key] === undefined || guest[
-										key] === '') {
-									isEmpty = true;
 									return
 								}
-							})
+								fieldsToCheck.forEach(field => {
+									if (guest[field] === null || guest[field] === undefined || guest[
+											field] === '') {
+										isEmpty = true
+										return
+									}
+								})
+							}
+							// Object.keys(guest).forEach(key => {
+							// 	console.log(key + ' + ' + guest[key])
+							// 	if (!guest.picValid) {
+							// 		allPicValid = false
+							// 	}
+							// 	if (guest[key] === null || guest[key] === undefined || guest[
+							// 			key] === '') {
+							// 		isEmpty = true;
+							// 		return
+							// 	}
+							// })
 						)
 						if (isEmpty) {
 							uni.$showMsg('请正确填写信息!')
@@ -250,17 +262,20 @@
 					}
 					this.checkinButtonLoading = true
 					try {
-						//检查人脸与姓名身份证号是否匹配
-						for (let guest of this.guestList) {
-							let yunjiFaceCheckInfo = {
-								idNo: guest.idNumber,
-								name: guest.name,
-								image: guest.picBase64
-							}
-							let res = await uni.$http.post('/faceVerification/yunjiVerification', yunjiFaceCheckInfo)
-							if (res.data.success === false) {
-								uni.$showMsg('顾客' + guest.name + '身份验证未通过')
-								return
+						if (this.userInfo.dynamicFaceCheck == false) {
+							//检查人脸与姓名身份证号是否匹配
+							for (let guest of this.guestList) {
+								let yunjiFaceCheckInfo = {
+									idNo: guest.idNumber,
+									name: guest.name,
+									image: guest.picBase64
+								}
+								let res = await uni.$http.post('/faceVerification/yunjiVerification',
+									yunjiFaceCheckInfo)
+								if (res.data.success === false) {
+									uni.$showMsg('顾客' + guest.name + '身份验证未通过')
+									return
+								}
 							}
 						}
 
@@ -416,6 +431,11 @@
 			//#ifdef MP-WEIXIN
 			this.needInitHotelList = this.hotelParams.wx === 0 || this.hotelParams.wx === null || this.hotelParams.wx ===
 				undefined
+			//#endif
+			//#ifdef MP-ALIPAY
+			this.needInitHotelList = this.hotelParams.alipay === 0 || this.hotelParams.alipay === null || this.hotelParams
+				.alipay === undefined
+			//#endif
 			console.log(this.needInitHotelList)
 			if (this.needInitHotelList) {
 				this.guestList.push({
@@ -430,7 +450,6 @@
 				this.guestList[0].name = this.userInfo.name
 
 			}
-			//#endif
 		},
 		onShow() {
 			console.log('onshow', this.pic)