index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="product-list" :class="'terminal'+terminal">
  3. <div class="picListWarp" v-if="componentContent.arrangeType == '横向滑动'">
  4. <div class="picList" v-if="productData && productData.length>0">
  5. <div class="swiper-button-prev"></div>
  6. <div class="swiper-button-next"></div>
  7. <swiper ref="swiper" class="products-swiper" :options="swiperOption">
  8. <swiper-slide class="products-swiper-slide item" v-for="(item,index) in productData" :key="index">
  9. <div class="a-link" @click="jumpProductDetail(item)">
  10. <div class="itemImgBox">
  11. <div class="imgBox">
  12. <el-image
  13. :src="item.image"
  14. fit="contain"></el-image>
  15. </div>
  16. </div>
  17. <div class="text">
  18. <h4 class="h4">{{item.productName}}</h4>
  19. <div class="priceBox">
  20. <span>¥{{item.price}}</span>
  21. <span class="discount" v-if="item.originalPrice">¥{{item.originalPrice}}</span>
  22. </div>
  23. </div>
  24. </div>
  25. </swiper-slide>
  26. </swiper>
  27. </div>
  28. </div>
  29. <div v-else class="picList" >
  30. <ul class="clearfix" :class="'imgTextNum' + componentContent.productNum">
  31. <li class="item" v-for="(item,index) in productData.slice(0, componentContent.productRowNum * componentContent.productNum)" :key="index">
  32. <div class="a-link" @click="jumpProductDetail(item)">
  33. <div class="itemImgBox">
  34. <div class="imgBox">
  35. <el-image
  36. :src="item.image"
  37. fit="contain"></el-image>
  38. </div>
  39. </div>
  40. <div class="text">
  41. <h4 class="h4">{{item.productName}}</h4>
  42. <div class="priceBox">
  43. <span>¥{{item.price}}</span>
  44. <span class="discount" v-if="item.originalPrice">¥{{item.originalPrice}}</span>
  45. </div>
  46. </div>
  47. </div>
  48. </li>
  49. </ul>
  50. </div>
  51. <button v-show="componentContent.showMore" class="btn-more" @click="jumpLink(componentContent.linkObj)">查看全部 <span class="icon iconfont icon-arrow-right"></span></button>
  52. </div>
  53. </template>
  54. <script>
  55. import {commonMixin} from '../mixin'
  56. export default {
  57. mixins: [commonMixin],
  58. data () {
  59. return {
  60. swiperOption: {
  61. slidesPerView: 4, // 显示数量
  62. spaceBetween: 13, // 间隔
  63. autoplay: false, // 可选选项,自动滑动
  64. loop: true,
  65. pagination: {
  66. el: '.product-pagination'
  67. },
  68. navigation: {
  69. nextEl: '.swiper-button-next',
  70. prevEl: '.swiper-button-prev'
  71. }
  72. }
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .product-list{
  79. padding: 20px 0;
  80. background-color: #fff;
  81. .picListWarp{
  82. width: 1380px;
  83. max-width: 100%;
  84. margin: 0 auto;
  85. position: relative;
  86. }
  87. .picList{
  88. width: 1200px;
  89. max-width: 100%;
  90. margin: 0 auto;
  91. .swiper-button-prev,.swiper-button-next{
  92. width: 50px;
  93. height: 50px;
  94. position: absolute;
  95. cursor:pointer;
  96. top: 140px;
  97. background-repeat: no-repeat;
  98. &:after{
  99. content: '';
  100. }
  101. }
  102. .swiper-button-prev{
  103. left: 0;
  104. background: url('../../../static/images/btn-prev.png');
  105. }
  106. .swiper-button-next{
  107. right: 0;
  108. background: url('../../../static/images/btn-next.png');
  109. }
  110. .a-link{
  111. cursor: pointer;
  112. &:hover{
  113. box-shadow: 3px 4px 20px 0px rgba(186, 186, 186, 0.5);
  114. }
  115. .itemImgBox {
  116. height: auto;
  117. display: flex;
  118. flex-direction: column;
  119. justify-content: center;
  120. .imgBox {
  121. padding-bottom: 100%;
  122. background-color: #cacaca;
  123. position: relative;
  124. .el-image {
  125. width: 100%;
  126. height: 100%;
  127. position: absolute;
  128. top: 0;
  129. left: 0;
  130. }
  131. }
  132. }
  133. .text{
  134. padding:25px 20px 17px;
  135. text-align: center;
  136. //height: 180px;
  137. .h4{
  138. font-size: 18px;
  139. line-height: 24px;
  140. overflow: hidden;
  141. text-overflow:ellipsis;
  142. white-space: nowrap;
  143. color: #333333;
  144. //max-height: 48px;
  145. }
  146. .p{
  147. color: #999;
  148. font-size: 16px;
  149. overflow: hidden;
  150. text-overflow:ellipsis;
  151. white-space: nowrap;
  152. padding-top: 18px;
  153. position: relative;
  154. margin-top: 8px;
  155. &:after{
  156. position: absolute;
  157. top: 0;
  158. left: 50%;
  159. margin-left: -80px;
  160. width: 160px;
  161. height: 2px;
  162. background: #F0F0F0;
  163. content: '';
  164. }
  165. }
  166. .priceBox {
  167. padding-top: 11px;
  168. line-height: 33px;
  169. span {
  170. font-size: 25px;
  171. color: #C83732;
  172. padding-right: 12px;
  173. }
  174. span.discount {
  175. font-size: 18px;
  176. color: #ccc;
  177. text-decoration: line-through;
  178. }
  179. }
  180. }
  181. }
  182. ul{
  183. margin: -15px 0 0 -15px;
  184. display: flex;
  185. flex-wrap: wrap;
  186. li{
  187. flex: 0 0 50%;
  188. padding: 15px 0 0 15px;
  189. width: 0;
  190. }
  191. }
  192. .imgTextNum2 {
  193. li {
  194. flex: 0 0 50%;
  195. }
  196. }
  197. .imgTextNum3 {
  198. li {
  199. flex: 0 0 33.33%;
  200. }
  201. }
  202. .imgTextNum4 {
  203. li {
  204. flex: 0 0 25%;
  205. }
  206. }
  207. .imgTextNum5 {
  208. li {
  209. flex: 0 0 20%;
  210. }
  211. }
  212. }
  213. }
  214. .btn-more {
  215. width: 130px;
  216. height: 41px;
  217. border: 2px solid #C5AA7B;
  218. color: #C5AA7B;
  219. font-size: 18px;
  220. background-color: transparent;
  221. margin: 20px auto 0;
  222. display: block;
  223. }
  224. </style>