ortherPay.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view>
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. payData: "",
  10. }
  11. },
  12. onLoad(option) {
  13. uni.showLoading({
  14. title: '支付中'
  15. })
  16. let that = {};
  17. that.payData = JSON.parse(option.miniPayquest)
  18. if (that.payData == null) return uni.hideLoading()
  19. uni.requestPayment({
  20. "provider": "wxpay",
  21. "orderInfo": that.payData,
  22. "appid": "wx3be1d6d84d46cdf7", // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
  23. "paySign": that.payData.paySign,
  24. "nonceStr": that.payData.nonceStr, // 随机字符串
  25. "package": that.payData.package, // 固定值
  26. // "prepayid": that.payData.package, // 统一下单订单号
  27. "timeStamp": that.payData.timeStamp, // 时间戳(单位:秒)
  28. "signType": that.payData.signType, //签名算法
  29. success(msg) {
  30. console.log('msg', msg, res);
  31. uni.showToast({
  32. title: '支付成功!',
  33. icon: 'fail'
  34. })
  35. uni.hideLoading()
  36. },
  37. fail(e) {
  38. console.log('err', e);
  39. uni.hideLoading()
  40. uni.showToast({
  41. title: '取消支付',
  42. icon: 'fail'
  43. })
  44. }
  45. })
  46. }
  47. }
  48. </script>
  49. <style>
  50. </style>