index.vue 6.5 KB

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