index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="content">
  3. <view class="header">
  4. <view @click="openScreen=true">
  5. <text v-if="searchForm.beginDate">{{searchForm.beginDate}} 至 {{searchForm.endDate}}</text>
  6. <text v-else>全部</text>
  7. <u-icon name="arrow-right" color="#9DA8B5" size="30"></u-icon>
  8. <!-- <u-image class="filter-img" width="36rpx" height="36rpx" src="/static/filter.png"></u-image> -->
  9. </view>
  10. <!-- 总计 -->
  11. <view class="header-cont">
  12. 总计:回收重量1000.11kg,支出金额4500.00元
  13. </view>
  14. </view>
  15. <view class="list-cont">
  16. <view class="item-title">
  17. 详细记录
  18. </view>
  19. <view class="table">
  20. <view>日期</view>
  21. <view>重量(kg)</view>
  22. <view>金额(元)</view>
  23. </view>
  24. <scroll-view class="scroll-con" :scroll-top="scrollTop" scroll-y @scrolltolower="onreachBottom">
  25. <!-- 列表数据 -->
  26. <view class="table item" v-for="item in listdata">
  27. <view>2020-10-21</view>
  28. <view>100</view>
  29. <view>100</view>
  30. </view>
  31. <!-- <view class="cell-item" >
  32. <view class="cell-item-title" >
  33. <view>
  34. <text>{{item.createDate}}</text>
  35. </view>
  36. <view @click="intoPage(item)">
  37. <span class="view">查看详情</span>
  38. <u-icon name="arrow-right" color="#999999" size="28"></u-icon>
  39. </view>
  40. </view>
  41. </view> -->
  42. <view class="nodata" v-if="listdata.length==0 && status!='loading'">
  43. <u-empty :text="noDataText" mode="list"></u-empty>
  44. </view>
  45. <view class="loadmore">
  46. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  47. </view>
  48. </scroll-view>
  49. </view>
  50. <!-- 筛选弹框 -->
  51. <search-modal v-if="openScreen" :visible="openScreen" :defaultParams="searchForm" @refresh="refresh" @close="openScreen=false"></search-modal>
  52. </view>
  53. </template>
  54. <script>
  55. import searchModal from './searchModal.vue'
  56. import {recycleOrderReserve,recycleOrderReserveSum} from '@/api/index.js'
  57. import { checkLogin } from '@/api/login.js'
  58. import moment from 'moment'
  59. import getDate from '@/libs/getDate.js'
  60. export default {
  61. components: { searchModal },
  62. data() {
  63. return {
  64. listdata: [], // 列表数据
  65. pageNo: 1, // 当前页码
  66. pageSize: 10, // 每页条数
  67. total: 0, // 数据总条数
  68. noDataText: '暂无数据', // 列表请求状态提示语
  69. status: 'loadmore', // 加载中状态
  70. openScreen: false, // 是否打开筛选
  71. searchForm: { // 查询条件
  72. beginDate: getDate.getRecentday().starttime, // 创建时间默认筛选近7天
  73. endDate: getDate.getRecentday().endtime, // 创建时间默认筛选近7天
  74. },
  75. scrollTop: 0, // 滚动条位置
  76. }
  77. },
  78. onLoad() {
  79. this.searchHandle(1)
  80. this.getTotal()
  81. // 开启分享
  82. uni.showShareMenu({
  83. withShareTicket: true,
  84. menus: ['shareAppMessage', 'shareTimeline']
  85. })
  86. },
  87. onShow() {
  88. },
  89. methods: {
  90. // 打开查询弹窗
  91. openSearch(){
  92. if(this.hasLogin){
  93. this.openScreen = true
  94. }
  95. },
  96. // 获取查询参数 刷新列表
  97. refresh(params){
  98. this.searchForm = params
  99. this.listdata = []
  100. this.total = 0
  101. this.searchHandle(1)
  102. this.getTotal()
  103. },
  104. // 搜索查询
  105. searchHandle (pageNo) {
  106. this.status = "loading"
  107. this.pageNo = pageNo ? pageNo : this.pageNo
  108. recycleOrderReserve({
  109. pageNo: this.pageNo,
  110. pageSize: this.pageSize,
  111. beginDate: this.searchForm.beginDate?moment(this.searchForm.beginDate).format('YYYY-MM-DD 00:00:00'):'',
  112. endDate: this.searchForm.endDate ? moment(this.searchForm.endDate).format('YYYY-MM-DD 23:59:59'):'',
  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. getTotal(){
  144. this.titleStatus = true
  145. recycleOrderReserveSum({
  146. beginDate: this.searchForm.beginDate?moment(this.searchForm.beginDate).format('YYYY-MM-DD 00:00:00'):'',
  147. endDate: this.searchForm.endDate ? moment(this.searchForm.endDate).format('YYYY-MM-DD 23:59:59'):''}).then(res=>{
  148. if(res.status==200){
  149. const a = res.data.find(item=>item.rubbishType=='GATHER_BUILDING')
  150. const b = res.data.find(item=>item.rubbishType=='GATHER_OTHER')
  151. const c = res.data.find(item=>item.rubbishType=='GATHER_KITCHEN')
  152. this.jianzhuTotal= a ? (a.rubbishWeight/1000).toFixed(3)/1 : '0'
  153. this.chuyuTotal= c ? (c.rubbishWeight/1000).toFixed(3)/1 : '0'
  154. this.otherTotal= b ? (b.rubbishWeight/1000).toFixed(3)/1 : '0'
  155. }
  156. console.log(res)
  157. this.titleStatus = false
  158. })
  159. },
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .content {
  165. width: 100%;
  166. height: 100vh;
  167. display: flex;
  168. flex-direction: column;
  169. justify-content: center;
  170. align-items: center;
  171. padding: 0;
  172. .header{
  173. width: 100%;
  174. background-color: #FFFFFF;
  175. display: flex;
  176. flex-direction: column;
  177. margin-bottom: 20upx;
  178. font-size: 30rpx;
  179. color: #191919;
  180. view:first-child {
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. padding: 28rpx 32rpx;
  185. }
  186. .header-cont{
  187. background: rgba(255, 209, 0, 0.4);
  188. padding: 20rpx 32rpx;
  189. }
  190. .filter-img{
  191. padding: 10upx;
  192. }
  193. }
  194. .list-cont{
  195. flex: 1;
  196. width: 100%;
  197. -webkit-box-flex:1;
  198. -webkit-flex:1;
  199. -ms-flex:1;
  200. background-color: #fff;
  201. padding: 0 32rpx;
  202. .item-title{
  203. padding: 28rpx 0rpx;
  204. font-size: 34rpx;
  205. color: #191919;
  206. }
  207. .table{
  208. padding: 20rpx 0;
  209. display: flex;
  210. font-size: 28rpx;
  211. view{
  212. width: 33%;
  213. text-align: center;
  214. }
  215. }
  216. .item{
  217. border-bottom: 1px solid #E5E5E5;
  218. }
  219. }
  220. .scroll-con{
  221. flex: 1;
  222. width: 100%;
  223. -webkit-box-flex:1;
  224. -webkit-flex:1;
  225. -ms-flex:1;
  226. overflow: auto;
  227. .cell-item{
  228. width: 100%;
  229. background-color: #fff;
  230. border-radius: 15upx;
  231. // padding: 20upx;
  232. box-shadow: 0upx 3upx 6upx #eee;
  233. .cell-item-title{
  234. padding: 20upx 20upx 10upx;
  235. width: 100%;
  236. display: flex;
  237. justify-content: space-between;
  238. // border-bottom: 1px solid #e6e6e6;
  239. .view{
  240. color: #999999;
  241. margin-right: 12upx;
  242. }
  243. }
  244. .cell-item-cont{
  245. width: 100%;
  246. display: flex;
  247. justify-content: space-between;
  248. padding: 20upx;
  249. margin-bottom: 20upx;
  250. .cont-item{
  251. display: flex;
  252. flex-direction: column;
  253. align-items: center;
  254. width: 33%;
  255. // border-right: 1px solid #e6e6e6;
  256. :first-child {
  257. width: 120upx;
  258. height: 120upx;
  259. margin-bottom: 20upx;
  260. }
  261. }
  262. :last-child {
  263. border: none;
  264. }
  265. }
  266. }
  267. }
  268. .footer{
  269. z-index: 9999;
  270. // position: absolute;
  271. // bottom: 30upx;
  272. // margin: 20upx;
  273. width: 95%;
  274. height: 80upx;
  275. background-color: #0DC55F;
  276. opacity: 1;
  277. border-radius: 50upx;
  278. color: #fff;
  279. font-size: 30rpx;
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. }
  284. }
  285. </style>