This commit is contained in:
SelfRidicule 2024-03-04 16:37:45 +08:00
parent 9c4b4b08c2
commit 8335c210ba
7 changed files with 75 additions and 25 deletions

View File

@ -35,3 +35,12 @@ export function meetingRoomBookedRecordRq(id) {
method: "get", method: "get",
}); });
} }
// 当前会议室是否可以预约
export function selectFreeMeetingRoomRq(data) {
return request({
url: '/api/roomContent/selectFreeMeetingRoom',
method: "post",
data
});
}

View File

@ -1,10 +1,10 @@
App({ App({
APPID: 'wxd9f93ef41a607dd5', APPID: 'wxd9f93ef41a607dd5',
// 本地测试时不用加/api // 本地测试时不用加/api
// DOMAIN_NAME: 'http://192.168.0.11:9227', //接口域名 DOMAIN_NAME: 'http://192.168.0.11:9227', //接口域名
// IMG_NAME: 'http://192.168.0.11:9227', IMG_NAME: 'http://192.168.0.11:9227',
DOMAIN_NAME: 'http://222.184.49.22:9227', //接口域名 // DOMAIN_NAME: 'http://222.184.49.22:9227', //接口域名
IMG_NAME: 'http://222.184.49.22:9227', // IMG_NAME: 'http://222.184.49.22:9227',
globals: { globals: {
refreshMyPages: false, refreshMyPages: false,
homedata: {}, homedata: {},

View File

@ -1,9 +1,16 @@
const app = getApp() const app = getApp()
import Notify from '@vant/weapp/notify/notify';
import { import {
meetingRoomBookedRecordRq meetingRoomBookedRecordRq,
selectFreeMeetingRoomRq
} from "../../../../api/meeting/meetingRoom.js" } from "../../../../api/meeting/meetingRoom.js"
import {selfFormatTimeReturnSecond59} from "../../../../utils/util.js" import {
selfFormatTimeReturnSecond59,
selfFormatTimeYMDHMS
} from "../../../../utils/util.js"
Page({ Page({
@ -46,16 +53,36 @@ Page({
// 确认时间 // 确认时间
confirmTime() { confirmTime() {
let meetingRoomId = this.data.meetingRoomId; let _this = this;
let startTime = this.data.startTime; let meetingRoomId = _this.data.meetingRoomId;
let endTime = this.data.endTime; let startTime = _this.data.startTime;
let endTime = _this.data.endTime;
let paramUrl = "?meetingRoomId=" + meetingRoomId + "&startTime=" + startTime + "&endTime=" + endTime; let paramUrl = "?meetingRoomId=" + meetingRoomId + "&startTime=" + startTime + "&endTime=" + endTime;
// 当前会议室是否可以预约
selectFreeMeetingRoomRq({
"roomContentId": meetingRoomId,
"startTime": selfFormatTimeYMDHMS(startTime),
"endDate": selfFormatTimeYMDHMS(endTime)
}).then(res => {
console.log('selectFreeMeetingRoomRq', res);
// 可以预约
if (!res.count) {
wx.navigateTo({ wx.navigateTo({
url: "/pages/meeting/meetingRoom/meetingOrder/meetingOrder" + paramUrl, url: "/pages/meeting/meetingRoom/meetingOrder/meetingOrder" + paramUrl,
}) })
this.setData({ _this.setData({
showTime: false showTime: false
}) })
} else { // 不能预约
Notify({
type: 'danger',
message: res.msg,
duration: 1000,
selector: '#notify',
});
}
})
}, },
// 取消时间 // 取消时间

View File

@ -1,7 +1,8 @@
{ {
"usingComponents": { "usingComponents": {
"van-datetime-picker": "@vant/weapp/datetime-picker/index", "van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-popup": "@vant/weapp/popup/index" "van-popup": "@vant/weapp/popup/index",
"van-notify": "@vant/weapp/notify/index"
}, },
"navigationBarTitleText": "会议室已预约" "navigationBarTitleText": "会议室已预约"
} }

View File

@ -18,13 +18,12 @@
<!-- 选择时间 --> <!-- 选择时间 -->
<view class="selfPop" wx:if="{{showTime}}"> <view class="selfPop" wx:if="{{showTime}}">
<van-datetime-picker title="请选择开始时间" type="datetime" value="{{ startTime }}" min-date="{{ minTime }}" max-date="{{ maxTime }}" bind:input="onInputStartTime" bind:confirm="confirmTime" bind:cancel="cancelTime" <van-datetime-picker title="请选择开始时间" type="datetime" value="{{ startTime }}" min-date="{{ minTime }}" max-date="{{ maxTime }}" bind:input="onInputStartTime" bind:confirm="confirmTime" bind:cancel="cancelTime" confirm-button-text="" cancel-button-text="" />
confirm-button-text=""
cancel-button-text=""/>
<van-datetime-picker title="请选择结束时间" type="datetime" value="{{ endTime }}" min-date="{{ startTime }}" max-date="{{ endMaxTime }}" bind:input="onInputEndTime" <van-datetime-picker title="请选择结束时间" type="datetime" value="{{ endTime }}" min-date="{{ startTime }}" max-date="{{ endMaxTime }}" bind:input="onInputEndTime" bind:confirm="confirmTime" bind:cancel="cancelTime" />
bind:confirm="confirmTime" bind:cancel="cancelTime"/>
</view> </view>
<!-- 消息提示 -->
<van-notify id="notify" />
</view> </view>

View File

@ -19,7 +19,7 @@
</view> </view>
<view class="priceView"> <view class="priceView">
<view class="price">¥ 200.00/</view> <view class="price">¥ 200.00/</view>
<view class="unit">小时 起</view> <view class="unit">小时 起</view>
</view> </view>
</view> </view>

View File

@ -85,6 +85,19 @@ function selfFormatTimeReturnSecond59(time) {
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, '59'].map(formatNumber).join(':') return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, '59'].map(formatNumber).join(':')
} }
//返回 2017-12-12 12:30:59
function selfFormatTimeYMDHMS(time) {
let date = new Date(time);
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => { const formatNumber = n => {
n = n.toString() n = n.toString()
@ -98,5 +111,6 @@ module.exports = {
formatDate2: formatDate2, formatDate2: formatDate2,
formatHour: formatHour, formatHour: formatHour,
formatTime2: formatTime2, formatTime2: formatTime2,
selfFormatTimeReturnSecond59 selfFormatTimeReturnSecond59,
selfFormatTimeYMDHMS
} }