index.vue 3.8 KB

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