detail-activity-tip.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <su-fixed bottom placeholder :val="44">
  3. <view>
  4. <view v-for="activity in data.activities" :key="activity.id">
  5. <view
  6. class="activity-box ss-p-x-38 ss-flex ss-row-between ss-col-center"
  7. :class="activity.type == 'seckill' ? 'seckill-box' : 'groupon-box'"
  8. >
  9. <view class="activity-title ss-flex">
  10. <view class="ss-m-r-16">
  11. <image
  12. :src="sheep.$url.static('/static/img/shop/goods/seckill-icon.png')"
  13. v-if="activity.type == 'seckill'"
  14. class="activity-icon"
  15. ></image>
  16. <image
  17. :src="sheep.$url.static('/static/img/shop/goods/groupon-icon.png')"
  18. class="activity-icon"
  19. v-else
  20. ></image>
  21. </view>
  22. <view>该商品正在参与{{ activity.type_text }}活动</view>
  23. </view>
  24. <button class="ss-reset-button activity-go" @tap="onActivity(activity)"> GO </button>
  25. </view>
  26. <!-- <button @tap="onActivity(activity)">{{ activity.title }} {{ activity.type_text }}</button> -->
  27. </view>
  28. </view>
  29. </su-fixed>
  30. </template>
  31. <script setup>
  32. import { ref, reactive } from 'vue';
  33. import sheep from '@/sheep';
  34. const seckillBg = sheep.$url.css('/assets/addons/shopro/frontend_img/goods/seckill-tip-bg.png');
  35. const grouponBg = sheep.$url.css('/assets/addons/shopro/frontend_img/goods/groupon-tip-bg.png');
  36. const props = defineProps({
  37. data: {
  38. type: Object,
  39. default() {},
  40. },
  41. });
  42. function onActivity(activity) {
  43. let type = activity.type;
  44. if (type === 'groupon_ladder') type = 'groupon';
  45. sheep.$router.go(`/pages/goods/${type}`, {
  46. id: props.data.id,
  47. activity_id: activity.id,
  48. });
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .activity-box {
  53. width: 100%;
  54. height: 80rpx;
  55. box-sizing: border-box;
  56. margin-bottom: 10rpx;
  57. .activity-title {
  58. font-size: 26rpx;
  59. font-weight: 500;
  60. color: #ffffff;
  61. line-height: 42rpx;
  62. .activity-icon {
  63. width: 38rpx;
  64. height: 38rpx;
  65. }
  66. }
  67. .activity-go {
  68. width: 70rpx;
  69. height: 32rpx;
  70. background: #ffffff;
  71. border-radius: 16rpx;
  72. font-weight: 500;
  73. color: #ff6000;
  74. font-size: 24rpx;
  75. line-height: normal;
  76. }
  77. }
  78. //秒杀卡片
  79. .seckill-box {
  80. background: v-bind(seckillBg) no-repeat;
  81. background-size: 100% 100%;
  82. }
  83. .groupon-box {
  84. background: v-bind(grouponBg) no-repeat;
  85. background-size: 100% 100%;
  86. }
  87. </style>