index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="discount">
  3. <div class="discount-top">
  4. <div class="discount-top-text">全场5折起</div>
  5. <div class="discount-top-time">
  6. <!-- 距{{count[0]}}-->
  7. 距离本场结束还有
  8. <div class="time"><span>{{count[1]}}</span>:<span>{{count[2]}}</span>:<span>{{count[3]}}</span></div></div>
  9. </div>
  10. <div class="discount-more" :style="{backgroundImage: 'url('+ componentContent.moreBg +')'}">
  11. <div class="discount-more-overlay">
  12. <button class="btn-more" @click="jumpGroupWorks(productData)">查看全部</button>
  13. </div>
  14. </div>
  15. <div class="discount-list">
  16. <div class="swiper-button-prev"></div>
  17. <div class="swiper-button-next"></div>
  18. <swiper class="products-swiper" :options="swiperOption">
  19. <swiper-slide class="products-swiper-slide item" v-for="(item,index) in productData.products" :key="index">
  20. <div class="a-link" @click="jumpProductDetail(item)">
  21. <div class="itemImgBox">
  22. <div class="imgBox">
  23. <el-image
  24. :src="item.image"
  25. fit="contain"></el-image>
  26. </div>
  27. </div>
  28. <div class="text">
  29. <h4 class="h4">{{item.productName}}</h4>
  30. <div class="priceBox">
  31. <span class="discount" v-if="item.originalPrice">¥{{item.originalPrice}}</span>
  32. <dl>
  33. <dt><img src="../../../static/images/discount/flag-discount.png" alt="折扣价"></dt>
  34. <dd>
  35. ¥{{item.price}}
  36. </dd>
  37. </dl>
  38. </div>
  39. </div>
  40. </div>
  41. </swiper-slide>
  42. </swiper>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import {commonMixin} from '../mixin'
  48. export default {
  49. mixins: [commonMixin],
  50. data () {
  51. return {
  52. swiperOption: {
  53. slidesPerView: 3, // 显示数量
  54. spaceBetween: 13, // 间隔
  55. autoplay: false, // 可选选项,自动滑动
  56. loop: true,
  57. pagination: {
  58. el: '.discount-pagination'
  59. },
  60. navigation: {
  61. nextEl: '.swiper-button-next',
  62. prevEl: '.swiper-button-prev'
  63. }
  64. }
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .discount{
  71. width: 1200px;
  72. max-width: 100%;
  73. margin: 0 auto;
  74. overflow: hidden;
  75. &-top{
  76. height: 250px;
  77. padding-top: 96px;
  78. margin-bottom: 15px;
  79. background: url("../../../static/images/discount/bg-discount-top.png") no-repeat;
  80. &-text{
  81. background: url("../../../static/images/discount/bg-discount-top-text.png") no-repeat;
  82. width: 176px;
  83. height: 83px;
  84. padding-top: 13px;
  85. line-height: 50px;
  86. font-size: 25px;
  87. color: #fff;
  88. margin: 0px auto 18px;
  89. text-align: center;
  90. }
  91. &-time{
  92. margin: 0 auto;
  93. text-align: center;
  94. font-size: 16px;
  95. color: #FFEBC4;
  96. .time{
  97. font-size: 20px;
  98. color: #999;
  99. display: inline-block;
  100. span{
  101. display: inline-block;
  102. line-height: 40px;
  103. padding: 0 9px;
  104. margin: 0 5px;
  105. background-color: #343434;
  106. color: #fff;
  107. }
  108. }
  109. }
  110. }
  111. &-list{
  112. margin-right: 303px;
  113. position: relative;
  114. .swiper-button-prev,.swiper-button-next{
  115. width: 95px;
  116. height: 95px;
  117. position: absolute;
  118. cursor:pointer;
  119. top: 115px;
  120. background-repeat: no-repeat;
  121. &:after{
  122. content: '';
  123. }
  124. }
  125. .swiper-button-prev{
  126. left: -22px;
  127. background: url('../../../static/images/btn-prev2.png');
  128. }
  129. .swiper-button-next{
  130. right: -22px;
  131. background: url('../../../static/images/btn-next2.png');
  132. }
  133. .a-link{
  134. cursor: pointer;
  135. &:hover{
  136. box-shadow: 3px 4px 20px 0px rgba(186, 186, 186, 0.5);
  137. }
  138. .itemImgBox {
  139. height: auto;
  140. display: flex;
  141. flex-direction: column;
  142. justify-content: center;
  143. .imgBox {
  144. padding-bottom: 100%;
  145. background-color: #cacaca;
  146. position: relative;
  147. .el-image {
  148. width: 100%;
  149. height: 100%;
  150. position: absolute;
  151. top: 0;
  152. left: 0;
  153. }
  154. }
  155. }
  156. .text{
  157. padding:25px 20px 17px;
  158. text-align: center;
  159. //height: 180px;
  160. .h4{
  161. font-size: 18px;
  162. line-height: 24px;
  163. overflow: hidden;
  164. text-overflow:ellipsis;
  165. white-space: nowrap;
  166. color: #333333;
  167. //max-height: 48px;
  168. }
  169. .p{
  170. color: #999;
  171. font-size: 16px;
  172. overflow: hidden;
  173. text-overflow:ellipsis;
  174. white-space: nowrap;
  175. padding-top: 18px;
  176. position: relative;
  177. margin-top: 8px;
  178. &:after{
  179. position: absolute;
  180. top: 0;
  181. left: 50%;
  182. margin-left: -80px;
  183. width: 160px;
  184. height: 2px;
  185. background: #F0F0F0;
  186. content: '';
  187. }
  188. }
  189. .priceBox {
  190. dl {
  191. display: inline-block;
  192. min-width: 130px;
  193. dt{
  194. float: left;
  195. img{
  196. display: block;
  197. }
  198. }
  199. dd{
  200. border: 1px solid #F3F4F5;
  201. font-size: 25px;
  202. line-height: 34px;
  203. color: #C83732;
  204. margin-left: 57px;
  205. padding: 0 10px;
  206. }
  207. }
  208. span.discount {
  209. display: block;
  210. font-size: 18px;
  211. line-height: 24px;
  212. padding: 15px 0 11px;
  213. color: #ccc;
  214. text-decoration: line-through;
  215. }
  216. }
  217. }
  218. }
  219. }
  220. &-more{
  221. width: 290px;
  222. height: 466px;
  223. float: right;
  224. position: relative;
  225. &-overlay{
  226. position: absolute;
  227. top: 0;
  228. left: 0;
  229. width: 100%;
  230. height: 100%;
  231. background-color: rgba(0,0,0,0.6);
  232. display: flex;
  233. justify-content: center;
  234. align-items: center;
  235. .btn-more{
  236. width: 130px;
  237. height: 41px;
  238. background-color: #fff;
  239. font-size: 18px;
  240. color: #C5AA7B;
  241. }
  242. }
  243. }
  244. }
  245. </style>