const app = getApp() import Dialog from '@vant/weapp/dialog/dialog'; import Notify from '@vant/weapp/notify/notify'; import { meetingRoomDetailRq, getCustomerTicketRq, calculateMeetingRoomAmountRq, saveMeetingRecordRq } from "../../../../api/meeting/meetingRoom.js" import { selfFormatTimeYMD, selfFormatTimeHM, twoTimeInterval, selfArrSum } from "../../../../utils/util.js" Page({ /** * 页面的初始数据 */ data: { IMG_NAME: app.IMG_NAME, protocolFlag: true, protocolTitle: '《会议室服务协议》', meetingRoomId: null, startTime: null, endTime: null, selectDay: null, selectCountTime: null, bannerList: [], room: {}, userData: {}, serviceList : [], }, /** * 生命周期函数--监听页面加载 */ 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 }) // 详细信息 this.getDetail(); }, // 详细信息 getDetail() { let _this = this; meetingRoomDetailRq(this.data.meetingRoomId).then(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({ room: detail, bannerList }) }) }, // 主题修改监听 titleChange(event) { this.setData({ title: event.detail }) }, // 跳转-空间设施 jumpMeetingFacilities() { let meetingRoomId = this.data.meetingRoomId; let serviceListJsonStr = JSON.stringify(this.data.serviceList) wx.navigateTo({ url: `/pages/meeting/meetingRoom/meetingService/meetingService?meetingRoomId=${meetingRoomId}&serviceList=${serviceListJsonStr}` }) }, // 提交订单 submitCase() { let _this = this // 参数校验 if (!_this.data.title) { // 错误提示 Notify({ type: 'danger', message: '请输入会议主题!' }); return; } saveMeetingRecordRq({ "roomContentId": _this.data.meetingRoomId, "userId": _this.data.userData.id, "ticketId": _this.data.couponId, "customerId": _this.data.userData.icsCustomerId, "title": _this.data.title, "startTime": _this.data.startTime, "endDate": _this.data.endTime, "orderMoney": _this.data.totalAmount, }).then(res => { console.log('saveMeetingRecordRq', res); if (res.code == 0) { wx.reLaunch({ url: '/pages/meeting/pay/waitComplete/waitComplete', }) } else { // 错误提示 Notify({ type: 'danger', message: res.msg }); } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { console.log('onShow'); let _this = this }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })