|
@@ -136,7 +136,8 @@
|
|
|
orderId: '',
|
|
|
endTime: '',
|
|
|
canExtend: false,
|
|
|
- checkinInfoId: ''
|
|
|
+ checkinInfoId: '',
|
|
|
+ useYst: true
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -240,18 +241,21 @@
|
|
|
},
|
|
|
async pay(orderId) {
|
|
|
console.log("pay start");
|
|
|
-
|
|
|
// #ifdef MP-WEIXIN
|
|
|
- let res = await uni.$http.post('/order/payment/weChat', {
|
|
|
- openid: this.userInfo.openid,
|
|
|
- orderId: orderId,
|
|
|
- })
|
|
|
- res.data.data.package = res.data.data.packageStr
|
|
|
- let paymentResult = await wx.requestPayment(res.data.data)
|
|
|
- console.log("payment result:", paymentResult)
|
|
|
- if (paymentResult.errMsg === 'requestPayment:ok') {
|
|
|
- uni.$showMsg("支付成功")
|
|
|
- this.extend()
|
|
|
+ if (this.useYst) {
|
|
|
+ await this.ystPayment(orderId)
|
|
|
+ } else {
|
|
|
+ let res = await uni.$http.post('/order/payment/weChat', {
|
|
|
+ openid: this.userInfo.openid,
|
|
|
+ orderId: orderId,
|
|
|
+ })
|
|
|
+ res.data.data.package = res.data.data.packageStr
|
|
|
+ let paymentResult = await wx.requestPayment(res.data.data)
|
|
|
+ console.log("payment result:", paymentResult)
|
|
|
+ if (paymentResult.errMsg === 'requestPayment:ok') {
|
|
|
+ uni.$showMsg("支付成功")
|
|
|
+ this.extend()
|
|
|
+ }
|
|
|
}
|
|
|
// #endif
|
|
|
|
|
@@ -263,6 +267,35 @@
|
|
|
}
|
|
|
// #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
|
|
|
+ })
|
|
|
+ // console.log("订单提交结果", submitRes)
|
|
|
+
|
|
|
+ const payData = JSON.parse(submitRes.data)
|
|
|
+ // console.log("支付数据", payData);
|
|
|
+ const paymentResult = await wx.requestPayment(payData)
|
|
|
+ // console.log("payment result:", paymentResult)
|
|
|
+
|
|
|
+ // 调用支付成功,查询下订单支付情况
|
|
|
+ const {data: paymentRes} = await uni.$http.post('/order/payment/queryYstPay', {
|
|
|
+ openid: this.userInfo.openid,
|
|
|
+ orderId: orderId,
|
|
|
+ appId: appId
|
|
|
+ })
|
|
|
+ console.log("订单支付结果", paymentRes)
|
|
|
+
|
|
|
+ if (paymentRes.success && paymentRes.data === "S") {
|
|
|
+ uni.$showMsg("支付成功")
|
|
|
+ this.extend()
|
|
|
+ }
|
|
|
+ },
|
|
|
async getCheckinInfo() {
|
|
|
let res = await uni.$http.get(`/user/checkinInfo/${this.currentHotel.hotelId}`);
|
|
|
if (res.data.code == 200) {
|