zoukankan      html  css  js  c++  java
  • 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, }); }) },
  • 相关阅读:
    [转载]Centos7.x下环境搭建(一)--yum方式安装mysql5.7
    树上分治
    [SPOJ2666]QTREE4
    [SPOJ375]QTREE
    [SPOJ1825]FTOUR2
    [POJ1741]Tree
    [LG-P5350]序列
    [COCI 2014/2015 #3]KAMIONI
    [SHOI2014]神奇化合物
    [GXOI/GZOI2019]旧词
  • 原文地址:https://www.cnblogs.com/ydam/p/9723920.html
Copyright © 2011-2022 走看看