detail-activity-tip.vue 2.5 KB

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