收藏
回答

h5wx.chooseWXPa支付

h5wx.chooseWXPa支付后回调函数之前可以正常执行。然后今天在手机上就突然不能正常执行了,但是在开发者工具上可以执行回调。

回答关注问题邀请回答
收藏

2 个回答

  • 微信支付技术助手1
    微信支付技术助手1
    2019-08-23

    有没有报错之类的,提供下错误信息和代码片段。

    2019-08-23
    有用
    回复 1
    • 知行合一
      知行合一
      2019-08-23

      没有任何报错,能正常支付。就是在手机上不执行回调。开发者工具上可以执行回调,地址是 : http://h5.glodog.cn/

      wxconfig文件:
      export async function wxConfig(share, payment) {
        const config = store.state.wxConfig
        const storeInfo = store.state.customData
        const shareTitle = share.title || storeInfo.title
        const shareDesc = share.desc || storeInfo.description
        const shareLink = share.link || window.location.href.split('#')[0] + '#/main?storeId=' + getStoreId()
        const shareImg = share.imgUrl || window.location.origin + '/share.png'
        wx.config({
          debug: false,
          appId: config.appid,
          timestamp: config.timestamp,
          nonceStr: config.nonceStr,
          signature: config.signature,
          jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay']
        })
       
        const d = {
          title: shareTitle, // 分享标题
          desc: shareDesc, // 分享描述
          link: shareLink, // 分享链接
          imgUrl: shareImg
        }
       
        wx.ready(() => {
          // 分享给朋友圈
          wx.updateTimelineShareData(d)
          wx.onMenuShareTimeline(d)
          // 分享给朋友
          wx.updateAppMessageShareData(d)
          wx.onMenuShareAppMessage(d)
          if (payment) {
            wx.chooseWXPay({
              timestamp: payment.timestamp,
              nonceStr: payment.nonceStr,
              package: payment.package,
              signType: payment.signType,
              paySign: payment.paySign,
              success: payment.success,
              fail: payment.fail,
              cancel: payment.fail
            })
          }
        })
       
        wx.error(() => {})
      }
       
      功能页调用wxconfig进行h5支付:
                    wxConfig(
                      {},
                      {
                        timestamp: result.data.timeStamp,
                        nonceStr: result.data.nonceStr,
                        package: result.data.package,
                        signType: result.data.signType,
                        paySign: result.data.sign,
                        success: message => {
                          Toast(message.errMsg)
                          Toast('支付成功')
                          setTimeout(() => {
                            this.$router.push({
                              path: '/myOrder',
                              query: {
                                status: 2
                              }
                            })
                          }, 1000)
                        },
                        fail: error => {
                          Toast(error.errMsg)
                          this.paymentError()
                        },
                        cancel: message => {
                          Toast(message.errMsg)
                          this.paymentError()
                        }
                      }
                    )



      2019-08-23
      回复
  • 痛快科技
    痛快科技
    2019-08-22

    是否有修改

    2019-08-22
    有用
    回复 1
    • 知行合一
      知行合一
      2019-08-23
      没有做过任何修改 关键问题是在开发者工具上可以执行 手机上不行
      2019-08-23
      回复
登录 后发表内容