471615499@qq.com a7dcd25647 会议预约功能完善
预约功能增删改查;
审核、会务列表页
2024-09-17 20:26:20 +08:00

302 lines
7.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
})