detail-activity-tip.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <su-fixed bottom placeholder :val="44">
  3. <view>
  4. <view v-for="activity in props.activityList" :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 === 1 ? 'seckill-box' : 'groupon-box'"
  8. >
  9. <view class="activity-title ss-flex">
  10. <view class="ss-m-r-16">
  11. <image
  12. v-if="activity.type === 1"
  13. :src="sheep.$url.static('/static/img/shop/goods/seckill-icon.png')"
  14. class="activity-icon"
  15. />
  16. <image
  17. v-else-if="activity.type === 3"
  18. :src="sheep.$url.static('/static/img/shop/goods/groupon-icon.png')"
  19. class="activity-icon"
  20. />
  21. </view>
  22. <view>该商品正在参与{{ activity.name }}活动</view>
  23. </view>
  24. <button class="ss-reset-button activity-go" @tap="onActivity(activity)"> GO </button>
  25. </view>
  26. </view>
  27. </view>
  28. </su-fixed>
  29. </template>
  30. <script setup>
  31. import sheep from '@/sheep';
  32. const seckillBg = sheep.$url.css('/static/img/shop/goods/seckill-tip-bg.png');
  33. const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
  34. const props = defineProps({
  35. activityList: {
  36. type: Array,
  37. default() {
  38. return [];
  39. }
  40. }
  41. });
  42. function onActivity(activity) {
  43. const type = activity.type;
  44. const typePath = type === 1 ? 'seckill' :
  45. type === 2 ? 'TODO 拼团' : 'groupon';
  46. sheep.$router.go(`/pages/goods/${typePath}`, {
  47. 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>