index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="content">
  3. <view class="header">
  4. <view>
  5. <text>2021-03-15至2021-06-02</text>
  6. <u-image @click="openScreen=true" class="filter-img" width="36rpx" height="36rpx" src="/static/filter.png"></u-image>
  7. </view>
  8. <text>总计:其它垃圾2000,厨余垃圾1000,建筑垃圾0。</text>
  9. </view>
  10. <scroll-view class="scroll-con" :scroll-top="scrollTop" scroll-y @scrolltolower="onreachBottom">
  11. <!-- 列表数据 -->
  12. <view class="cell-item" v-for="item in listdata">
  13. <view class="cell-item-title" >
  14. <view>
  15. <text>2020-02-23 15:12:30</text>
  16. </view>
  17. <view>
  18. <span>查看详情</span>
  19. <u-icon name="arrow-right" size="28"></u-icon>
  20. </view>
  21. </view>
  22. <view class="cell-item-cont">
  23. <view class="cont-item">
  24. <text>其它垃圾</text>
  25. <text>1000kg</text>
  26. </view>
  27. <view class="cont-item">
  28. <text>厨余垃圾</text>
  29. <text>1000kg</text>
  30. </view>
  31. <view class="cont-item">
  32. <text>建筑垃圾</text>
  33. <text>1000kg</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="nodata" v-if="listdata.length==0 && status!='loading'">
  38. <u-empty :text="noDataText" mode="list"></u-empty>
  39. </view>
  40. <view class="loadmore">
  41. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  42. </view>
  43. </scroll-view>
  44. <view class="footer">
  45. <u-icon name="edit-pen" size="30"></u-icon>
  46. <text>垃圾数据录入</text>
  47. </view>
  48. <!-- 筛选弹框 -->
  49. <search-modal v-if="openScreen" :visible="openScreen" :defaultParams="searchForm" @refresh="refresh" @close="openScreen=false"></search-modal>
  50. </view>
  51. </template>
  52. <script>
  53. import searchModal from './searchModal.vue'
  54. export default {
  55. components: { searchModal },
  56. data() {
  57. return {
  58. listdata: [{},{},{},{}],
  59. pageNo: 1, // 当前页码
  60. pageSize: 10, // 每页条数
  61. total: 0, // 数据总条数
  62. noDataText: '暂无数据', // 列表请求状态提示语
  63. status: 'loadmore', // 加载中状态
  64. openScreen: false, // 是否打开筛选
  65. searchForm: { // 查询条件
  66. beginDate: '', // 创建时间默认筛选近7天
  67. endDate: '', // 创建时间默认筛选近7天
  68. },
  69. scrollTop: 0, // 滚动条位置
  70. }
  71. },
  72. onLoad() {
  73. },
  74. onUnload() {
  75. },
  76. onShareAppMessage(res) {
  77. },
  78. onShareTimeline(res) {
  79. },
  80. onShow() {
  81. },
  82. methods: {
  83. // 获取查询参数 刷新列表
  84. refresh(params){
  85. this.searchForm = params
  86. // this.listdata = []
  87. this.total = 0
  88. this.searchHandle(1)
  89. },
  90. // 搜索查询
  91. searchHandle (pageNo) {
  92. // this.status = "loading"
  93. pageNo ? this.pageNo = pageNo : null
  94. // getGoldLogList({
  95. // pageNo: this.pageNo,
  96. // pageSize: this.pageSize,
  97. // beginDate: this.searchForm.beginDate,
  98. // endDate: this.searchForm.endDate,
  99. // }).then(res => {
  100. // if (res.status == 200) {
  101. // if(this.pageNo>1){
  102. // this.listdata = this.listdata.concat(res.data.list || [])
  103. // }else{
  104. // this.listdata = res.data.list || []
  105. // this.scrollTop = 0
  106. // }
  107. // this.total = res.data.count || 0
  108. // this.noDataText = '暂无数据'
  109. // } else {
  110. // this.noDataText = res.message
  111. // this.listdata = []
  112. // this.total = 0
  113. // }
  114. // this.status = "loadmore"
  115. // })
  116. },
  117. // scroll-view到底部加载更多
  118. onreachBottom() {
  119. console.log(111111)
  120. if(this.listdata.length < this.total){
  121. this.pageNo += 1
  122. // this.searchHandle()
  123. }else{
  124. uni.showToast({ title: '已经到底了', icon: 'none' })
  125. this.status = "nomore"
  126. }
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .content {
  133. width: 100%;
  134. height: 100vh;
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: center;
  138. align-items: center;
  139. .header{
  140. background-color: #FFFFFF;
  141. display: flex;
  142. flex-direction: column;
  143. border-radius: 15upx;
  144. padding: 20upx;
  145. box-shadow: 0upx 3upx 6upx #eee;
  146. margin-bottom: 20upx;
  147. > text {
  148. line-height: 50upx;
  149. }
  150. :first-child {
  151. display: flex;
  152. justify-content: space-between;
  153. align-items: center;
  154. }
  155. .filter-img{
  156. padding: 10upx;
  157. }
  158. }
  159. .scroll-con{
  160. flex: 1;
  161. width: 100%;
  162. -webkit-box-flex:1;
  163. -webkit-flex:1;
  164. -ms-flex:1;
  165. overflow: auto;
  166. .cell-item{
  167. width: 100%;
  168. background-color: #fff;
  169. border-radius: 15upx;
  170. // padding: 20upx;
  171. box-shadow: 0upx 3upx 6upx #eee;
  172. .cell-item-title{
  173. padding: 20upx 20upx 10upx;
  174. width: 100%;
  175. display: flex;
  176. justify-content: space-between;
  177. border-bottom: 1px solid #e6e6e6;
  178. }
  179. .cell-item-cont{
  180. width: 100%;
  181. display: flex;
  182. justify-content: space-between;
  183. padding: 20upx;
  184. margin-bottom: 20upx;
  185. .cont-item{
  186. display: flex;
  187. flex-direction: column;
  188. align-items: center;
  189. width: 33%;
  190. border-right: 1px solid #e6e6e6;
  191. :first-child {
  192. padding: 26upx;
  193. width: 100upx;
  194. height: 100upx;
  195. background-color: red;
  196. border-radius: 50%;
  197. font-size: 24upx;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. color: #fff;
  202. }
  203. }
  204. :last-child {
  205. border: none;
  206. }
  207. }
  208. }
  209. }
  210. .footer{
  211. z-index: 9999;
  212. position: fixed;
  213. bottom: 80upx;
  214. width: 80%;
  215. height: 80upx;
  216. background-color: red;
  217. opacity: 0.8;
  218. border-radius: 40upx;
  219. color: #fff;
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. }
  224. }
  225. </style>