index.vue 6.7 KB

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