mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 23:39:36 +08:00
196 lines
4.8 KiB
JavaScript
196 lines
4.8 KiB
JavaScript
const app = getApp()
|
|
|
|
import {
|
|
meetingRoomDetailRq,
|
|
getCustomerTicketRq
|
|
} from "../../../../api/meeting/meetingRoom.js"
|
|
|
|
import {
|
|
selfFormatTimeYMD,
|
|
selfFormatTimeHM,
|
|
twoTimeInterval
|
|
} 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: {},
|
|
couponId: '',
|
|
couponData : {},
|
|
couponList: [],
|
|
couponUseList: [],
|
|
couponNotUseList: [],
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
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();
|
|
// 获取优惠卷
|
|
this.getCustomerTicket();
|
|
},
|
|
|
|
// 详细信息
|
|
getDetail() {
|
|
let _this = this;
|
|
meetingRoomDetailRq(this.data.meetingRoomId).then(res => {
|
|
_this.setData({
|
|
room: res.roomContent,
|
|
bannerList: [res.roomContent.indoorPicUrl]
|
|
})
|
|
})
|
|
},
|
|
|
|
// 获取优惠卷
|
|
getCustomerTicket() {
|
|
let _this = this;
|
|
getCustomerTicketRq({
|
|
"userId": _this.data.userData.id,
|
|
"customerId": _this.data.userData.icsCustomerId,
|
|
"type": '1'
|
|
}).then(res => {
|
|
let nowTime = new Date().getTime();
|
|
let dataList = res.data.map(item => {
|
|
item.startTime = selfFormatTimeYMD(item.startTime)
|
|
item.endDate = selfFormatTimeYMD(item.endDate)
|
|
let kaishiTime = new Date(item.startTime + " 00:00:00")
|
|
let jieshuTime = new Date(item.endDate + " 23:59:59")
|
|
if (nowTime >= kaishiTime && nowTime <= jieshuTime) {
|
|
item.isDisable = false
|
|
} else {
|
|
item.isDisable = true
|
|
}
|
|
return item;
|
|
})
|
|
// 可用
|
|
let useList = res.data.filter(item => !item.isDisable)
|
|
// 不可用
|
|
let notUseList = res.data.filter(item => item.isDisable)
|
|
_this.setData({
|
|
couponList: dataList,
|
|
couponUseList: useList,
|
|
couponNotUseList: notUseList,
|
|
})
|
|
})
|
|
},
|
|
|
|
// 跳转-空间设施
|
|
jumpMeetingFacilities() {
|
|
let meetingRoomId = this.data.meetingRoomId;
|
|
wx.navigateTo({
|
|
url: '/pages/meeting/meetingRoom/meetingFacilities/meetingFacilities?meetingRoomId=' + meetingRoomId,
|
|
})
|
|
},
|
|
|
|
// 跳转-优惠卷
|
|
jumpMeetingCoupon() {
|
|
let _this = this;
|
|
wx.navigateTo({
|
|
url: "/pages/meeting/meetingRoom/meetingCoupon/meetingCoupon?type=1&couponId=" + _this.data.couponId,
|
|
})
|
|
},
|
|
|
|
// 协议点击
|
|
protocolChange() {
|
|
let _this = this;
|
|
_this.setData({
|
|
protocolFlag: !_this.data.protocolFlag
|
|
});
|
|
},
|
|
|
|
// 跳转协议
|
|
jumpProtocol() {
|
|
let _this = this;
|
|
wx.navigateTo({
|
|
url: "/pages/meeting/meetingRoom/meetingProtocol/meetingProtocol?title=" + _this.data.protocolTitle,
|
|
})
|
|
},
|
|
|
|
// 提交订单
|
|
submitCase() {
|
|
wx.redirectTo({
|
|
url: "/pages/meeting/pay/waitPay/waitPay",
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
console.log('onShow');
|
|
let _this = this
|
|
_this.data.couponData
|
|
if(_this.data.couponId){
|
|
let couponData = _this.data.couponList.find(item=> item.id == _this.data.couponId)
|
|
_this.setData({
|
|
couponData
|
|
})
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |