index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div class="hom-pro-list">
  3. <div class="product-swiper">
  4. <swiper class="product-swiper-box" :options="swiperOption">
  5. <swiper-slide class="product-swiper-item" v-for="(item,index) in productData.slice(0, 3)" :key="index" @click="jumpProductDetail(item)">
  6. <div class="product-swiper-img">
  7. <img class="img" :src="item.image">
  8. </div>
  9. <div class="product-swiper-info">
  10. <label class="product-name">{{item.productName}}</label>
  11. <div class="price-warp">
  12. <div class="price">
  13. ¥ {{item.price}}
  14. </div>
  15. <div class="original-price">
  16. ¥ {{item.originalPrice}}
  17. </div>
  18. </div>
  19. </div>
  20. </swiper-slide>
  21. </swiper>
  22. <div class="pagination new-pagination"></div>
  23. </div>
  24. <button v-show="componentContent.showMore" class="btn-more" @click="jumpLink(componentContent.linkObj)">查看全部 <span class="icon iconfont icon-arrow-right"></span></button>
  25. </div>
  26. </template>
  27. <script>
  28. import {commonMixin} from '../mixin'
  29. export default {
  30. mixins: [commonMixin],
  31. data () {
  32. return {
  33. index: 1,
  34. swiperOption: {
  35. slidesPerView: 3,
  36. spaceBetween: 12,
  37. autoplay: false, // 可选选项,自动滑动
  38. loop: true,
  39. pagination: {
  40. el: '.new-pagination'
  41. }
  42. }
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .hom-pro-list{
  49. ::v-deep .swiper-wrapper{
  50. position: static;
  51. }
  52. /**横向滑动**/
  53. .product-swiper{
  54. width: 100%;
  55. height: 454px;
  56. padding: 90px 34px 0;
  57. background: url("../../../static/images/newProduct/bg-product-card.png") no-repeat center;
  58. position: relative;
  59. &+.btn-more{
  60. margin-top: 20px;
  61. }
  62. .title{
  63. padding: 22px 0px 0 0;
  64. label{
  65. background-image: none;
  66. color: #A56C4C;
  67. font-style: italic;
  68. padding: 0;
  69. }
  70. }
  71. &-box {
  72. padding-bottom: 20px;
  73. }
  74. &-item {
  75. width: 220px;
  76. position: relative;
  77. background-color: #FFFFFF;
  78. }
  79. &-img {
  80. width: 220px;
  81. height: 220px;
  82. position: relative;
  83. &:after{
  84. content: '';
  85. display: block;
  86. width: 54px;
  87. height: 54px;
  88. background: url("../../../static/images/newProduct/flag-new.png") no-repeat;
  89. position: absolute;
  90. top: 0;
  91. left: 0;
  92. }
  93. .img {
  94. width: 100%;
  95. height: 100%;
  96. object-fit: contain;
  97. }
  98. }
  99. &-info {
  100. background-color: #FFFFFF;
  101. padding: 10px;
  102. text-align: center;
  103. .product-name{
  104. font-size: 20px;
  105. color: #333;
  106. display: block;
  107. overflow: hidden;
  108. text-overflow:ellipsis;
  109. white-space: nowrap;
  110. margin-bottom: 6px;
  111. line-height: 28px;
  112. }
  113. .price-warp{
  114. display: flex;
  115. justify-content: center;
  116. align-items: baseline;
  117. line-height: 28px;
  118. .price{
  119. color: #C83732;
  120. font-size: 20px;
  121. margin-right: 10px;
  122. }
  123. .original-price{
  124. font-size: 16px;
  125. color: #ccc;
  126. text-decoration: line-through;
  127. }
  128. }
  129. }
  130. }
  131. }
  132. .pagination{
  133. display: flex;
  134. justify-content: center;
  135. width: 100%;
  136. bottom: 0;
  137. ::v-deep .swiper-pagination-bullet{
  138. width: 24px;
  139. height: 4px;
  140. background: #FFFFFF;
  141. opacity: 0.5;
  142. border-radius: 2px;
  143. margin: 0 10px;
  144. }
  145. ::v-deep .swiper-pagination-bullet-active{
  146. opacity: 1;
  147. }
  148. }
  149. .btn-more {
  150. width: 170px;
  151. height: 54px;
  152. border: 2px solid #C5AA7B;
  153. color: #C5AA7B;
  154. font-size: 24px;
  155. background-color: transparent;
  156. margin: 20px auto 0;
  157. display: block;
  158. }
  159. </style>