index.vue 6.6 KB

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