From cc499362b6eba119792e113796e4da029a70fc6d Mon Sep 17 00:00:00 2001 From: queenwuli <942534046@qq.com> Date: Sun, 27 Dec 2020 14:59:26 +0800 Subject: [PATCH] 服务单接口联调 --- hive-app/pages/workbench/serviceOrderList.vue | 189 ++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 168 insertions(+), 21 deletions(-) diff --git a/hive-app/pages/workbench/serviceOrderList.vue b/hive-app/pages/workbench/serviceOrderList.vue index 2f098ae..192c81b 100644 --- a/hive-app/pages/workbench/serviceOrderList.vue +++ b/hive-app/pages/workbench/serviceOrderList.vue @@ -1,11 +1,13 @@ <template> <view> <view class="header"> - <search-bar class="mb-0" placeholder="输入会员姓名、手机号、订单号查询"></search-bar> + <search-bar @confirm="search" class="mb-0" placeholder="输入会员姓名、手机号、订单号查询"></search-bar> </view> <view> <h-tabs class="tab" + :activeIndex="orderStatus" + @tabClick="tabChange" :tabData="tabs" :config="{ color: '#abb1cc', @@ -17,42 +19,54 @@ }" /> <view class="list"> - <navigator url="./serviceOrderDetail" class="list-item" v-for="item in 4"> + <navigator :url="'./serviceOrderDetail?id='+item.id" class="list-item" v-for="item in list"> <view class="list-header"> - <text>订单号: N202012123556</text> - <text class="gray">2020-12-15 18:11</text> + <text>订单号: {{item.serviceNo}}</text> + <text class="gray">{{item.time}}</text> </view> <view class="list-content"> <view class="flex flex-v"> <view> <image src="../../static/images/order-icon1.png" class="icon"></image> - <text>李广</text> + <text>{{item.vipName}}</text> </view> <view class="flex mt-10"> <image src="../../static/images/order-icon2.png" class="icon" style="padding-top: 3px;"></image> <view> - <text>肽补水·无创水光管理</text> - <text class="block mt-5">肽补水·无创水光管理</text> + <text class="block" :class="index===0?'':'mt-5'" v-for="(op, index) in item.projs">{{op.projName}}</text> </view> </view> <view class="mt-10"> <image src="../../static/images/order-icon3.png" class="icon"></image> - <text>VIP-2(星海店)</text> + <text>{{item.bed || '-'}}</text> </view> </view> <view class="flex flex-v right"> - <text class="gray">90分钟</text> - <text class="gray mt-10">莉莉</text> - <text class="gray mt-5">雯雯</text> - <text class="blue mt-10">待付款</text> + <text class="gray mb-5">{{item.timeLength}}分钟</text> + <text class="gray mt-5" v-for="(op, index) in item.projs">{{op.beautyName || '-'}}</text> + <text class="mt-10" :class="item.status==7 || item.status==8?'gray':'blue'">{{item.status | formatStatus}}</text> </view> </view> - <view class="list-footer"> - <text class="white-btn small-btn">取消</text> - <text class="blue-btn small-btn ml-10">开始服务</text> + <view :class="isShowFooter(item.status, item.projs, item.staffId)?'list-footer':''"> + <text class="white-btn small-btn" + v-if="isShowCancelBtn(item.status, item.projs, item.staffId)" + @click.stop="cancelOrder(item.id)"> + 取消 + </text> + <text class="blue-btn small-btn ml-10" + v-if="isShowStartServiceBtn(item.status, item.projs)" + @click.stop="startService(item.id)"> + 开始服务 + </text> + <text class="blue-btn small-btn ml-10" + v-if="isShowEndServiceBtn(item.status, item.projs)" + @click.stop="endService(item.id)"> + 结束服务 + </text> </view> </navigator> + <no-record :isShow="!list.length" txt="暂无服务单记录"></no-record> </view> </view> </view> @@ -68,33 +82,166 @@ }, data() { return { + queryKey: '', + orderStatus: 0, tabs:[ { - state: 1, + state: 0, name: '全部' }, { - state: 2, + state: 1, name: '待预约' }, { - state: 3, + state: 2, name: '待配料' }, { - state: 4, + state: 3, name: '待服务' }, { - state: 5, + state: 4, name: '服务中' }, { - state: 6, + state: 5, name: '已完成' } ], + list: [], + userId: '' } + }, + onLoad(options) { + if(options.status){ + this.orderStatus = Number(options.status); + } + this.loadList(); + this.userId = this.$httpUtils.getRoleInfo().id; + }, + methods:{ + loadList(){ + this.$httpUtils.request('/api/serviceOrder/findServiceOrderList', { + pageNum: 1, + pageSize: 100, + queryKey: this.queryKey, + status: this.orderStatus + }, 'POST').then((res) => { + if(res.status == 200){ + this.list = res.rows; + } + }) + }, + // 是否显示操作按钮 + isShowFooter(status, items, staffId){ + return this.isShowCancelBtn(status, items, staffId) || + this.isShowStartServiceBtn(status, items) || + this.isShowEndServiceBtn(status, items) + }, + // 是否显示取消按钮 + 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; + }, + // 是否显示开始服务按钮 + isShowStartServiceBtn(status, items){ + // 只有美疗师本人才可以开始服务 + let isEnable = items.some((item) => item.id == this.userId) + return status == 4 && isEnable; + }, + // 是否显示结束服务按钮 + isShowEndServiceBtn(status, items){ + // 只有美疗师本人才可以开始服务 + let isEnable = items.some((item) => item.id == this.userId) + return status == 5 && isEnable; + }, + search(val){ + this.queryKey = val; + this.loadList(); + }, + tabChange(index){ + if(this.orderStatus === index){ + return; + } + this.orderStatus = index; + this.loadList(); + }, + // 取消订单 + cancelOrder(id){ + uni.showModal({ + title: '提示', + content: '确定取消服务吗?', + success: (res) => { + if (res.confirm) { + this.$httpUtils.request('/api/serviceOrder/cancelService/'+id).then((res) => { + if(res.status == 200){ + this.loadList() + } + this.$toast.info(res.info); + }) + } + } + }); + }, + //开始服务 + startService(id){ + uni.showModal({ + title: '提示', + content: '确定开始服务吗?', + success: (res) => { + if (res.confirm) { + this.$httpUtils.request('/api/serviceOrder/startService/'+id).then((res) => { + if(res.status == 200){ + this.loadList() + } + this.$toast.info(res.info); + }) + } + } + }); + }, + // 结束服务 + endService(id){ + uni.showModal({ + title: '提示', + content: '确定结束服务吗?', + success: (res) => { + if (res.confirm) { + this.$httpUtils.request('/api/serviceOrder/stopService/'+id).then((res) => { + if(res.status == 200){ + this.loadList() + } + this.$toast.info(res.info); + }) + } + } + }); + } + }, + filters:{ + // 状态 1-待预约 2-待派单 3-待配料 4-待服务 5-服务中 6-服务完成 7-服务单结束 8-服务单取消 + formatStatus(val){ + if(val==1){ + return '待预约' + } else if(val == 2){ + return '待派单' + } else if(val == 3){ + return '待配料' + } else if(val == 4){ + return '待服务' + } else if(val == 5){ + return '服务中' + } else if(val == 6){ + return '已完成' + } else if(val == 7){ + return '服务单结束' + } else { + return '已取消' + } + }, } } </script> -- Gitblit v1.9.1