위챗 애플릿에서 위챗 결제

1774 단어
clickzhifu() {
    var that = this;
    wx.request({
      url: that.data.url + '******',
      data: {
        user_id: that.data.user_id,
        order_id: that.data.order_id
      },
      success: function(res) {
        console.log(res)
        if (res.data.status == 200) {
          console.log(res.data.data)
          res.data.data = JSON.parse(res.data.data)
          wx.requestPayment({
            appId: res.data.data.appId,
            nonceStr: res.data.data.nonceStr,
            package: res.data.data.package,
            paySign: res.data.data.paySign,
            signType: res.data.data.signType,
            timeStamp: res.data.data.timeStamp,
            success: function(res) {
              console.log(res)
              wx.showModal({
                title: ' ',
                content: ' , ',
                success: function(res) {
                  if (res.confirm) {
                    wx.switchTab({
                      url: '../../../../../../my/my',
                    })
                  } else {
                    // console.log(' ')
                  }
                }
              })
            },
            fail: function(res) {
              wx.showToast({
                title: ' , ',
                icon: 'none',
                duration: 1500
              })
            }
          })
        } else {
          wx.showToast({
            title: res.data.msg,
            duration: 2000,
            icon: 'none'
          })
        }
      },
      fail: function(res) {
        wx.showToast({
          title: ' , ',
          duration: 2000,
          icon: 'none'
        })
      }
    })
  },

좋은 웹페이지 즐겨찾기