https://www.cnblogs.com/yuhangwang/p/5322921.html 大神
wx.config({
debug: false,
appId: "wxfbb78a36297d43b4", // 必填,公众号的唯一标识
timestamp: time1, // 必填,生成签名的时间戳
nonceStr: nonceStr1, // 必填,生成签名的随机串
signature: signature2, // 必填,签名,见附录1
jsApiList: [
'checkJsApi',
'chooseWXPay',
'hideOptionMenu'
]
});
alert("确定付款吗?");
wx.chooseWXPay({
timestamp: time1, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: nonceStr1, // 支付签名随机串,不长于 32 位
package: "prepay_id=" + package1, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: signature2, // 支付签名
success: function (res) {
alert("jkfjdf");
if (res.errMsg == "chooseWXPay:ok") {
alert("啦啦啦");
} else {
alert(res.errMsg);
}
// 支付成功后的回调函数
//if (res.err_msg == "get_brand_wcpay_request:ok") {
// $(function () {
// $.ajax({
// contentType: "application/json",
// url: "/Customer/Pay_ProductPage2",
// data: "{OrderID:'" + OrderID + "'}",
// type: "POST",
// dataType: "json",
// success: function (json) {
// json = eval("(" + json.d + ")");
// if (json.success == "success") {
// $("#tip").text("支付成功,正在跳转......");
// window.location = "http://bt20749562.51mypc.cn/Customer/my";
// }
// else {
// $("#tip").text(json.msg);
// alert("支付失败");
// window.location = "http://bt20749562.51mypc.cn/Customer/my";
// }
// },
// error: function (err, ex) {
// alert(err.responseText);
// }
// });
// })
//} // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok,但并不保证它绝对可靠。
//else {
// alert("交易取消");
// window.location = "http://bt20749562.51mypc.cn/Customer/my";
//}
}
});
},
error: function (datr) {
alert(datr + "错误");
},
});
注释部分怎么都不好用 终于后来的后来