ソースを参照

bugfi:处理支付宝小程序入住失败的问题

Shu 4 ヶ月 前
コミット
8c7b5bd1f0
1 ファイル変更31 行追加34 行削除
  1. 31 34
      subpkg_checkin/addGuest/addGuest.vue

+ 31 - 34
subpkg_checkin/addGuest/addGuest.vue

@@ -299,6 +299,8 @@
 					margin: "0 auto"
 				},
 				frontPassed: false,
+				idCardFrontBase64: null,
+				idCardBackBase64: null,
 				backPassed: false,
 				checkPicTips: "身份核验中....",
 				screenWidth: 0,
@@ -945,11 +947,13 @@
 					this.idCardInfoInPage.birth = data.birth
 					this.idCardInfoInPage.address = data.address
 					this.idCardInfoInPage.idNumber = data.cardNum
+					this.idCardFrontBase64 = imgBase64
 					this.frontPassed = true
 				} else if (_ocrType === ocrType.emblem) {
 					this.idCardInfoInPage.issuingAuthority = data.issuingAuthority
 					this.idCardInfoInPage.issuingDate = data.issuingDate
 					this.idCardInfoInPage.expiryDate = data.expiryDate
+					this.idCardBackBase64 = imgBase64
 					this.backPassed = true
 				}
 				my.hideLoading()
@@ -982,13 +986,14 @@
 				this.showTips = false
 				this.isCheckingFace = true
 
+				let succeedImgBase64
 				while (!this.faceCheckSucceed) {
-					// console.log("开始takePhoto进行人脸检测");
+					// console.log("开始takePhoto进行人脸检测", this.faceCheckCam);
 
 					const photo = await this.faceCheckCam.takePhoto({
 						quality: 'normal',
 					})
-					// console.log("完成takePhoto", this.photo.tempImagePath);
+					// console.log("完成takePhoto", photo.tempImagePath);
 					const { data: photoBase64 } = await this.fileSystem.readFile({
 						filePath: photo.tempImagePath,
 						encoding: "base64"
@@ -1004,12 +1009,13 @@
 						// console.log("checkPicRes.data", checkPicRes.data.msg.split("原因:")[1]);
 						this.checkPicTips = checkPicRes.data.msg.split("原因:")[1] + "请将面部完整放入拍摄区域。"
 					} else {
+						succeedImgBase64 = photoBase64
 						this.faceCheckSucceed = checkPicRes.data.success
 					}
 					setTimeout(() => {}, 100)
 				}
 				// 进行云极人证比对
-				await this.afterSuccessCheckPicAlipay(photoBase64)
+				await this.afterSuccessCheckPicAlipay(succeedImgBase64)
 			},
 			async afterSuccessCheckPicAlipay(photoBase64) {
 				if (this.userInfo.skipIdMatching === true) {
@@ -1062,43 +1068,42 @@
 						title: '正在身份核验,请稍后',
 					});
 					let yunjiFaceCheckInfo = {
-						idNo: that.idNumber,
-						name: that.name,
-						image: mybase64,
+						idNo: this.idNumber,
+						name: this.name,
+						image: photoBase64,
 					};
 					let checkRes = await uni.$http.post(
 						'/faceVerification/yunjiVerification',
 						yunjiFaceCheckInfo
 					);
 
-					if (checkRes.data.success === true) {
+					if (checkRes.data.success) {
 						let infoFromIdCard = {}
-						that.infoList.forEach(info => {
-							infoFromIdCard[info] = that.idCardInfoInPage[info]
+						this.infoList.forEach(info => {
+							infoFromIdCard[info] = this.idCardInfoInPage[info]
 						})
 						let currentCheckinInfo = {
-							name: that.name,
-							idNumber: that.idNumber,
-							faceData: mybase64,
-							phone: that.phone,
+							name: this.name,
+							idNumber: this.idNumber,
+							faceData: photoBase64,
+							phone: this.phone,
 							...infoFromIdCard
 						}
 						//更新local storage 中的入住信息
-						let checkinInfoToUpdate = that.checkinInfo
+						let checkinInfoToUpdate = this.checkinInfo
 						checkinInfoToUpdate.push(currentCheckinInfo)
-						that.updateCheckinInfo(checkinInfoToUpdate)
+						this.updateCheckinInfo(checkinInfoToUpdate)
 						//更新local storage 中的身份证信息
-						let idCardInfoToUpdate = that.idCardInfo
-						idCardInfoToUpdate.push(that.idCardInfoInPage)
-						that.updateIdCardInfo(idCardInfoToUpdate)
+						let idCardInfoToUpdate = this.idCardInfo
+						idCardInfoToUpdate.push(this.idCardInfoInPage)
+						this.updateIdCardInfo(idCardInfoToUpdate)
 						//如果上传过照片则更新服务器中的身份证信息
-						if (that.idCardFrontDetectInfo.detected && that.idCardBackDetectInfo
-							.detected) {
+						if (this.frontPassed && this.backPassed) {
 							uni.$http.post('/idCardInfo', {
-								...that.idCardInfoInPage,
-								birthday: that.idCardInfoInPage.birth,
-								idCardFrontBase64: that.idCardFrontPicPath.split(',')[1],
-								idCardBackBase64: that.idCardBackPicPath.split(',')[1]
+								...this.idCardInfoInPage,
+								birthday: this.idCardInfoInPage.birth,
+								idCardFrontBase64: this.idCardFrontBase64,
+								idCardBackBase64: this.idCardBackBase64
 							})
 						}
 						if (this.isMainCustomer) {
@@ -1123,16 +1128,8 @@
 						}), 1000)
 					} else {
 						uni.hideLoading()
-						uni.showModal({
-							content: '身份核验失败,请重试',
-							showCancel: false,
-							success: function(res) {
-								if (res.confirm) {
-									console.log('用户点击确定');
-									that.initData();
-								}
-							},
-						});
+						this.isCheckingFace = false
+						this.checkPicTips = "身份核验失败,请重新进行"
 					}
 				}
 			},