vue.js 微信支付前端代码分享_vue.js_脚本之家
分类:计算机网络

十博官网网址,vue.js 微信支付前端代码分享,vue.js支付前端代码

实例如下所示:

onBridgeReady: function () {
  const openId = localStorage.getItem('openId')
  payService.payment(this.$route.params.orderId, 1, openId).then(rt => { //1:支付类型,可不填
  this.message = rt.t
  WeixinJSBridge.invoke(
    'getBrandWCPayRequest', {
    'appId': this.message.appId,
    'timeStamp': this.message.timeStamp,
    'nonceStr': this.message.nonceStr,
    'package': this.message.package,
    'signType': this.message.signType,
    'paySign': this.message.paySign
    },
   function (res) {
   console.log(res)
   if (res.err_msg === 'get_brand_wcpay_request:ok') {
    Toast('微信支付成功')
    this.$router.push('/MineOrder')
   } else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
    Toast('用户取消支付')
    // window.location.href = 'gift_failview.do?out_trade_no=' + this.orderId
   } else if (res.err_msg === 'get_brand_wcpay_request:fail') {
    Toast('网络异常,请重试')
   }
   }
  )
  })
 },
 callpay: function () {
  if (typeof WeixinJSBridge === 'undefined') {
  if (document.addEventListener) {
   document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(), false)
  } else if (document.attachEvent) {
   document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady())
   document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady())
  }
  } else {
  this.onBridgeReady()
  }
 }

以上这篇vue.js 微信支付前端代码分享就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持帮客之家。

微信支付前端代码分享,vue.js支付前端代码 实例如下所示: onBridgeReady: function () { const openId = localStorage.getItem('openId') payService.payment...

实例如下所示:

onBridgeReady: function () { const openId = localStorage.getItem payService.payment(this.$route.params.orderId, 1, openId).then(rt => { //1:支付类型,可不填 this.message = rt.t WeixinJSBridge.invoke( 'getBrandWCPayRequest', { 'appId': this.message.appId, 'timeStamp': this.message.timeStamp, 'nonceStr': this.message.nonceStr, 'package': this.message.package, 'signType': this.message.signType, 'paySign': this.message.paySign }, function  { console.log if (res.err_msg === 'get_brand_wcpay_request:ok') { Toast this.$router.push } else if (res.err_msg === 'get_brand_wcpay_request:cancel') { Toast // window.location.href = 'gift_failview.do?out_trade_no=' + this.orderId } else if (res.err_msg === 'get_brand_wcpay_request:fail') { Toast }, callpay: function () { if (typeof WeixinJSBridge === 'undefined') { if (document.addEventListener) { document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady } else if  { document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady } } else { this.onBridgeReady() } }

本文由十博官网网址发布于计算机网络,转载请注明出处:vue.js 微信支付前端代码分享_vue.js_脚本之家

上一篇:没有了 下一篇:没有了
猜你喜欢
热门排行
精彩图文