getConfig(){
wx.config({
debug: this.wx_config.debug, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: this.wx_config.appId, // 必填,公众号的唯一标识
timestamp: this.wx_config.timestamp, // 必填,生成签名的时间戳
nonceStr: this.wx_config.nonceStr, // 必填,生成签名的随机串
signature:this.wx_config.signature,// 必填,签名
jsApiList: this.wx_config.jsApiList // 必填,需要使用的JS接口列表
});
//微信支付
wx.ready(function() {
// console.log(this.jsApiCall());
wx.chooseWXPay({
timestamp: this.wechat_code.timestamp,
nonceStr:this.wechat_code.nonceStr,
package: this.wechat_code.package,
signType: this.wechat_code.signType,
paySign: this.wechat_code.paySign,
success: function () {
// 支付成功后的回调函数
alert("支付成功");
window.location.href = "/hd/becomevip";
},
cancel: function() {
alert("支付失败");
}
});
}.bind(this));
},
总结:
踩坑总是难免的,总结,还有不要因为怕麻烦而不去做正确的事~









