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

564 lines
16 KiB

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