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