Selaa lähdekoodia

bugfix: 修复支付接口没有传appId的问题

Shu 2 viikkoa sitten
vanhempi
commit
7515a92ba3
2 muutettua tiedostoa jossa 22 lisäystä ja 15 poistoa
  1. 7 5
      subpkg/extend/extend.vue
  2. 15 10
      subpkg_checkin/confirmOrder/confirmOrder.vue

+ 7 - 5
subpkg/extend/extend.vue

@@ -137,6 +137,7 @@
 				endTime: '',
 				canExtend: false,
 				checkinInfoId: '',
+				appId: "",
 			};
 		},
 		computed: {
@@ -247,6 +248,7 @@
 					let res = await uni.$http.post('/order/payment/weChat', {
 						openid: this.userInfo.openid,
 						orderId: orderId,
+						appId: this.appId
 					})
 					res.data.data.package = res.data.data.packageStr
 					let paymentResult = await wx.requestPayment(res.data.data)
@@ -267,13 +269,10 @@
 				// #endif
 			},
 			async ystPayment(orderId) {
-				const {miniProgram: {appId}} = uni.getAccountInfoSync();
-				// console.log("小程序信息", appId);
-
 				const {data: submitRes} = await uni.$http.post('/order/payment/ystPay', {
 					openid: this.userInfo.openid,
 					orderId: orderId,
-					appId: appId
+					appId: this.appId
 				})
 				// console.log("订单提交结果", submitRes)
 
@@ -286,7 +285,7 @@
 				const {data: paymentRes} = await uni.$http.post('/order/payment/queryYstPay', {
 					openid: this.userInfo.openid,
 					orderId: orderId,
-					appId: appId
+					appId: this.appId
 				})
 				console.log("订单支付结果", paymentRes)
 
@@ -447,6 +446,9 @@
 			// #endif
 		},
 		async onLoad(options) {
+			const {miniProgram: {appId}} = uni.getAccountInfoSync();
+			// console.log("小程序信息", appId);
+			this.appId = appId
 			await this.getCheckinInfo()
 			if (!this.roomTypePicPath) {
 				return

+ 15 - 10
subpkg_checkin/confirmOrder/confirmOrder.vue

@@ -146,6 +146,7 @@
 					}
 				}],
 				title: "",
+				appId: '',
 				// #ifdef MP-ALIPAY
 				rightBtns: [{
 					text: "删除",
@@ -215,6 +216,7 @@
 				let res = await uni.$http.post('/order/payment/weChat', {
 					openid: this.userInfo.openid,
 					orderId: this.order.orderId,
+					appId: this.appId
 				})
 				if (res.data.code == 200) {
 					res.data.data.package = res.data.data.packageStr
@@ -270,21 +272,19 @@
 				// #endif
 			},
 			async ystPayment() {
-				const {miniProgram: {appId}} = uni.getAccountInfoSync();
-				// console.log("小程序信息", appId);
-				
+				let platform
 				// #ifdef MP-WEIXIN
-				const platform = "WECHAT"
+				platform = "WECHAT"
 				// #endif
 
 				// #ifdef MP-ALIPAY
-				const platform = "ALIPAY"
+				platform = "ALIPAY"
 				// #endif
 
 				const {data: submitRes} = await uni.$http.post('/order/payment/ystPay', {
 					openid: this.userInfo.openid,
 					orderId: this.order.orderId,
-					appId: appId
+					appId: this.appId
 				})
 
 				console.log("订单提交结果", submitRes)
@@ -336,7 +336,7 @@
 				const {data: paymentRes} = await uni.$http.post('/order/payment/queryYstPay', {
 					openid: this.userInfo.openid,
 					orderId: this.order.orderId,
-					appId: appId,
+					appId: this.appId,
 					platform: platform
 				})
 				console.log("订单支付结果", paymentRes)
@@ -369,7 +369,8 @@
 				// 申请获取预付号
 				let alipayRes = await uni.$http.post('/order/payment/alipayNormal', {
 					openid: this.userInfo.openid,
-					orderId: this.order.orderId
+					orderId: this.order.orderId,
+					appId: this.appId
 				})
 				// console.log("获取预付号",alipayRes.data)
 				if (!alipayRes.data.success) {
@@ -447,7 +448,8 @@
 				// 申请获取签名字符串
 				let alipayRes = await uni.$http.post('/order/payment/alipayAuthPay', {
 					openid: this.userInfo.openid,
-					orderId: this.order.orderId
+					orderId: this.order.orderId,
+					appId: this.appId
 				})
 				console.log("签名字符串", alipayRes.data)
 
@@ -509,7 +511,8 @@
 					// 顾客授权后,查询授权状态,只有AUTHORIZED(已授权状态:授权成功,可以进行转支付或解冻操作)才算成功
 					const { data: tradeStatus } = await uni.$http.post('/order/payment/queryAlipayAuthPay', {
 						openid: this.userInfo.openid,
-						orderId: this.order.orderId
+						orderId: this.order.orderId,
+						appId: this.appId
 					})
 					// console.log("tradeStatus", tradeStatus);
 					if (tradeStatus.success && tradeStatus.data === "AUTHORIZED") {
@@ -525,6 +528,8 @@
 			// #endif
 		},
 		async onLoad() {
+			const {miniProgram: {appId}} = uni.getAccountInfoSync();
+			this.appId = appId
 			const res = await uni.$http.post(`/hotel/roomType`, {
 				hotelId: this.currentHotel.hotelId,
 				roomType: this.order.roomType