// 支付的回调函数
function pay(res, successData, errorData) {
console.log(res.data.data)
var data=res.data;
wx.requestPayment({
timeStamp: data.timeStamp,
nonceStr: data.nonceStr,
package: data.package,
signType: data.signType,
paySign: data.paySign,
success: function (res) {
console.info(res,'============');
if(successData){
successData(res)
}
},
fail: function (res) {
console.info(res,'============');
if (errorData) {
errorData(res)
}
}
})
}
module.exports = {
pay: pay,
}
回调函数引入
var utils = require('../../../../utils/utils')```
回调函数调用
utils.pay(res, that.successData, that.errorData)