index.vue 6.9 KB

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