위챗 mpvue 프레임워크 애플릿 결제
pay(){
wx.login({
success: (res)=> {
// code, , openid
if (res.code) {
this.$httpWX.post({ //
url:" ",
data:{
code:res.code,
money:this.money, //
}
}).then(res=>{
wx.requestPayment({
timeStamp: res.info.timeStamp.toString(),
nonceStr: res.info.nonceStr,
package: res.info.package,
signType: 'MD5',
paySign: res.info.paySign,
success: (res) =>{
wx.showToast({
title: ' !',
icon: 'success',
duration: 2000,
})
},
fail: function (res) {
wx.showToast({
title: " !",
icon: 'warn',
duration: 1500
})
},
complete: function (res) {
console.log(res);
}
})
}).catch(err=>{
})
} else {
console.log(' !' + res.errMsg)
}
}
});
}