index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <div class="hom-pro-list">
  3. <div class="title">
  4. <img src="../../../static/images/discount/img-title.png" alt="限时折扣"/>
  5. </div>
  6. <div v-if="componentContent.arrangeType == '横向滑动'" class="product-list product-swiper">
  7. <swiper ref="mySwiper" class="product-list-box" :options="swiperOption">
  8. <swiper-slide class="product-list-item" v-for="(item,index) in productData.products" :key="index" @click="jumpProductDetail(item)">
  9. <div class="product-list-img">
  10. <img v-show="item.image" class="img" :src="item.image">
  11. </div>
  12. <div class="product-list-info">
  13. <label class="product-name">{{item.productName}}</label>
  14. <div>
  15. <div class="flag">
  16. <img src="../../../static/images/discount/flag-discount2.png" alt="限时折扣"/>
  17. </div>
  18. <label class="buy-count">剩余{{item.stockNumber}}件</label>
  19. </div>
  20. <div class="price-warp">
  21. <div class="price">
  22. ¥ {{item.price}}
  23. </div>
  24. <div class="original-price">
  25. ¥ {{item.originalPrice}}
  26. </div>
  27. </div>
  28. </div>
  29. </swiper-slide>
  30. </swiper>
  31. <div class="pagination discount-pagination" slot="pagination"></div>
  32. </div>
  33. <div v-if="componentContent.arrangeType == '多行多列'" class="product-list">
  34. <div class="product-list-box" >
  35. <div class="product-list-item" v-for="(item,index) in productData.products" :key="index" @click="jumpProductDetail(item)">
  36. <div class="product-list-img">
  37. <img v-show="item.image" class="img" :src="item.image">
  38. </div>
  39. <div class="product-list-info">
  40. <label class="product-name">{{item.productName}}</label>
  41. <div>
  42. <div class="flag">
  43. <img src="../../../static/images/discount/flag-discount2.png" alt="限时折扣"/>
  44. </div>
  45. <label class="buy-count">剩余{{item.stockNumber}}件</label>
  46. </div>
  47. <div class="price-warp">
  48. <div class="price">
  49. ¥ {{item.price}}
  50. </div>
  51. <div class="original-price">
  52. ¥ {{item.originalPrice}}
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <button v-show="componentContent.showMore" class="btn-more" @click="jumpGroupWorks(productData)">查看全部 <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: 2,
  70. spaceBetween: 14,
  71. autoplay: false, // 可选选项,自动滑动
  72. loop: true,
  73. pagination: {
  74. el: '.discount-pagination',
  75. clickable: true
  76. },
  77. navigation: {
  78. nextEl: '.swiper-button-next',
  79. prevEl: '.swiper-button-prev'
  80. }
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .hom-pro-list{
  88. padding: 20px 0;
  89. .title{
  90. text-align: center;
  91. margin-bottom: 20px;
  92. label{
  93. background: url("../../../static/images/icon-title.png") no-repeat left center;
  94. font-size: 30px;
  95. font-weight: bold;
  96. padding-left: 48px;
  97. }
  98. }
  99. /**多行多列**/
  100. .product-list {
  101. position: relative;
  102. &-box {
  103. display: flex;
  104. flex-wrap: wrap;
  105. flex-direction: row;
  106. padding-left: 20px;
  107. }
  108. &.product-swiper .product-list-box{
  109. margin: 0 20px;
  110. padding-left: 0;
  111. }
  112. &-item {
  113. margin: 0 14px 20px 0;
  114. width: 348px;
  115. }
  116. &-img {
  117. width: 348px;
  118. height: 348px;
  119. background-color: #f5f5f5;
  120. border-radius: 10px 10px 0 0;
  121. .img {
  122. width: 100%;
  123. height: 100%;
  124. object-fit: contain;
  125. }
  126. }
  127. &-info {
  128. background-color: #FFFFFF;
  129. //box-shadow: 0px 0px 15px 0px rgba(52, 52, 52, 0.15);
  130. border-radius: 0 0 10px 10px;
  131. padding: 20px;
  132. label{
  133. font-weight: normal;
  134. }
  135. .product-name{
  136. font-size: 28px;
  137. color: #333;
  138. display: block;
  139. overflow: hidden;
  140. text-overflow:ellipsis;
  141. white-space: nowrap;
  142. margin-bottom: 18px;
  143. line-height: 40px;
  144. }
  145. .shop-box{
  146. background-color: #333333;
  147. border-radius: 0px 20px 20px 0px;
  148. line-height: 40px;
  149. display: inline-block;
  150. height: 40px;
  151. margin-right: 10px;
  152. .shop-name{
  153. font-size: 20px;
  154. color: #FFEBC4;
  155. padding: 0 8px 0 12px;
  156. }
  157. .shop-logo{
  158. border: 2px solid #707070;
  159. border-radius: 50%;
  160. overflow: hidden;
  161. float: right;
  162. img{
  163. width: 34px;
  164. height: 34px;
  165. display: block;
  166. }
  167. }
  168. }
  169. .flag{
  170. float: left;
  171. margin-right: 20px;
  172. img{
  173. height: 44px;
  174. }
  175. }
  176. .buy-count{
  177. color: #C5AA7B;
  178. font-size: 20px;
  179. border: 2px solid #E4E5E6;
  180. line-height: 40px;
  181. padding: 0 5px;
  182. display: inline-block;
  183. }
  184. .price-warp{
  185. display: flex;
  186. align-items: baseline;
  187. line-height: 56px;
  188. margin-top: 16px;
  189. .price{
  190. color: #C83732;
  191. font-size: 40px;
  192. margin-right: 20px;
  193. }
  194. .original-price{
  195. font-size: 24px;
  196. color: #ccc;
  197. text-decoration: line-through;
  198. }
  199. }
  200. }
  201. //::v-deep .swiper-pagination-bullet{
  202. // display: none;
  203. //}
  204. }
  205. }
  206. .pagination{
  207. display: flex;
  208. justify-content: center;
  209. padding: 20px 0;
  210. ::v-deep .swiper-pagination-bullet{
  211. width: 10px;
  212. height: 10px;
  213. background: #333333;
  214. opacity: 0.3;
  215. border-radius: 5px;
  216. margin: 0 5px;
  217. }
  218. ::v-deep .swiper-pagination-bullet-active{
  219. width: 20px;
  220. height: 10px;
  221. opacity: 1;
  222. }
  223. }
  224. .btn-more {
  225. width: 170px;
  226. height: 54px;
  227. border: 2px solid #C5AA7B;
  228. color: #C5AA7B;
  229. font-size: 24px;
  230. background-color: transparent;
  231. margin: 20px auto 0;
  232. display: block;
  233. }
  234. </style>