From 1d1e327a1cbf8bd822078a9f71894f25ddcee437 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Mon, 11 Jan 2021 10:32:49 +0800
Subject: [PATCH] gx

---
 hive-app/pages/workbench/serviceOrderList.vue |   54 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/hive-app/pages/workbench/serviceOrderList.vue b/hive-app/pages/workbench/serviceOrderList.vue
index aaec120..20a2941 100644
--- a/hive-app/pages/workbench/serviceOrderList.vue
+++ b/hive-app/pages/workbench/serviceOrderList.vue
@@ -72,6 +72,9 @@
 					</view>
 				</navigator>
 				<no-record :isShow="!list.length" txt="暂无服务单记录"></no-record>
+				<view v-if="list.length">
+					<uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
+				</view>
 			</view>
 		</view>
 	</view>
@@ -80,10 +83,12 @@
 <script>
 	import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
 	import searchBar from '../../components/searchBar/index.vue';
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 	export default {
 		components: {
 		    HTabs,
-			searchBar
+			searchBar,
+			uniLoadMore
 		},
 		data() {
 		  return {
@@ -120,7 +125,9 @@
 				}
 			],
 			list: [],
-			userId: ''
+			userId: '',
+			loadStatus: 'more',
+			pageNum: 1
 		  }  
 		},
 		onLoad(options) {
@@ -139,6 +146,17 @@
 			}
 			// #endif
 		},
+		onPullDownRefresh(){
+			this.reloadData();
+			let timer = setTimeout(function () {
+				uni.startPullDownRefresh();
+				clearTimeout(timer);
+				timer = null;
+			}, 800);
+		},
+		onReachBottom(){
+			this.loadList()
+		},
 		onNavigationBarButtonTap(Object){
 			if(Object.key === 'add'){
 				uni.navigateTo({
@@ -147,15 +165,31 @@
 			}
 		},
 		methods:{
+			reloadData(){
+				this.list = [];
+				this.pageNum = 1;
+				this.loadStatus = 'more';
+				this.loadList();
+			},
 			loadList(){
+				if(this.loadStatus!=='more'){
+					return;
+				}
 				this.$httpUtils.request('/api/serviceOrder/findServiceOrderList', {
-					pageNum: 1,
-					pageSize: 100,
+					pageNum: this.pageNum,
+					pageSize: 10,
 					queryKey: this.queryKey,
 					status: this.orderStatus
 				}, 'POST').then((res) => {
 					if(res.status == 200){
-						this.list = res.rows;
+						let result = res.rows;
+						if(result.length < 10){
+							this.loadStatus = 'noMore';
+						} else {
+							this.pageNum ++ ;
+							this.loadStatus = 'more';
+						}
+						this.list = this.list.concat(result);
 					}
 				})
 			},
@@ -190,14 +224,14 @@
 			},
 			search(val){
 				this.queryKey = val;
-				this.loadList();
+				this.reloadData();
 			},
 			tabChange(index){
 				if(this.orderStatus === index){
 					return;
 				}
 				this.orderStatus = index;
-				this.loadList();
+				this.reloadData();
 			},
 			// 取消订单
 			cancelOrder(id){
@@ -208,7 +242,7 @@
 				        if (res.confirm) {
 							this.$httpUtils.request('/api/serviceOrder/cancelService/'+id).then((res) => {
 								if(res.status == 200){
-									this.loadList()
+									this.reloadData()
 								}
 								this.$toast.info(res.info);
 							})
@@ -225,7 +259,7 @@
 				        if (res.confirm) {
 							this.$httpUtils.request('/api/serviceOrder/startService/'+id).then((res) => {
 								if(res.status == 200){
-									this.loadList()
+									this.reloadData()
 								}
 								this.$toast.info(res.info);
 							})
@@ -242,7 +276,7 @@
 				        if (res.confirm) {
 							this.$httpUtils.request('/api/serviceOrder/stopService/'+id).then((res) => {
 								if(res.status == 200){
-									this.loadList()
+									this.reloadData()
 								}
 								this.$toast.info(res.info);
 							})

--
Gitblit v1.9.1