From a7dcd256477c1da0bbbd2f458bdf47e9d8e58f85 Mon Sep 17 00:00:00 2001 From: "471615499@qq.com" Date: Tue, 17 Sep 2024 20:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E9=A2=84=E7=BA=A6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 预约功能增删改查; 审核、会务列表页 --- miniprogram/app.json | 3 + miniprogram/pages/index/index.wxss | 2 +- miniprogram/pages/meeting/index/index.js | 8 +- .../meetingReservation/meetingReservation.js | 10 +- .../meetingBooked/meetingBooked.js | 4 +- .../meetingRoom/meetingOrder/meetingOrder.js | 112 +- .../meetingOrder/meetingOrder.wxml | 7 + .../pages/meeting/meetingRoom/meetingRoom.js | 24 +- .../meetingService/meetingService.js | 29 +- .../meetingService/meetingService.wxml | 6 +- .../reservationRecord/approve/approve.js | 610 +++++++++++ .../reservationRecord/approve/approve.json | 18 + .../reservationRecord/approve/approve.wxml | 67 ++ .../reservationRecord/approve/approve.wxss | 136 +++ .../meetingDetail/meetingDetail.js | 576 ++++++----- .../meetingDetail/meetingDetail.json | 7 +- .../meetingDetail/meetingDetail.wxml | 195 ++-- .../meetingRecord/meetingRecord.js | 979 +++++++++++------- .../meetingRecord/meetingRecord.json | 25 +- .../meetingRecord/meetingRecord.wxml | 36 +- .../reservationRecord/service/service.js | 302 ++++++ .../reservationRecord/service/service.json | 18 + .../reservationRecord/service/service.wxml | 36 + .../reservationRecord/service/service.wxss | 136 +++ 24 files changed, 2546 insertions(+), 800 deletions(-) create mode 100644 miniprogram/pages/meeting/reservationRecord/approve/approve.js create mode 100644 miniprogram/pages/meeting/reservationRecord/approve/approve.json create mode 100644 miniprogram/pages/meeting/reservationRecord/approve/approve.wxml create mode 100644 miniprogram/pages/meeting/reservationRecord/approve/approve.wxss create mode 100644 miniprogram/pages/meeting/reservationRecord/service/service.js create mode 100644 miniprogram/pages/meeting/reservationRecord/service/service.json create mode 100644 miniprogram/pages/meeting/reservationRecord/service/service.wxml create mode 100644 miniprogram/pages/meeting/reservationRecord/service/service.wxss diff --git a/miniprogram/app.json b/miniprogram/app.json index cef4a4d..b7f274b 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -62,6 +62,8 @@ "pages/meeting/reservationRecord/reservationRecord", "pages/meeting/reservationRecord/meetingRecord/meetingRecord", "pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail", + "pages/meeting/reservationRecord/approve/approve", + "pages/meeting/reservationRecord/service/service", "pages/meeting/invite/invite", "pages/meeting/visitorIinvitation/list/list", "pages/meeting/visitorIinvitation/add/add", @@ -74,6 +76,7 @@ "pages/meeting/reservationRecord/exhibitionRecord/list/list", "pages/meeting/reservationRecord/exhibitionRecord/detail/detail", "pages/meeting/meetingRoom/meetingService/meetingService", + "pages/reportRepair/index/index", "pages/reportRepair/report/report", "pages/reportRepair/query/record/record", diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss index 40b37ed..f87ff4b 100644 --- a/miniprogram/pages/index/index.wxss +++ b/miniprogram/pages/index/index.wxss @@ -183,7 +183,7 @@ } .fixedbox { - width: 100%; + width: 50%; text-align: center; margin-top: 70rpx; float: left; diff --git a/miniprogram/pages/meeting/index/index.js b/miniprogram/pages/meeting/index/index.js index 84ade9c..d399858 100644 --- a/miniprogram/pages/meeting/index/index.js +++ b/miniprogram/pages/meeting/index/index.js @@ -26,14 +26,14 @@ Page({ type: "assign", name: "会议审核", img: "/profile/static/repair/index/case.png", - path: "/pages/meeting/visitorIinvitation/list/list", - visible: false + path: "/pages/meeting/reservationRecord/approve/approve", + visible: true }, { type: "repair", name: "会务服务", img: "/profile/static/repair/index/repair.png", - path: "/pages/reportRepair/repair/index/index", - visible: false + path: "/pages/meeting/reservationRecord/service/service", + visible: true }], timeShow: false, currentDate: new Date().getTime(), diff --git a/miniprogram/pages/meeting/meetingReservation/meetingReservation.js b/miniprogram/pages/meeting/meetingReservation/meetingReservation.js index 88abe58..b2c9acf 100644 --- a/miniprogram/pages/meeting/meetingReservation/meetingReservation.js +++ b/miniprogram/pages/meeting/meetingReservation/meetingReservation.js @@ -15,6 +15,7 @@ Page({ data: { IMG_NAME: app.IMG_NAME, roomDataList: {}, + rId: '', date: '', queryParam: { timeRangeDict: { @@ -87,13 +88,18 @@ Page({ title: options.name }) } + if (!options.rId) { + // 首页过来会找不到rId,设为空,否则会报错 + options.rId = '' + } const time = options.time if (!time || time === '') { app.selfShowMsg('请选择时间!', '/pages/meeting/index/index') return } this.setData({ - date: time + date: time, + rId: options.rId }) const _date = new Date(parseInt(time)) const _year = _date.getFullYear() @@ -285,7 +291,7 @@ Page({ timeRange = timeRange ? timeRange : 0 // 跳转预约详情 wx.navigateTo({ - url: "/pages/meeting/meetingRoom/meetingRoom?id=" + e.currentTarget.dataset.id + '&time=' + this.data.date + '&timeRange=' + timeRange, + url: "/pages/meeting/meetingRoom/meetingRoom?id=" + e.currentTarget.dataset.id + '&time=' + this.data.date + '&timeRange=' + timeRange + '&rId=' + this.data.rId, }) }, diff --git a/miniprogram/pages/meeting/meetingRoom/meetingBooked/meetingBooked.js b/miniprogram/pages/meeting/meetingRoom/meetingBooked/meetingBooked.js index d16aeaa..b0fd310 100644 --- a/miniprogram/pages/meeting/meetingRoom/meetingBooked/meetingBooked.js +++ b/miniprogram/pages/meeting/meetingRoom/meetingBooked/meetingBooked.js @@ -21,6 +21,7 @@ Page({ data: { IMG_NAME: app.IMG_NAME, date: '', + rId: '', dateText: '', timeRange: '', timeRangeText: '', @@ -110,7 +111,7 @@ Page({ startTime = parseInt(date) + (parseInt(startTimeArr[0]) * 60 * 60 + parseInt(startTimeArr[1]) * 60) * 1000 let endTimeArr = endTime.split(':') endTime = parseInt(date) + (parseInt(endTimeArr[0]) * 60 * 60 + parseInt(endTimeArr[1]) * 60) * 1000 - let paramUrl = "?meetingRoomId=" + meetingRoomId + "&startTime=" + selfFormatTimeYMDHMS(startTime) + "&endTime=" + selfFormatTimeYMDHMS(endTime); + let paramUrl = "?meetingRoomId=" + meetingRoomId + "&startTime=" + selfFormatTimeYMDHMS(startTime) + "&endTime=" + selfFormatTimeYMDHMS(endTime) + '&rId=' + _this.data.rId; // 结束时间不能小于开始时间 if (startTime >= endTime) { Notify('结束时间不能小于开始时间!') @@ -261,6 +262,7 @@ Page({ this.setData({ meetingRoomId: options.meetingRoomId, date: time, + rId: options.rId, dateText: _year + '年' + _month + '月' + _day + '日', timeRange: _timeRange, timeRangeText: _timeRangeText, diff --git a/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.js b/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.js index 200579d..737caaf 100644 --- a/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.js +++ b/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.js @@ -9,7 +9,7 @@ import { calculateMeetingRoomAmountRq, saveMeetingRecordRq, saveChangyangMeetingRecordRq, - meetingRoomBookedRecordRq + selectReservationByIdRq } from "../../../../api/meeting/meetingRoom.js" import { @@ -26,7 +26,7 @@ Page({ * 页面的初始数据 */ data: { - id: '', + rId: '', IMG_NAME: app.IMG_NAME, detail: {}, meetingRoomId: null, @@ -45,22 +45,36 @@ Page({ */ onLoad(options) { console.log('onLoad', options); - let selectCountTime = selfFormatTimeHM(options.startTime) + "-" + selfFormatTimeHM(options.endTime) + ' 共计' + twoTimeInterval(options.startTime, options.endTime) this.setData({ ...options, userData: wx.getStorageSync('user'), - selectDay: selfFormatTimeYMD(options.startTime), - selectCountTime + // selectDay: selfFormatTimeYMD(options.startTime), + // selectCountTime, }) + if (options.startTime && options.endTime) { + this.getTimeDetail(options.startTime, options.endTime) + } // 详细信息 this.getDetail(); }, - + /** + * 计算并填充时间细节 + * @param {*} sTime 开始时间 2024-09-18 09:04:00 + * @param {*} eTime 结束时间 2024-09-18 10:04:00 + */ + getTimeDetail(sTime, eTime) { + let selectCountTime = selfFormatTimeHM(sTime) + "-" + selfFormatTimeHM(eTime) + ' 共计' + twoTimeInterval(sTime, eTime) + this.setData({ + selectDay: selfFormatTimeYMD(sTime), + selectCountTime, + }) + }, // 详细信息 getDetail() { let _this = this; - let _dataId = _this.data.id + let _dataId = _this.data.rId if (_dataId === '') { + console.log('新增预约') // 为新增,新增的会议室id是传来的 let _meetingRoomId = _this.data.meetingRoomId _this.getRoomInfo(_meetingRoomId) @@ -76,14 +90,52 @@ Page({ } }) } else { - // 为编辑,此时根据id获取信息,获取信息后其中有roomId - meetingRoomBookedRecordRq(_dataId).then(res => { - console.log(res) + // 为编辑,编辑有两种情况,一是重新选择会议室和时间,另一种是编辑基本信息 + // 1. 无时间和会议室id,此时根据id获取信息,获取信息后其中有roomId + // 2. 有时间和会议室id,此时根据会议室id获取会议室信息即可 + let _meetingRoomId = _this.data.meetingRoomId + if (_meetingRoomId !== null) { + _this.getRoomInfo(_meetingRoomId) + } + selectReservationByIdRq(_dataId).then(res => { + console.log('编辑,获取信息', res) + if (_meetingRoomId === null) { + _meetingRoomId = res.data.roomContentId + _this.setData({ + meetingRoomId: _meetingRoomId, + startTime: res.data.startTime, + endTime: res.data.endDate + }) + let serviceId = [] + for (let key in res.data.reservationServes) { + let eachObj = res.data.reservationServes[key] + serviceId.push(eachObj.serveId) + } + _this.getRoomInfo(_meetingRoomId, serviceId) + // 计算日期和时间 + _this.getTimeDetail(res.data.startTime, res.data.endDate) + } + _this.setData({ + detail: { + orderUser: res.data.orderUser, + orderTel: res.data.orderTel, + title: res.data.title, + personNum: res.data.personNum, + leader: res.data.leader, + depName: res.data.depName, + remark: res.data.remark, + } + }) }) } }, - - getRoomInfo(roomId) { + /** + * 获取会议室基本信息 + * @param {*} roomId 会议室id + * @param {*} serveId 提供服务id,用于编辑时默认勾选 + */ + getRoomInfo(roomId, serveId) { + serveId = serveId || [] // 获取会议室详情 let _this = this meetingRoomDetailRq(this.data.meetingRoomId).then(res => { @@ -96,7 +148,22 @@ Page({ console.log(`JSON error : ${error}`); } } + // 提前处理服务,不需要进入页面后获取 + let serviceList = detail.roomServeList.map(item => { + let isSel = false + if (serveId.includes(item.id)) { + isSel = true + } + return { + serveId: item.id, + serveName: item.serveName, + isSelect: isSel, + num: '', + type: 'free' + } + }) _this.setData({ + serviceList: serviceList, room: detail, bannerList }) @@ -153,15 +220,15 @@ Page({ // }); // return; // } - if (_this.data.detail.orderUser == '') { + if (!_this.data.detail.orderUser || _this.data.detail.orderUser === '') { // 错误提示 Notify({ type: 'danger', message: '请输入预约人!' }); - return; + return } - if (_this.data.detail.orderTel == '') { + if (!_this.data.detail.orderUser || _this.data.detail.orderTel == '') { // 错误提示 Notify({ type: 'danger', @@ -169,6 +236,19 @@ Page({ }); return; } + // 处理一下serviceList + let service = [] + let serviceList = _this.data.serviceList + // console.log(serviceList) + for (let key in serviceList) { + let eachObj = serviceList[key] + console.log(eachObj) + if (eachObj.isSelect === true) { + service.push(eachObj) + } + } + // console.log(service) + // return saveChangyangMeetingRecordRq({ "roomContentId": _this.data.meetingRoomId, "userId": _this.data.userData.id, @@ -178,7 +258,7 @@ Page({ "startTime": _this.data.startTime, "endDate": _this.data.endTime, "orderMoney": 0, - "reservationServes": _this.data.serviceList, + "reservationServes": service, "remark": _this.data.detail.remark, "orderUser": _this.data.detail.orderUser, "orderTel": _this.data.detail.orderTel, diff --git a/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.wxml b/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.wxml index fd79746..66e9f4c 100644 --- a/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.wxml +++ b/miniprogram/pages/meeting/meetingRoom/meetingOrder/meetingOrder.wxml @@ -90,6 +90,13 @@ + + + + #{{item.serveName}} + + + - 免费服务 + 服务 @@ -13,7 +13,7 @@ - + diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.js b/miniprogram/pages/meeting/reservationRecord/approve/approve.js new file mode 100644 index 0000000..2a12304 --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.js @@ -0,0 +1,610 @@ +const app = getApp() + +import Dialog from '@vant/weapp/dialog/dialog'; +import Notify from '@vant/weapp/notify/notify'; + +import { + selfFormatTimeYMD, + selfFormatTimeHM +} from "../../../../utils/util.js" + +import { + selectReservationListByUserIdRq, + selectVisitorInvitationRecordRq, + cancelOrderRq +} from "../../../../api/meeting/meetingRoom.js" + +Page({ + + /** + * 页面的初始数据 + */ + data: { + IMG_NAME: app.IMG_NAME, + userData: null, + dataChange: false, + tabTitle: '预约记录', + // 预约记录参数 + reservationPageNum: 1, + reservationPageSize: 10, + reservationDataList: [], + reservationIsDataAll: false, + search: { + title: { + text: '会议名称', + value: '' + }, + status: { + value: 1, + option: [{ + text: '全部预约', + value: '' + }, + { + text: '待审核', + value: 1 + }, + { + text: '待开始', + value: 2 + }, + { + text: '已结束', + value: 3 + }, + { + text: '已取消', + value: 4 + }, + { + text: '已驳回', + value: 5 + }, + ] + } + }, + showRejectReason: false, // 是否展示弹出层 + rejectlId: '', // 驳回预约会议id + rejectReason: '', // 驳回预约原因 + beforeReject(action) { + return new Promise(resolve => { + if (action === 'confirm') { + resolve(false) + } else { + resolve(true) + } + }); + }, // 弹出层点击确认不关闭,手动关 + // 会议重新预约需要参数 + editId: '', + showEdit: false, + editAction: [{ + name: '重新选择时间、会议室', + type: 1 + }, + { + name: '重新编辑会议信息', + type: 2 + }, + ], + timeShow: false, + currentDate: new Date().getTime(), + minDate: new Date().getTime(), + maxDate: '', + formatter(type, value) { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }, + // 参与记录参数,不需要 + // participatePageNum: 1, + // participatePageSize: 10, + // participateDataList: [], + // participateIsDataAll: false, + }, + changeSearchTitle(e) { + this.setData({ + ['search.title.value']: e.detail, + }) + }, + searchTitle() { + // 刷新预约数据 + this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + }) + this.getDataList() + this.selectComponent('#item').toggle() + }, + changeSearchStatus(e) { + // 刷新预约数据 + this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + ['search.status.value']: e.detail + }) + this.getDataList() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let _this = this; + _this.setData({ + userData: wx.getStorageSync('user'), + }) + // 获取数据 + 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) + newDate.setMonth(newDate.getMonth() + 1) + _this.setData({ + maxDate: newDate.getTime() + }) + }, + + // 获取数据 + getDataList() { + // 获取参数 + let _this = this; + let tabTitle = _this.data.tabTitle + let userId = _this.data.userData.id + let isDataAll = null + let pageNum = null + let pageSize = null + // 预约记录参数,目前只保留预约记录,其余去掉 + isDataAll = _this.data.reservationIsDataAll + pageNum = _this.data.reservationPageNum + pageSize = _this.data.reservationPageSize + + // 判断数据是否已全部加载 + if (isDataAll) { + return; + } + // 传递参数 + let param = { + userId, + pageNum, + pageSize + } + _this.getReservationData(param) + }, + + // 获取预约数据 + getReservationData(param) { + let _this = this; + let { + pageNum, + pageSize, + userId + } = param + // 查询数据 + selectReservationListByUserIdRq({ + pageNum, + pageSize, + userId, + parkId: 25, + title: _this.data.search.title.value, + statusValue: _this.data.search.status.value + }).then(res => { + console.log('selectReservationListByUserIdRq', res); + // 判断数据是否全部查询 + let queryDataList = res.page.records; + if (queryDataList && queryDataList.length > 0) { + // 更新参数 + let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList)); + let reservationPageNum = _this.data.reservationPageNum + 1; + _this.setData({ + reservationPageNum, + reservationDataList, + }) + } else { + _this.setData({ + reservationIsDataAll: true + }) + } + }) + }, + + // 获取参与数据,此处不需要 + getParticipateData(param) { + let _this = this; + let { + pageNum, + pageSize, + userId + } = param + // 查询数据 + selectVisitorInvitationRecordRq({ + pageNum, + pageSize, + userId + }).then(res => { + console.log('selectVisitorInvitationRecordRq', res); + // 判断数据是否全部查询 + let queryDataList = res.page.records; + if (queryDataList && queryDataList.length > 0) { + // 更新参数 + let participateDataList = _this.data.participateDataList.concat(_this.formartData(queryDataList)); + let participatePageNum = _this.data.participatePageNum + 1; + _this.setData({ + participatePageNum, + participateDataList, + }) + } else { + _this.setData({ + participateIsDataAll: true + }) + } + }) + }, + + // 格式化数据 + formartData(queryDataList) { + // 格式化数据 + return queryDataList.map(item => { + item.timeSlot = selfFormatTimeYMD(item.startTime) + ' ' + selfFormatTimeHM(item.startTime) + '~' + selfFormatTimeHM(item.endDate); + // 状态字体颜色 + let statusColor = "#FFB119"; + // 按钮是否显示 + let statusValue = item.statusValue; + let showPay = false; + let showInvite = false; + let showCancel = false; + let showDetail = false; + // 待支付 0 :去支付、取消订单、查看详情 + if (statusValue == 0) { + showPay = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FFB119"; + } + // 待使用 1:去邀请、取消订单、查看详情 + if (statusValue == 1) { + showInvite = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#3794FF"; + // 待使用 修改为 预约成功 + item.statusName = '预约成功' + } + // 进行中 2:去邀请、查看详情 + if (statusValue == 2) { + showInvite = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FF4040"; + } + // 已结束 3:查看详情 + if (statusValue == 3) { + showDetail = true; + // 状态字体颜色 + statusColor = "#333333"; + } + // 已取消 4:查看详情 + if (statusValue == 4) { + showDetail = true; + // 状态字体颜色 + statusColor = "#7F7F7F"; + } + // + // 赋值 + item.showPay = showPay; + item.showInvite = showInvite; + item.showCancel = showCancel; + item.showDetail = showDetail; + // 状态字体颜色 + item.statusColor = statusColor; + // 图片 + if (item.roomContent.indoorPicUrl) { + try { + item.roomContent.indoorPicUrlFirst = JSON.parse(item.roomContent.indoorPicUrl)[0].url + } catch (error) { + console.log(`JSON error : ${error}`); + } + } + return item; + }) + + }, + + // 跳转-预约详情 + jumpMeetingDetail(e) { + console.log('jumpMeetingDetail', e); + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?id=" + id, + }) + }, + + // 取消预约一系列方法 + cancelConfirm(e) { + console.log('cancelConfirm', e); + let _this = this; + let id = e.currentTarget.dataset.id + _this.setData({ + cancelId: id, + showCancelReason: true, + cancelReason: '' + }) + }, + onCloseCancel(e) { + let _this = this; + _this.setData({ + cancelId: '', + showCancelReason: false, + cancelReason: '' + }) + }, + onChangeCancelReason(e) { + let _this = this; + _this.setData({ + cancelReason: e.detail + }) + }, + // 取消订单 + cancelOrder() { + let _this = this; + let id = _this.data.cancelId + let reason = _this.data.cancelReason + if (id === '') { + return + } + if (reason === '') { + Notify('请输入取消原因!') + return + } + cancelOrderRq({ + id: id, + cancelResaon: reason + }).then(res => { + console.log('cancelOrderRq', res); + if (res.code == 0) { + // 刷新预约数据 + _this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + showCancelReason: false + }) + _this.getDataList() + } else { + // 危险通知 + Notify({ + type: 'danger', + message: res.msg + }); + } + }) + }, + editConfirm(e) { + let id = e.currentTarget.dataset.id + this.setData({ + editId: id, + showEdit: true + }) + }, + hideEdit() { + this.setData({ + showEdit: false + }) + }, + editMode(e) { + let _this = this + if (e.detail.type === 1) { + // 重选时间会议室 + this.setData({ + showEdit: false, + timeShow: true + }) + } else { + // 直接跳转 + console.log('重新编辑会议基本信息!') + this.setData({ + showEdit: false, + }) + wx.navigateTo({ + url: "/pages/meeting/meetingRoom/meetingOrder/meetingOrder?rId=" + _this.data.editId, + }) + } + }, + showTimePicker() { + this.setData({ + timeShow: true + }); + }, + hideTimePicker() { + this.setData({ + timeShow: false + }); + }, + // 跳转会议预约页面 + goRes(e) { + let _this = this + // 加入rId参数,为预约id,用于重新修改 + wx.navigateTo({ + url: '/pages/meeting/meetingReservation/meetingReservation?rId=' + _this.data.editId + '&time=' + e.detail, + }) + }, + pass() { + Dialog.confirm({ + title: '确认', + message: '是否确认通过会议室申请?', + }) + .then(() => { + // on confirm + console.log('已通过') + // 重新加载数据 + this.getDataList() + }) + .catch(() => { + // on cancel + }); + }, + // 取消预约一系列方法 + rejectConfirm(e) { + console.log('rejectConfirm', e); + let _this = this; + let id = e.currentTarget.dataset.id + _this.setData({ + rejectId: id, + showRejectReason: true, + rejectReason: '' + }) + }, + onCloseReject(e) { + let _this = this; + _this.setData({ + rejectId: '', + showRejectReason: false, + rejectReason: '' + }) + }, + onChangeRejectReason(e) { + let _this = this; + _this.setData({ + rejectReason: e.detail + }) + }, + // 取消订单 + rejectOrder() { + let _this = this; + let id = _this.data.rejectId + let reason = _this.data.rejectReason + if (id === '') { + return + } + if (reason === '') { + Notify('请输入驳回原因!') + return + } + // 执行驳回方法 + console.log('驳回,原因为' + reason) + return + cancelOrderRq({ + id: id, + cancelResaon: reason + }).then(res => { + console.log('rejectOrder', res); + if (res.code == 0) { + // 刷新预约数据 + _this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + showRejcctReason: false + }) + _this.getDataList() + } else { + // 危险通知 + Notify({ + type: 'danger', + message: res.msg + }); + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + let _this = this; + // 数据是否变化 + if (_this.data.dataChange) { + // 刷新数据 + _this.setData({ + dataChange: false, + // 预约记录参数 + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + // 搜索重置 + ['search.title.value']: '', + ['search.status.value']: 0 + }) + + // 获取数据 + let userId = _this.data.userData.id + // 获取预约数据 + _this.getReservationData({ + userId, + pageNum: _this.data.reservationPageNum, + pageSize: _this.data.reservationPageSize, + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + console.log('onPullDownRefresh', '页面相关事件处理函数--监听用户下拉动作'); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('onReachBottom', '页面上拉触底事件的处理函数'); + let _this = this; + // 获取数据 + _this.getDataList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage(e) { + console.log('onShareAppMessage', e); + let _this = this; + let id = e.target.dataset.id; + let detail = _this.data.reservationDataList.find(item => item.id == id) + // + let param = { + title: detail.title, + path: "/pages/meeting/invite/invite?id=" + id, + imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, + } + console.log('onShareAppMessage', param); + return param; + } +}) \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.json b/miniprogram/pages/meeting/reservationRecord/approve/approve.json new file mode 100644 index 0000000..3399b1a --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.json @@ -0,0 +1,18 @@ +{ + "usingComponents": { + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "van-divider": "@vant/weapp/divider/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-notify": "@vant/weapp/notify/index", + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-popup": "@vant/weapp/popup/index", + "van-action-sheet": "@vant/weapp/action-sheet/index" + }, + "navigationBarTitleText": "会议审核", + "onReachBottomDistance": 100 +} \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml new file mode 100644 index 0000000..f6f126c --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxml @@ -0,0 +1,67 @@ + + + + + + + + + 查询 + + + + + + + + {{item.title}} + {{item.statusName}} + + + + + {{item.roomContent.buildingName}} | {{item.roomContent.roomName}} | {{item.roomContent.capacityNum}} | {{item.roomContent.shape}} + 预约人: {{item.createBy}} + {{item.timeSlot}} + + + + {{item.cancelResaon}} + + + + + 修改信息 + 通过 + 驳回 + + + + + + 数据已全部加载 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss new file mode 100644 index 0000000..964381e --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/approve/approve.wxss @@ -0,0 +1,136 @@ +.containerView.public { + background: none; + height: auto; +} + +.itemView { + background: white; + margin: 30rpx 20rpx; + padding: 30rpx 20rpx; + /* box-shadow: rgba(210,210,210,0.5) 0px 3.752px 3.752px 0px; */ +} + +.itemView .headView { + display: flex; + justify-content: space-between; + align-items: center; +} + +.itemView .headView .number { + flex: 1; + margin-right: 30rpx; + font-size: 26rpx; + + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; +} + +.itemView .headView .status { + font-size: 26rpx; + color: #4e96f8; + margin-right: 20rpx; +} + +.itemView .contentView { + box-sizing: border-box; + border-radius: 10rpx; + width: 100%; + margin-top: 20rpx; + padding: 30rpx 20rpx; + display: flex; + justify-content: flex-start; + align-items: center; + background: #f2f2f2; +} + +.itemView .contentView .img { + border-radius: 10rpx; + width: 200rpx; + height: 110rpx; +} + +.itemView .contentView .msgView { + flex: 1; + margin-left: 20rpx; + word-break: break-all; +} + +.itemView .contentView .msgView .title { + font-size: 28rpx; +} + +.itemView .contentView .msgView .name, +.itemView .contentView .msgView .time { + font-size: 24rpx; + color: gray; + margin-top: 6rpx; +} + +.itemView .priceView { + display: flex; + justify-content: flex-end; + align-items: center; + margin: 30rpx 0; +} + +.itemView .priceView .cancelContent { + flex: 1; + margin-right: 40rpx; + font-size: 26rpx; + color: #7F7F7F; + + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; +} + +.itemView .priceView .priceContent { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.itemView .priceView .priceContent .name { + font-size: 26rpx; +} + +.itemView .priceView .priceContent .price { + font-size: 28rpx; + font-weight: bold; + color: red; + margin-left: 10rpx; +} + +.itemView .btnView { + display: flex; + justify-content: flex-end; + align-items: center; + +} + +.itemView .btnView .btn { + border: 1px solid #4e96f8; + position: relative; + border-radius: 10rpx; + margin-left: 16rpx; + padding: 10rpx 24rpx; + font-size: 24rpx; + color: #4e96f8; +} + +.shareBtn { + position: absolute; + z-index: 1; + width: 100%; + height: 100%; + left: 0; + top: 0; + opacity: 0; +} + +.loadAllLine { + margin-top: 80rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.js b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.js index ccd1c03..f01e0c1 100644 --- a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.js +++ b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.js @@ -4,251 +4,363 @@ import Dialog from '@vant/weapp/dialog/dialog'; import Notify from '@vant/weapp/notify/notify'; import { - selfFormatTimeYMD, - selfFormatTimeHM, - twoTimeIntervalReturnHours + selfFormatTimeYMD, + selfFormatTimeHM, + twoTimeIntervalReturnHours } from "../../../../../utils/util.js" import { - selectReservationByIdRq, - cancelOrderRq, - inviteRecordPersonListRq, - getMeetingRoomServiceAndEquipmentRq, + selectReservationByIdRq, + cancelOrderRq, + inviteRecordPersonListRq, + getMeetingRoomServiceAndEquipmentRq, } from "../../../../../api/meeting/meetingRoom.js" Page({ - /** - * 页面的初始数据 - */ - data: { - IMG_NAME: app.IMG_NAME, - id: null, - detail: null, - facilities: {}, - joinPersonList: [] - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let _this = this; - _this.setData({ - ...options - }) - // 获取详情 - _this.getDetail(); + /** + * 页面的初始数据 + */ + data: { + IMG_NAME: app.IMG_NAME, + id: null, + detail: null, + facilities: {}, + joinPersonList: [], + showCancelReason: false, // 是否展示弹出层 + cancelId: '', // 取消预约会议id + cancelReason: '', // 取消预约原因 + beforeClose(action) { + return new Promise(resolve => { + if (action === 'confirm') { + resolve(false) + } else { + resolve(true) + } + }); + }, // 弹出层点击确认不关闭,手动关 + // 会议重新预约需要参数 + showEdit: false, + editAction: [ + { + name: '重新选择时间、会议室', + type: 1 + }, + { + name: '重新编辑会议信息', + type: 2 + }, + ], + timeShow: false, + currentDate: new Date().getTime(), + minDate: new Date().getTime(), + maxDate: '', + formatter(type, value) { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; }, + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let _this = this; + _this.setData({ + ...options + }) // 获取详情 - getDetail() { - let _this = this; - let id = _this.data.id; - selectReservationByIdRq(id).then(res => { - let detail = res.data; - // 时间段 - detail.timeSlot = selfFormatTimeYMD(detail.startTime) + ' ' + selfFormatTimeHM(detail.startTime) + '~' + selfFormatTimeHM(detail.endDate); - // 合计时间 - detail.countTime = twoTimeIntervalReturnHours(detail.startTime, detail.endDate) - // 状态字体颜色 - let statusColor = "#FFB119"; - // 按钮是否显示 - let statusValue = detail.statusValue; - let showPay = false; - let showInvite = false; - let showCancel = false; - let showDetail = false; - // 待支付 0 :去支付、取消订单、查看详情 - if (statusValue == 0) { - showPay = true; - showCancel = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#FFB119"; - } - // 待使用 1:去邀请、取消订单、查看详情 - if (statusValue == 1) { - showInvite = true; - showCancel = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#3794FF"; - // 待使用 修改为 预约成功 - detail.statusName = '预约成功' - } - // 进行中 2:去邀请、查看详情 - if (statusValue == 2) { - showInvite = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#FF4040"; - } - // 已结束 3:查看详情 - if (statusValue == 3) { - showDetail = true; - // 状态字体颜色 - statusColor = "#333333"; - } - // 已取消 4:查看详情 - if (statusValue == 4) { - showDetail = true; - // 状态字体颜色 - statusColor = "#7F7F7F"; - } - // - // 赋值 - detail.showPay = showPay; - detail.showInvite = showInvite; - detail.showCancel = showCancel; - detail.showDetail = showDetail; - // 状态字体颜色 - detail.statusColor = statusColor; - // 图片 - if (detail.roomContent.indoorPicUrl) { - try { - detail.roomContent.indoorPicUrlFirst = JSON.parse(detail.roomContent.indoorPicUrl)[0].url - } catch (error) { - console.log(`JSON error : ${error}`); - } - } - _this.setData({ - detail - }) + _this.getDetail(); + // 获取一月后时间,默认只能选一个月之后 + const today = new Date() + const newDate = new Date(today) + newDate.setMonth(newDate.getMonth() + 1) + _this.setData({ + maxDate: newDate.getTime() + }) + }, - // 查询服务 - getMeetingRoomServiceAndEquipmentRq(_this.data.detail.roomContent.id).then(res => { - _this.setData({ - facilities: res.data - }) - }) + // 获取详情 + getDetail() { + let _this = this; + let id = _this.data.id; + selectReservationByIdRq(id).then(res => { + let detail = res.data; + // 时间段 + detail.timeSlot = selfFormatTimeYMD(detail.startTime) + ' ' + selfFormatTimeHM(detail.startTime) + '~' + selfFormatTimeHM(detail.endDate); + // 合计时间 + detail.countTime = twoTimeIntervalReturnHours(detail.startTime, detail.endDate) + // 状态字体颜色 + let statusColor = "#FFB119"; + // 按钮是否显示 + let statusValue = detail.statusValue; + let showPay = false; + let showInvite = false; + let showCancel = false; + let showDetail = false; + // 待支付 0 :去支付、取消订单、查看详情 + if (statusValue == 0) { + showPay = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FFB119"; + } + // 待使用 1:去邀请、取消订单、查看详情 + if (statusValue == 1) { + showInvite = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#3794FF"; + // 待使用 修改为 预约成功 + detail.statusName = '预约成功' + } + // 进行中 2:去邀请、查看详情 + if (statusValue == 2) { + showInvite = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FF4040"; + } + // 已结束 3:查看详情 + if (statusValue == 3) { + showDetail = true; + // 状态字体颜色 + statusColor = "#333333"; + } + // 已取消 4:查看详情 + if (statusValue == 4) { + showDetail = true; + // 状态字体颜色 + statusColor = "#7F7F7F"; + } + // + // 赋值 + detail.showPay = showPay; + detail.showInvite = showInvite; + detail.showCancel = showCancel; + detail.showDetail = showDetail; + // 状态字体颜色 + detail.statusColor = statusColor; + // 图片 + if (detail.roomContent.indoorPicUrl) { + try { + detail.roomContent.indoorPicUrlFirst = JSON.parse(detail.roomContent.indoorPicUrl)[0].url + } catch (error) { + console.log(`JSON error : ${error}`); + } + } + _this.setData({ + detail + }) + + // 查询服务 + getMeetingRoomServiceAndEquipmentRq(_this.data.detail.roomContent.id).then(res => { + _this.setData({ + facilities: res.data }) - // 查询参与会议预约人员列表 - _this.getInviteRecordPersonList() - }, - + }) + }) // 查询参与会议预约人员列表 - getInviteRecordPersonList() { - let _this = this; - let id = _this.data.id; - inviteRecordPersonListRq(id).then(res => { - console.log('inviteRecordPersonListRq', res); - _this.setData({ - joinPersonList: res.data - }) - }) - }, + _this.getInviteRecordPersonList() + }, - // 取消订单 - cancelOrder(e) { - console.log('cancelOrder', e); - let _this = this; - let id = e.currentTarget.dataset.id - const beforeClose = (action) => { - console.log('action', action); - return new Promise((resolve) => { - if (action === 'confirm') { - cancelOrderRq({ - id, - cancelResaon: "" - }).then(res => { - console.log('cancelOrderRq', res); - if (res.code == 0) { - // 刷新数据 - _this.getDetail(); - // 数据状态变更,向上个页面传递变更 - let pages = getCurrentPages(); //获取page - let prevPage = pages[pages.length - 2]; //上一个页面(父页面) - prevPage.setData({ - dataChange: true - }) - } else { - // 危险通知 - Notify({ - type: 'danger', - message: res.msg - }); - } - resolve(true); - }) - } else { - // 拦截取消操作 - resolve(true); - } - }); - } - Dialog.confirm({ - title: '提示', - message: '是否取消预约!', - beforeClose, - }); - }, - - // 跳转-支付 - jumpPay(e) { - console.log('jumpPay', e); - wx.navigateTo({ - url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom" - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage(e) { - console.log('onShareAppMessage', e); - let _this = this; - let id = e.target.dataset.id; - let detail = _this.data.detail - // - let param = { - title: detail.title, - path: "/pages/meeting/invite/invite?id=" + id, - imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, - } - console.log('onShareAppMessage', param); - return param; + // 查询参与会议预约人员列表 + getInviteRecordPersonList() { + let _this = this; + let id = _this.data.id; + inviteRecordPersonListRq(id).then(res => { + console.log('inviteRecordPersonListRq', res); + _this.setData({ + joinPersonList: res.data + }) + }) + }, + // 取消预约一系列方法 + cancelConfirm(e) { + console.log('cancelConfirm', e); + let _this = this; + let id = e.currentTarget.dataset.id + _this.setData({ + cancelId: id, + showCancelReason: true, + cancelReason: '' + }) + }, + onCloseCancel(e) { + let _this = this; + _this.setData({ + cancelId: '', + showCancelReason: false, + cancelReason: '' + }) + }, + onChangeCancelReason(e) { + let _this = this; + _this.setData({ + cancelReason: e.detail + }) + }, + // 取消订单 + cancelOrder() { + let _this = this; + let id = _this.data.cancelId + let reason = _this.data.cancelReason + if (id === '') { + return } + if (reason === '') { + Notify('请输入取消原因!') + return + } + cancelOrderRq({ + id: id, + cancelResaon: reason + }).then(res => { + console.log('cancelOrderRq', res); + if (res.code == 0) { + _this.setData({ + showCancelReason: false + }) + // 刷新数据 + _this.getDetail(); + // 数据状态变更,向上个页面传递变更 + let pages = getCurrentPages(); //获取page + let prevPage = pages[pages.length - 2]; //上一个页面(父页面) + prevPage.setData({ + dataChange: true + }) + } else { + // 危险通知 + Notify({ + type: 'danger', + message: res.msg + }); + } + }) + }, + editConfirm() { + this.setData({ + showEdit: true + }) + }, + hideEdit() { + this.setData({ + showEdit: false + }) + }, + editMode(e) { + let _this = this + if (e.detail.type === 1) { + // 重选时间会议室 + this.setData({ + showEdit: false, + timeShow: true + }) + } else { + // 直接跳转 + console.log('重新编辑会议基本信息!') + this.setData({ + showEdit: false, + }) + wx.navigateTo({ + url: "/pages/meeting/meetingRoom/meetingOrder/meetingOrder?rId=" + _this.data.detail.id, + }) + } + }, + showTimePicker() { + this.setData({ + timeShow: true + }); + }, + hideTimePicker() { + this.setData({ + timeShow: false + }); + }, + // 跳转会议预约页面 + goRes(e) { + let _this = this + // 加入rId参数,为预约id,用于重新修改 + wx.navigateTo({ + url: '/pages/meeting/meetingReservation/meetingReservation?rId=' + _this.data.detail.id + '&time=' + e.detail, + }) + }, + + // 跳转-支付 + jumpPay(e) { + console.log('jumpPay', e); + wx.navigateTo({ + url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom" + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage(e) { + console.log('onShareAppMessage', e); + let _this = this; + let id = e.target.dataset.id; + let detail = _this.data.detail + // + let param = { + title: detail.title, + path: "/pages/meeting/invite/invite?id=" + id, + imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, + } + console.log('onShareAppMessage', param); + return param; + } }) \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.json b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.json index d90d0a5..957027b 100644 --- a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.json +++ b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.json @@ -1,7 +1,12 @@ { "usingComponents": { "van-dialog": "@vant/weapp/dialog/index", - "van-notify": "@vant/weapp/notify/index" + "van-notify": "@vant/weapp/notify/index", + "van-field": "@vant/weapp/field/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-popup": "@vant/weapp/popup/index", + "van-action-sheet": "@vant/weapp/action-sheet/index", + "van-button": "@vant/weapp/button/index" }, "navigationBarTitleText": "会议预约详情" } \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.wxml b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.wxml index e02cb54..4fd7529 100644 --- a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.wxml +++ b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail.wxml @@ -1,90 +1,90 @@ - - - - - - {{detail.roomContent.buildingName}} | {{detail.roomContent.roomName}} | {{detail.roomContent.capacityNum}}人 | {{detail.roomContent.shape}} - {{detail.roomContent.meetingName}} - {{detail.timeSlot}} - - + + + + + {{detail.roomContent.buildingName}} | {{detail.roomContent.roomName}} | {{detail.roomContent.capacityNum}}人 | {{detail.roomContent.shape}} + {{detail.roomContent.meetingName}} + {{detail.timeSlot}} + + - + + + + + + 预约情况 + + 预约状态 + {{detail.statusName}} + + + 取消原因 + {{detail.cancelResaon}} + + + + + 基本信息 + + 会议时间 + {{detail.timeSlot}} 共计{{detail.countTime}}小时 + + + 会议名称 + {{detail.title}} + + + 参会人数 + {{detail.personNum}} + + + 参会领导 + {{detail.leader}} + + + 预约部门 + {{detail.depName}} + + + 会议预约人 + {{detail.userName}} + + + 联系方式 + {{detail.phone}} + + + 备注 + {{detail.remark}} - - - 预约情况 - - 预约状态 - {{detail.statusName}} - - - 取消原因 - {{detail.cancelResaon}} - - - - - 基本信息 - - 会议时间 - {{detail.timeSlot}} 共计{{detail.countTime}}小时 - - - 会议名称 - {{detail.title}} - - - 参会人数 - {{detail.personNum}} - - - 参会领导 - {{detail.leader}} - - - 预约部门 - {{detail.depName}} - - - 会议预约人 - {{detail.userName}} - - - 联系方式 - {{detail.phone}} - - - 备注 - {{detail.remark}} - - - - 会议室设备 - - {{item.name}} - - - - - 会议服务 - - {{item.serveName}} - - - - - 创建时间 - {{detail.createTime}} - - + + 会议室设备 + + {{item.name}} + - - + + + + 创建时间 + {{detail.createTime}} + + + + + - - - - + + + - 取消预约 - + 取消预约 + 修改信息 + + + - - - - - \ No newline at end of file + + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.js b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.js index a8d7bbd..9cdebdf 100644 --- a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.js +++ b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.js @@ -4,424 +4,597 @@ import Dialog from '@vant/weapp/dialog/dialog'; import Notify from '@vant/weapp/notify/notify'; import { - selfFormatTimeYMD, - selfFormatTimeHM + selfFormatTimeYMD, + selfFormatTimeHM } from "../../../../utils/util.js" import { - selectReservationListByUserIdRq, - selectVisitorInvitationRecordRq, - cancelOrderRq + selectReservationListByUserIdRq, + selectVisitorInvitationRecordRq, + cancelOrderRq } from "../../../../api/meeting/meetingRoom.js" Page({ - /** - * 页面的初始数据 - */ - data: { - IMG_NAME: app.IMG_NAME, - userData: null, + /** + * 页面的初始数据 + */ + data: { + IMG_NAME: app.IMG_NAME, + userData: null, + dataChange: false, + tabTitle: '预约记录', + // 预约记录参数 + reservationPageNum: 1, + reservationPageSize: 10, + reservationDataList: [], + reservationIsDataAll: false, + search: { + title: { + text: '会议名称', + value: '' + }, + status: { + value: '', + option: [{ + text: '全部预约', + value: '' + }, + { + text: '待审核', + value: 1 + }, + { + text: '待开始', + value: 2 + }, + { + text: '已结束', + value: 3 + }, + { + text: '已取消', + value: 4 + }, + { + text: '已驳回', + value: 5 + }, + ] + } + }, + showCancelReason: false, // 是否展示弹出层 + cancelId: '', // 取消预约会议id + cancelReason: '', // 取消预约原因 + beforeClose(action) { + return new Promise(resolve => { + if (action === 'confirm') { + resolve(false) + } else { + resolve(true) + } + }); + }, // 弹出层点击确认不关闭,手动关 + // 会议重新预约需要参数 + editId: '', + showEdit: false, + editAction: [{ + name: '重新选择时间、会议室', + type: 1 + }, + { + name: '重新编辑会议信息', + type: 2 + }, + ], + timeShow: false, + currentDate: new Date().getTime(), + minDate: new Date().getTime(), + maxDate: '', + formatter(type, value) { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }, + // 参与记录参数,不需要 + // participatePageNum: 1, + // participatePageSize: 10, + // participateDataList: [], + // participateIsDataAll: false, + }, + changeSearchTitle(e) { + this.setData({ + ['search.title.value']: e.detail + }) + }, + searchTitle() { + // 刷新预约数据 + this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + }) + this.getDataList() + this.selectComponent('#item').toggle() + }, + changeSearchStatus(e) { + // 刷新预约数据 + this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + ['search.status.value']: e.detail + }) + this.getDataList() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let _this = this; + _this.setData({ + userData: wx.getStorageSync('user'), + }) + // 获取数据 + 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) + newDate.setMonth(newDate.getMonth() + 1) + _this.setData({ + maxDate: newDate.getTime() + }) + // 获取参与数据 + // _this.getParticipateData({ + // userId, + // pageNum: _this.data.participatePageNum, + // pageSize: _this.data.participatePageSize + // }) + }, + + // 获取数据 + getDataList() { + // 获取参数 + let _this = this; + let tabTitle = _this.data.tabTitle + let userId = _this.data.userData.id + let isDataAll = null + let pageNum = null + let pageSize = null + // 预约记录参数,目前只保留预约记录,其余去掉 + isDataAll = _this.data.reservationIsDataAll + pageNum = _this.data.reservationPageNum + pageSize = _this.data.reservationPageSize + // if (tabTitle == '预约记录') { + // // 预约记录参数 + // isDataAll = _this.data.reservationIsDataAll + // pageNum = _this.data.reservationPageNum + // pageSize = _this.data.reservationPageSize + + // } else if (tabTitle == '预约记录') { + // // 参与记录参数 + // isDataAll = _this.data.participateIsDataAll + // pageNum = _this.data.participatePageNum + // pageSize = _this.data.participatePageSize + // } else { + // wx.showToast({ + // title: `tab 切换错误(${tabTitle})`, + // icon: 'none', + // }); + // return; + // } + // 判断数据是否已全部加载 + if (isDataAll) { + return; + } + // 传递参数 + let param = { + userId, + pageNum, + pageSize + } + _this.getReservationData(param) + // if (tabTitle == '预约记录') { + // // 获取预约数据 + // _this.getReservationData(param) + // } else if (tabTitle == '预约记录') { + // // 获取参与数据 + // _this.getParticipateData(param) + // } + }, + + // 获取预约数据 + getReservationData(param) { + let _this = this; + let { + pageNum, + pageSize, + userId + } = param + // 查询数据 + selectReservationListByUserIdRq({ + pageNum, + pageSize, + userId, + parkId: 25, + title: _this.data.search.title.value, + statusValue: _this.data.search.status.value + }).then(res => { + console.log('selectReservationListByUserIdRq', res); + // 判断数据是否全部查询 + let queryDataList = res.page.records; + if (queryDataList && queryDataList.length > 0) { + // 更新参数 + let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList)); + let reservationPageNum = _this.data.reservationPageNum + 1; + _this.setData({ + reservationPageNum, + reservationDataList, + }) + } else { + _this.setData({ + reservationIsDataAll: true + }) + } + }) + }, + + // 获取参与数据,此处不需要 + getParticipateData(param) { + let _this = this; + let { + pageNum, + pageSize, + userId + } = param + // 查询数据 + selectVisitorInvitationRecordRq({ + pageNum, + pageSize, + userId + }).then(res => { + console.log('selectVisitorInvitationRecordRq', res); + // 判断数据是否全部查询 + let queryDataList = res.page.records; + if (queryDataList && queryDataList.length > 0) { + // 更新参数 + let participateDataList = _this.data.participateDataList.concat(_this.formartData(queryDataList)); + let participatePageNum = _this.data.participatePageNum + 1; + _this.setData({ + participatePageNum, + participateDataList, + }) + } else { + _this.setData({ + participateIsDataAll: true + }) + } + }) + }, + + // 格式化数据 + formartData(queryDataList) { + // 格式化数据 + return queryDataList.map(item => { + item.timeSlot = selfFormatTimeYMD(item.startTime) + ' ' + selfFormatTimeHM(item.startTime) + '~' + selfFormatTimeHM(item.endDate); + // 状态字体颜色 + let statusColor = "#FFB119"; + // 按钮是否显示 + let statusValue = item.statusValue; + let showPay = false; + let showInvite = false; + let showCancel = false; + let showDetail = false; + // 待支付 0 :去支付、取消订单、查看详情 + if (statusValue == 0) { + showPay = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FFB119"; + } + // 待使用 1:去邀请、取消订单、查看详情 + if (statusValue == 1) { + showInvite = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#3794FF"; + // 待使用 修改为 预约成功 + item.statusName = '预约成功' + } + // 进行中 2:去邀请、查看详情 + if (statusValue == 2) { + showInvite = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FF4040"; + } + // 已结束 3:查看详情 + if (statusValue == 3) { + showDetail = true; + // 状态字体颜色 + statusColor = "#333333"; + } + // 已取消 4:查看详情 + if (statusValue == 4) { + showDetail = true; + // 状态字体颜色 + statusColor = "#7F7F7F"; + } + // + // 赋值 + item.showPay = showPay; + item.showInvite = showInvite; + item.showCancel = showCancel; + item.showDetail = showDetail; + // 状态字体颜色 + item.statusColor = statusColor; + // 图片 + if (item.roomContent.indoorPicUrl) { + try { + item.roomContent.indoorPicUrlFirst = JSON.parse(item.roomContent.indoorPicUrl)[0].url + } catch (error) { + console.log(`JSON error : ${error}`); + } + } + return item; + }) + + }, + + // 跳转-支付,此处不需要 + jumpPay(e) { + return + console.log('jumpPay', e); + wx.navigateTo({ + url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom" + }) + }, + + // 跳转-预约详情 + jumpMeetingDetail(e) { + console.log('jumpMeetingDetail', e); + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?id=" + id, + }) + }, + + // 跳转-参与详情 + jumpParticipateDetail(e) { + return + console.log('jumpParticipateDetail', e); + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: "/pages/meeting/invite/invite?id=" + id, + }) + }, + + // tab 点击切换 + tabClickSwitch(event) { + return + console.log('tabClickSwitch', event); + let _this = this; + _this.setData({ + tabTitle: event.detail.title + }) + }, + // 取消预约一系列方法 + cancelConfirm(e) { + console.log('cancelConfirm', e); + let _this = this; + let id = e.currentTarget.dataset.id + _this.setData({ + cancelId: id, + showCancelReason: true, + cancelReason: '' + }) + }, + onCloseCancel(e) { + let _this = this; + _this.setData({ + cancelId: '', + showCancelReason: false, + cancelReason: '' + }) + }, + onChangeCancelReason(e) { + let _this = this; + _this.setData({ + cancelReason: e.detail + }) + }, + // 取消订单 + cancelOrder() { + let _this = this; + let id = _this.data.cancelId + let reason = _this.data.cancelReason + if (id === '') { + return + } + if (reason === '') { + Notify('请输入取消原因!') + return + } + cancelOrderRq({ + id: id, + cancelResaon: reason + }).then(res => { + console.log('cancelOrderRq', res); + if (res.code == 0) { + // 刷新预约数据 + _this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + showCancelReason: false + }) + _this.getDataList() + } else { + // 危险通知 + Notify({ + type: 'danger', + message: res.msg + }); + } + }) + }, + editConfirm(e) { + let id = e.currentTarget.dataset.id + this.setData({ + editId: id, + showEdit: true + }) + }, + hideEdit() { + this.setData({ + showEdit: false + }) + }, + editMode(e) { + let _this = this + if (e.detail.type === 1) { + // 重选时间会议室 + this.setData({ + showEdit: false, + timeShow: true + }) + } else { + // 直接跳转 + console.log('重新编辑会议基本信息!') + this.setData({ + showEdit: false, + }) + wx.navigateTo({ + url: "/pages/meeting/meetingRoom/meetingOrder/meetingOrder?rId=" + _this.data.editId, + }) + } + }, + showTimePicker() { + this.setData({ + timeShow: true + }); + }, + hideTimePicker() { + this.setData({ + timeShow: false + }); + }, + // 跳转会议预约页面 + goRes(e) { + let _this = this + // 加入rId参数,为预约id,用于重新修改 + wx.navigateTo({ + url: '/pages/meeting/meetingReservation/meetingReservation?rId=' + _this.data.editId + '&time=' + e.detail, + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + let _this = this; + // 数据是否变化 + if (_this.data.dataChange) { + // 刷新数据 + _this.setData({ dataChange: false, - tabTitle: '预约记录', // 预约记录参数 reservationPageNum: 1, - reservationPageSize: 10, reservationDataList: [], reservationIsDataAll: false, - // 参与记录参数,不需要 + // 搜索重置 + ['search.title.value']: '', + ['search.status.value']: 0 + // 参与记录参数 // participatePageNum: 1, - // participatePageSize: 10, // participateDataList: [], // participateIsDataAll: false, - }, + }) - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let _this = this; - _this.setData({ - userData: wx.getStorageSync('user'), - }) - // 获取数据 - let userId = _this.data.userData.id - // 获取预约数据 - _this.getReservationData({ - userId, - pageNum: _this.data.reservationPageNum, - pageSize: _this.data.reservationPageSize, - }) - // 获取参与数据 - // _this.getParticipateData({ - // userId, - // pageNum: _this.data.participatePageNum, - // pageSize: _this.data.participatePageSize - // }) - }, - - // 获取数据 - getDataList() { - // 获取参数 - let _this = this; - let tabTitle = _this.data.tabTitle - let userId = _this.data.userData.id - let isDataAll = null - let pageNum = null - let pageSize = null - // 预约记录参数,目前只保留预约记录,其余去掉 - isDataAll = _this.data.reservationIsDataAll - pageNum = _this.data.reservationPageNum - pageSize = _this.data.reservationPageSize - // if (tabTitle == '预约记录') { - // // 预约记录参数 - // isDataAll = _this.data.reservationIsDataAll - // pageNum = _this.data.reservationPageNum - // pageSize = _this.data.reservationPageSize - - // } else if (tabTitle == '预约记录') { - // // 参与记录参数 - // isDataAll = _this.data.participateIsDataAll - // pageNum = _this.data.participatePageNum - // pageSize = _this.data.participatePageSize - // } else { - // wx.showToast({ - // title: `tab 切换错误(${tabTitle})`, - // icon: 'none', - // }); - // return; - // } - - // 判断数据是否已全部加载 - if (isDataAll) { - return; - } - // 传递参数 - let param = { - userId, - pageNum, - pageSize - } - _this.getReservationData(param) - // if (tabTitle == '预约记录') { - // // 获取预约数据 - // _this.getReservationData(param) - // } else if (tabTitle == '预约记录') { - // // 获取参与数据 - // _this.getParticipateData(param) - // } - }, - - // 获取预约数据 - getReservationData(param) { - let _this = this; - let { - pageNum, - pageSize, - userId - } = param - // 查询数据 - selectReservationListByUserIdRq({ - pageNum, - pageSize, - userId, - parkId: 25, - }).then(res => { - console.log('selectReservationListByUserIdRq', res); - // 判断数据是否全部查询 - let queryDataList = res.page.records; - if (queryDataList && queryDataList.length > 0) { - // 更新参数 - let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList)); - let reservationPageNum = _this.data.reservationPageNum + 1; - _this.setData({ - reservationPageNum, - reservationDataList, - }) - } else { - _this.setData({ - reservationIsDataAll: true - }) - } - }) - }, - - // 获取参与数据,此处不需要 - getParticipateData(param) { - let _this = this; - let { - pageNum, - pageSize, - userId - } = param - // 查询数据 - selectVisitorInvitationRecordRq({ - pageNum, - pageSize, - userId - }).then(res => { - console.log('selectVisitorInvitationRecordRq', res); - // 判断数据是否全部查询 - let queryDataList = res.page.records; - if (queryDataList && queryDataList.length > 0) { - // 更新参数 - let participateDataList = _this.data.participateDataList.concat(_this.formartData(queryDataList)); - let participatePageNum = _this.data.participatePageNum + 1; - _this.setData({ - participatePageNum, - participateDataList, - }) - } else { - _this.setData({ - participateIsDataAll: true - }) - } - }) - }, - - // 格式化数据 - formartData(queryDataList) { - // 格式化数据 - return queryDataList.map(item => { - item.timeSlot = selfFormatTimeYMD(item.startTime) + ' ' + selfFormatTimeHM(item.startTime) + '~' + selfFormatTimeHM(item.endDate); - // 状态字体颜色 - let statusColor = "#FFB119"; - // 按钮是否显示 - let statusValue = item.statusValue; - let showPay = false; - let showInvite = false; - let showCancel = false; - let showDetail = false; - // 待支付 0 :去支付、取消订单、查看详情 - if (statusValue == 0) { - showPay = true; - showCancel = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#FFB119"; - } - // 待使用 1:去邀请、取消订单、查看详情 - if (statusValue == 1) { - showInvite = true; - showCancel = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#3794FF"; - // 待使用 修改为 预约成功 - item.statusName = '预约成功' - } - // 进行中 2:去邀请、查看详情 - if (statusValue == 2) { - showInvite = true; - showDetail = true; - // 状态字体颜色 - statusColor = "#FF4040"; - } - // 已结束 3:查看详情 - if (statusValue == 3) { - showDetail = true; - // 状态字体颜色 - statusColor = "#333333"; - } - // 已取消 4:查看详情 - if (statusValue == 4) { - showDetail = true; - // 状态字体颜色 - statusColor = "#7F7F7F"; - } - // - // 赋值 - item.showPay = showPay; - item.showInvite = showInvite; - item.showCancel = showCancel; - item.showDetail = showDetail; - // 状态字体颜色 - item.statusColor = statusColor; - // 图片 - if (item.roomContent.indoorPicUrl) { - try { - item.roomContent.indoorPicUrlFirst = JSON.parse(item.roomContent.indoorPicUrl)[0].url - } catch (error) { - console.log(`JSON error : ${error}`); - } - } - return item; - }) - - }, - - // 跳转-支付,此处不需要 - jumpPay(e) { - return - console.log('jumpPay', e); - wx.navigateTo({ - url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom" - }) - }, - - // 跳转-预约详情 - jumpMeetingDetail(e) { - console.log('jumpMeetingDetail', e); - let id = e.currentTarget.dataset.id - wx.navigateTo({ - url: "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?id=" + id, - }) - }, - - // 跳转-参与详情 - jumpParticipateDetail(e) { - return - console.log('jumpParticipateDetail', e); - let id = e.currentTarget.dataset.id - wx.navigateTo({ - url: "/pages/meeting/invite/invite?id=" + id, - }) - }, - - // tab 点击切换 - tabClickSwitch(event) { - return - console.log('tabClickSwitch', event); - let _this = this; - _this.setData({ - tabTitle: event.detail.title - }) - }, - - // 取消订单 - cancelOrder(e) { - console.log('cancelOrder', e); - let _this = this; - let id = e.currentTarget.dataset.id - const beforeClose = (action) => { - console.log('action', action); - return new Promise((resolve) => { - if (action === 'confirm') { - cancelOrderRq({ - id, - cancelResaon: "" - }).then(res => { - console.log('cancelOrderRq', res); - if (res.code == 0) { - // 刷新预约数据 - _this.setData({ - reservationPageNum: 1, - reservationDataList: [], - reservationIsDataAll: false, - }) - _this.getDataList() - } else { - // 危险通知 - Notify({ - type: 'danger', - message: res.msg - }); - } - resolve(true); - }) - } else { - // 拦截取消操作 - resolve(true); - } - }); - } - Dialog.confirm({ - title: '提示', - message: '是否取消预约!', - beforeClose, - }); - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - let _this = this; - // 数据是否变化 - if (_this.data.dataChange) { - // 刷新数据 - _this.setData({ - dataChange: false, - // 预约记录参数 - reservationPageNum: 1, - reservationDataList: [], - reservationIsDataAll: false, - // 参与记录参数 - // participatePageNum: 1, - // participateDataList: [], - // participateIsDataAll: false, - }) - - // 获取数据 - let userId = _this.data.userData.id - // 获取预约数据 - _this.getReservationData({ - userId, - pageNum: _this.data.reservationPageNum, - pageSize: _this.data.reservationPageSize, - }) - // 获取参与数据 - // _this.getParticipateData({ - // userId, - // pageNum: _this.data.participatePageNum, - // pageSize: _this.data.participatePageSize - // }) - } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - console.log('onPullDownRefresh', '页面相关事件处理函数--监听用户下拉动作'); - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - console.log('onReachBottom', '页面上拉触底事件的处理函数'); - let _this = this; - // 获取数据 - _this.getDataList() - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage(e) { - console.log('onShareAppMessage', e); - let _this = this; - let id = e.target.dataset.id; - let detail = _this.data.reservationDataList.find(item => item.id == id) - // - let param = { - title: detail.title, - path: "/pages/meeting/invite/invite?id=" + id, - imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, - } - console.log('onShareAppMessage', param); - return param; + // 获取数据 + let userId = _this.data.userData.id + // 获取预约数据 + _this.getReservationData({ + userId, + pageNum: _this.data.reservationPageNum, + pageSize: _this.data.reservationPageSize, + }) + // 获取参与数据 + // _this.getParticipateData({ + // userId, + // pageNum: _this.data.participatePageNum, + // pageSize: _this.data.participatePageSize + // }) } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + console.log('onPullDownRefresh', '页面相关事件处理函数--监听用户下拉动作'); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('onReachBottom', '页面上拉触底事件的处理函数'); + let _this = this; + // 获取数据 + _this.getDataList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage(e) { + console.log('onShareAppMessage', e); + let _this = this; + let id = e.target.dataset.id; + let detail = _this.data.reservationDataList.find(item => item.id == id) + // + let param = { + title: detail.title, + path: "/pages/meeting/invite/invite?id=" + id, + imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, + } + console.log('onShareAppMessage', param); + return param; + } }) \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.json b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.json index 1661855..4511069 100644 --- a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.json +++ b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.json @@ -1,11 +1,18 @@ { - "usingComponents": { - "van-tab": "@vant/weapp/tab/index", - "van-tabs": "@vant/weapp/tabs/index", - "van-divider": "@vant/weapp/divider/index", - "van-dialog": "@vant/weapp/dialog/index", - "van-notify": "@vant/weapp/notify/index" - }, - "navigationBarTitleText": "预约记录", - "onReachBottomDistance": 100 + "usingComponents": { + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "van-divider": "@vant/weapp/divider/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-notify": "@vant/weapp/notify/index", + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-popup": "@vant/weapp/popup/index", + "van-action-sheet": "@vant/weapp/action-sheet/index" + }, + "navigationBarTitleText": "预约记录", + "onReachBottomDistance": 100 } \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.wxml b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.wxml index 98076f2..f785e47 100644 --- a/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.wxml +++ b/miniprogram/pages/meeting/reservationRecord/meetingRecord/meetingRecord.wxml @@ -50,7 +50,19 @@ --> - + + + + + + + + 查询 + + + + + {{item.title}} @@ -65,23 +77,35 @@ - 取消原因: {{item.cancelResaon}} + {{item.cancelResaon}} - 取消预约 - 查看详情 + 取消预约 + 修改信息 + + 数据已全部加载 + - + + + + + + + - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/service/service.js b/miniprogram/pages/meeting/reservationRecord/service/service.js new file mode 100644 index 0000000..acd6b08 --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/service/service.js @@ -0,0 +1,302 @@ +const app = getApp() + +import Dialog from '@vant/weapp/dialog/dialog'; +import Notify from '@vant/weapp/notify/notify'; + +import { + selfFormatTimeYMD, + selfFormatTimeHM +} from "../../../../utils/util.js" + +import { + selectReservationListByUserIdRq, + selectVisitorInvitationRecordRq, + cancelOrderRq +} from "../../../../api/meeting/meetingRoom.js" + +Page({ + + /** + * 页面的初始数据 + */ + data: { + IMG_NAME: app.IMG_NAME, + userData: null, + dataChange: false, + // 我的服务参数 + reservationPageNum: 1, + reservationPageSize: 10, + reservationDataList: [], + reservationIsDataAll: false, + search: { + title: { + text: '会议名称', + value: '' + }, + status: { + value: 1, + option: [{ + text: '全部会议', + value: '' + }, + { + text: '待开始', + value: 1 + }, + { + text: '已结束', + value: 2 + }, + ] + } + }, + }, + changeSearchTitle(e) { + this.setData({ + ['search.title.value']: e.detail, + }) + }, + searchTitle() { + // 刷新预约数据 + this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + }) + this.getDataList() + this.selectComponent('#item').toggle() + }, + changeSearchStatus(e) { + // 刷新预约数据 + this.setData({ + reservationPageNum: 1, + reservationDataList: [], + reservationIsDataAll: false, + ['search.status.value']: e.detail + }) + this.getDataList() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let _this = this; + _this.setData({ + userData: wx.getStorageSync('user'), + }) + // 获取数据 + let userId = _this.data.userData.id + // 获取预约数据 + _this.getReservationData({ + userId, + pageNum: _this.data.reservationPageNum, + pageSize: _this.data.reservationPageSize, + }) + }, + + // 获取数据 + getDataList() { + // 获取参数 + let _this = this; + let tabTitle = _this.data.tabTitle + let userId = _this.data.userData.id + let isDataAll = null + let pageNum = null + let pageSize = null + // 预约记录参数,目前只保留预约记录,其余去掉 + isDataAll = _this.data.reservationIsDataAll + pageNum = _this.data.reservationPageNum + pageSize = _this.data.reservationPageSize + + // 判断数据是否已全部加载 + if (isDataAll) { + return; + } + // 传递参数 + let param = { + userId, + pageNum, + pageSize + } + _this.getReservationData(param) + }, + + // 获取会议数据 + getReservationData(param) { + let _this = this; + let { + pageNum, + pageSize, + userId + } = param + // 查询数据 + selectReservationListByUserIdRq({ + pageNum, + pageSize, + userId, + parkId: 25, + title: _this.data.search.title.value, + statusValue: _this.data.search.status.value + }).then(res => { + console.log('selectReservationListByUserIdRq', res); + // 判断数据是否全部查询 + let queryDataList = res.page.records; + if (queryDataList && queryDataList.length > 0) { + // 更新参数 + let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList)); + let reservationPageNum = _this.data.reservationPageNum + 1; + _this.setData({ + reservationPageNum, + reservationDataList, + }) + } else { + _this.setData({ + reservationIsDataAll: true + }) + } + }) + }, + + // 格式化数据 + formartData(queryDataList) { + // 格式化数据 + return queryDataList.map(item => { + item.timeSlot = selfFormatTimeYMD(item.startTime) + ' ' + selfFormatTimeHM(item.startTime) + '~' + selfFormatTimeHM(item.endDate); + // 状态字体颜色 + let statusColor = "#FFB119"; + // 按钮是否显示 + let statusValue = item.statusValue; + let showPay = false; + let showInvite = false; + let showCancel = false; + let showDetail = false; + // 待支付 0 :去支付、取消订单、查看详情 + if (statusValue == 0) { + showPay = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FFB119"; + } + // 待使用 1:去邀请、取消订单、查看详情 + if (statusValue == 1) { + showInvite = true; + showCancel = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#3794FF"; + // 待使用 修改为 预约成功 + item.statusName = '预约成功' + } + // 进行中 2:去邀请、查看详情 + if (statusValue == 2) { + showInvite = true; + showDetail = true; + // 状态字体颜色 + statusColor = "#FF4040"; + } + // 已结束 3:查看详情 + if (statusValue == 3) { + showDetail = true; + // 状态字体颜色 + statusColor = "#333333"; + } + // 已取消 4:查看详情 + if (statusValue == 4) { + showDetail = true; + // 状态字体颜色 + statusColor = "#7F7F7F"; + } + // + // 赋值 + item.showPay = showPay; + item.showInvite = showInvite; + item.showCancel = showCancel; + item.showDetail = showDetail; + // 状态字体颜色 + item.statusColor = statusColor; + // 图片 + if (item.roomContent.indoorPicUrl) { + try { + item.roomContent.indoorPicUrlFirst = JSON.parse(item.roomContent.indoorPicUrl)[0].url + } catch (error) { + console.log(`JSON error : ${error}`); + } + } + return item; + }) + + }, + + // 跳转-预约详情 + jumpMeetingDetail(e) { + console.log('jumpMeetingDetail', e); + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?id=" + id, + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + let _this = this; + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + console.log('onPullDownRefresh', '页面相关事件处理函数--监听用户下拉动作'); + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('onReachBottom', '页面上拉触底事件的处理函数'); + let _this = this; + // 获取数据 + _this.getDataList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage(e) { + console.log('onShareAppMessage', e); + let _this = this; + let id = e.target.dataset.id; + let detail = _this.data.reservationDataList.find(item => item.id == id) + // + let param = { + title: detail.title, + path: "/pages/meeting/invite/invite?id=" + id, + imageUrl: app.IMG_NAME + detail.roomContent.indoorPicUrlFirst, + } + console.log('onShareAppMessage', param); + return param; + } +}) \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/service/service.json b/miniprogram/pages/meeting/reservationRecord/service/service.json new file mode 100644 index 0000000..6f9a2a8 --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/service/service.json @@ -0,0 +1,18 @@ +{ + "usingComponents": { + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "van-divider": "@vant/weapp/divider/index", + "van-dialog": "@vant/weapp/dialog/index", + "van-notify": "@vant/weapp/notify/index", + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "van-field": "@vant/weapp/field/index", + "van-button": "@vant/weapp/button/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-popup": "@vant/weapp/popup/index", + "van-action-sheet": "@vant/weapp/action-sheet/index" + }, + "navigationBarTitleText": "会务服务", + "onReachBottomDistance": 100 +} \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/service/service.wxml b/miniprogram/pages/meeting/reservationRecord/service/service.wxml new file mode 100644 index 0000000..f28302a --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/service/service.wxml @@ -0,0 +1,36 @@ + + + + + + + + + 查询 + + + + + + + + {{item.title}} + {{item.statusName}} + + + + + {{item.roomContent.buildingName}} | {{item.roomContent.roomName}} | {{item.roomContent.capacityNum}} | {{item.roomContent.shape}} + 预约人: {{item.createBy}} + {{item.timeSlot}} + + + + {{item.cancelResaon}} + + + + 数据已全部加载 + + + \ No newline at end of file diff --git a/miniprogram/pages/meeting/reservationRecord/service/service.wxss b/miniprogram/pages/meeting/reservationRecord/service/service.wxss new file mode 100644 index 0000000..964381e --- /dev/null +++ b/miniprogram/pages/meeting/reservationRecord/service/service.wxss @@ -0,0 +1,136 @@ +.containerView.public { + background: none; + height: auto; +} + +.itemView { + background: white; + margin: 30rpx 20rpx; + padding: 30rpx 20rpx; + /* box-shadow: rgba(210,210,210,0.5) 0px 3.752px 3.752px 0px; */ +} + +.itemView .headView { + display: flex; + justify-content: space-between; + align-items: center; +} + +.itemView .headView .number { + flex: 1; + margin-right: 30rpx; + font-size: 26rpx; + + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; +} + +.itemView .headView .status { + font-size: 26rpx; + color: #4e96f8; + margin-right: 20rpx; +} + +.itemView .contentView { + box-sizing: border-box; + border-radius: 10rpx; + width: 100%; + margin-top: 20rpx; + padding: 30rpx 20rpx; + display: flex; + justify-content: flex-start; + align-items: center; + background: #f2f2f2; +} + +.itemView .contentView .img { + border-radius: 10rpx; + width: 200rpx; + height: 110rpx; +} + +.itemView .contentView .msgView { + flex: 1; + margin-left: 20rpx; + word-break: break-all; +} + +.itemView .contentView .msgView .title { + font-size: 28rpx; +} + +.itemView .contentView .msgView .name, +.itemView .contentView .msgView .time { + font-size: 24rpx; + color: gray; + margin-top: 6rpx; +} + +.itemView .priceView { + display: flex; + justify-content: flex-end; + align-items: center; + margin: 30rpx 0; +} + +.itemView .priceView .cancelContent { + flex: 1; + margin-right: 40rpx; + font-size: 26rpx; + color: #7F7F7F; + + text-overflow: ellipsis; + overflow: hidden; + word-break: break-all; + white-space: nowrap; +} + +.itemView .priceView .priceContent { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.itemView .priceView .priceContent .name { + font-size: 26rpx; +} + +.itemView .priceView .priceContent .price { + font-size: 28rpx; + font-weight: bold; + color: red; + margin-left: 10rpx; +} + +.itemView .btnView { + display: flex; + justify-content: flex-end; + align-items: center; + +} + +.itemView .btnView .btn { + border: 1px solid #4e96f8; + position: relative; + border-radius: 10rpx; + margin-left: 16rpx; + padding: 10rpx 24rpx; + font-size: 24rpx; + color: #4e96f8; +} + +.shareBtn { + position: absolute; + z-index: 1; + width: 100%; + height: 100%; + left: 0; + top: 0; + opacity: 0; +} + +.loadAllLine { + margin-top: 80rpx; +} \ No newline at end of file