2024-02-26 19:30:25 +08:00
|
|
|
const app = getApp()
|
2024-03-02 16:57:04 +08:00
|
|
|
import {
|
2024-09-16 23:14:30 +08:00
|
|
|
meetingRoomDetailRq,
|
|
|
|
selectCoordinateRq,
|
|
|
|
meetingRoomBookedRecordRq
|
2024-03-02 16:57:04 +08:00
|
|
|
} from "../../../api/meeting/meetingRoom.js"
|
2024-03-06 20:27:42 +08:00
|
|
|
|
|
|
|
|
2024-02-26 19:30:25 +08:00
|
|
|
Page({
|
2024-02-26 17:17:27 +08:00
|
|
|
|
2024-09-16 23:14:30 +08:00
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
IMG_NAME: app.IMG_NAME,
|
|
|
|
meetingRoomId: null,
|
|
|
|
date: '',
|
|
|
|
timeRange: '',
|
|
|
|
detail: {},
|
|
|
|
bannerList: [],
|
|
|
|
mapData: {},
|
|
|
|
recordList: [{
|
|
|
|
date: '2024年9月18日',
|
|
|
|
time: '14:00 - 17:30',
|
|
|
|
user: '王XX',
|
|
|
|
dep: '司法局',
|
|
|
|
tel: '15811111111'
|
|
|
|
}, {
|
|
|
|
date: '2024年9月19日',
|
|
|
|
time: '14:00 - 17:30',
|
|
|
|
user: '王XX',
|
|
|
|
dep: '司法局',
|
|
|
|
tel: '15811111111'
|
|
|
|
}],
|
|
|
|
canRes: true // 是否允许预约
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
let _this = this;
|
|
|
|
console.log('onLoad', options);
|
|
|
|
let time = options.time
|
|
|
|
let timeRange = options.timeRange
|
|
|
|
_this.setData({
|
|
|
|
date: time,
|
|
|
|
timeRange: timeRange
|
|
|
|
})
|
|
|
|
let meetingRoomId = options.id;
|
|
|
|
meetingRoomDetailRq(meetingRoomId).then(res => {
|
|
|
|
console.log('meetingRoomDetailRq', res);
|
|
|
|
let detail = res.roomContent;
|
|
|
|
let bannerList = []
|
|
|
|
if (detail.indoorPicUrl) {
|
|
|
|
try {
|
|
|
|
bannerList = JSON.parse(detail.indoorPicUrl).map(item => item.url)
|
|
|
|
} catch (error) {
|
|
|
|
console.log(`JSON error : ${error}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_this.setData({
|
|
|
|
meetingRoomId,
|
|
|
|
detail,
|
|
|
|
bannerList
|
|
|
|
})
|
|
|
|
})
|
|
|
|
meetingRoomBookedRecordRq(meetingRoomId).then(res => {
|
|
|
|
console.log('meetingRoomBookedRecordRq', res);
|
|
|
|
let _recordList = []
|
|
|
|
for (let key in res.data) {
|
|
|
|
let eachObj = res.data[key]
|
|
|
|
let _date = eachObj['nowDate']
|
|
|
|
let _dataList = eachObj['reservations']
|
|
|
|
for (let i in _dataList) {
|
|
|
|
let dateObj = _dataList[i]
|
|
|
|
let _eachData = {
|
|
|
|
date: _date,
|
|
|
|
time: dateObj.startTime.substr(11, 5) + ' - ' + dateObj.endDate.substr(11, 5),
|
|
|
|
user: dateObj.userName,
|
|
|
|
dep: '暂无',
|
|
|
|
tel: dateObj.phone,
|
|
|
|
}
|
|
|
|
_recordList.push(_eachData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_this.setData({
|
|
|
|
recordList: _recordList
|
|
|
|
})
|
|
|
|
// console.log(_recordList)
|
|
|
|
// let recordList = res.data;
|
|
|
|
// recordList.map(item => {
|
|
|
|
// item.nowDate = item.nowDate.substring(0, 10);
|
|
|
|
// item.reservations = item.reservations.map(record => {
|
|
|
|
// record.startTime = record.startTime.substring(11)
|
|
|
|
// record.endDate = record.endDate.substring(11)
|
|
|
|
// record.userName = record.userName.substring(0, 1) + "某"
|
|
|
|
// record.phone = record.phone.substring(0, 3) + "****" + record.phone.substring(7, record.phone.length)
|
|
|
|
// return record;
|
|
|
|
// })
|
|
|
|
// return item
|
|
|
|
// })
|
|
|
|
// _this.setData({
|
|
|
|
// recordList
|
|
|
|
// })
|
|
|
|
// console.log(_this.data.recordList)
|
|
|
|
})
|
|
|
|
// 获取地址信息
|
|
|
|
// _this.getAddress()
|
|
|
|
},
|
|
|
|
|
|
|
|
// 获取地址信息(不需要地址)
|
|
|
|
getAddress() {
|
|
|
|
let _this = this;
|
|
|
|
selectCoordinateRq().then(res => {
|
|
|
|
_this.setData({
|
|
|
|
address: res,
|
|
|
|
mapData: {
|
|
|
|
latitude: res.lat,
|
|
|
|
longitude: res.lng,
|
|
|
|
markers: [{
|
|
|
|
id: 1,
|
|
|
|
latitude: res.lat,
|
|
|
|
longitude: res.lng,
|
|
|
|
title: res.address,
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 打开地图,不需要地图
|
|
|
|
openMap(e) {
|
|
|
|
console.log('openMap', e);
|
|
|
|
let _this = this;
|
|
|
|
wx.openLocation({
|
|
|
|
name: _this.data.address.address,
|
|
|
|
latitude: _this.data.address.lat,
|
|
|
|
longitude: _this.data.address.lng,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 跳转空间设施,不需要
|
|
|
|
jumpMeetingFacilities() {
|
|
|
|
let meetingRoomId = this.data.meetingRoomId;
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/meeting/meetingRoom/meetingFacilities/meetingFacilities?meetingRoomId=' + meetingRoomId,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 跳转-会议室已预约
|
|
|
|
jumpMeetingBooked() {
|
|
|
|
let meetingRoomId = this.data.meetingRoomId;
|
|
|
|
let time = this.data.date
|
|
|
|
let timeRange = this.data.timeRange
|
|
|
|
wx.navigateTo({
|
|
|
|
url: "/pages/meeting/meetingRoom/meetingBooked/meetingBooked?meetingRoomId=" + meetingRoomId + '&time=' + time + '&timeRange=' + timeRange,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
}
|
2024-02-26 17:17:27 +08:00
|
|
|
})
|