2024-09-18 20:35:54 +08:00
|
|
|
const app = getApp()
|
|
|
|
|
|
|
|
import Notify from '@vant/weapp/notify/notify';
|
|
|
|
|
|
|
|
import {
|
2024-09-27 17:37:49 +08:00
|
|
|
getStaff,
|
|
|
|
selectReservationByIdRq,
|
|
|
|
addStaff
|
2024-09-18 20:35:54 +08:00
|
|
|
} from "../../../../api/meeting/meetingRoom.js"
|
|
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
IMG_NAME: app.IMG_NAME,
|
|
|
|
rId: '',
|
|
|
|
checkUser: [],
|
2024-09-27 17:37:49 +08:00
|
|
|
// staffMusicList: [{
|
|
|
|
// id: 1,
|
|
|
|
// name: '张三',
|
|
|
|
// isSelect: false
|
|
|
|
// }],
|
|
|
|
staffMusicList: [],
|
|
|
|
// staffServeList: [{
|
|
|
|
// id: 4,
|
|
|
|
// name: '赵六',
|
|
|
|
// isSelect: false
|
|
|
|
// }],
|
2024-10-20 13:56:54 +08:00
|
|
|
staffServeList: [],
|
|
|
|
serviceCheckAll: false,
|
|
|
|
musicCheckAll: false
|
2024-09-18 20:35:54 +08:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
let _this = this
|
|
|
|
let rId = options.rId
|
|
|
|
|
|
|
|
// console.log(ser)
|
|
|
|
_this.setData({
|
|
|
|
rId: rId
|
|
|
|
})
|
|
|
|
// 获取数据
|
|
|
|
_this.getData()
|
|
|
|
},
|
|
|
|
|
|
|
|
// 获取数据
|
|
|
|
getData() {
|
2024-09-27 17:37:49 +08:00
|
|
|
let _this = this
|
|
|
|
let id = _this.data.rId
|
|
|
|
// 获取预约信息
|
|
|
|
selectReservationByIdRq({
|
|
|
|
id: id
|
|
|
|
}).then(res => {
|
|
|
|
console.log('预约信息:', res)
|
|
|
|
let staffIdArr = []
|
|
|
|
let staff = res.waiters
|
|
|
|
for (let key in staff) {
|
|
|
|
staffIdArr.push(staff[key].userId)
|
|
|
|
}
|
|
|
|
getStaff().then(resStaff => {
|
|
|
|
console.log('会务人员:', resStaff)
|
|
|
|
let musicList = []
|
|
|
|
let serveList = []
|
|
|
|
for (let key in resStaff.voiceWaiter) {
|
|
|
|
let eachObj = resStaff.voiceWaiter[key]
|
|
|
|
let isSel = false
|
|
|
|
if (staffIdArr.includes(eachObj.id)) {
|
|
|
|
isSel = true
|
|
|
|
}
|
|
|
|
musicList.push({
|
|
|
|
id: eachObj.id,
|
|
|
|
name: eachObj.username,
|
|
|
|
isSelect: isSel
|
|
|
|
})
|
|
|
|
}
|
|
|
|
for (let key in resStaff.serveWaiter) {
|
|
|
|
let eachObj = resStaff.serveWaiter[key]
|
|
|
|
let isSel = false
|
|
|
|
if (staffIdArr.includes(eachObj.id)) {
|
|
|
|
isSel = true
|
|
|
|
}
|
|
|
|
serveList.push({
|
|
|
|
id: eachObj.id,
|
|
|
|
name: eachObj.username,
|
|
|
|
isSelect: isSel
|
|
|
|
})
|
|
|
|
}
|
|
|
|
_this.setData({
|
|
|
|
staffServeList: serveList,
|
|
|
|
staffMusicList: musicList
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2024-09-18 20:35:54 +08:00
|
|
|
// ajax获取当前预约的人员以及会务人员列表
|
|
|
|
},
|
|
|
|
|
|
|
|
// 服务选择
|
|
|
|
checkBoxClick(e) {
|
|
|
|
let _this = this
|
|
|
|
console.log('checkBoxClick', e)
|
|
|
|
// get param
|
|
|
|
let id = e.target.dataset.id
|
|
|
|
let type = e.target.dataset.type
|
|
|
|
if (type === 'music') {
|
|
|
|
let staffMusicList = _this.data.staffMusicList.map(item => {
|
|
|
|
if (item.id == id) {
|
|
|
|
item.isSelect = !item.isSelect
|
|
|
|
}
|
|
|
|
return item
|
|
|
|
})
|
|
|
|
_this.setData({
|
|
|
|
staffMusicList
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
let staffServeList = _this.data.staffServeList.map(item => {
|
|
|
|
if (item.id == id) {
|
|
|
|
item.isSelect = !item.isSelect
|
|
|
|
}
|
|
|
|
return item
|
|
|
|
})
|
|
|
|
_this.setData({
|
|
|
|
staffServeList
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// 确定
|
|
|
|
submit() {
|
|
|
|
let _this = this;
|
|
|
|
// 提交
|
|
|
|
console.log(_this.data.staffMusicList)
|
|
|
|
console.log(_this.data.staffServeList)
|
2024-09-27 17:37:49 +08:00
|
|
|
let staffMusicList = _this.data.staffMusicList
|
|
|
|
let staffServeList = _this.data.staffServeList
|
|
|
|
let musicId = ''
|
|
|
|
for (let key in staffMusicList) {
|
|
|
|
if (staffMusicList[key].isSelect) {
|
|
|
|
musicId += staffMusicList[key].id + ','
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (musicId != '') {
|
|
|
|
// 去掉最后一个,
|
|
|
|
musicId = musicId.substring(0, musicId.length - 1)
|
|
|
|
}
|
|
|
|
let serveId = ''
|
|
|
|
for (let key in staffServeList) {
|
|
|
|
if (staffServeList[key].isSelect) {
|
|
|
|
serveId += staffServeList[key].id + ','
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (serveId != '') {
|
|
|
|
// 去掉最后一个,
|
|
|
|
serveId = serveId.substring(0, serveId.length - 1)
|
|
|
|
}
|
|
|
|
addStaff({
|
|
|
|
id: _this.data.rId,
|
|
|
|
voiceWaiter: musicId,
|
|
|
|
serveWaiter: serveId
|
|
|
|
}).then(res => {
|
|
|
|
Notify({
|
|
|
|
type: 'success',
|
|
|
|
message: '分配成功!'
|
|
|
|
})
|
|
|
|
wx.navigateBack()
|
|
|
|
})
|
|
|
|
|
2024-09-18 20:35:54 +08:00
|
|
|
// let pages = getCurrentPages(); //获取page
|
|
|
|
// let prevPage = pages[pages.length - 2]; //上一个页面(父页面)
|
|
|
|
// prevPage.setData({
|
|
|
|
// serviceList: _this.data.serviceList
|
|
|
|
// })
|
|
|
|
// console.log(_this.data.serviceList)
|
2024-09-27 17:37:49 +08:00
|
|
|
// wx.navigateBack()
|
2024-09-18 20:35:54 +08:00
|
|
|
},
|
2024-10-20 13:56:54 +08:00
|
|
|
checkMusicAll() {
|
|
|
|
let _this = this
|
|
|
|
let checkStatus = _this.data.musicCheckAll
|
|
|
|
checkStatus = checkStatus ? false : true
|
|
|
|
let staffMusicList = _this.data.staffMusicList.map(item => {
|
|
|
|
item.isSelect = checkStatus
|
|
|
|
return item
|
|
|
|
})
|
|
|
|
_this.setData({
|
|
|
|
staffMusicList,
|
|
|
|
musicCheckAll: checkStatus
|
|
|
|
})
|
|
|
|
},
|
|
|
|
checkServiceAll() {
|
|
|
|
let _this = this
|
|
|
|
let checkStatus = _this.data.serviceCheckAll
|
|
|
|
checkStatus = checkStatus ? false : true
|
|
|
|
let staffServeList = _this.data.staffServeList.map(item => {
|
|
|
|
item.isSelect = checkStatus
|
|
|
|
return item
|
|
|
|
})
|
|
|
|
_this.setData({
|
|
|
|
staffServeList,
|
|
|
|
serviceCheckAll: checkStatus
|
|
|
|
})
|
|
|
|
},
|
2024-09-18 20:35:54 +08:00
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|