index.vue 6.4 KB

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