index.vue 7.7 KB

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