Commit a29f5e90 by jscat

nyx weapp: 微信支付

1. 添加微信支付功能
parent e6a7671a
......@@ -433,6 +433,42 @@ Page({
},
/*
jscat 2020/11/17 支付成功
*/
toPay_ok: function (e) {
var datas = this.data;
var strUrl = 'https://wx.hisuhong.com/api/nyx/wx/pay/orders?openId=onuaY5fagtbB9zyEQ3fQ6jaesgrM&money=1&body=123'
wx.request({
url: strUrl,
method: "GET",
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) { //后端返回的数据
//console.log(res)
wx.requestPayment({
'timeStamp': res.data.payMap.timeStamp,
'nonceStr': res.data.payMap.nonceStr,
'package': res.data.payMap.package,
'signType': 'MD5',
'paySign': res.data.payMap.paySign,
success: function (res) {
if (res.errMsg == "requestPayment:ok"){
//这里是支付成功后的操作,你可以在此提交表单或者进行其他减少库存量等一系列操作
console.log("pay:ok");
}
},
fail : function(res)
{
console.log("failed")
}
})
}
});
},
//跳转到首页
toHome: function (e) {
var _this = this;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论