|
@@ -97,7 +97,10 @@
|
|
<text text="" align="right" size="20">(注:需付押金{{order.deposit ? order.deposit : ""}}元)</text>
|
|
<text text="" align="right" size="20">(注:需付押金{{order.deposit ? order.deposit : ""}}元)</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="completeBtn">
|
|
|
|
|
|
+ <view class="completeBtn" v-if="useYst">
|
|
|
|
+ <button class="u-button" @click="ystPayment">支付</button>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="completeBtn" v-else>
|
|
<button class="u-button" @click="pay">支付</button>
|
|
<button class="u-button" @click="pay">支付</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -143,6 +146,7 @@
|
|
}
|
|
}
|
|
}],
|
|
}],
|
|
title: "",
|
|
title: "",
|
|
|
|
+ useYst: true,
|
|
// #ifdef MP-ALIPAY
|
|
// #ifdef MP-ALIPAY
|
|
rightBtns: [{
|
|
rightBtns: [{
|
|
text: "删除",
|
|
text: "删除",
|
|
@@ -259,6 +263,78 @@
|
|
}
|
|
}
|
|
// #endif
|
|
// #endif
|
|
},
|
|
},
|
|
|
|
+ async ystPayment() {
|
|
|
|
+ const {miniProgram: {appId}} = uni.getAccountInfoSync();
|
|
|
|
+ // console.log("小程序信息", appId);
|
|
|
|
+
|
|
|
|
+ const {data: submitRes} = await uni.$http.post('/order/payment/ystPay', {
|
|
|
|
+ openid: this.userInfo.openid,
|
|
|
|
+ orderId: this.order.orderId,
|
|
|
|
+ appId: appId
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ console.log("订单提交结果", submitRes)
|
|
|
|
+
|
|
|
|
+ // 创建订单失败
|
|
|
|
+ if (!submitRes.success) {
|
|
|
|
+ //小程序创建的订单跳转至选择房间,pms预订单跳转至查询订单
|
|
|
|
+ if (this.order.orderSource === 'MINI_APP') {
|
|
|
|
+ uni.showModal({
|
|
|
|
+ content: '房间已被占用,请重新选房',
|
|
|
|
+ showCancel: false,
|
|
|
|
+ success: (res) => {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/subpkg_checkin/selectRoom/selectRoom?roomType=' +
|
|
|
|
+ this.order.roomType
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ uni.showModal({
|
|
|
|
+ content: '订单不可用,请重新选择订单',
|
|
|
|
+ showCancel: false,
|
|
|
|
+ success: (res) => {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/subpkg_checkin/queryOrder/queryOrder?'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const payData = JSON.parse(submitRes.data)
|
|
|
|
+ // console.log("支付数据", payData);
|
|
|
|
+ const paymentResult = await wx.requestPayment(payData)
|
|
|
|
+ console.log("payment result:", paymentResult)
|
|
|
|
+
|
|
|
|
+ // 不是调用支付成功的情况,解锁订单,直接返回
|
|
|
|
+ if (paymentResult.errMsg !== 'requestPayment:ok') {
|
|
|
|
+ await uni.$http.post(`/order/cancelPayment/${this.order.id}`)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 调用支付成功,查询下订单支付情况
|
|
|
|
+ const {data: paymentRes} = await uni.$http.post('/order/payment/queryYstPay', {
|
|
|
|
+ openid: this.userInfo.openid,
|
|
|
|
+ orderId: this.order.orderId,
|
|
|
|
+ appId: appId
|
|
|
|
+ })
|
|
|
|
+ console.log("订单支付结果", paymentRes)
|
|
|
|
+
|
|
|
|
+ if (paymentRes.success && paymentRes.data === "S") {
|
|
|
|
+ uni.$showMsg("支付成功")
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/subpkg_checkin/checkin/checkin'
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ uni.$http.post(`/order/cancelPayment/${this.order.id}`)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// #ifdef MP-ALIPAY
|
|
// #ifdef MP-ALIPAY
|
|
onSwipeStart() {
|
|
onSwipeStart() {
|
|
this.swipeIndex = ""
|
|
this.swipeIndex = ""
|