coupon-list.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <!-- TODO -->
  3. <view class="coupon-find-list">
  4. <!-- tabs -->
  5. <tui-tabs
  6. :tabs="tabs"
  7. :currentTab="currentTab"
  8. @change="tabChange"
  9. :sliderWidth="118"
  10. color="#333333"
  11. selectedColor="#FF457B"
  12. sliderBgColor="#FF457B"
  13. ></tui-tabs>
  14. <!-- 优惠券列表 -->
  15. <swiper
  16. :indicator-dots="false"
  17. :autoplay="false"
  18. class="swiper"
  19. :style="{ height: swiperHeight + 'px' }"
  20. :current="currentTab"
  21. @change="swiperChange"
  22. >
  23. <swiper-item class="coupon-list"> <cm-coupon :key="i" v-for="i in 15"></cm-coupon> </swiper-item>
  24. <swiper-item class="coupon-list"> <cm-coupon :key="i" v-for="i in 3"></cm-coupon> </swiper-item>
  25. <swiper-item class="coupon-list">
  26. <cm-empty message="暂无任何优惠券~" :image="baseUrl + 'icon-coupon-empty.png'" :offset="-12"></cm-empty>
  27. </swiper-item>
  28. </swiper>
  29. <!-- 跳转领券中心 -->
  30. <view class="footer"> <view class="btn">领券中心</view> </view>
  31. </view>
  32. </template>
  33. <script>
  34. import CmCoupon from '@/components/cm-module/cm-coupon/cm-coupon.vue'
  35. import CmEmpty from '@/components/cm-module/cm-empty/cm-empty.vue'
  36. import { mapGetters } from 'vuex'
  37. export default {
  38. components: {
  39. CmCoupon,
  40. CmEmpty
  41. },
  42. data() {
  43. return {
  44. baseUrl: this.$Static,
  45. tabs: [
  46. {
  47. name: '未使用10'
  48. },
  49. {
  50. name: '已使用10'
  51. },
  52. {
  53. name: '已失效10'
  54. }
  55. ],
  56. currentTab: 0
  57. }
  58. },
  59. computed: {
  60. ...mapGetters(['windowHeight', 'isIphoneX']),
  61. swiperHeight() {
  62. if (this.isIphoneX) {
  63. return this.windowHeight - 120
  64. }
  65. return this.windowHeight - 80
  66. }
  67. },
  68. onLoad() {},
  69. methods: {
  70. tabChange(e) {
  71. this.currentTab = e.index
  72. },
  73. swiperChange(e){
  74. this.currentTab = e.detail.current
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. page{
  81. width: 100%;
  82. height: 100%;
  83. background: #f7f7f7;
  84. }
  85. .swiper {
  86. height: 800rpx;
  87. background: #f7f7f7;
  88. .coupon-list{
  89. height: 100%;
  90. overflow-y: scroll;
  91. }
  92. }
  93. .footer {
  94. display: flex;
  95. justify-content: center;
  96. align-items: center;
  97. background: #f7f7f7;
  98. padding-top: 20rpx;
  99. .btn {
  100. display: flex;
  101. justify-content: center;
  102. align-items: center;
  103. width: 600rpx;
  104. height: 90rpx;
  105. background: linear-gradient(90deg, #fc32b4 0%, #f83c6c 100%);
  106. border-radius: 45rpx;
  107. font-size: 30rpx;
  108. color: #ffffff;
  109. }
  110. }
  111. </style>