HotCommodity.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="hot-commodity recommend-fragment">
  3. <div class="title-icon">
  4. <span>产品推荐</span>
  5. <img src="/images/original/line.png" alt=""/>
  6. </div>
  7. <div v-if="hotComponents && hotComponents.length>0" class="hot-components">
  8. <div v-if="hotComponents.length<=2">
  9. <ul class="recommend-list clearfix">
  10. <li v-for="(component, index) in hotComponents.slice(0,2)" class="big">
  11. <a :href="component.detailsLink" target="_blank">
  12. <div class="img"><img :src="component.pictureLink || '/images/store/common/default.png'"/></div>
  13. <span class="name">{{component.metadatas.contExp_abstract}}</span>
  14. <div class="price">{{component.metadatas.contExp_remark}}</div>
  15. </a>
  16. </li>
  17. </ul>
  18. </div>
  19. </div>
  20. <div v-swiper:mySwiper="swiperOption" v-if="hotComponents && hotComponents.length>2">
  21. <div class="swiper-wrapper">
  22. <div class="swiper-slide" v-if="hotComponents.length>0">
  23. <ul class="recommend-list clearfix">
  24. <li v-for="(component, index) in hotComponents.slice(0,2)" class="big">
  25. <a :href="component.detailsLink" target="_blank">
  26. <div class="img"><img :src="component.pictureLink || '/images/store/common/default.png'"/></div>
  27. <span class="name">{{component.metadatas.contExp_abstract}}</span>
  28. <div class="price">{{component.metadatas.contExp_remark}}</div>
  29. </a>
  30. </li>
  31. </ul>
  32. </div>
  33. <div class="swiper-slide" v-if="hotComponents.length>2">
  34. <ul class="recommend-list clearfix">
  35. <li v-for="(component, index) in hotComponents.slice(2,4)" class="big">
  36. <a :href="component.detailsLink" target="_blank">
  37. <div class="img"><img :src="component.pictureLink || '/images/store/common/default.png'"/></div>
  38. <span class="name">{{component.metadatas.contExp_abstract}}</span>
  39. <div class="price">{{component.metadatas.contExp_remark}}</div>
  40. </a>
  41. </li>
  42. </ul>
  43. </div>
  44. <div class="swiper-slide" v-if="hotComponents.length>4">
  45. <ul class="recommend-list clearfix">
  46. <li v-for="(component, index) in hotComponents.slice(4,6)" class="big">
  47. <a :href="component.detailsLink" target="_blank">
  48. <div class="img"><img :src="component.pictureLink || '/images/store/common/default.png'"/></div>
  49. <span class="name">{{component.metadatas.contExp_abstract}}</span>
  50. <div class="price">{{component.metadatas.contExp_remark}}</div>
  51. </a>
  52. </li>
  53. </ul>
  54. </div>
  55. <div class="swiper-slide" v-if="hotComponents.length>6">
  56. <ul class="recommend-list clearfix">
  57. <li v-for="(component, index) in hotComponents.slice(6,8)" class="big">
  58. <a :href="component.detailsLink" target="_blank">
  59. <div class="img"><img :src="component.pictureLink || '/images/store/common/default.png'"/></div>
  60. <span class="name">{{component.metadatas.contExp_abstract}}</span>
  61. <div class="price">{{component.metadatas.contExp_remark}}</div>
  62. </a>
  63. </li>
  64. </ul>
  65. </div>
  66. </div>
  67. <div class="swiper-pagination swiper-pagination-bullets" style="bottom: -3px!important;"></div>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. export default {
  73. name: 'hot-commodity',
  74. computed: {
  75. hotComponents () {
  76. // console.log(this.$store.state.provider.storeCms.hotComponents.data.data)
  77. return this.$store.state.provider.storeCms.hotComponents.data.data
  78. },
  79. // 产品推荐轮播
  80. swiperOption () {
  81. return {
  82. autoplay: 5000,
  83. initialSlide: 0,
  84. loop: true,
  85. effect: this.effect,
  86. lazyLoading: true,
  87. // 解决点击分页器后图片就不能轮播的问题
  88. autoplayDisableOnInteraction: false,
  89. pagination: '.swiper-pagination',
  90. paginationClickable: true,
  91. paginationElement: 'li'
  92. }
  93. }
  94. }
  95. }
  96. </script>
  97. <style scoped lang="scss">
  98. .hot-commodity {
  99. margin: 10px 0 30px 0;
  100. width: 220px;
  101. height: 464px;
  102. background-color: #fff;
  103. border-radius: 5px;
  104. .title-icon {
  105. position: relative;
  106. width: 100%;
  107. height: 34px;
  108. line-height: 34px;
  109. text-align: center;
  110. span{
  111. font-size: 14px;
  112. font-weight: bold;
  113. color: #333;
  114. }
  115. img{
  116. position: absolute;
  117. top: 14px;
  118. left: 26px;
  119. }
  120. }
  121. ul{
  122. padding: 14px 0 0;
  123. width: 220px;
  124. li{
  125. margin: 0 auto 25px;
  126. text-align: center;
  127. .img{
  128. margin: 0 auto;
  129. width: 181px;
  130. height: 117px;
  131. line-height: 117px;
  132. border-radius: 2px;
  133. border: solid 1px #e2e2e2;
  134. img{
  135. width: 91px;
  136. height: 87px;
  137. }
  138. }
  139. .name {
  140. display: inline-block;
  141. margin: 10px auto;
  142. font-size: 14px;
  143. color: #333;
  144. }
  145. .price{
  146. margin: 0 auto;
  147. width: 124px;
  148. height: 21px;
  149. line-height: 21px;
  150. font-size: 13px;
  151. color: #fff;
  152. background-color: #e6382f;
  153. }
  154. }
  155. }
  156. }
  157. </style>