diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.js b/miniprogram/pages/meeting/reservationRecord/approve/approve.js
index 873217d..af8c7db 100644
--- a/miniprogram/pages/meeting/reservationRecord/approve/approve.js
+++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.js
@@ -159,6 +159,16 @@ Page({
reservationIsDataAll: false,
['search.status.value']: e.detail
})
+
+ // 更新状态文本
+ const statusOption = this.data.search.status.option;
+ const selectedOption = statusOption.find(option => option.value === e.detail);
+ if (selectedOption) {
+ this.setData({
+ ['search.status.text']: selectedOption.text
+ });
+ }
+
this.getDataList()
},
changeSearchSort(e) {
@@ -169,6 +179,16 @@ Page({
reservationIsDataAll: false,
['search.sort.value']: e.detail
})
+
+ // 更新排序文本
+ const sortOption = this.data.search.sort.option;
+ const selectedOption = sortOption.find(option => option.value === e.detail);
+ if (selectedOption) {
+ this.setData({
+ ['search.sort.text']: selectedOption.text
+ });
+ }
+
this.getDataList()
},
/**
@@ -206,14 +226,7 @@ Page({
_this.setData({
userData: userDetail
})
- // 获取数据
- let userId = _this.data.userData.id
- // 获取预约数据
- _this.getReservationData({
- userId,
- pageNum: _this.data.reservationPageNum,
- pageSize: _this.data.reservationPageSize,
- })
+
// 获取两周后时间,默认只能选两周之后,管理员可以选一年后的
const today = new Date()
const newDate = new Date(today)
@@ -225,6 +238,9 @@ Page({
_this.setData({
maxDate: newDate.getTime()
})
+
+ // 获取数据
+ _this.getDataList()
},
// 获取数据
@@ -267,8 +283,9 @@ Page({
role: _this.data.userData.roomRole, // 按不同角色去查询预约记录。1.普通用户, 3.会议服务人员 ,5.会议管理员
pageNum,
pageSize,
+ userId: _this.data.userData.id, // 确保传递用户ID
title: _this.data.search.title.value,
- status: _this.data.search.status.value,
+ status: _this.data.search.status.value === '' ? null : _this.data.search.status.value,
sort: _this.data.search.sort.value, // 排序
}).then(res => {
console.log('selectReservationListByUserIdRq', res);
@@ -332,6 +349,9 @@ Page({
// 格式化数据
formartData(queryDataList) {
// 格式化数据
+ let _this = this;
+ let userRole = _this.data.userData.roomRole; // 获取用户角色
+
return queryDataList.map(item => {
let isNowDay = false
let nowDate = selfFormatTimeYMD(getNowDate())
@@ -352,6 +372,7 @@ Page({
let showApprove = false // 显示审批操作
let statusName = ''
// 预约状态,1 取消 3 驳回 4 占用 5 待审核 7 审核通过,待开始 9 进行中 11已结束
+
if (statusValue == 1) {
// 取消
// 状态字体颜色
@@ -361,37 +382,43 @@ Page({
if (statusValue == 3) {
// 驳回,可以修改
statusColor = "#333333"
- // showCancel = true
- // showEdit = true
statusName = '已驳回'
}
if (statusValue == 4) {
- // 占用,可以修改
- showEdit = true
- showCancel = true
- // showStaff = true
+ // 占用,仅管理员可以修改
statusName = '已占用'
+ if (userRole == 5) { // 只有管理员可以编辑和取消占用
+ showEdit = true
+ showCancel = true
+ }
}
if (statusValue == 5) {
- // 待审核,普通用户只能取消,管理员可以修改
- showEdit = true
- // showCancel = true
- showApprove = true
- // showStaff = true
+ // 待审核,管理员可以审批
statusName = '待审核'
+ if (userRole == 5) { // 只有管理员可以编辑和审批
+ showEdit = true
+ showApprove = true
+ }
}
if (statusValue == 7) {
// 审核通过,管理员可修改
- showCancel = true
- showStaff = true
- showEdit = true
statusName = '待开始'
+ if (userRole == 5) { // 只有管理员可以取消、编辑和分配会务人员
+ showCancel = true
+ showEdit = true
+ showStaff = true
+ }
+ }
+ if (statusValue == 9) {
+ // 进行中
+ statusName = '进行中'
}
if (statusValue == 11) {
// 已结束
statusColor = "#333333"
statusName = '已结束'
}
+
// 赋值
item.showCancel = showCancel
item.showEdit = showEdit
diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml
index 6419ac7..1d4698e 100644
--- a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml
+++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml
@@ -10,8 +10,8 @@
-
-
+
+
@@ -28,8 +28,8 @@
- 取消原因:{{item.operate[item.operate.length - 1].content}}
- 驳回原因:{{item.operate[item.operate.length - 1].content}}
+ 取消原因:{{item.operate[item.operate.length - 1].content}}
+ 驳回原因:{{item.operate[item.operate.length - 1].content}}
-
-
-
+
+
@@ -80,17 +80,12 @@
- 取消原因:{{item.operate[item.operate.length - 1].content}}
+ 取消原因:{{item.operate[item.operate.length - 1].content}}
+ 驳回原因:{{item.operate[item.operate.length - 1].content}}
-
取消预约
修改信息
-
-
diff --git a/miniprogram/pages/meeting/reservationRecord/service/service.js b/miniprogram/pages/meeting/reservationRecord/service/service.js
index 534b6d2..52e7e7f 100644
--- a/miniprogram/pages/meeting/reservationRecord/service/service.js
+++ b/miniprogram/pages/meeting/reservationRecord/service/service.js
@@ -5,7 +5,9 @@ import Notify from '@vant/weapp/notify/notify';
import {
selfFormatTimeYMD,
- selfFormatTimeHM
+ selfFormatTimeHM,
+ getWeekday,
+ getNowDate
} from "../../../../utils/util.js"
import {
@@ -36,6 +38,7 @@ Page({
value: ''
},
status: {
+ text: '待开始',
value: 7,
option: [{
text: '全部会议',
@@ -80,6 +83,16 @@ Page({
reservationIsDataAll: false,
['search.status.value']: e.detail
})
+
+ // 更新状态文本
+ const statusOption = this.data.search.status.option;
+ const selectedOption = statusOption.find(option => option.value === e.detail);
+ if (selectedOption) {
+ this.setData({
+ ['search.status.text']: selectedOption.text
+ });
+ }
+
this.getDataList()
},
/**
@@ -87,17 +100,34 @@ Page({
*/
onLoad(options) {
let _this = this;
+ let userDetail = wx.getStorageSync('user')
+
+ // 检查是否有URL参数指定状态
+ if (options && options.status) {
+ const statusValue = parseInt(options.status) || 7;
+ // 找到对应的状态文本
+ const statusOption = _this.data.search.status.option;
+ const selectedOption = statusOption.find(option => option.value === statusValue);
+ let statusText = selectedOption ? selectedOption.text : '待开始';
+
+ this.setData({
+ ['search.status.value']: statusValue,
+ ['search.status.text']: statusText
+ });
+ } else {
+ // 确保默认显示"待开始"
+ this.setData({
+ ['search.status.value']: 7,
+ ['search.status.text']: '待开始'
+ });
+ }
+
_this.setData({
- userData: wx.getStorageSync('user'),
+ userData: userDetail
})
+
// 获取数据
- let userId = _this.data.userData.id
- // 获取预约数据
- _this.getReservationData({
- userId,
- pageNum: _this.data.reservationPageNum,
- pageSize: _this.data.reservationPageSize,
- })
+ _this.getDataList()
},
// 获取数据
@@ -137,11 +167,12 @@ Page({
} = param
// 查询数据
selectReservationListByUserIdRq({
- role: 3, // 按不同角色去查询预约记录。1.普通用户, 3.会议服务人员 ,5.会议管理员
+ role: _this.data.userData.roomRole, // 按不同角色去查询预约记录。1.普通用户, 3.会议服务人员 ,5.会议管理员
pageNum,
pageSize,
+ userId: _this.data.userData.id, // 确保传递用户ID
title: _this.data.search.title.value,
- status: _this.data.search.status.value
+ status: _this.data.search.status.value === '' ? null : _this.data.search.status.value
}).then(res => {
console.log('selectReservationListByUserIdRq', res);
// 判断数据是否全部查询
@@ -204,7 +235,19 @@ Page({
// 格式化数据
formartData(queryDataList) {
// 格式化数据
+ let _this = this;
+ let userRole = _this.data.userData.roomRole; // 获取当前用户角色
+
return queryDataList.map(item => {
+ let isNowDay = false
+ let nowDate = selfFormatTimeYMD(getNowDate())
+ if (nowDate == selfFormatTimeYMD(item.start)) {
+ isNowDay = true
+ }
+ item.isNowDay = isNowDay
+
+ // 添加星期几属性用于颜色判断
+ item.weekDay = getWeekday(item.start)
item.timeSlot = selfFormatTimeYMD(item.start) + ' '+ getWeekday(item.start) + ' ' + selfFormatTimeHM(item.start) + '~' + selfFormatTimeHM(item.end);
// 状态字体颜色
let statusColor = "#FFB119";
@@ -213,7 +256,6 @@ Page({
let showCancel = false // 显示取消操作
let showEdit = false // 显示编辑操作
let showStaff = false // 显示会务人员
- let showApprove = false // 显示审批操作
let statusName = ''
// 预约状态,1 取消 3 驳回 4 占用 5 待审核 7 审核通过,待开始 9 进行中 11已结束
if (statusValue == 1) {
@@ -225,41 +267,34 @@ Page({
if (statusValue == 3) {
// 驳回,可以修改
statusColor = "#333333"
- showCancel = true
- showEdit = true
statusName = '已驳回'
}
if (statusValue == 4) {
// 占用,可以修改,取消
- showEdit = true
- showCancel = true
- showStaff = true
statusName = '已占用'
}
if (statusValue == 5) {
- // 待审核,普通用户只能取消,管理员可以修改
- showEdit = true
- showCancel = true
- showApprove = true
- showStaff = true
+ // 待审核
statusName = '待审核'
}
if (statusValue == 7) {
- // 审核通过,可以取消,不允许修改
- showCancel = true
- showStaff = true
+ // 审核通过,服务人员只能查看详情
statusName = '待开始'
}
+ if (statusValue == 9) {
+ // 进行中
+ statusColor = "#333333"
+ statusName = '进行中'
+ }
if (statusValue == 11) {
// 已结束
statusColor = "#333333"
statusName = '已结束'
}
// 赋值
- item.showCancel = false
- item.showEdit = false
- item.showApprove = false
- item.showStaff = false
+ item.showCancel = showCancel
+ item.showEdit = showEdit
+ item.showStaff = showStaff
item.statusName = statusName
// 状态字体颜色
item.statusColor = statusColor;
@@ -271,6 +306,12 @@ Page({
console.log(`JSON error : ${error}`);
}
}
+ for (let key in item) {
+ // null设置为空
+ if (item[key] == null) {
+ item[key] = ''
+ }
+ }
return item
})
},
@@ -288,7 +329,11 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
-
+ // 确保状态值和文本正确初始化
+ this.setData({
+ ['search.status.value']: 7,
+ ['search.status.text']: '待开始'
+ });
},
/**
diff --git a/miniprogram/pages/meeting/reservationRecord/service/service.wxml b/miniprogram/pages/meeting/reservationRecord/service/service.wxml
index 79f791d..db003d2 100644
--- a/miniprogram/pages/meeting/reservationRecord/service/service.wxml
+++ b/miniprogram/pages/meeting/reservationRecord/service/service.wxml
@@ -10,7 +10,7 @@
-
+
@@ -26,8 +26,8 @@
- 取消原因:{{item.operate[0].content}}
- 驳回原因:{{item.operate[0].content}}
+ 取消原因:{{item.operate[item.operate.length - 1].content}}
+ 驳回原因:{{item.operate[item.operate.length - 1].content}}