index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div class="group-list">
  3. <div class="group-warp">
  4. <div class="title">
  5. <label>
  6. <!-- #ifdef MP-WEIXIN -->
  7. <img class="title-img" src="../../../static/images/group/img-title.png" alt="拼团专区" mode="widthFix"/>
  8. <!-- #endif -->
  9. <!-- #ifdef H5 || APP-PLUS -->
  10. <image class="title-img" src="../../../static/images/group/img-title.png" alt="拼团专区" mode="widthFix"/>
  11. <!-- #endif -->
  12. </label>
  13. <a v-show="componentContent.showMore" class="btn-all a-link" @click="jumpGroupWorks(productData)">更多<i class="iconfont icon-arrow-right"></i></a>
  14. </div>
  15. <div>
  16. <swiper class="swiper pro-box" :indicator-dots="false" :autoplay="true" :display-multiple-items="3" @change="swiperChange">
  17. <swiper-item class="swiper-slide pro-item-warp" v-for="(item,index) in productData.products" :key="index" @click="jumpProductDetail(item)">
  18. <div class="pro-item-inner">
  19. <div class="pro-item">
  20. <div class="pro-item-img">
  21. <img v-show="item.image" class="img" :src="item.image">
  22. </div>
  23. <div class="pro-item-info">
  24. <label class="name">{{item.productName}}</label>
  25. <div class="price">
  26. <label class="unit">¥ </label>
  27. <label class="val"> {{item.price}}</label>
  28. </div>
  29. <label class="buyCount">{{item.workUsers?item.workUsers:0}}人已拼</label>
  30. </div>
  31. </div>
  32. </div>
  33. </swiper-item>
  34. <swiper-item v-if="productData.products.length" class="swiper-slide pro-item-warp" v-for="item in (3 - productData.products.length)">
  35. </swiper-item>
  36. </swiper>
  37. <view class="swiper-dots" v-if="productData.products && productData.products.length > 3">
  38. <text class="dot" :class="index - swiperCurrent <= 2 && index - swiperCurrent >=0 && 'dot-active'" v-for="(dot, index) in productData.products.length"
  39. :key="index"></text>
  40. </view>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import {commonMixin} from '../mixin'
  47. export default {
  48. mixins: [commonMixin],
  49. data () {
  50. return {
  51. swiperCurrent: 0,
  52. }
  53. },
  54. methods:{
  55. swiperChange(e) {
  56. this.swiperCurrent = e.detail.current;
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .group-list{
  63. padding: 30upx 20upx 60upx;
  64. .group-warp{
  65. width: 710upx;
  66. height: 528upx;
  67. padding: 0 2upx;
  68. background: #333333;
  69. box-shadow: 0px 20upx 30upx rgba(0, 0, 0, 0.3);
  70. opacity: 1;
  71. border-radius: 20upx;
  72. position: relative;
  73. }
  74. .title{
  75. display: flex;
  76. align-items:center;
  77. position: relative;
  78. padding: 40upx 0 25upx 20upx;
  79. .title-img{
  80. width: 189upx;
  81. }
  82. .btn-all{
  83. position: absolute;
  84. right: 8upx;
  85. top: 40upx;
  86. line-height: 33upx;
  87. padding-right: 25upx;
  88. font-size: 24upx;
  89. color: #FFEBC4;
  90. .iconfont{
  91. content: '';
  92. font-size: 26upx;
  93. position: absolute;
  94. right: 0;
  95. top: 0;
  96. }
  97. }
  98. }
  99. .pro-box{
  100. height: 390upx;
  101. display: flex;
  102. &.swiper-disabled{
  103. .uni-swiper-wrapper{
  104. position: static;
  105. }
  106. }
  107. .pro-item-warp{
  108. width: 236px;
  109. }
  110. .pro-item{
  111. width: 220upx;
  112. height: 382upx;
  113. background: #FFFFFF;
  114. .pro-item-img{
  115. .img{
  116. width: 100%;
  117. height: 220upx;
  118. }
  119. }
  120. &-inner{
  121. padding: 0 8upx;
  122. }
  123. .pro-item-info{
  124. text-align: center;
  125. padding: 0px 10upx 20upx;
  126. .name{
  127. font-size: 24upx;
  128. font-weight: normal;
  129. color: #FFEBC4;
  130. line-height: 50upx;
  131. background-color: #333333;
  132. text-align: center;
  133. margin-bottom: 18upx;
  134. padding: 0 5px;
  135. display: block;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. white-space: nowrap;
  139. }
  140. .price{
  141. color: #C83732;
  142. font-size: 28upx;
  143. font-weight: bold;
  144. line-height: 40upx;
  145. }
  146. .buyCount{
  147. font-size: 24upx;
  148. color: #ccc;
  149. line-height: 34upx;
  150. font-weight: normal;
  151. }
  152. }
  153. }
  154. }
  155. ::v-deep .uni-swiper-dots{
  156. display: flex;
  157. justify-content: center;
  158. bottom: 27px;
  159. .uni-swiper-dot{
  160. width: 24upx;
  161. height: 4upx;
  162. background: #fff;
  163. opacity: 0.5;
  164. border-radius: 2upx;
  165. margin: 0 5upx;
  166. &-active{
  167. opacity: 1;
  168. }
  169. }
  170. }
  171. //.pagination{
  172. // display: flex;
  173. // justify-content: center;
  174. // ::v-deep .swiper-pagination-bullet{
  175. // width: 24upx;
  176. // height: 4upx;
  177. // background: #fff;
  178. // opacity: 0.5;
  179. // border-radius: 2upx;
  180. // margin: 0 5upx;
  181. // }
  182. // ::v-deep .swiper-pagination-bullet-active{
  183. // opacity: 1;
  184. // }
  185. //}
  186. .swiper-dots {
  187. display: flex;
  188. position: absolute;
  189. left: 50%;
  190. transform: translateX(-50%);
  191. bottom: 15rpx;
  192. z-index: 66;
  193. .dot {
  194. width: 24upx;
  195. height: 4upx;
  196. background: #fff;
  197. opacity: 0.5;
  198. border-radius: 2upx;
  199. margin: 0 10upx;
  200. }
  201. .dot-active {
  202. opacity: 1;
  203. }
  204. }
  205. }
  206. </style>