From 5227ce05a36d16fc32691b73e4d75c8aee9cea51 Mon Sep 17 00:00:00 2001
From: li-guang <153605324@qq.com>
Date: Mon, 11 Jan 2021 16:46:37 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/jyyforjava/hive-app

---
 hive-app/pages/workbench/serviceOrderList.vue |   81 +++++++++++++++++++++++++++++++++-------
 1 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/hive-app/pages/workbench/serviceOrderList.vue b/hive-app/pages/workbench/serviceOrderList.vue
index 2ab8b80..20a2941 100644
--- a/hive-app/pages/workbench/serviceOrderList.vue
+++ b/hive-app/pages/workbench/serviceOrderList.vue
@@ -54,6 +54,11 @@
 							@click.stop="cancelOrder(item.id)">
 							取消
 						</text>
+						<text class="blue-btn small-btn ml-10"
+							v-if="isShowOrder(item.status)"
+							@click.stop="">
+							确认预约
+						</text>
 						<text class="blue-btn small-btn ml-10" 
 							v-if="isShowStartServiceBtn(item.status, item.projs)"
 							@click.stop="startService(item.id)">
@@ -67,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>
@@ -75,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 {
@@ -115,7 +125,9 @@
 				}
 			],
 			list: [],
-			userId: ''
+			userId: '',
+			loadStatus: 'more',
+			pageNum: 1
 		  }  
 		},
 		onLoad(options) {
@@ -124,6 +136,26 @@
 			}
 			this.loadList();
 			this.userId = this.$httpUtils.getRoleInfo().id;
+			// 判断权限
+			// #ifdef APP-PLUS
+			if(!this.$utils.hasPermission('fwdgl.add')){
+				let webView = this.$mp.page.$getAppWebview();
+				webView.setTitleNViewButtonStyle(0, {
+				    width: 0,  
+				});
+			}
+			// #endif
+		},
+		onPullDownRefresh(){
+			this.reloadData();
+			let timer = setTimeout(function () {
+				uni.startPullDownRefresh();
+				clearTimeout(timer);
+				timer = null;
+			}, 800);
+		},
+		onReachBottom(){
+			this.loadList()
 		},
 		onNavigationBarButtonTap(Object){
 			if(Object.key === 'add'){
@@ -133,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);
 					}
 				})
 			},
@@ -149,36 +197,41 @@
 			isShowFooter(status, items, staffId){
 				return this.isShowCancelBtn(status, items, staffId) ||
 					this.isShowStartServiceBtn(status, items) ||
-					this.isShowEndServiceBtn(status, items)
+					this.isShowEndServiceBtn(status, items) ||
+					this.isShowOrder(status)
 			},
 			// 是否显示取消按钮
 			isShowCancelBtn(status, items, staffId){
 				// 美疗师和下单顾问可以取消服务
 				let isEnable = (items.some((item) => item.id == this.userId)) || (this.userId == staffId);
-				return status != 5 && status != 6 && status != 7 && status != 8 && isEnable;
+				return status != 5 && status != 6 && status != 7 && status != 8 && isEnable && this.$utils.hasPermission('fwdgl.cancel');
+			},
+			// 是否显示确认预约
+			isShowOrder(status){
+				return status == 1 && this.$utils.hasPermission('fwdgl.qryy');
 			},
 			// 是否显示开始服务按钮
 			isShowStartServiceBtn(status, items){
 				// 只有美疗师本人才可以开始服务
 				let isEnable = items.some((item) => item.id == this.userId)
-				return status == 4 && isEnable;
+				return status == 4 && isEnable && this.$utils.hasPermission('fwdgl.begin');
 			},
 			// 是否显示结束服务按钮
 			isShowEndServiceBtn(status, items){
 				// 只有美疗师本人才可以开始服务
 				let isEnable = items.some((item) => item.id == this.userId)
-				return status == 5 && isEnable;
+				return status == 5 && isEnable && this.$utils.hasPermission('fwdgl.end');
 			},
 			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){
@@ -189,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);
 							})
@@ -206,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);
 							})
@@ -223,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