From 1993c97a543c37890c99d9bc21b7c6a86e1e8fa0 Mon Sep 17 00:00:00 2001 From: luoyu Date: Fri, 13 Jun 2025 16:08:45 +0800 Subject: [PATCH] =?UTF-8?q?20250613-=E9=A2=84=E7=BA=A6=E5=90=8E=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meetingRoom/meetingStaff/meetingStaff.js | 36 +++++ .../reservationRecord/approve/approve.js | 146 +++++++++++++----- .../reservationRecord/approve/approve.wxml | 5 +- .../reservationRecord/approve/approve.wxss | 14 ++ 4 files changed, 158 insertions(+), 43 deletions(-) diff --git a/miniprogram/pages/meeting/meetingRoom/meetingStaff/meetingStaff.js b/miniprogram/pages/meeting/meetingRoom/meetingStaff/meetingStaff.js index 4e215f8..cf76b34 100644 --- a/miniprogram/pages/meeting/meetingRoom/meetingStaff/meetingStaff.js +++ b/miniprogram/pages/meeting/meetingRoom/meetingStaff/meetingStaff.js @@ -66,11 +66,15 @@ Page({ console.log('会务人员:', resStaff) let musicList = [] let serveList = [] + let hasMusicStaff = false + let hasServiceStaff = false + for (let key in resStaff.voiceWaiter) { let eachObj = resStaff.voiceWaiter[key] let isSel = false if (staffIdArr.includes(eachObj.id)) { isSel = true + hasMusicStaff = true } musicList.push({ id: eachObj.id, @@ -83,6 +87,7 @@ Page({ let isSel = false if (staffIdArr.includes(eachObj.id)) { isSel = true + hasServiceStaff = true } serveList.push({ id: eachObj.id, @@ -90,6 +95,13 @@ Page({ isSelect: isSel }) } + + // 保存初始状态到本地存储 + wx.setStorageSync('staffStatus_' + _this.data.rId, { + hasMusicStaff, + hasServiceStaff + }); + _this.setData({ staffServeList: serveList, staffMusicList: musicList @@ -138,8 +150,11 @@ Page({ let staffMusicList = _this.data.staffMusicList let staffServeList = _this.data.staffServeList let musicId = '' + // 检查音控组是否有选择 + let hasMusicStaff = false for (let key in staffMusicList) { if (staffMusicList[key].isSelect) { + hasMusicStaff = true musicId += staffMusicList[key].id + ',' } } @@ -148,8 +163,11 @@ Page({ musicId = musicId.substring(0, musicId.length - 1) } let serveId = '' + // 检查会务服务组是否有选择 + let hasServiceStaff = false for (let key in staffServeList) { if (staffServeList[key].isSelect) { + hasServiceStaff = true serveId += staffServeList[key].id + ',' } } @@ -157,6 +175,13 @@ Page({ // 去掉最后一个, serveId = serveId.substring(0, serveId.length - 1) } + + // 保存选择状态到本地存储 + wx.setStorageSync('staffStatus_' + _this.data.rId, { + hasMusicStaff, + hasServiceStaff + }); + addStaff({ id: _this.data.rId, voiceWaiter: musicId, @@ -166,6 +191,17 @@ Page({ type: 'success', message: '分配成功!' }) + + // 获取页面栈 + let pages = getCurrentPages() + // 获取上一页实例 + let prevPage = pages[pages.length - 2] + // 设置上一页的dataChange为true,触发刷新 + prevPage.setData({ + dataChange: true + }) + + // 返回上一页 wx.navigateBack() }) diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.js b/miniprogram/pages/meeting/reservationRecord/approve/approve.js index 5934cbb..f591ae6 100644 --- a/miniprogram/pages/meeting/reservationRecord/approve/approve.js +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.js @@ -444,6 +444,47 @@ Page({ showCancel = true showEdit = true showStaff = true + + // 根据会务负责人选择状态设置按钮颜色和提示 + try { + // 从本地存储获取会务负责人选择状态 + let staffStatus = wx.getStorageSync('staffStatus_' + item.id); + if (staffStatus) { + // 判断音控组和会务服务组选择状态 + const hasMusicStaff = staffStatus.hasMusicStaff; + const hasServiceStaff = staffStatus.hasServiceStaff; + + if (hasMusicStaff && hasServiceStaff) { + // 音控组和会务服务组都有选择 + item.staffBtnType = ''; + item.staffTip = ''; + // 绿色样式标记 + item.isStaffComplete = true; + } else if (!hasMusicStaff && !hasServiceStaff) { + // 音控组和会务服务组都没有选择 + item.staffBtnType = 'danger'; + item.staffTip = '请选择音控组和会务服务组'; + item.isStaffComplete = false; + } else if (hasMusicStaff && !hasServiceStaff) { + // 只选择了音控组 + item.staffBtnType = 'warning'; + item.staffTip = '请选择会务服务组'; + item.isStaffComplete = false; + } else if (!hasMusicStaff && hasServiceStaff) { + // 只选择了会务服务组 + item.staffBtnType = 'warning'; + item.staffTip = '请选择音控组'; + item.isStaffComplete = false; + } + } else { + // 默认状态:黄色按钮(与取消预约按钮一致),提示选择两个组 + item.staffBtnType = 'warning'; + item.staffTip = '请选择音控组和会务服务组'; + item.isStaffComplete = false; + } + } catch (error) { + console.error('获取会务负责人状态失败', error); + } } } if (statusValue == 9) { @@ -500,6 +541,41 @@ Page({ url: "/pages/meeting/meetingRoom/meetingStaff/meetingStaff?rId=" + id, }) }, + + /** + * 生命周期函数--监听页面显示 + * 添加刷新会务负责人状态按钮显示逻辑 + */ + onShow() { + let _this = this; + + // 每次页面显示时检查用户角色是否有变化 + let currentUserData = wx.getStorageSync('user'); + let userRoleChanged = false; + + // 检查用户角色是否发生变化 + if(_this.data.userData && currentUserData && _this.data.userData.roomRole !== currentUserData.roomRole) { + userRoleChanged = true; + // 更新用户数据 + _this.setData({ + userData: currentUserData + }); + console.log('用户角色已变更,重新加载数据'); + } + + // 数据是否变化或用户角色变化 + if (_this.data.dataChange || userRoleChanged) { + // 刷新数据 + _this.setData({ + dataChange: false, + // 预约记录参数 + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + }) + _this.getDataList() + } + }, // 取消预约一系列方法 cancelConfirm(e) { console.log('cancelConfirm', e); @@ -673,18 +749,38 @@ Page({ }).then(res => { console.log('passOrder', res) if (res.code == 0) { - // 刷新预约数据 - _this.setData({ - reservationPageNum: 1, - reservationDataList: [], - reservationIsDataAll: false, - showRejectReason: false - }) + // 通知成功 Notify({ type: 'success', message: '已通过该申请!' }) - _this.getDataList() + + // 先提示用户选择会务负责人,再刷新数据 + wx.showModal({ + title: '会务负责人', + content: '请选择会议的音控组和会务服务组负责人', + confirmText: '去选择', + cancelText: '我知道了', + success(res) { + if (res.confirm) { + // 点击"去选择",跳转到会务负责人页面 + wx.navigateTo({ + url: "/pages/meeting/meetingRoom/meetingStaff/meetingStaff?rId=" + id, + }) + } else { + // 点击"我知道了",只刷新数据 + console.log('用户选择稍后设置会务负责人') + // 刷新预约数据 + _this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + showRejectReason: false + }) + _this.getDataList() + } + } + }) } else { // 危险通知 Notify({ @@ -772,39 +868,7 @@ Page({ }, - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - let _this = this; - - // 每次页面显示时检查用户角色是否有变化 - let currentUserData = wx.getStorageSync('user'); - let userRoleChanged = false; - - // 检查用户角色是否发生变化 - if(_this.data.userData && currentUserData && _this.data.userData.roomRole !== currentUserData.roomRole) { - userRoleChanged = true; - // 更新用户数据 - _this.setData({ - userData: currentUserData - }); - console.log('用户角色已变更,重新加载数据'); - } - - // 数据是否变化或用户角色变化 - if (_this.data.dataChange || userRoleChanged) { - // 刷新数据 - _this.setData({ - dataChange: false, - // 预约记录参数 - reservationPageNum: 1, - reservationDataList: [], - reservationIsDataAll: false, - }) - _this.getDataList() - } - }, + /** * 生命周期函数--监听页面隐藏 diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml index 0233a45..453c26e 100644 --- a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml @@ -29,6 +29,7 @@ 取消原因:{{item.operate[item.operate.length - 1].content}} 驳回原因:{{item.operate[item.operate.length - 1].content}} + {{item.staffTip}} 取消预约 修改信息 - 会务负责人 - 通过 + 会务负责人 + 通过 驳回 diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss index 4b5a80d..647a829 100644 --- a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss @@ -150,4 +150,18 @@ .loadAllLine { margin-top: 80rpx; +} + +.staff-tip { + color: #ff4d4f; + font-size: 28rpx; + margin: 10rpx 0; + text-align: right; + font-weight: bold; +} + +/* 通过按钮绿色样式 */ +.approve-btn-success { + color: #07c160 !important; + border-color: #07c160 !important; } \ No newline at end of file