index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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 @click="intoPage()" 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. intoPage(flag) {
  130. let url = flag ? `/pages/index/addData?id=${flag}` : `/pages/index/addData`
  131. uni.navigateTo({
  132. url: url
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .content {
  140. width: 100%;
  141. height: 100vh;
  142. display: flex;
  143. flex-direction: column;
  144. justify-content: center;
  145. align-items: center;
  146. .header{
  147. background-color: #FFFFFF;
  148. display: flex;
  149. flex-direction: column;
  150. border-radius: 15upx;
  151. padding: 20upx;
  152. box-shadow: 0upx 3upx 6upx #eee;
  153. margin-bottom: 20upx;
  154. > text {
  155. line-height: 50upx;
  156. }
  157. :first-child {
  158. display: flex;
  159. justify-content: space-between;
  160. align-items: center;
  161. }
  162. .filter-img{
  163. padding: 10upx;
  164. }
  165. }
  166. .scroll-con{
  167. flex: 1;
  168. width: 100%;
  169. -webkit-box-flex:1;
  170. -webkit-flex:1;
  171. -ms-flex:1;
  172. overflow: auto;
  173. .cell-item{
  174. width: 100%;
  175. background-color: #fff;
  176. border-radius: 15upx;
  177. // padding: 20upx;
  178. box-shadow: 0upx 3upx 6upx #eee;
  179. .cell-item-title{
  180. padding: 20upx 20upx 10upx;
  181. width: 100%;
  182. display: flex;
  183. justify-content: space-between;
  184. border-bottom: 1px solid #e6e6e6;
  185. }
  186. .cell-item-cont{
  187. width: 100%;
  188. display: flex;
  189. justify-content: space-between;
  190. padding: 20upx;
  191. margin-bottom: 20upx;
  192. .cont-item{
  193. display: flex;
  194. flex-direction: column;
  195. align-items: center;
  196. width: 33%;
  197. border-right: 1px solid #e6e6e6;
  198. :first-child {
  199. padding: 26upx;
  200. width: 100upx;
  201. height: 100upx;
  202. background-color: red;
  203. border-radius: 50%;
  204. font-size: 24upx;
  205. display: flex;
  206. align-items: center;
  207. justify-content: center;
  208. color: #fff;
  209. }
  210. }
  211. :last-child {
  212. border: none;
  213. }
  214. }
  215. }
  216. }
  217. .footer{
  218. z-index: 9999;
  219. position: fixed;
  220. bottom: 80upx;
  221. width: 80%;
  222. height: 80upx;
  223. background-color: red;
  224. opacity: 0.8;
  225. border-radius: 40upx;
  226. color: #fff;
  227. display: flex;
  228. align-items: center;
  229. justify-content: center;
  230. }
  231. }
  232. </style>