PintuanList.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="拼团活动" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div goods-list" style="position:relative">
  14. <!-- 无限加载滚动列表 -->
  15. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div flex-wrapper" @scrolltolower="loadMore" scroll-y="true">
  16. <view class="div item" v-for='(item, index) in pintuanList' :key='index'>
  17. <view class="div goods-list-top">
  18. <view class="div img">
  19. <view class="div img-content">
  20. <image mode="aspectFit" class="img" :src="item.pintuan_image" />
  21. </view>
  22. </view>
  23. <view class="div goods-info">
  24. <view class="div info">
  25. <view class="div goods_nameBox">
  26. <view class="div goods_nameText">
  27. <text class="span">{{item.pintuan_goods_name}}</text>
  28. </view>
  29. </view>
  30. <view class="div p">
  31. 已开团{{item.pintuan_count}}组
  32. </view>
  33. <view class="div goods_price_wrap">
  34. <view class="div now_price">
  35. <text class="span small_price">
  36. <text class="span">¥</text>
  37. </text>
  38. <text class="span big_price">
  39. <text class="span">{{item.pintuan_zhe_price}}</text>
  40. </text>
  41. </view>
  42. <view class="div old_price">
  43. ¥{{item.pintuan_goods_price}}
  44. </view>
  45. </view>
  46. <view class="div navigator" @click="goDetail(item)">
  47. <view class="div group_num_wrap">
  48. <view class="div iconImg">
  49. <text class="span iconfont icon-text">&#xe6f0;</text>
  50. </view>
  51. <view class="div text-content">
  52. <text class="span">{{item.pintuan_limit_number}}人团</text>
  53. </view>
  54. </view>
  55. <view class="div go_to_group">
  56. 去拼团
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="div loading-wrapper" v-if="pintuanList.length > 0">
  64. <view class="p common-no-more" v-if='!isMore'>没有更多了</view>
  65. <uni-load-more status="loading" color='#e93b3d' v-if='isMore'></uni-load-more>
  66. </view>
  67. <empty-record v-if='pintuanList.length <= 0 && !isMore'></empty-record>
  68. </scroll-view>
  69. </view>
  70. </view></home-base>
  71. </template>
  72. <script>
  73. import {getFontSize,urlencode} from '@/util/common'
  74. import TitleHeader from '../../TitleHeader'
  75. import HomeBase from '../HomeBase'
  76. import EmptyRecord from '../../EmptyRecord'
  77. import CountDown from '../../CountDown'
  78. import { getPintuanList } from '../../../api/homesearch'
  79. export default {
  80. name: 'PintuanList',
  81. components:{
  82. TitleHeader,
  83. HomeBase,
  84. EmptyRecord,
  85. CountDown
  86. },
  87. mounted(){
  88. // #ifdef MP-WEIXIN
  89. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  90. // #endif
  91. },
  92. computed:{
  93. fontSize(){
  94. return getFontSize()
  95. },
  96. },
  97. data(){
  98. return {
  99. navHeight: 0,
  100. pintuanList: [],
  101. params: { 'page': 0, 'per_page': 10 },
  102. loading: false, // 是否加载更多
  103. isMore: true // 是否有更多
  104. }
  105. },
  106. created () {
  107. this.loadMore()
  108. },
  109. methods:{
  110. goBack(){uni.navigateBack({delta:1})},
  111. loadMore () {
  112. this.loading = true
  113. this.params.page = ++this.params.page
  114. if (this.isMore) {
  115. this.loading = false
  116. this.getPintuanList(true)
  117. }
  118. },
  119. getPintuanList () {
  120. uni.showLoading({ title: '加载中' })
  121. getPintuanList(this.params).then(res => {
  122. uni.hideLoading()
  123. if (res.result.hasmore) {
  124. this.isMore = true
  125. } else {
  126. this.isMore = false
  127. }
  128. if (this.pintuanList) {
  129. this.pintuanList = this.pintuanList.concat(res.result.pintuan_list)
  130. } else {
  131. this.pintuanList = res.result.pintuan_list
  132. }
  133. }).catch(function (error) {
  134. uni.hideLoading()
  135. uni.showToast({icon:'none',title: error.message})
  136. })
  137. },
  138. goDetail (item) {
  139. uni.navigateTo({ url: '/pages/home/goodsdetail/Goodsdetail'+'?'+urlencode( { 'goods_id': item.pintuan_goods_id } )})
  140. }
  141. }
  142. }
  143. </script>
  144. <style scoped lang='scss'>
  145. .scroll-view-wrapper{display: flex;flex-direction: column;}
  146. .scroll-view{flex:1}
  147. .goods-list {padding: 0 10px;}
  148. .goods-list *{flex-direction: column;}
  149. .goods-list .item {display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-webkit-flex-direction: column;flex-direction: column;border-radius: 7px;box-sizing: border-box;background-color: #fff;font-size:$fontSize;color: #999;margin-top: 10px;padding: 10px 10px 20px 10px}
  150. .goods-list-top .img {position: relative;width: 135px;height: 135px;margin-right: 10px;background-color: #f8f8f8;border-radius: 7px}
  151. .img .img-content {width: 135px;height: 135px;border-radius: 7px}
  152. .img .img-content >img{display: block;position: absolute;top: 0;left: 0;width: 100%;height: 100%;}
  153. .goods-list .item {display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-webkit-flex-direction: column;flex-direction: column}
  154. .goods-list-top {display: -webkit-box;display: -webkit-flex;display: flex;flex-direction: row;}
  155. .goods-info {display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-webkit-flex-direction: column;flex-direction: column;position: relative}
  156. .goods-info .info .goods_nameBox {margin-bottom: 2px}
  157. .goods-info .goods_price_wrap {display: flex;margin-top: 15px;flex-direction: row;align-items: baseline;}
  158. .goods_price_wrap .now_price {font-size:$fontSize;font-weight: 600;color: #fc1c1c;font-weight: 700}
  159. .now_price .big_price {font-size:$h1}
  160. .goods-info .info .old_price {color: #9a9a9a;font-size:$h6;margin-left: 5px;text-decoration: line-through;padding-bottom: 2px}
  161. .goods-info .info .p {font-size:$fontSize;color: #666;display: -webkit-box;display: -webkit-flex;display: flex;}
  162. .goods-info .p .line {display: block;width: 1px;height: 10px;margin: 0 7px;background-color: #999}
  163. .goods-info .navigator {display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-align: center;-webkit-align-items: center;align-items: center;-webkit-box-pack: center;-webkit-justify-content: center;justify-content: center;width: 140px;height: 25px;color: #fff;font-size:$subFontSize;border-radius: 19px;position: absolute;bottom: 0;left: 0;flex-direction: row;}
  164. .group_num_wrap {display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-pack: center;-webkit-justify-content: center;justify-content: center;-webkit-box-align: center;-webkit-align-items: center;align-items: center;width: 75px;height: 23px;color: #fc1c1c;font-size:$fontSize;border-radius: 12px 0 0 12px;border: 1px solid #fc1c1c;padding-right: 10px;flex-direction: row;}
  165. .goods-info .iconImg {width: 15px;height: 13px;margin-right: 5px;position: relative;}
  166. .goods-info .iconImg .icon-text{display: block;position: absolute;top: 0;left: 0;width: 100%;height: 100%;font-size:$h2;line-height: 13px;}
  167. .go_to_group {display: -webkit-box;display: -webkit-flex;display: flex;-webkit-box-align: center;-webkit-align-items: center;align-items: center;-webkit-box-pack: center;-webkit-justify-content: center;justify-content: center;width: 74px;height: 25px;font-size: $subFontSize;color: #fff;background-color: #fc1c1c;border-radius: 0 12px 12px 12px;margin-left: -15px}
  168. .goods_nameBox {margin-top: 10px}
  169. .goods_nameText {color: #2e2e2e;font-size:$subFontSize;font-weight: 600;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;line-clamp: 2;-webkit-box-orient: vertical}
  170. .group_bottom_text {white-space: nowrap;text-overflow: ellipsis;overflow: hidden}
  171. </style>