|
@@ -13,8 +13,28 @@ Page({
|
|
|
wx.navigateBack({ delta: 1 })
|
|
|
},
|
|
|
|
|
|
- toPay: function (e) {
|
|
|
-
|
|
|
+ toPay: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ const id = e.currentTarget.dataset?.item?._id;
|
|
|
+ const res = await app.$post('/newCourt/api/payOrder/toRePay', { id })
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ wx.requestPayment({
|
|
|
+ "timeStamp": res.data.wxSign.timestamp,
|
|
|
+ "nonceStr": res.data.wxSign.nonceStr,
|
|
|
+ "package": `prepay_id=${res.data.wxSign.prepay_id}`,
|
|
|
+ "signType": res.data.wxSign.signType,
|
|
|
+ "paySign": res.data.wxSign.paySign,
|
|
|
+ "success": async function (res) {
|
|
|
+ wx.showToast({ title: `支付成功`, icon: 'success', duration: 2000 });
|
|
|
+ const aee = await app.$post(`/newCourt/api/payOrder/${res.data.data._id}`, { status: '1' });
|
|
|
+ if (aee.errcode == '0') { that.watchLogin(); }
|
|
|
+ },
|
|
|
+ "fail": function (res) {
|
|
|
+ wx.showToast({ title: `支付未成功`, icon: 'error', duration: 2000 })
|
|
|
+ that.watchLogin()
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
toRefund: async function (e) {
|