199 lines
4.7 KiB
JavaScript
Raw Normal View History

2024-02-27 12:00:47 +08:00
const app = getApp()
2024-03-05 19:18:13 +08:00
import Dialog from '@vant/weapp/dialog/dialog';
2024-03-05 20:07:13 +08:00
import Notify from '@vant/weapp/notify/notify';
2024-03-05 19:18:13 +08:00
2024-03-04 17:10:32 +08:00
import {
2024-03-05 16:00:04 +08:00
meetingRoomDetailRq,
2024-03-05 19:18:13 +08:00
getCustomerTicketRq,
2024-03-05 20:07:13 +08:00
calculateMeetingRoomAmountRq,
2024-06-27 14:55:40 +08:00
saveMeetingRecordRq,
saveChangyangMeetingRecordRq
2024-03-04 17:10:32 +08:00
} from "../../../../api/meeting/meetingRoom.js"
2024-03-04 18:00:27 +08:00
import {
selfFormatTimeYMD,
selfFormatTimeHM,
2024-04-10 10:42:06 +08:00
twoTimeInterval,
selfArrSum
2024-03-04 18:00:27 +08:00
} from "../../../../utils/util.js"
2024-02-27 12:00:47 +08:00
Page({
/**
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
2024-03-04 17:10:32 +08:00
meetingRoomId: null,
startTime: null,
endTime: null,
2024-03-04 18:00:27 +08:00
selectDay: null,
selectCountTime: null,
2024-03-04 17:10:32 +08:00
bannerList: [],
room: {},
2024-03-04 18:00:27 +08:00
userData: {},
2024-06-27 14:55:40 +08:00
serviceList: [],
title: '',
personNum: '',
2024-02-27 12:00:47 +08:00
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2024-03-04 14:38:21 +08:00
console.log('onLoad', options);
2024-03-05 16:00:04 +08:00
let selectCountTime = selfFormatTimeHM(options.startTime) + "-" + selfFormatTimeHM(options.endTime) + ' 共计' + twoTimeInterval(options.startTime, options.endTime)
2024-03-04 14:38:21 +08:00
this.setData({
2024-03-04 18:00:27 +08:00
...options,
userData: wx.getStorageSync('user'),
selectDay: selfFormatTimeYMD(options.startTime),
selectCountTime
2024-03-04 14:38:21 +08:00
})
2024-03-04 17:10:32 +08:00
// 详细信息
this.getDetail();
},
// 详细信息
getDetail() {
let _this = this;
meetingRoomDetailRq(this.data.meetingRoomId).then(res => {
let detail = res.roomContent;
let bannerList = []
if (detail.indoorPicUrl) {
try {
2024-04-10 10:42:06 +08:00
bannerList = JSON.parse(detail.indoorPicUrl).map(item => item.url)
} catch (error) {
console.log(`JSON error : ${error}`);
}
}
2024-03-04 17:10:32 +08:00
_this.setData({
room: detail,
bannerList
2024-03-04 17:10:32 +08:00
})
})
2024-02-27 12:00:47 +08:00
},
2024-06-27 14:55:40 +08:00
// input修改监听
inputChange(e) {
console.log('input change', e);
let _this = this
let name = e.currentTarget.dataset.name
let value = e.detail
let data = _this.data
data[name] = value
2024-03-05 20:07:13 +08:00
this.setData({
2024-06-27 14:55:40 +08:00
...data
2024-03-05 20:07:13 +08:00
})
},
2024-02-27 17:58:38 +08:00
// 跳转-空间设施
jumpMeetingFacilities() {
2024-03-04 17:10:32 +08:00
let meetingRoomId = this.data.meetingRoomId;
2024-06-27 12:00:33 +08:00
let serviceListJsonStr = JSON.stringify(this.data.serviceList)
2024-02-27 17:58:38 +08:00
wx.navigateTo({
2024-06-27 12:00:33 +08:00
url: `/pages/meeting/meetingRoom/meetingService/meetingService?meetingRoomId=${meetingRoomId}&serviceList=${serviceListJsonStr}`
2024-02-27 16:06:54 +08:00
})
2024-02-27 15:38:56 +08:00
},
2024-03-05 19:18:13 +08:00
2024-02-28 13:41:19 +08:00
// 提交订单
submitCase() {
2024-03-05 20:07:13 +08:00
let _this = this
// 参数校验
if (!_this.data.title) {
// 错误提示
Notify({
type: 'danger',
message: '请输入会议主题!'
});
return;
}
2024-06-27 14:55:40 +08:00
if (_this.data.personNum == '') {
// 错误提示
Notify({
type: 'danger',
message: '请输入参会人数!'
});
return;
}
saveChangyangMeetingRecordRq({
2024-03-05 20:07:13 +08:00
"roomContentId": _this.data.meetingRoomId,
"userId": _this.data.userData.id,
"customerId": _this.data.userData.icsCustomerId,
"title": _this.data.title,
2024-06-27 14:55:40 +08:00
"personNum": _this.data.personNum,
2024-03-05 20:07:13 +08:00
"startTime": _this.data.startTime,
"endDate": _this.data.endTime,
2024-06-27 14:55:40 +08:00
"orderMoney": 0,
"reservationServes" : _this.data.serviceList,
2024-03-05 20:07:13 +08:00
}).then(res => {
console.log('saveMeetingRecordRq', res);
if (res.code == 0) {
2024-06-26 09:44:57 +08:00
wx.reLaunch({
url: '/pages/meeting/pay/waitComplete/waitComplete',
})
2024-03-05 20:07:13 +08:00
} else {
// 错误提示
Notify({
type: 'danger',
message: res.msg
});
}
2024-02-28 13:41:19 +08:00
})
},
2024-02-27 12:00:47 +08:00
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
2024-03-05 16:00:04 +08:00
onShow() {
console.log('onShow');
let _this = this
2024-06-27 14:55:40 +08:00
2024-02-27 12:00:47 +08:00
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})