多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
8.4 KiB

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