depositPayment.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="tip-area">
  3. <image class="image" src="/static/success.png"></image>
  4. <text class="text">房券支付成功,</text>
  5. <text class="text">即将进行押金支付</text>
  6. </view>
  7. <view class="payment-button">
  8. <button class="button" @click="payDeposit">支付押金</button>
  9. <u-button text="" color="#a09bc4"></u-button>
  10. </view>
  11. </template>
  12. <script setup>
  13. import {
  14. useAppInfoStore
  15. } from '../../store/appInfoStore';
  16. import {
  17. useOrderStore
  18. } from '../../store/orderStore';
  19. import {
  20. useUserStore
  21. } from '../../store/userStore';
  22. let userStore = useUserStore()
  23. let userInfo = userStore.userInfo
  24. let appInfoStore = useAppInfoStore()
  25. let orderStore = useOrderStore()
  26. let orderInfo = orderStore.orderInfo
  27. async function payDeposit() {
  28. let res = await uni.request({
  29. url: '/order/payment/weChatVoucher',
  30. method: 'POST',
  31. data: {
  32. openid: userInfo.openid,
  33. orderId: orderInfo.orderId,
  34. appId: appInfoStore.appId,
  35. payee: 'HOTEL'
  36. }
  37. })
  38. if (res.data.code == 200) {
  39. res.data.data.package = res.data.data.packageStr
  40. let paymentResult = await wx.requestPayment(res.data.data)
  41. console.log("payment result:", paymentResult)
  42. if (paymentResult.errMsg === 'requestPayment:ok') {
  43. uni.showToast({
  44. icon: 'none',
  45. title: '支付成功'
  46. })
  47. uni.redirectTo({
  48. url: '/subpkg_checkin/checkin/checkin'
  49. })
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. .tip-area {
  56. padding-top: 160rpx;
  57. padding-bottom: 160rpx;
  58. display: flex;
  59. flex-direction: column;
  60. .image {
  61. width: 200rpx;
  62. height: 200rpx;
  63. margin: 0 auto;
  64. }
  65. .text {
  66. color: #666666;
  67. font-size: 40rpx;
  68. text-align: center;
  69. }
  70. }
  71. .payment-button {
  72. width: 80vw;
  73. margin: 100rpx auto;
  74. .button {
  75. background-color: #a09bc4;
  76. color: #ffffff;
  77. border-radius: 20rpx;
  78. }
  79. }
  80. </style>