sh-coupon.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="category-box u-m-b-10">
  3. <swiper class="swiper-box" @change="onSwiper" circular :autoplay="false" :interval="3000" :duration="1000">
  4. <swiper-item v-for="(c, index) in couponList" :key="c.id">
  5. <view class="tab-list u-flex u-row-center u-col-center"><shopro-coupon :couponData="c" :state="0"></shopro-coupon></view>
  6. </swiper-item>
  7. </swiper>
  8. <view class="category-dots">
  9. <text :class="categoryCurrent === index ? 'category-dot-active' : 'category-dot'" v-for="(dot, index) in couponList.length" :key="index"></text>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. /**
  15. * 详情优惠券轮播 - 详情专用
  16. * @property {Object} couponList - 优惠劵列表
  17. */
  18. export default {
  19. components: {},
  20. data() {
  21. return {
  22. categoryCurrent: 0 //分类轮播下标
  23. };
  24. },
  25. props: {
  26. couponList: {}
  27. },
  28. computed: {},
  29. methods: {
  30. // 轮播
  31. onSwiper(e) {
  32. this.categoryCurrent = e.detail.current;
  33. }
  34. }
  35. };
  36. </script>
  37. <style lang="scss">
  38. .category-box {
  39. padding-top: 20rpx;
  40. background: #fff;
  41. height: 230rpx;
  42. position: relative;
  43. .swiper-box {
  44. height: 210rpx;
  45. .tab-list {
  46. /deep/.coupon-wrap {
  47. width: 710rpx;
  48. }
  49. }
  50. }
  51. .category-dots {
  52. display: flex;
  53. position: absolute;
  54. left: 50%;
  55. transform: translateX(-50%);
  56. bottom: 15rpx;
  57. .category-dot {
  58. width: 40rpx;
  59. height: 3rpx;
  60. background: #eeeeee;
  61. margin-right: 10rpx;
  62. }
  63. .category-dot-active {
  64. width: 40rpx;
  65. height: 3rpx;
  66. background: #a8700d;
  67. margin-right: 10rpx;
  68. }
  69. }
  70. }
  71. </style>