微信支付功能

166 阅读1分钟

  async goPay() {    $api.PRESCRIPTION.getDrugOrder({
      //将后端需要的参数传入      mainId: ,       openId:       payChannel: "",      payMethod: "",    }).then(res => {      // 调用微信支付接口      wx.requestPayment(        {          'timeStamp': res.data.timeStamp,          'nonceStr': res.data.nonceStr,          'package': res.data.packageValue,          'signType': res.data.signType,          'paySign': res.data.paySign,          'success': function () {            wx.showToast({              title: '支付成功',              icon: 'success',              duration: 1000            });            $router.redirectTo({              url: '/prescription/pages/paySuccess',            })          },          'fail': function () {            wx.showToast({              title: '支付已取消',              icon: 'none'            })          }        })    }).catch((error) => {      wx.showToast({        title: error,        icon: 'none'      })    })  },