mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 14:19:38 +08:00
1
This commit is contained in:
parent
39ce32b201
commit
1dd20a0380
12
miniprogram/api/pay/pay.js
Normal file
12
miniprogram/api/pay/pay.js
Normal file
@ -0,0 +1,12 @@
|
||||
import {
|
||||
request
|
||||
} from '../selfRequest';
|
||||
|
||||
// 唤起支付需要的参数
|
||||
export function wxPaySignRq(data) {
|
||||
return request({
|
||||
url: '/meeting/wxPay/paySign',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
@ -5,6 +5,10 @@ import {
|
||||
selectReservationByIdRq,
|
||||
} from "../../../../api/meeting/meetingRoom.js"
|
||||
|
||||
import {
|
||||
wxPaySignRq
|
||||
} from "../../../../api/pay/pay.js"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -83,22 +87,33 @@ Page({
|
||||
// 确认支付
|
||||
payComplete() {
|
||||
let _this = this;
|
||||
meetingRoomPayOrderRq({
|
||||
id: _this.data.id
|
||||
wxPaySignRq({
|
||||
prepayId: _this.data.detail.prepayId
|
||||
}).then(res => {
|
||||
console.log('meetingRoomPayOrderRq', res);
|
||||
if (res.code == 0) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/meeting/pay/waitComplete/waitComplete',
|
||||
})
|
||||
} else {
|
||||
// 消息提示
|
||||
Notify({
|
||||
message: res.msg,
|
||||
color: '#FB4B4B',
|
||||
background: '#FBE9E9',
|
||||
duration: 3000,
|
||||
});
|
||||
console.log('wxPaySignRq', res);
|
||||
// 唤起支付
|
||||
_this.callPay(res.data)
|
||||
})
|
||||
},
|
||||
|
||||
// 唤起支付
|
||||
callPay(data) {
|
||||
wx.requestPayment({
|
||||
timeStamp: data.timeStamp,
|
||||
nonceStr: data.nonceStr,
|
||||
package: data.prepayId,
|
||||
signType: data.signType,
|
||||
paySign: data.paySign,
|
||||
success(res) {
|
||||
console.log('success' ,res );
|
||||
|
||||
},
|
||||
fail(res) {
|
||||
console.log('fail' ,res );
|
||||
|
||||
},
|
||||
complete(res) {
|
||||
console.log('complete' , res);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user