这是代码
toConfirm: function(){
var that = this
var data = {
userId: app.globalData.userInfo.id,
total: that.data.info.price,
type: 1,
payCode: config.payCode,
openId: app.globalData.userInfo.openId
}
app.myRequest(config.prePay, { data: JSON.stringify(data) }, function (res) {
wx.requestPayment({
timeStamp: res.data.tableData.data.timeStamp + "",
nonceStr: res.data.tableData.data.nonceStr,
package: res.data.tableData.data.package,
signType: res.data.tableData.data.signType,
paySign: res.data.tableData.data.paySign,
success: function (ree) {
wx.showToast({
title: "支付成功!",
duration: 2000,
});
this.getExchange();
},
fail: function (ree) {
wx.showToast({
title: ree,
duration: 3000
}, 2000)
},
cancel: function (ree) {
wx.showToast({
title: ree,
duration: 3000
}, 2000)
}
})
})
}