vue调起微信支付


           
affirmPay() {
if(typeof WeixinJSBridge == "undefined") { if(document.addEventListener) { document.addEventListener('WeixinJSBridgeReady', this.jsApiCall, false); } else if(document.attachEvent) { document.attachEvent('WeixinJSBridgeReady', this.jsApiCall); document.attachEvent('onWeixinJSBridgeReady', this.jsApiCall); } } else { this.jsApiCall(this.id); } }, jsApiCall($orderNo) { this.$dialog.loading.open('正在连接支付接口...'); var jsondata = { pay_type: "wechatJsApi", order_sn: this.id, }; this.$http.post(this.getApiUrl() + "Payment/pay", jsondata, { emulateJSON: true }).then(function(datas) { this.$dialog.loading.close(); var Jsonparse = JSON.parse(datas.bodyText); if(Jsonparse.status == "1") { //成功 WeixinJSBridge.invoke( 'getBrandWCPayRequest', JSON.parse(Jsonparse.data), function(res) { if(res.err_msg == "get_brand_wcpay_request:ok") { alert('支付成功'); location.href = ''; //支付成功后的跳转地址 } //WeixinJSBridge.log(res.err_msg); //alert(res.err_code+res.err_desc+res.err_msg); } ); } else { this.$dialog.toast({ mes: Jsonparse.msg, timeout: 1500, }); } }, function(response) { this.$dialog.loading.close(); this.$dialog.toast({ mes: '网络请求超时 - ' + response.status, timeout: 1500, }); }) },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM