attractionsOrderPay.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. definePage({
  4. name: 'attractions-order-pay',
  5. islogin: false,
  6. style: {
  7. navigationBarTitleText: '订单支付',
  8. },
  9. })
  10. const productName = ref('')
  11. const num = ref(0)
  12. const orderNo = ref('')
  13. onLoad((options: any) => {
  14. productName.value = options.productName || ''
  15. num.value = Number(options.num) || 0
  16. orderNo.value = options.orderNo || ''
  17. })
  18. onMounted(() => {
  19. getPayPreview()
  20. })
  21. const payPreviewInfo = ref<Api.ScenicPayPreviewVo>()
  22. const payMethod = ref(['1']) // 默认选中微信支付
  23. async function getPayPreview() {
  24. const res = await Apis.attractions.payPreview({ data: { orderNumber: orderNo.value } })
  25. payPreviewInfo.value = res.data
  26. }
  27. async function submitPay() {
  28. const res = await useUserStore().handleCommonPayMent(orderNo.value)
  29. if (res.payType !== 1) {
  30. try {
  31. await useUserStore().getWxCommonPayment(res)
  32. router.push({ name: 'attractions-order-detail' })
  33. }
  34. catch {
  35. await useUserStore().payError('xsb-order', 'subPack-xsb/commonTab/index')
  36. }
  37. }
  38. else {
  39. router.push({ name: 'attractions-order-detail' })
  40. }
  41. }
  42. </script>
  43. <template>
  44. <view class="order-pay-page">
  45. <view class="px-24rpx">
  46. <view class="h-20rpx" />
  47. <view class="rounded-16rpx bg-#FFF p-24rpx">
  48. <view class="flex items-center justify-between gap-50rpx text-32rpx font-bold">
  49. <view>{{ productName }}</view>
  50. <view class="text-28rpx font-normal">
  51. x{{ num }}
  52. </view>
  53. </view>
  54. <view class="mt-24rpx h-2rpx w-full bg-#F0F0F0" />
  55. <view class="mt-24rpx flex items-center justify-between">
  56. <view class="text-28rpx font-bold">
  57. 订单总金额
  58. </view>
  59. <view class="text-32rpx text-#FF4A39 font-bold">
  60. <text class="text-26rpx">
  61. </text>
  62. {{ payPreviewInfo?.orderTotal }}
  63. </view>
  64. </view>
  65. <view class="mt-20rpx flex items-center justify-between text-24rpx">
  66. <view>积分扣减</view>
  67. <view class="text-#FF4A39 font-bold">
  68. ¥{{ payPreviewInfo?.pointsDeduct }}
  69. </view>
  70. </view>
  71. <view class="mt-20rpx flex items-center justify-between text-24rpx">
  72. <view>微信支付</view>
  73. <view class="text-#FF4A39 font-bold">
  74. ¥{{ payPreviewInfo?.wxPayMoney }}
  75. </view>
  76. </view>
  77. </view>
  78. <view v-if="(payPreviewInfo?.wxPayMoney ?? 0) > 0" class="mt-20rpx rounded-16rpx bg-#FFF p-24rpx">
  79. <view class="text-32rpx font-bold">
  80. 选择支付方式
  81. </view>
  82. <view class="mt-24rpx h-2rpx w-full bg-#F0F0F0" />
  83. <view>
  84. <wd-cell-group border>
  85. <wd-checkbox-group v-model="payMethod" size="large">
  86. <wd-cell title="微信支付" center clickable>
  87. <view>
  88. <wd-checkbox model-value="1" custom-style="margin:0;" />
  89. </view>
  90. </wd-cell>
  91. </wd-checkbox-group>
  92. </wd-cell-group>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="fixed bottom-0 h-174rpx w-full border-[1rpx_solid_#EEEEEE] bg-#FFF px-24rpx">
  97. <wd-button custom-class="w-702rpx mt-10rpx" block size="large" @click="submitPay">
  98. 立即支付
  99. </wd-button>
  100. </view>
  101. </view>
  102. </template>
  103. <style lang="scss" scoped></style>