From 45fb4b11ad51bb38306765b11a6747402e382cee Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Sat, 20 Feb 2021 17:37:33 +0800 Subject: [PATCH] fix --- hive-app/pages/workbench/serviceOrderList.vue | 92 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 75 insertions(+), 17 deletions(-) diff --git a/hive-app/pages/workbench/serviceOrderList.vue b/hive-app/pages/workbench/serviceOrderList.vue index aaec120..01e1fbe 100644 --- a/hive-app/pages/workbench/serviceOrderList.vue +++ b/hive-app/pages/workbench/serviceOrderList.vue @@ -56,7 +56,7 @@ </text> <text class="blue-btn small-btn ml-10" v-if="isShowOrder(item.status)" - @click.stop=""> + @click.stop="confirmServiceOrder(item.id)"> 确认预约 </text> <text class="blue-btn small-btn ml-10" @@ -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 { @@ -99,33 +104,38 @@ name: '待确认' }, { - state: 8, + state: 2, name: '待排班' }, { - state: 2, + state: 3, name: '待配料' }, { - state: 3, + state: 4, name: '待服务' }, { - state: 4, + state: 5, name: '服务中' }, { - state: 5, + state: 6, name: '已完成' } ], list: [], - userId: '' + userId: '', + loadStatus: 'more', + pageNum: 1 } }, onLoad(options) { if(options.status){ this.orderStatus = Number(options.status); + } + if(options.queryKey){ + this.queryKey = options.queryKey; } this.loadList(); this.userId = this.$httpUtils.getRoleInfo().id; @@ -139,6 +149,17 @@ } // #endif }, + onPullDownRefresh(){ + this.reloadData(); + let timer = setTimeout(function () { + uni.stopPullDownRefresh(); + clearTimeout(timer); + timer = null; + }, 800); + }, + onReachBottom(){ + this.loadList() + }, onNavigationBarButtonTap(Object){ if(Object.key === 'add'){ uni.navigateTo({ @@ -147,15 +168,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); } }) }, @@ -174,7 +211,7 @@ }, // 是否显示确认预约 isShowOrder(status){ - return status == 1 && this.$utils.hasPermission('fwdgl.qryy'); + return status == 9 && this.$utils.hasPermission('fwdgl.qryy'); }, // 是否显示开始服务按钮 isShowStartServiceBtn(status, items){ @@ -190,14 +227,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 +245,26 @@ 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); + }) + } + } + }); + }, + // 确认预约 + confirmServiceOrder(id){ + uni.showModal({ + title: '提示', + content: '确认预约吗?', + success: (res) => { + if (res.confirm) { + this.$httpUtils.request('/api/serviceOrder/confirmServiceOrder', { + id:id + }, 'POST').then((res) => { + if(res.status == 200){ + this.reloadData() } this.$toast.info(res.info); }) @@ -225,7 +281,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 +298,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); }) @@ -268,6 +324,8 @@ return '已完成' } else if(val == 7){ return '服务单结束' + } else if(val == 9){ + return '待确认' } else { return '已取消' } -- Gitblit v1.9.1