index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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.products && productData.products.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. .picListWarp{
  88. width: 1380px;
  89. max-width: 100%;
  90. margin: 0 auto;
  91. position: relative;
  92. }
  93. .picList{
  94. width: 1200px;
  95. max-width: 100%;
  96. margin: 0 auto;
  97. .swiper-button-prev,.swiper-button-next{
  98. width: 50px;
  99. height: 50px;
  100. position: absolute;
  101. cursor:pointer;
  102. top: 140px;
  103. background-repeat: no-repeat;
  104. &:after{
  105. content: '';
  106. }
  107. }
  108. .swiper-button-prev{
  109. left: 0;
  110. background: url('../../../static/images/btn-prev.png');
  111. }
  112. .swiper-button-next{
  113. right: 0;
  114. background: url('../../../static/images/btn-next.png');
  115. }
  116. .a-link{
  117. cursor: pointer;
  118. &:hover{
  119. box-shadow: 3px 4px 20px 0px rgba(186, 186, 186, 0.5);
  120. }
  121. .itemImgBox {
  122. height: auto;
  123. display: flex;
  124. flex-direction: column;
  125. justify-content: center;
  126. .imgBox {
  127. padding-bottom: 100%;
  128. background-color: #cacaca;
  129. position: relative;
  130. .el-image {
  131. width: 100%;
  132. height: 100%;
  133. position: absolute;
  134. top: 0;
  135. left: 0;
  136. }
  137. }
  138. }
  139. .text{
  140. padding:25px 10px 17px;
  141. text-align: center;
  142. position: relative;
  143. //height: 180px;
  144. .discount-text{
  145. background: url("../../../static/images/price/bg-discount.png") no-repeat;
  146. width: 100%;
  147. height: 47px;
  148. font-size: 14px;
  149. color: #fff;
  150. line-height: 60px;
  151. text-align: center;
  152. position: absolute;
  153. top: -47px;
  154. left: 0;
  155. }
  156. .h4{
  157. font-size: 18px;
  158. line-height: 24px;
  159. overflow: hidden;
  160. text-overflow:ellipsis;
  161. white-space: nowrap;
  162. color: #333333;
  163. //max-height: 48px;
  164. }
  165. .p{
  166. color: #999;
  167. font-size: 16px;
  168. overflow: hidden;
  169. text-overflow:ellipsis;
  170. white-space: nowrap;
  171. padding-top: 18px;
  172. position: relative;
  173. margin-top: 8px;
  174. &:after{
  175. position: absolute;
  176. top: 0;
  177. left: 50%;
  178. margin-left: -80px;
  179. width: 160px;
  180. height: 2px;
  181. background: #F0F0F0;
  182. content: '';
  183. }
  184. }
  185. .priceBox {
  186. padding-top: 11px;
  187. line-height: 33px;
  188. span {
  189. font-size: 25px;
  190. color: #C83732;
  191. padding-right: 12px;
  192. }
  193. span.discount {
  194. font-size: 18px;
  195. color: #ccc;
  196. text-decoration: line-through;
  197. }
  198. }
  199. .btn-cart{
  200. margin-top: 5px;
  201. width: 270px;
  202. height: 40px;
  203. background-color: #333;
  204. font-size: 18px;
  205. color: #FFEBC4;
  206. }
  207. }
  208. }
  209. ul{
  210. margin: -15px 0 0 -15px;
  211. display: flex;
  212. flex-wrap: wrap;
  213. li{
  214. flex: 0 0 50%;
  215. padding: 15px 0 0 15px;
  216. width: 0;
  217. }
  218. }
  219. .imgTextNum2 {
  220. li {
  221. flex: 0 0 50%;
  222. }
  223. }
  224. .imgTextNum3 {
  225. li {
  226. flex: 0 0 33.33%;
  227. }
  228. }
  229. .imgTextNum4 {
  230. li {
  231. flex: 0 0 25%;
  232. }
  233. }
  234. .imgTextNum5 {
  235. li {
  236. flex: 0 0 20%;
  237. }
  238. }
  239. }
  240. }
  241. .btn-more {
  242. width: 130px;
  243. height: 41px;
  244. border: 2px solid #C5AA7B;
  245. color: #C5AA7B;
  246. font-size: 18px;
  247. background-color: transparent;
  248. margin: 20px auto 0;
  249. display: block;
  250. }
  251. </style>