index.vue 8.2 KB

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