Prechádzať zdrojové kódy

opt:调整支付宝小程序代码与后端小程序应用程序一致

Shu 1 mesiac pred
rodič
commit
5dc6cd1591

+ 2 - 2
subpkg/extend/extend.vue

@@ -267,7 +267,7 @@
 				let res = await uni.$http.get(`/user/checkinInfo/${this.currentHotel.hotelId}`);
 				if (res.data.code == 200) {
 					let checkinInfo = res.data.data
-					console.log(checkinInfo)
+					// console.log(checkinInfo)
 					if (checkinInfo) {
 						this.roomTypePicPath = IMG_BASE_URL + '/' + checkinInfo.roomPicPath
 						this.roomInfo = checkinInfo.roomTypeName + checkinInfo.room
@@ -416,7 +416,7 @@
 		},
 		async onLoad(options) {
 			await this.getCheckinInfo()
-			if (Object.keys(this.checkinInfo).length <= 0) {
+			if (!this.roomTypePicPath) {
 				return
 			}
 			this.fromExtend = options.fromExtend == 'true'

+ 20 - 19
subpkg_checkin/addGuest/addGuest.vue

@@ -117,7 +117,7 @@
 				<!-- #endif -->
 
 				<!-- #ifdef MP-ALIPAY -->
-				<view v-if="!showTips" class="check-pic-result">
+				<view v-if="showTips" class="check-pic-result">
 					{{ checkPicTips }}
 				</view>
 				<!-- #endif -->
@@ -310,7 +310,7 @@
 				checkPicTips: "身份核验中....",
 				screenWidth: 0,
 				faceCheckCamTopGap: 0,
-				showTips: true,
+				showTips: false,
 				isCheckingFace: false,
 				faceCheckSucceed: false,
 				// #endif
@@ -977,11 +977,8 @@
 				}
 				// console.log("进行了相机授权操作");
 				this.checkPicTips = "身份核验中...."
-				this.showTips = false
+				this.showTips = true
 				this.isCheckingFace = true
-				uni.showLoading({
-					title: '正在身份核验...',
-				});
 				while (!this.faceCheckSucceed) {
 					// console.log("开始takePhoto进行人脸检测", this.faceCheckCam);
 
@@ -1006,21 +1003,26 @@
 					console.log("checkPicRes", checkPicRes);
 
 					if (!checkPicRes.success) {
-						if (["活体检测失败", "人证比对失败"].includes(checkPicRes.msg)) {
-							this.checkPicTips = checkPicRes.msg
-						} else {
-						// console.log("checkPicRes.data", checkPicRes.data.msg.split("原因:")[1]);
-						this.checkPicTips = checkPicRes.msg.split("原因:")[1] + "请将面部完整放入拍摄区域。"
-						}
+						// if (["活体检测失败", "人证比对失败"].includes(checkPicRes.msg)) {
+						// 	this.checkPicTips = checkPicRes.msg
+						// } else {
+						// 	this.checkPicTips = checkPicRes.msg.split("原因:")[1] + "。请将面部完整放入拍摄区域。";
+						// 	console.log("checkPicRes.data", this.checkPicTips);
+						// }
+						this.checkPicTips = checkPicRes.msg
+						await new Promise(resolve => {
+							setTimeout(() => {resolve()}, 100)
+						})
 					} else {
-						this.faceCheckSucceed = checkPicRes.success
-						setTimeout(() => {}, 200)
+						this.checkPicTips = "人脸检测成功"
+						this.faceCheckSucceed = true
+
+						// 进行人脸检测成功的后继操作
+						await this.afterSuccessCheckPicAlipay(photoBase64)
 					}
 				}
-				// 进行人脸检测成功的后继操作
-				await this.afterSuccessCheckPicAlipay()
 			},
-			async afterSuccessCheckPicAlipay() {
+			async afterSuccessCheckPicAlipay(photoBase64) {
 				let infoFromIdCard = {}
 				this.infoList.forEach(info => {
 					infoFromIdCard[info] = this.idCardInfoInPage[info]
@@ -1066,8 +1068,7 @@
 					orderToUpdate.phone = this.phone
 					this.updateOrder(orderToUpdate)
 				}
-				uni.hideLoading();
-				uni.$showMsg('身份核验通过!')
+				this.checkPicTips = "身份核验通过!"
 				setTimeout(() => uni.reLaunch({
 					url: '/subpkg_checkin/confirmOrder/confirmOrder'
 				}), 1000)

+ 16 - 16
subpkg_checkin/confirmOrder/confirmOrder.vue

@@ -276,7 +276,7 @@
 			},
 			async aliPaymentNormal() {
 				// 申请获取预付号
-				let alipayRes = await uni.$http.post('/hotelOrder/alipayPrepay', {
+				let alipayRes = await uni.$http.post('/order/payment/alipayNormal', {
 					openid: this.userInfo.openid,
 					orderId: this.order.orderId
 				})
@@ -322,7 +322,7 @@
 
 				if (tradeRes.resultCode === "6001") {
 					console.log("支付未完成。");
-					uni.$http.post(`/hotelOrder/cancelPayment/${this.order.id}`)
+					uni.$http.post(`/order/cancelPayment/${this.order.id}`)
 				}
 
 				if (tradeRes.resultCode === "6002") {
@@ -331,13 +331,13 @@
 						title: "网络连接出错",
 						content: "网络连接出错,请检查网络连接后重试。",
 					});
-					uni.$http.post(`/hotelOrder/cancelPayment/${this.order.id}`)
+					uni.$http.post(`/order/cancelPayment/${this.order.id}`)
 				}
 
 				// 顾客支付后,查询支付状态
 				if (["9000", "6004", "8000"].includes(tradeRes.resultCode)) {
 					// 顾客支付订单后,查询支付宝侧的订单支付状态,只有TRADE_SUCCESS才为支付成功
-					let tradeStatus = await uni.$http.post('/hotelOrder/queryAlipayTradeStatus', {
+					let tradeStatus = await uni.$http.post('/order/payment/queryAlipayNormal', {
 						tradeNo: tradeNo,
 						hotelId: this.currentHotel.hotelId
 					})
@@ -348,15 +348,15 @@
 							url: '/subpkg_checkin/checkin/checkin'
 						})
 					} else {
-						uni.$http.post(`/hotelOrder/cancelPayment/${this.order.id}`)
+						uni.$http.post(`/order/cancelPayment/${this.order.id}`)
 					}
 				}
 			},
 			async aliPaymentFreeze() {
 				// 申请获取签名字符串
-				let alipayRes = await uni.$http.post('/hotelOrder/alipayFreezeFund', {
-					orderId: this.order.orderId,
-					hotelId: this.currentHotel.hotelId
+				let alipayRes = await uni.$http.post('/order/payment/alipayAuthPay', {
+					openid: this.userInfo.openid,
+					orderId: this.order.orderId
 				})
 				console.log("签名字符串", alipayRes.data)
 
@@ -401,7 +401,7 @@
 
 				if (tradeRes.resultCode === "6001") {
 					console.log("支付未完成。");
-					uni.$http.post(`/hotelOrder/cancelPayment/${this.order.id}`)
+					uni.$http.post(`/order/cancelPayment/${this.order.id}`)
 				}
 
 				if (tradeRes.resultCode === "6002") {
@@ -410,31 +410,31 @@
 						title: "网络连接出错",
 						content: "网络连接出错,请检查网络连接后重试。",
 					});
-					uni.$http.post(`/hotelOrder/cancelPayment/${this.order.id}`)
+					uni.$http.post(`/order/cancelPayment/${this.order.id}`)
 				}
 
 				// 顾客授权后,查询授权状态
 				if (["9000", "6004", "8000"].includes(tradeRes.resultCode)) {
 					// 顾客授权后,查询授权状态,只有AUTHORIZED(已授权状态:授权成功,可以进行转支付或解冻操作)才算成功
-					let tradeStatus = await uni.$http.post('/hotelOrder/queryFreezeStatus', {
-						orderId: this.order.orderId,
-						hotelId: this.currentHotel.hotelId
+					const { data: tradeStatus } = await uni.$http.post('/order/payment/queryAlipayAuthPay', {
+						openid: this.userInfo.openid,
+						orderId: this.order.orderId
 					})
 					// console.log("tradeStatus", tradeStatus);
-					if (tradeStatus.data.success && tradeStatus.data.data === "AUTHORIZED") {
+					if (tradeStatus.success && tradeStatus.data === "AUTHORIZED") {
 						uni.$showMsg("支付成功")
 						uni.navigateTo({
 							url: '/subpkg_checkin/checkin/checkin'
 						})
 					} else {
-						uni.$http.post(`/hotelOrder/cancelPayment/${this.order.id}`)
+						uni.$http.post(`/order/cancelPayment/${this.order.id}`)
 					}
 				}
 			}
 			// #endif
 		},
 		async onLoad() {
-			let res = await uni.$http.post(`/hotel/roomType`, {
+			const res = await uni.$http.post(`/hotel/roomType`, {
 				hotelId: this.currentHotel.hotelId,
 				roomType: this.order.roomType
 			})