index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <div class="hom-pro-list">
  3. <div class="title">
  4. <img src="../../../static/images/product/img-title.png" alt="商品推荐"/>
  5. </div>
  6. <div v-if="componentContent.arrangeType == '横向滑动'" class="product-list product-swiper">
  7. <swiper ref="mySwiper" class="product-list-box" :options="swiperOption">
  8. <swiper-slide class="product-list-item" v-for="(item,index) in productData.slice(0, 10)" :key="index" @click="jumpProductDetail(item)">
  9. <div class="product-list-img">
  10. <img v-show="item.image" class="img" :src="item.image">
  11. </div>
  12. <div class="product-list-info">
  13. <label class="product-name">{{item.productName}}</label>
  14. <div>
  15. <div class="shop-box" v-if="typeId == 1" @click.stop="jumpStore(item)">
  16. <label class="shop-name">{{item.shopName}}</label>
  17. <div class="shop-logo">
  18. <img :src="item.shopLogo">
  19. </div>
  20. </div>
  21. <label class="buy-count">{{item.users?item.users: 0}}人付款</label>
  22. </div>
  23. <div class="price-warp">
  24. <div class="price">
  25. ¥ {{item.price}}
  26. </div>
  27. <div class="original-price">
  28. ¥ {{item.originalPrice}}
  29. </div>
  30. </div>
  31. </div>
  32. </swiper-slide>
  33. </swiper>
  34. <div class="pagination product-pagination" slot="pagination"></div>
  35. </div>
  36. <div v-if="componentContent.arrangeType == '多行多列'" class="product-list">
  37. <div class="product-list-box" >
  38. <div class="product-list-item" v-for="(item,index) in productData" :key="index" @click="jumpProductDetail(item)">
  39. <div class="product-list-img">
  40. <img v-show="item.image" class="img" :src="item.image">
  41. </div>
  42. <div class="product-list-info">
  43. <label class="product-name">{{item.productName}}</label>
  44. <div>
  45. <div class="shop-box" v-if="typeId == 1" @click.stop="jumpStore(item)">
  46. <label class="shop-name">{{item.shopName}}</label>
  47. <div class="shop-logo">
  48. <img :src="item.shopLogo">
  49. </div>
  50. </div>
  51. <label class="buy-count">{{item.users?item.users: 0}}人付款</label>
  52. </div>
  53. <div class="price-warp">
  54. <div class="price">
  55. ¥ {{item.price}}
  56. </div>
  57. <div class="original-price">
  58. ¥ {{item.originalPrice}}
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <button v-show="componentContent.showMore" class="btn-more" @click="jumpLink(componentContent.linkObj)">查看全部 <span class="icon iconfont icon-arrow-right"></span></button>
  66. </div>
  67. </template>
  68. <script>
  69. import {commonMixin} from '../mixin'
  70. export default {
  71. mixins: [commonMixin],
  72. data () {
  73. return {
  74. swiperOption: {
  75. slidesPerView: 2,
  76. spaceBetween: 14,
  77. autoplay: false, // 可选选项,自动滑动
  78. loop: true,
  79. pagination: {
  80. el: '.product-pagination',
  81. clickable: true
  82. },
  83. navigation: {
  84. nextEl: '.swiper-button-next',
  85. prevEl: '.swiper-button-prev'
  86. }
  87. }
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .hom-pro-list{
  94. padding: 20px 0;
  95. .title{
  96. text-align: center;
  97. margin-bottom: 20px;
  98. label{
  99. background: url("../../../static/images/icon-title.png") no-repeat left center;
  100. font-size: 30px;
  101. font-weight: bold;
  102. padding-left: 48px;
  103. }
  104. }
  105. /**多行多列**/
  106. .product-list {
  107. position: relative;
  108. &-box {
  109. display: flex;
  110. flex-wrap: wrap;
  111. flex-direction: row;
  112. padding-left: 20px;
  113. ::v-deep .swiper-pagination-bullet{
  114. display: none;
  115. }
  116. }
  117. &.product-swiper .product-list-box{
  118. margin: 0 20px;
  119. padding-left: 0;
  120. }
  121. &-item {
  122. margin: 0 14px 20px 0;
  123. width: 348px;
  124. }
  125. &-img {
  126. width: 348px;
  127. height: 348px;
  128. background-color: #f5f5f5;
  129. border-radius: 10px 10px 0 0;
  130. .img {
  131. width: 100%;
  132. height: 100%;
  133. object-fit: contain;
  134. }
  135. }
  136. &-info {
  137. background-color: #FFFFFF;
  138. //box-shadow: 0px 0px 15px 0px rgba(52, 52, 52, 0.15);
  139. border-radius: 0 0 10px 10px;
  140. padding: 20px;
  141. label{
  142. font-weight: normal;
  143. }
  144. .product-name{
  145. font-size: 28px;
  146. color: #333;
  147. display: block;
  148. overflow: hidden;
  149. text-overflow:ellipsis;
  150. white-space: nowrap;
  151. margin-bottom: 18px;
  152. line-height: 40px;
  153. }
  154. .shop-box{
  155. background-color: #333333;
  156. border-radius: 0px 20px 20px 0px;
  157. line-height: 40px;
  158. display: inline-block;
  159. height: 40px;
  160. margin-right: 10px;
  161. .shop-name{
  162. font-size: 20px;
  163. color: #FFEBC4;
  164. padding: 0 8px 0 12px;
  165. }
  166. .shop-logo{
  167. border: 2px solid #707070;
  168. border-radius: 50%;
  169. overflow: hidden;
  170. float: right;
  171. img{
  172. width: 34px;
  173. height: 34px;
  174. display: block;
  175. }
  176. }
  177. }
  178. .buy-count{
  179. color: #C5AA7B;
  180. font-size: 20px;
  181. margin-bottom: 16px;
  182. border: 2px solid #E4E5E6;
  183. line-height: 40px;
  184. padding: 0 5px;
  185. display: inline-block;
  186. }
  187. .price-warp{
  188. display: flex;
  189. align-items: baseline;
  190. line-height: 56px;
  191. .price{
  192. color: #C83732;
  193. font-size: 40px;
  194. margin-right: 20px;
  195. }
  196. .original-price{
  197. font-size: 24px;
  198. color: #ccc;
  199. text-decoration: line-through;
  200. }
  201. }
  202. }
  203. //::v-deep .swiper-pagination-bullet{
  204. // display: none;
  205. //}
  206. }
  207. }
  208. .pagination{
  209. display: flex;
  210. justify-content: center;
  211. padding: 20px 0;
  212. ::v-deep .swiper-pagination-bullet{
  213. width: 10px;
  214. height: 10px;
  215. background: #333333;
  216. opacity: 0.3;
  217. border-radius: 5px;
  218. margin: 0 5px;
  219. }
  220. ::v-deep .swiper-pagination-bullet-active{
  221. width: 20px;
  222. height: 10px;
  223. opacity: 1;
  224. }
  225. }
  226. .btn-more {
  227. width: 170px;
  228. height: 54px;
  229. border: 2px solid #C5AA7B;
  230. color: #C5AA7B;
  231. font-size: 24px;
  232. background-color: transparent;
  233. margin: 20px auto 0;
  234. display: block;
  235. }
  236. </style>