list.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view class="content">
  3. <view class="topbar" v-show="isIphone">
  4. </view>
  5. <view class="status_bar">
  6. <view class="left2" @click="goBack"><u-icon name="arrow-left"></u-icon>返回</view>
  7. <span style="font-size: 36rpx;">医废验收</span>
  8. <view class="right2">
  9. <span>
  10. <u-icon style="margin-right: 10px;" name="scan" color="#fff" size="35rpx"></u-icon>
  11. </span>
  12. <span @click="filterShow = true">筛选</span>
  13. </view>
  14. </view>
  15. <view class="status_tabs">
  16. <u-tabs bg-color="#5976ba" active-color="#fff" inactive-color="#fff" :list="tabList" :is-scroll="false"
  17. :current="current" @change="tabChange"></u-tabs>
  18. </view>
  19. <view class="search_bar">
  20. <u-search @custom="clearSearch" @search="onRefresh" action-text="清除" placeholder="请输入收集姓名查询"
  21. v-model="keyword">
  22. </u-search>
  23. </view>
  24. <scroll-view id="editorBox" @scroll="scroll" :style="{paddingBottom: '10px'}" scroll-y
  25. class="scroll-box mainCont" @scrolltolower="handleLoadMore" :refresher-enabled="scroll_refresher_enabled"
  26. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white"
  27. @refresherrefresh="onRefresh" @refresherrestore="onRestore">
  28. <view class="card" :id="'editor' + index" @click="goInfo(item.id)" v-for="(item, index) in tableList"
  29. :key="index">
  30. <view class="top">
  31. <view class="left">{{ item.batchName }}</view>
  32. <view class="right" v-show="current == 0" style="color: #1890FF">待验收</view>
  33. <view class="right" v-show="current == 1" style="color: #CCCCCC">已完成</view>
  34. </view>
  35. <view class="bottom">
  36. <view>重&emsp;&emsp;量:{{ item.checkWeight }}
  37. <span v-show="item.errorStatus == 2" style="color: #FF0000;float: right">待处理</span>
  38. <span v-show="item.errorStatus == 1" style="color: #00CC00;float: right">已处理</span>
  39. </view>
  40. <view>收&ensp;集&ensp;人:{{ item.checkUserName }}<span
  41. style="float: right">{{ item.collectDate }}</span></view>
  42. <view class="bButton" v-show="current == 0">
  43. <span @click.stop="doCollect()">验收</span>
  44. </view>
  45. </view>
  46. </view>
  47. <view style="margin-top: 100px;text-align: center;" v-show="!tableList.length">暂无数据</view>
  48. </scroll-view>
  49. <u-picker :default-time="time" @confirm="fliterConfirm" @cancel="fliterCancel" mode="time" v-model="filterShow"
  50. :params="params">
  51. </u-picker>
  52. <u-toast ref="uToast" />
  53. </view>
  54. </template>
  55. <script>
  56. const NET = require('@/utils/request')
  57. const API = require('@/config/api')
  58. export default {
  59. data() {
  60. return {
  61. current: 0,
  62. tabList: [{
  63. name: '待验收'
  64. }, {
  65. name: '已完成'
  66. }],
  67. scroll_refresher_enabled: true,
  68. triggered: false,
  69. keyword: "",
  70. isOver: false,
  71. loading: false,
  72. loading1: false,
  73. pageIndex: 1,
  74. tableList: [],
  75. filterShow: false,
  76. isIphone: false,
  77. params: {
  78. year: true,
  79. month: true,
  80. day: true,
  81. hour: false,
  82. minute: false,
  83. second: false
  84. },
  85. time: "",
  86. }
  87. },
  88. onShow() {
  89. console.log('showaaaaaaaa')
  90. let date = new Date;
  91. //获取年份
  92. let yy = date.getFullYear();
  93. //获取月份
  94. let mm = date.getMonth() + 1;
  95. //如果月份小于10 前面加0
  96. mm = (mm < 10 ? "0" + mm : mm);
  97. let dd = date.getDate();
  98. dd = (dd < 10 ? "0" + dd : dd);
  99. //返回日期
  100. this.time = `${yy}-${mm}-${dd}`
  101. this.onRefresh()
  102. },
  103. onLoad() {
  104. uni.getSystemInfo({
  105. success: (res) => {
  106. console.log(res)
  107. if (res.model == 'iPhone') {
  108. this.isIphone = true;
  109. }
  110. },
  111. fail: (err) => {
  112. console.log(err)
  113. }
  114. })
  115. this.onRefresh()
  116. },
  117. onReady() {
  118. if (this.isIphone) {
  119. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  120. 0].clientHeight - 25 + 'px'
  121. }
  122. },
  123. methods: {
  124. goBack() {
  125. try {
  126. EbeiPlugins.onBackKeyDown();
  127. } catch (error) {}
  128. },
  129. tabChange(index) {
  130. this.current = index;
  131. this.onRefresh()
  132. },
  133. clearSearch() {
  134. this.keyword = "";
  135. },
  136. getNum() {
  137. if (this.loading1) {
  138. return false;
  139. }
  140. this.loading1 = true;
  141. let postData = {
  142. date: this.time,
  143. name: this.keyword,
  144. }
  145. NET.request(API.queryBatchStatus, postData).then(res => {
  146. this.loading1 = false;
  147. this.tabList[0].name = `待验收(${res.data.notCheck})`
  148. this.tabList[1].name = `已完成(${res.data.finished})`
  149. }).catch(error => {
  150. this.$refs.uToast.show({
  151. title: error.msg,
  152. type: 'warning',
  153. })
  154. })
  155. },
  156. getTableList() {
  157. if (this.loading || this.isOver) {
  158. return false;
  159. }
  160. this.loading = true;
  161. let postData = {
  162. // date: '2021-06-24',
  163. date: this.time,
  164. pageIndex: this.pageIndex,
  165. pageSize: 10,
  166. type: this.current + 2,
  167. name: this.keyword,
  168. }
  169. NET.request(API.queryBatchByPage, postData).then(res => {
  170. this.loading = false;
  171. this.triggered = false;
  172. if (res.data.records.length < 10) {
  173. this.isOver = true
  174. }
  175. for (let i in res.data.records) {
  176. this.tableList.push(res.data.records[i])
  177. }
  178. }).catch(error => {
  179. this.$refs.uToast.show({
  180. title: error.msg,
  181. type: 'warning',
  182. })
  183. })
  184. },
  185. scroll(e) {
  186. console.log(e)
  187. if (e.detail.scrollTop < 100) {
  188. this.scroll_refresher_enabled = true
  189. } else {
  190. this.scroll_refresher_enabled = false
  191. }
  192. },
  193. // 下拉刷新
  194. onRefresh() {
  195. this.triggered = true
  196. this.isOver = false
  197. this.pageIndex = 1
  198. this.tableList = []
  199. this.getTableList()
  200. this.getNum()
  201. },
  202. // 重置下拉刷新状态
  203. onRestore() {
  204. this.triggered = 'restore'
  205. this.triggered = false
  206. },
  207. //获取更多数据
  208. handleLoadMore() {
  209. if (this.isOver) {
  210. } else if (this.loading) {
  211. } else {
  212. this.pageIndex++;
  213. this.getTableList()
  214. }
  215. },
  216. fliterConfirm(val) {
  217. let time = `${val.year}-${val.month}-${val.day}`
  218. console.log(time)
  219. this.time = time
  220. this.onRefresh()
  221. },
  222. filterCancel(val) {
  223. console.log(val)
  224. },
  225. doCollect() {},
  226. goInfo(id) {
  227. uni.navigateTo({
  228. url: `/wasteCheck/batchInfo?id=${id}`
  229. });
  230. },
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. .search_bar {
  236. padding: 0 10px;
  237. height: 100rpx;
  238. background: #fff;
  239. line-height: 100rpx;
  240. }
  241. .mainCont {
  242. height: calc(100vh - 80rpx - 80rpx - 100rpx);
  243. padding: 10px 0 10px 0;
  244. box-sizing: border-box;
  245. }
  246. .pcTop {
  247. width: calc(100% - 20px);
  248. padding: 0 10px;
  249. height: 20px;
  250. line-height: 20px;
  251. margin: 0 auto;
  252. margin-bottom: 10px;
  253. position: relative;
  254. &:after {
  255. content: '';
  256. position: absolute;
  257. height: 20px;
  258. top: 0;
  259. left: 0;
  260. width: 2px;
  261. background-color: #6aa0f7;
  262. }
  263. }
  264. .bottomButtons {
  265. box-shadow: 0px -5px 5px #d0cece;
  266. position: fixed;
  267. display: flex;
  268. justify-content: space-between;
  269. width: 100%;
  270. height: 40px;
  271. line-height: 40px;
  272. bottom: 0;
  273. left: 0;
  274. view {
  275. width: 50%;
  276. height: 40px;
  277. line-height: 40px;
  278. text-align: center;
  279. }
  280. }
  281. .filterCont {
  282. height: calc(100% - 80rpx);
  283. display: flex;
  284. justify-content: space-between;
  285. .left {
  286. height: 100%;
  287. overflow-y: auto;
  288. width: 35%;
  289. background-color: #fafafa;
  290. view {
  291. height: 40px;
  292. line-height: 40px;
  293. text-align: center;
  294. &.active {
  295. background-color: #fff;
  296. }
  297. }
  298. }
  299. .right {
  300. height: 100%;
  301. overflow-y: auto;
  302. width: 65%;
  303. view {
  304. width: calc(100% - 20px);
  305. margin: 0 auto;
  306. padding: 0 20px;
  307. height: 39px;
  308. line-height: 39px;
  309. border-bottom: 1px solid #f2f2f2;
  310. }
  311. }
  312. }
  313. /deep/ .uni-scroll-view-refresher {
  314. background-color: #f5f5f9 !important;
  315. }
  316. </style>