activity-list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="container activity">
  3. <view class="activity-content" v-if="activityList.length > 0">
  4. <view class="activity-list" v-for="(activity,index) in activityList" :key="index" @click="NavigatorPath(activity)">
  5. <view class="activity-list-pic">
  6. <image class="activity-image" :src="activity.listImage" mode=""></image>
  7. </view>
  8. <view class="activity-list-msg">
  9. <view class="activity-title">{{ activity.name }}</view>
  10. <view class="activity-numbe">商品数:<text class="color">{{ activity.productCount }}</text> </view>
  11. <view class="activity-times">
  12. <text class="label">活动时间:</text>
  13. <text class="color">{{ activity.beginTime }} ~ {{ activity.endTime }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view v-else class="activity-content-empty">
  19. <view class="empty-container">
  20. <image class="empty-container-image" :src="StaticUrl+'icon-empty-activity.png'" mode="aspectFit"></image>
  21. <text class="error-text">您还没有活动哟~</text>
  22. <text class="error-text">可联系采美帮您设置活动~</text>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default{
  29. data(){
  30. return{
  31. activityList:[],
  32. hasNextPage:false,
  33. listQuery:{
  34. userId:0,
  35. pageNum:1,
  36. pageSize:10
  37. }
  38. }
  39. },
  40. onLoad() {
  41. },
  42. methods:{
  43. GetInitProductList(){//初始化活动列表数据
  44. this.ProductService.GetProductActivityAreaList(this.listQuery).then(response => {
  45. const data = response.data
  46. this.hasNextPage = data.hasNextPage
  47. this.activityList = data.list
  48. }).catch(error =>{
  49. this.$util.msg(error.msg,2000);
  50. })
  51. },
  52. GetOnReachBottomData(){//上滑加载更多
  53. this.listQuery.pageNum+=1
  54. this.ProductService.GetProductActivityAreaList(this.listQuery).then(response => {
  55. const data = response.data
  56. this.hasNextPage = data.hasNextPage
  57. this.activityList = this.activityList.concat(data.list)
  58. }).catch(error =>{
  59. this.$util.msg(error.msg,2000);
  60. })
  61. },
  62. NavigatorPath(item){
  63. this.$api.navigateTo(`/pages/user/activity/activity?activityId=${item.activityId}&userId=${this.listQuery.userId}`)
  64. }
  65. },
  66. onPullDownRefresh() {//下拉刷新
  67. this.listQuery.pageNum = 1
  68. this.GetInitProductList()
  69. uni.stopPullDownRefresh()
  70. },
  71. onReachBottom(){
  72. if(this.hasNextPage){
  73. this.GetOnReachBottomData()
  74. }
  75. },
  76. onShow() {
  77. this.$api.getStorage().then((resolve) => {
  78. this.listQuery.userId = resolve.userId ? resolve.userId : '';
  79. this.GetInitProductList()
  80. })
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. page{
  86. height: auto !important;
  87. background-color: $color-system;
  88. }
  89. .activity-content{
  90. width: 100%;
  91. height: auto;
  92. box-sizing: border-box;
  93. padding: 24rpx;
  94. .activity-list{
  95. width: 100%;
  96. height: 228rpx;
  97. box-sizing: border-box;
  98. padding: 24rpx 20rpx;
  99. background-color: #FFFFFF;
  100. border-radius: 16rpx;
  101. margin-bottom: 24rpx;
  102. .activity-list-pic{
  103. width: 180rpx;
  104. height: 180rpx;
  105. float: left;
  106. box-sizing: border-box;
  107. border: 1px solid #e1e1e1;
  108. border-radius: 8rpx;
  109. .activity-image{
  110. width: 178rpx;
  111. height: 178rpx;
  112. display: block;
  113. border-radius: 8rpx;
  114. }
  115. }
  116. .activity-list-msg{
  117. width: 470rpx;
  118. height: 100%;
  119. float: right;
  120. position: relative;
  121. .activity-title{
  122. width: 100%;
  123. height: auto;
  124. line-height: 36rpx;
  125. text-overflow: ellipsis;
  126. overflow: hidden;
  127. display: -webkit-box;
  128. -webkit-line-clamp: 2;
  129. line-clamp: 2;
  130. -webkit-box-orient: vertical;
  131. font-size: $font-size-26;
  132. color: #333333;
  133. text-align: justify;
  134. float: left;
  135. }
  136. .activity-numbe{
  137. width: 100%;
  138. height: 28rpx;
  139. float: left;
  140. margin-top: 4rpx;
  141. text-align: left;
  142. line-height: 28rpx;
  143. font-size: $font-size-24;
  144. color: #999999;
  145. .color{
  146. color: #666666;
  147. }
  148. }
  149. .activity-times{
  150. width: 100%;
  151. height: 44rpx;
  152. position: absolute;
  153. bottom: 0;
  154. left: 0;
  155. font-size:18rpx;
  156. color: #666666;
  157. line-height: 44rpx;
  158. .label{
  159. display: inline-block;
  160. float: left;
  161. }
  162. .color{
  163. display: inline-block;
  164. float: left;
  165. color: $color-system;
  166. }
  167. }
  168. }
  169. }
  170. }
  171. .activity-content-empty{
  172. position: relative;
  173. }
  174. </style>