index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <script setup lang="ts">
  2. import { dayjs } from 'wot-design-uni'
  3. import { StaticUrl } from '@/config'
  4. import router from '@/router'
  5. defineProps<{
  6. itemcoupon: Api.AppMemberCouponVO
  7. /** 是否显示"去使用"按鈕,默认 true */
  8. showUseBtn?: boolean
  9. /** 隐藏所有操作按鈕(选券模式用) */
  10. hideAllBtn?: boolean
  11. }>()
  12. const {
  13. isClassfiyPageOpen,
  14. } = storeToRefs(useSysXsbStore())
  15. function handleUseCoupon() {
  16. isClassfiyPageOpen.value = true
  17. // router.replace({ name: 'xsb-homeTabbar', params: { name: 'xsb-classfiy' } })
  18. router.back()
  19. }
  20. </script>
  21. <template>
  22. <view class="relative">
  23. <view class="relative box-border h164rpx w-full flex overflow-hidden rounded-16rpx">
  24. <image
  25. v-if="itemcoupon.useStatus !== 2 || itemcoupon.isUsed === 1"
  26. :src="`${StaticUrl}/xsb-coupon-bg-un.png`"
  27. class="h-full w-full"
  28. />
  29. <image
  30. v-else
  31. :src="`${StaticUrl}/xsb-coupon-bg-item.png`"
  32. class="h-full w-full"
  33. />
  34. <view class="absolute left-0 top-0 h-full w-full flex items-center">
  35. <view class="w-184rpx flex flex-shrink-0 flex-col items-center justify-center py-36rpx">
  36. <view class="flex items-end leading-none" :class="[itemcoupon.useStatus == 2 || itemcoupon.isUsed == 2 ? 'text-[#FF4A39]' : 'text-[#AAAAAA]']">
  37. <text class="mb-6rpx text-24rpx font-semibold">
  38. ¥
  39. </text>
  40. <text class="text-48rpx font-bold">
  41. {{ itemcoupon.discountMoney ?? 0 }}
  42. </text>
  43. </view>
  44. <view class="mt-12rpx text-24rpx text-[#AAAAAA]">
  45. {{ Number(itemcoupon.amountMoney) > 0 ? `满${itemcoupon.amountMoney}可用` : '无门槛' }}
  46. </view>
  47. </view>
  48. <view class="flex flex-1 items-center py-28rpx pr-24rpx">
  49. <view class="flex-1 pr-20rpx">
  50. <view class="text-28rpx text-[#333] font-semibold">
  51. {{ itemcoupon.activityName || itemcoupon.couponName || '优惠券' }}
  52. </view>
  53. <template v-if="[2, 5].includes(itemcoupon.useStatus || 2)">
  54. <view v-if="itemcoupon.expirationTime" class="mt-12rpx text-22rpx text-[#AAAAAA]">
  55. 有效期:{{ dayjs(itemcoupon.expirationTime).format('YYYY-MM-DD HH:mm:ss') }}
  56. </view>
  57. <view v-if="itemcoupon.scopeDesc" class="mt-8rpx text-22rpx text-[#AAAAAA]">
  58. 限:{{ itemcoupon.scopeDesc }}
  59. </view>
  60. </template>
  61. <view v-if="itemcoupon.orderCreateTime" class="mt-8rpx text-22rpx text-[#AAAAAA]">
  62. 使用时间: {{ itemcoupon.orderCreateTime }}
  63. </view>
  64. <view v-if="itemcoupon.lockOrderId" class="mt-8rpx flex items-center text-22rpx text-[#AAAAAA]">
  65. 订单号:{{ itemcoupon.lockOrderId }}
  66. </view>
  67. <view v-if="itemcoupon.useStatus === 1" class="mt-8rpx text-22rpx text-[#AAAAAA]">
  68. 说明:部分退款,优惠券不退还
  69. </view>
  70. <view v-if="itemcoupon.useStatus === 7" class="mt-8rpx text-22rpx text-[#AAAAAA]">
  71. 冻结原因:该券已被占用,取消可恢复,有效期内可用。
  72. </view>
  73. </view>
  74. <template v-if="!hideAllBtn">
  75. <view
  76. v-if="showUseBtn !== false"
  77. class="flex-shrink-0 rounded-full bg-[#FF4A39] px-28rpx py-16rpx text-26rpx text-white"
  78. @click="handleUseCoupon"
  79. >
  80. 去使用
  81. </view>
  82. <wd-button v-if="itemcoupon.useStatus === 1" hairline plain size="small" type="info" @click="router.replace({ name: 'xsb-orderDetaile', params: { id: String(itemcoupon.lockOrderId) } })">
  83. 查看订单
  84. </wd-button>
  85. <wd-button v-if="itemcoupon.useStatus === 7" plain hairline size="small" type="info" @click="router.replace({ name: 'xsb-orderDetaile', params: { id: String(itemcoupon.lockOrderId) } })">
  86. 去取消订单
  87. </wd-button>
  88. </template>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </template>
  94. <style lang="scss" scoped>
  95. </style>