多租户商城-商户小程序端
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.

550 lines
16 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="hom-pro-list">
  3. <div class="title">
  4. <!-- #ifdef MP-WEIXIN -->
  5. <img
  6. class="title-img"
  7. src="../../../static/images/product/img-title.png"
  8. alt="商品推荐"
  9. mode="widthFix"
  10. />
  11. <!-- #endif -->
  12. <!-- #ifdef H5 || APP-PLUS -->
  13. <image
  14. class="title-img"
  15. src="../../../static/images/product/img-title.png"
  16. alt="商品推荐"
  17. mode="widthFix"
  18. />
  19. <!-- #endif -->
  20. </div>
  21. <div
  22. v-if="componentContent.arrangeType == '横向滑动' && productData.length > 2"
  23. class="product-list"
  24. >
  25. <swiper
  26. ref="mySwiper"
  27. class="swiper product-list-box"
  28. :circular="true"
  29. :indicator-dots="false"
  30. :autoplay="true"
  31. :display-multiple-items="2"
  32. @change="swiperChange"
  33. >
  34. <swiper-item
  35. class="product-list-item-warp"
  36. v-for="(item,index) in productData"
  37. :key="index"
  38. >
  39. <div class="product-list-item" v-if="JSON.stringify(item)!=='{}'" @click="jumpProductDetail(item)">
  40. <div class="product-list-img">
  41. <img
  42. class="img pic-img default-img"
  43. :src="item.image"
  44. onerror="this.src='url(https://ceres.zkthink.com/static/root/default.png) no-repeat center';this.οnerrοr=null"
  45. >
  46. </div>
  47. <div class="product-list-info">
  48. <label class="product-name">{{ item.productName }}</label>
  49. <div class="flex">
  50. <div
  51. class="shop-box"
  52. v-if="typeId == 1"
  53. @click.stop="jumpStore(item)"
  54. >
  55. <label class="shop-name">{{ item.shopName }}</label>
  56. </div>
  57. <label class="buy-count">已售{{ item.number ? item.number : 0 }}</label>
  58. </div>
  59. <div class="price-warp">
  60. <!-- #ifdef MP-WEIXIN -->
  61. <img
  62. class="iconImg"
  63. v-if="item.activityType == 1"
  64. src="../../../static/images/groupBuyIcon.png"
  65. >
  66. <img
  67. class="iconImg"
  68. v-if="item.activityType == 2"
  69. src="../../../static/images/spikeIcon.png"
  70. >
  71. <img
  72. class="iconImg"
  73. v-if="item.activityType == 4"
  74. src="../../../static/images/spikeIcon.png"
  75. >
  76. <img
  77. class="iconImg"
  78. v-if="item.activityType == 3"
  79. src="../../../static/images/discountListIcon.png"
  80. >
  81. <img
  82. class="iconImg"
  83. v-if="item.activityType == 5"
  84. src="../../../static/images/discountListIcon.png"
  85. >
  86. <img
  87. class="iconImg"
  88. v-if="item.activityType == 9"
  89. src="../../../static/images/memberCenterIcon.png"
  90. >
  91. <img
  92. class="iconImg"
  93. v-if="item.activityType == 8"
  94. src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png"
  95. >
  96. <!-- #endif -->
  97. <!-- #ifdef H5 || APP-PLUS -->
  98. <image
  99. class="iconImg"
  100. v-if="item.activityType == 1"
  101. src="../../../static/images/groupBuyIcon.png"
  102. >
  103. <image
  104. class="iconImg"
  105. v-if="item.activityType == 2"
  106. src="../../../static/images/spikeIcon.png"
  107. >
  108. <image
  109. class="iconImg"
  110. v-if="item.activityType == 4"
  111. src="../../../static/images/spikeIcon.png"
  112. >
  113. <image
  114. class="iconImg"
  115. v-if="item.activityType == 3"
  116. src="../../../static/images/discountListIcon.png"
  117. >
  118. <image
  119. class="iconImg"
  120. v-if="item.activityType == 5"
  121. src="../../../static/images/discountListIcon.png"
  122. >
  123. <image
  124. class="iconImg"
  125. v-if="item.activityType == 9"
  126. src="../../../static/images/memberCenterIcon.png"
  127. >
  128. <image
  129. class="iconImg"
  130. v-if="item.activityType == 8"
  131. src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png"
  132. >
  133. <!-- #endif -->
  134. <div class="price">
  135. ¥ {{ item.price }}
  136. </div>
  137. <div class="original-price">
  138. ¥ {{ item.originalPrice }}
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <!-- 自定义骨架屏 -->
  144. <div
  145. class="product-list-item ske-loading"
  146. v-else
  147. >
  148. <div class="product-list-img child-loading">
  149. </div>
  150. <div class="product-list-info">
  151. <label class="product-name child-loading"></label>
  152. <div class="price-warp child-loading" style="padding: 5px 0">
  153. </div>
  154. <div class="price-warp child-loading" style="padding: 5px 0">
  155. </div>
  156. </div>
  157. </div>
  158. </swiper-item>
  159. </swiper>
  160. <view
  161. class="swiper-dots"
  162. v-if="productData && productData.length > 2"
  163. >
  164. <text
  165. class="dot"
  166. :class="index - swiperCurrent <= 1 && index - swiperCurrent >=0 && 'dot-active'"
  167. v-for="(dot, index) in productData.length"
  168. :key="index"
  169. ></text>
  170. </view>
  171. </div>
  172. <div
  173. v-else
  174. class="product-list"
  175. >
  176. <ProductSkeleton style="" v-if="isFirst" :loading="loading" :isFirst="isFirst" />
  177. <div class="product-list-box" v-else>
  178. <div
  179. class="product-list-item-warp"
  180. v-for="(item,index) in productData"
  181. :key="index"
  182. >
  183. <div
  184. @click="jumpProductDetail(item)"
  185. class="product-list-item"
  186. >
  187. <div class="product-list-img">
  188. <img
  189. class="img pic-img default-img"
  190. :src="item.image"
  191. onerror="this.src='url(https://ceres.zkthink.com/static/root/default.png) no-repeat center';this.οnerrοr=null"
  192. >
  193. </div>
  194. <div class="product-list-info">
  195. <label class="product-name">{{ item.productName }}</label>
  196. <div class="flex">
  197. <div
  198. class="shop-box"
  199. v-if="typeId == 1"
  200. @click.stop="jumpStore(item)"
  201. >
  202. <label class="shop-name">{{ item.shopName }}</label>
  203. <div class="shop-logo">
  204. <img :src="item.shopLogo">
  205. </div>
  206. </div>
  207. <label class="buy-count">已售{{ item.number ? item.number : 0 }}</label>
  208. </div>
  209. <div class="price-warp">
  210. <!-- #ifdef MP-WEIXIN -->
  211. <img
  212. class="iconImg"
  213. v-if="item.activityType == 1"
  214. src="../../../static/images/groupBuyIcon.png"
  215. />
  216. <img
  217. class="iconImg"
  218. v-if="item.activityType == 2"
  219. src="../../../static/images/spikeIcon.png"
  220. />
  221. <img
  222. class="iconImg"
  223. v-if="item.activityType == 4"
  224. src="../../../static/images/spikeIcon.png"
  225. />
  226. <img
  227. class="iconImg"
  228. v-if="item.activityType == 3"
  229. src="../../../static/images/discountListIcon.png"
  230. />
  231. <img
  232. class="iconImg"
  233. v-if="item.activityType == 5"
  234. src="../../../static/images/discountListIcon.png"
  235. />
  236. <img
  237. class="iconImg"
  238. v-if="item.activityType == 9"
  239. src="../../../static/images/memberCenterIcon.png"
  240. />
  241. <img
  242. class="iconImg"
  243. v-if="item.activityType == 8"
  244. src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png"
  245. />
  246. <!-- #endif -->
  247. <!-- #ifdef H5 || APP-PLUS -->
  248. <image
  249. class="iconImg"
  250. v-if="item.activityType == 1"
  251. src="../../../static/images/groupBuyIcon.png"
  252. />
  253. <image
  254. class="iconImg"
  255. v-if="item.activityType == 2"
  256. src="../../../static/images/spikeIcon.png"
  257. />
  258. <image
  259. class="iconImg"
  260. v-if="item.activityType == 4"
  261. src="../../../static/images/spikeIcon.png"
  262. />
  263. <image
  264. class="iconImg"
  265. v-if="item.activityType == 3"
  266. src="../../../static/images/discountListIcon.png"
  267. />
  268. <image
  269. class="iconImg"
  270. v-if="item.activityType == 5"
  271. src="../../../static/images/discountListIcon.png"
  272. />
  273. <image
  274. class="iconImg"
  275. v-if="item.activityType == 9"
  276. src="../../../static/images/memberCenterIcon.png"
  277. />
  278. <image
  279. class="iconImg"
  280. v-if="item.activityType == 8"
  281. src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png"
  282. />
  283. <!-- #endif -->
  284. <div class="price">
  285. ¥ {{ item.price }}
  286. </div>
  287. <div class="original-price">
  288. ¥ {{ item.originalPrice }}
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. <button
  297. v-show="componentContent.showMore"
  298. class="btn-more"
  299. @click="jumpProList(componentContent.productData)"
  300. >查看全部 <span class="icon iconfont icon-arrow-right"></span></button>
  301. </div>
  302. </template>
  303. <script>
  304. import { commonMixin } from '../mixin'
  305. import ProductSkeleton from "@/components/basics/components/ProductSkeleton";
  306. export default {
  307. mixins: [commonMixin],
  308. components:{
  309. ProductSkeleton
  310. },
  311. data() {
  312. return {
  313. swiperCurrent: 0,
  314. }
  315. },
  316. methods: {
  317. swiperChange(e) {
  318. this.swiperCurrent = e.detail.current;
  319. }
  320. }
  321. }
  322. </script>
  323. <style
  324. lang="scss"
  325. scoped
  326. >
  327. .hom-pro-list {
  328. padding: 20rpx 13rpx;
  329. .title {
  330. text-align: center;
  331. margin-bottom: 20rpx;
  332. .title-img {
  333. width: 211rpx;
  334. }
  335. }
  336. /**多行多列**/
  337. .product-list {
  338. position: relative;
  339. &-box {
  340. display: flex;
  341. flex-wrap: wrap;
  342. flex-direction: row;
  343. &.swiper {
  344. height: 620rpx;
  345. }
  346. }
  347. &.product-swiper .product-list-box {
  348. padding-left: 0;
  349. }
  350. &-item-warp {
  351. margin: 0 0 20rpx 0;
  352. }
  353. &-item {
  354. width: 348rpx;
  355. padding: 0 7rpx;
  356. box-sizing: content-box;
  357. }
  358. &-img {
  359. width: 348rpx;
  360. height: 348rpx;
  361. background-color: white;
  362. border-radius: 10rpx 10rpx 0 0;
  363. .img {
  364. width: 100%;
  365. height: 100%;
  366. object-fit: contain;
  367. }
  368. }
  369. &-info {
  370. background-color: #FFFFFF;
  371. //box-shadow: 0px 0px 15px 0px rgba(52, 52, 52, 0.15);
  372. border-radius: 0 0 10rpx 10rpx;
  373. padding: 20rpx;
  374. label {
  375. font-weight: normal;
  376. }
  377. .product-name {
  378. font-size: 28rpx;
  379. color: #333;
  380. display: block;
  381. overflow: hidden;
  382. text-overflow: ellipsis;
  383. white-space: nowrap;
  384. margin-bottom: 18rpx;
  385. line-height: 40rpx;
  386. }
  387. .flex {
  388. display: flex;
  389. align-items: center;
  390. }
  391. .shop-box {
  392. background-color: #333333;
  393. border-radius: 0rpx 20rpx 20rpx 0rpx;
  394. line-height: 40rpx;
  395. display: flex;
  396. align-items: center;
  397. height: 40rpx;
  398. margin-right: 10rpx;
  399. .shop-name {
  400. font-size: 20rpx;
  401. color: #FFEBC4;
  402. padding: 0 8rpx 0 12rpx;
  403. }
  404. .shop-logo {
  405. border: 2rpx solid #707070;
  406. border-radius: 50%;
  407. overflow: hidden;
  408. float: right;
  409. img {
  410. width: 34rpx;
  411. height: 34rpx;
  412. display: block;
  413. }
  414. }
  415. }
  416. .buy-count {
  417. color: #C5AA7B;
  418. font-size: 20rpx;
  419. border: 2rpx solid #E4E5E6;
  420. line-height: 40rpx;
  421. padding: 0 5rpx;
  422. }
  423. .price-warp {
  424. display: flex;
  425. align-items: baseline;
  426. line-height: 56rpx;
  427. .iconImg {
  428. width: 58rpx;
  429. height: 36rpx;
  430. margin-right: 10rpx;
  431. }
  432. .price {
  433. color: #C83732;
  434. font-size: 40rpx;
  435. margin-right: 20rpx;
  436. }
  437. .original-price {
  438. font-size: 24rpx;
  439. color: #ccc;
  440. text-decoration: line-through;
  441. }
  442. }
  443. }
  444. //::v-deep .swiper-pagination-bullet{
  445. // display: none;
  446. //}
  447. }
  448. }
  449. //::v-deep .uni-swiper-dots{
  450. // display: flex;
  451. // justify-content: center;
  452. // padding: 10rpx 0;
  453. // .uni-swiper-dot{
  454. // width: 10rpx;
  455. // height: 10rpx;
  456. // background: #333333;
  457. // opacity: 0.3;
  458. // border-radius: 5rpx;
  459. // margin: 0 5rpx;
  460. // &-active{
  461. // width: 20rpx;
  462. // height: 10rpx;
  463. // opacity: 1;
  464. // }
  465. // }
  466. //}
  467. .swiper-dots {
  468. display: flex;
  469. position: absolute;
  470. left: 50%;
  471. transform: translateX(-50%);
  472. bottom: 15rpx;
  473. z-index: 66;
  474. .dot {
  475. width: 10rpx;
  476. height: 10rpx;
  477. background: #333333;
  478. opacity: 0.3;
  479. border-radius: 5rpx;
  480. margin: 0 10rpx;
  481. }
  482. .dot-active {
  483. width: 20rpx;
  484. opacity: 1;
  485. }
  486. }
  487. //.pagination{
  488. // display: flex;
  489. // justify-content: center;
  490. // padding: 20rpx 0;
  491. // ::v-deep .swiper-pagination-bullet{
  492. // width: 10rpx;
  493. // height: 10rpx;
  494. // background: #333333;
  495. // opacity: 0.3;
  496. // border-radius: 5rpx;
  497. // margin: 0 5rpx;
  498. // }
  499. // ::v-deep .swiper-pagination-bullet-active{
  500. // width: 20rpx;
  501. // height: 10rpx;
  502. // opacity: 1;
  503. // }
  504. //}
  505. .btn-more {
  506. width: 170rpx;
  507. height: 54rpx;
  508. line-height: 54rpx;
  509. border: 2rpx solid #C5AA7B;
  510. color: #C5AA7B;
  511. font-size: 24rpx;
  512. background-color: transparent;
  513. margin: 20rpx auto 0;
  514. display: flex;
  515. align-items: center;
  516. }
  517. </style>