index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. import { StaticUrl } from '@/config'
  4. definePage({
  5. name: 'activityList',
  6. islogin: true,
  7. style: {
  8. navigationBarTitleText: '活动中心',
  9. navigationStyle: 'custom',
  10. },
  11. })
  12. const showModel = ref(false)
  13. const clickItem = ref<Api.CouponInfoAppVo>()
  14. const { data, isLastPage, page, send } = usePagination((pageNum, pageSize) => Apis.app.get_smqjh_system_app_api_coupon_page({ params: {
  15. pageNum,
  16. pageSize,
  17. } }), {
  18. initialPage: 1,
  19. initialPageSize: 10,
  20. data: res => res.data?.list,
  21. append: true,
  22. immediate: false,
  23. })
  24. onShow(() => {
  25. data.value = []
  26. send()
  27. },
  28. )
  29. // 查看详情
  30. function handleViewDetail(item: any) {
  31. router.push({
  32. name: 'activityCenter-detail',
  33. params: { id: item.id },
  34. })
  35. }
  36. onReachBottom(() => {
  37. if (!isLastPage.value) {
  38. page.value++
  39. }
  40. })
  41. function handleExchange(item: Api.CouponInfoAppVo) {
  42. showModel.value = true
  43. clickItem.value = item
  44. }
  45. </script>
  46. <template>
  47. <view class="activity-list-page px24rpx pt20rpx">
  48. <!-- 活动卡片列表 -->
  49. <view
  50. v-for="item in data"
  51. :key="item.id"
  52. class="activity-card mb24rpx overflow-hidden rounded-16rpx bg-white"
  53. >
  54. <view class="page-box flex flex-1 items-start justify-between px24rpx py28rpx">
  55. <view class="flex-1">
  56. <!-- 标题 -->
  57. <view class="text-32rpx font-semibold">
  58. {{ item.activityName }}
  59. </view>
  60. <!-- 抵扣信息 -->
  61. <view class="mt16rpx text-28rpx text-#333">
  62. 抵扣{{ item.discountMoney }}元(满{{ item.amountMoney }}元可用)
  63. </view>
  64. <!-- 有效期 -->
  65. <view class="mt12rpx text-26rpx text-#666">
  66. 有效期:{{ item.expirationTime ? item.expirationTime : `领取过后${item.expirationDate}天有效` }}
  67. </view>
  68. <!-- 已领取数量 -->
  69. <view class="mt12rpx text-26rpx text-#666">
  70. 已领取:{{ Number(item.inventoryTotal) - Number(item.inventoryActual) }} / {{ item.inventoryTotal }}
  71. </view>
  72. <!-- 状态 -->
  73. <view v-if="item.receiveSign" class="mt12rpx text-26rpx text-#666">
  74. 状态:已领取
  75. </view>
  76. </view>
  77. <!-- 右侧礼包图片 -->
  78. <image
  79. :src="`${StaticUrl}/smqjh-jy-center.png`"
  80. class="ml20rpx h212rpx w212rpx flex-shrink-0"
  81. />
  82. </view>
  83. <!-- 底部按钮 -->
  84. <view class="flex justify-center pb28rpx">
  85. <wd-button
  86. v-if="!item.receiveSign"
  87. size="small"
  88. custom-class="exchange-btn"
  89. @click="handleExchange(item)"
  90. >
  91. 积分兑换
  92. </wd-button>
  93. <wd-button
  94. v-else
  95. size="small"
  96. plain
  97. custom-class="detail-btn"
  98. @click="handleViewDetail(item)"
  99. >
  100. 查看详情
  101. </wd-button>
  102. </view>
  103. </view>
  104. <StatusTip v-if="!data.length" tip="暂无活动" />
  105. <IntegralPopup v-model="showModel" :coupon-id="String(clickItem?.id)" />
  106. </view>
  107. </template>
  108. <style lang="scss" scoped>
  109. :deep(.exchange-btn) {
  110. min-width: 180rpx !important;
  111. border-radius: 32rpx !important;
  112. }
  113. :deep(.detail-btn) {
  114. min-width: 180rpx !important;
  115. border-radius: 32rpx !important;
  116. border-color: var(--them-color) !important;
  117. color: var(--them-color) !important;
  118. }
  119. .page-box{
  120. background: linear-gradient( 180deg, #FFDCDC 0%, #FFF8F8 36.01%, #FFFFFF 100%);
  121. }
  122. </style>