index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div class="hom-pro-list">
  3. <div class="title">
  4. <!-- #ifdef MP-WEIXIN -->
  5. <img class="title-img" src="../../../static/images/product/img-title.png" alt="商品推荐" mode="widthFix" />
  6. <!-- #endif -->
  7. <!-- #ifdef H5 || APP-PLUS -->
  8. <image class="title-img" src="../../../static/images/product/img-title.png" alt="商品推荐" mode="widthFix" />
  9. <!-- #endif -->
  10. </div>
  11. <div v-if="componentContent.arrangeType == '横向滑动' && productData.length > 2" class="product-list">
  12. <swiper
  13. ref="mySwiper" class="swiper product-list-box" :circular="true" :indicator-dots="false"
  14. :autoplay="true"
  15. :display-multiple-items="2" @change="swiperChange"
  16. >
  17. <swiper-item v-for="(item, index) in productData" :key="index" class="product-list-item-warp">
  18. <div v-if="JSON.stringify(item) !== '{}'" class="product-list-item" @click="jumpProductDetail(item)">
  19. <div class="product-list-img">
  20. <img class="img pic-img default-img" :src="item.image">
  21. </div>
  22. <div class="product-list-info">
  23. <label class="product-name">{{ item.productName }}</label>
  24. <div class="flex">
  25. <div v-if="typeId == 1" class="shop-box" @click.stop="jumpStore(item)">
  26. <label class="shop-name">{{ item.shopName }}</label>
  27. <div class="shop-logo">
  28. <img :src="item.shopLogo">
  29. </div>
  30. </div>
  31. <label class="buy-count">已售{{ item.number ? item.number : 0 }}件</label>
  32. </div>
  33. <div class="price-warp">
  34. <!-- #ifdef MP-WEIXIN -->
  35. <img v-if="item.activityType == 1" class="iconImg" src="../../../static/images/groupBuyIcon.png">
  36. <img v-if="item.activityType == 2" class="iconImg" src="../../../static/images/spikeIcon.png">
  37. <img v-if="item.activityType == 4" class="iconImg" src="../../../static/images/spikeIcon.png">
  38. <img v-if="item.activityType == 3" class="iconImg" src="../../../static/images/discountListIcon.png">
  39. <img v-if="item.activityType == 5" class="iconImg" src="../../../static/images/discountListIcon.png">
  40. <img v-if="item.activityType == 9" class="iconImg" src="../../../static/images/memberCenterIcon.png">
  41. <img
  42. v-if="item.activityType == 8" class="iconImg"
  43. src="../../../../../static/images/new-business/shop/jierizhekou.png"
  44. >
  45. <!-- #endif -->
  46. <!-- #ifdef H5 || APP-PLUS -->
  47. <image v-if="item.activityType == 1" class="iconImg" src="../../../static/images/groupBuyIcon.png">
  48. <image v-if="item.activityType == 2" class="iconImg" src="../../../static/images/spikeIcon.png">
  49. <image v-if="item.activityType == 4" class="iconImg" src="../../../static/images/spikeIcon.png">
  50. <image
  51. v-if="item.activityType == 3" class="iconImg"
  52. src="../../../static/images/discountListIcon.png"
  53. >
  54. <image
  55. v-if="item.activityType == 5" class="iconImg"
  56. src="../../../static/images/discountListIcon.png"
  57. >
  58. <image
  59. v-if="item.activityType == 9" class="iconImg"
  60. src="../../../static/images/memberCenterIcon.png"
  61. >
  62. <image
  63. v-if="item.activityType == 8" class="iconImg"
  64. src="../../../../../static/images/new-business/shop/jierizhekou.png"
  65. >
  66. <!-- #endif -->
  67. <div class="price">
  68. ¥ {{ item.price }}
  69. </div>
  70. <div class="original-price">
  71. ¥ {{ item.originalPrice }}
  72. </div>
  73. </image>
  74. </image>
  75. </image>
  76. </image>
  77. </image>
  78. </image>
  79. </image>
  80. </div>
  81. </div>
  82. </div>
  83. <!-- 自定义骨架屏 -->
  84. <div v-else class="product-list-item ske-loading">
  85. <div class="product-list-img child-loading">
  86. </div>
  87. <div class="product-list-info">
  88. <label class="product-name child-loading"></label>
  89. <div class="price-warp child-loading" style="padding: 5px 0">
  90. </div>
  91. <div class="price-warp child-loading" style="padding: 5px 0">
  92. </div>
  93. </div>
  94. </div>
  95. </swiper-item>
  96. </swiper>
  97. <view v-if="productData && productData.length > 2" class="swiper-dots">
  98. <text
  99. v-for="(dot, index) in productData.length" :key="index" class="dot"
  100. :class="index - swiperCurrent <= 1 && index - swiperCurrent >= 0 && 'dot-active'"
  101. ></text>
  102. </view>
  103. </div>
  104. <div v-else class="product-list">
  105. <LoadingMore v-if="isFirst" :status="loading ? 'loading' : 'no-more'"></LoadingMore>
  106. <div v-else class="product-list-box">
  107. <div v-for="(item, index) in productData" :key="index" class="product-list-item-warp">
  108. <div class="product-list-item" @click="jumpProductDetail(item)">
  109. <div class="product-list-img">
  110. <img class="img pic-img default-img" :src="item.image">
  111. </div>
  112. <div class="product-list-info">
  113. <label class="product-name">{{ item.productName }}</label>
  114. <div class="flex">
  115. <div v-if="typeId == 1" class="shop-box" @click.stop="jumpStore(item)">
  116. <label class="shop-name">{{ item.shopName }}</label>
  117. <div class="shop-logo">
  118. <img :src="item.shopLogo">
  119. </div>
  120. </div>
  121. <label class="buy-count">已售{{ item.number ? item.number : 0 }}件</label>
  122. </div>
  123. <div class="price-warp">
  124. <!-- #ifdef MP-WEIXIN -->
  125. <img v-if="item.activityType == 1" class="iconImg" src="../../../static/images/groupBuyIcon.png" />
  126. <img v-if="item.activityType == 2" class="iconImg" src="../../../static/images/spikeIcon.png" />
  127. <img v-if="item.activityType == 4" class="iconImg" src="../../../static/images/spikeIcon.png" />
  128. <img v-if="item.activityType == 3" class="iconImg" src="../../../static/images/discountListIcon.png" />
  129. <img v-if="item.activityType == 5" class="iconImg" src="../../../static/images/discountListIcon.png" />
  130. <img v-if="item.activityType == 9" class="iconImg" src="../../../static/images/memberCenterIcon.png" />
  131. <img
  132. v-if="item.activityType == 8" class="iconImg"
  133. src="../../../../../static/images/new-business/shop/jierizhekou.png"
  134. />
  135. <!-- #endif -->
  136. <!-- #ifdef H5 || APP-PLUS -->
  137. <image v-if="item.activityType == 1" class="iconImg" src="../../../static/images/groupBuyIcon.png" />
  138. <image v-if="item.activityType == 2" class="iconImg" src="../../../static/images/spikeIcon.png" />
  139. <image v-if="item.activityType == 4" class="iconImg" src="../../../static/images/spikeIcon.png" />
  140. <image v-if="item.activityType == 3" class="iconImg" src="../../../static/images/discountListIcon.png" />
  141. <image v-if="item.activityType == 5" class="iconImg" src="../../../static/images/discountListIcon.png" />
  142. <image v-if="item.activityType == 9" class="iconImg" src="../../../static/images/memberCenterIcon.png" />
  143. <image
  144. v-if="item.activityType == 8" class="iconImg"
  145. src="../../../../../static/images/new-business/shop/jierizhekou.png"
  146. />
  147. <!-- #endif -->
  148. <div class="price">
  149. ¥ {{ item.price }}
  150. </div>
  151. <div v-if="item.originalPrice && item.originalPrice > item.price" class="original-price">
  152. ¥ {{ item.originalPrice }}
  153. </div>
  154. </div>
  155. <div
  156. v-if="item.voucherId && item.voucherPrice"
  157. style="width: fit-content;margin-top: 4upx;padding: 2upx 12upx 6upx 2upx;background-color: #f0f0f0;font-size: 28upx;color: #fa5151;border-radius: 0 22upx 22upx 0;"
  158. >
  159. 可使用{{ item.voucherPrice }}代金券抵扣
  160. </div>
  161. <div
  162. v-if="item.presenterVoucher"
  163. style="width: fit-content;margin-top: 4upx;padding: 2upx 12upx 6upx 2upx;background-color: #f0f0f0;font-size: 28upx;color: #fa5151;border-radius: 0 22upx 22upx 0;"
  164. >
  165. 赠送 {{ item.presenterVoucher }} 代金券
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <button v-show="componentContent.showMore" class="btn-more" @click="jumpProList(componentContent.productData)">
  173. 查看全部 <span class="icon iconfont icon-arrow-right"></span>
  174. </button>
  175. </div>
  176. </template>
  177. <script>
  178. import { commonMixin } from '../mixin'
  179. export default {
  180. components: {
  181. },
  182. mixins: [ commonMixin ],
  183. data() {
  184. return {
  185. swiperCurrent: 0
  186. }
  187. },
  188. methods: {
  189. swiperChange(e) {
  190. this.swiperCurrent = e.detail.current
  191. }
  192. }
  193. }
  194. </script>
  195. <style
  196. lang="scss"
  197. scoped
  198. >
  199. .hom-pro-list {
  200. padding: 20rpx 13rpx;
  201. .title {
  202. text-align: center;
  203. margin-bottom: 20rpx;
  204. .title-img {
  205. width: 211rpx;
  206. }
  207. }
  208. /**多行多列**/
  209. .product-list {
  210. position: relative;
  211. &-box {
  212. display: flex;
  213. flex-wrap: wrap;
  214. flex-direction: row;
  215. &.swiper {
  216. height: 620rpx;
  217. }
  218. }
  219. &.product-swiper .product-list-box {
  220. padding-left: 0;
  221. }
  222. &-item-warp {
  223. margin: 0 0 20rpx 0;
  224. }
  225. &-item {
  226. width: 348rpx;
  227. padding: 0 7rpx;
  228. box-sizing: content-box;
  229. }
  230. &-img {
  231. width: 348rpx;
  232. height: 348rpx;
  233. background-color: #f5f5f5;
  234. border-radius: 10rpx 10rpx 0 0;
  235. .img {
  236. width: 100%;
  237. height: 100%;
  238. object-fit: contain;
  239. }
  240. }
  241. &-info {
  242. background-color: #FFFFFF;
  243. //box-shadow: 0px 0px 15px 0px rgba(52, 52, 52, 0.15);
  244. border-radius: 0 0 10rpx 10rpx;
  245. padding: 20rpx;
  246. label {
  247. font-weight: normal;
  248. }
  249. .product-name {
  250. font-size: 28rpx;
  251. color: #333;
  252. display: block;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. white-space: nowrap;
  256. margin-bottom: 18rpx;
  257. line-height: 40rpx;
  258. }
  259. .flex {
  260. display: flex;
  261. align-items: center;
  262. }
  263. .shop-box {
  264. background-color: #333333;
  265. border-radius: 0rpx 20rpx 20rpx 0rpx;
  266. line-height: 40rpx;
  267. display: flex;
  268. align-items: center;
  269. height: 40rpx;
  270. margin-right: 10rpx;
  271. .shop-name {
  272. font-size: 20rpx;
  273. color: #FFEBC4;
  274. padding: 0 8rpx 0 12rpx;
  275. }
  276. .shop-logo {
  277. border: 2rpx solid #707070;
  278. border-radius: 50%;
  279. overflow: hidden;
  280. float: right;
  281. img {
  282. width: 34rpx;
  283. height: 34rpx;
  284. display: block;
  285. }
  286. }
  287. }
  288. .buy-count {
  289. color: #C5AA7B;
  290. font-size: 20rpx;
  291. border: 2rpx solid #E4E5E6;
  292. line-height: 40rpx;
  293. padding: 0 5rpx;
  294. }
  295. .price-warp {
  296. display: flex;
  297. align-items: baseline;
  298. line-height: 56rpx;
  299. .iconImg {
  300. width: 58rpx;
  301. height: 36rpx;
  302. margin-right: 10rpx;
  303. }
  304. .price {
  305. color: #C83732;
  306. font-size: 40rpx;
  307. margin-right: 20rpx;
  308. }
  309. .original-price {
  310. font-size: 24rpx;
  311. color: #ccc;
  312. text-decoration: line-through;
  313. }
  314. }
  315. }
  316. //::v-deep .swiper-pagination-bullet{
  317. // display: none;
  318. //}
  319. }
  320. }
  321. //::v-deep .uni-swiper-dots{
  322. // display: flex;
  323. // justify-content: center;
  324. // padding: 10rpx 0;
  325. // .uni-swiper-dot{
  326. // width: 10rpx;
  327. // height: 10rpx;
  328. // background: #333333;
  329. // opacity: 0.3;
  330. // border-radius: 5rpx;
  331. // margin: 0 5rpx;
  332. // &-active{
  333. // width: 20rpx;
  334. // height: 10rpx;
  335. // opacity: 1;
  336. // }
  337. // }
  338. //}
  339. .swiper-dots {
  340. display: flex;
  341. position: absolute;
  342. left: 50%;
  343. transform: translateX(-50%);
  344. bottom: 15rpx;
  345. z-index: 66;
  346. .dot {
  347. width: 10rpx;
  348. height: 10rpx;
  349. background: #333333;
  350. opacity: 0.3;
  351. border-radius: 5rpx;
  352. margin: 0 10rpx;
  353. }
  354. .dot-active {
  355. width: 20rpx;
  356. opacity: 1;
  357. }
  358. }
  359. //.pagination{
  360. // display: flex;
  361. // justify-content: center;
  362. // padding: 20rpx 0;
  363. // ::v-deep .swiper-pagination-bullet{
  364. // width: 10rpx;
  365. // height: 10rpx;
  366. // background: #333333;
  367. // opacity: 0.3;
  368. // border-radius: 5rpx;
  369. // margin: 0 5rpx;
  370. // }
  371. // ::v-deep .swiper-pagination-bullet-active{
  372. // width: 20rpx;
  373. // height: 10rpx;
  374. // opacity: 1;
  375. // }
  376. //}
  377. .btn-more {
  378. width: 170rpx;
  379. height: 54rpx;
  380. line-height: 54rpx;
  381. border: 2rpx solid #C5AA7B;
  382. color: #C5AA7B;
  383. font-size: 24rpx;
  384. background-color: transparent;
  385. margin: 20rpx auto 0;
  386. display: flex;
  387. align-items: center;
  388. }
  389. </style>