ui修改.
This commit is contained in:
parent
83668500df
commit
a3e160ffe1
|
|
@ -320,7 +320,7 @@ const handleJoin = () => {
|
||||||
.info-text {
|
.info-text {
|
||||||
font-family: PingFang SC, PingFang SC;
|
font-family: PingFang SC, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size:18rpx;
|
font-size:24rpx;
|
||||||
color: #575757;
|
color: #575757;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
||||||
|
|
@ -107,18 +107,19 @@
|
||||||
|
|
||||||
<card-container marginTop="30rpx">
|
<card-container marginTop="30rpx">
|
||||||
|
|
||||||
<label-slect-field label="鸽子费">
|
<label-slect-field label="鸽子费">
|
||||||
<com-appointment-radio-select :options="depositOptions" v-model="reservationInfo.deposit_fee" />
|
<com-appointment-radio-select :options="depositOptions" v-model="reservationInfo.deposit_fee" />
|
||||||
</label-slect-field>
|
</label-slect-field>
|
||||||
<view v-if="reservationInfo.deposit_fee === -1" :style="{ height: lineHeight }"></view>
|
<view v-if="reservationInfo.deposit_fee === -1" :style="{ height: lineHeight }"></view>
|
||||||
<label-slect-field v-if="reservationInfo.deposit_fee === -1" label="金额">
|
<label-slect-field v-if="reservationInfo.deposit_fee === -1" label="金额">
|
||||||
<view class="input-wrapper">
|
<view class="input-wrapper">
|
||||||
<up-input type="number" placeholder="请输入0-50" v-model="customDeposit" @input="onCustomDepositInput"></up-input>
|
<up-input type="number" placeholder="请输入0-50" v-model="customDeposit"
|
||||||
</view>
|
@input="onCustomDepositInput"></up-input>
|
||||||
</label-slect-field>
|
</view>
|
||||||
<view :style="{ height: lineHeight }"></view>
|
</label-slect-field>
|
||||||
<text class="note-text">鸽子费(保证金),参与人需缴纳鸽子费。若有参与者在预约后没有赴约,其鸽子费由在场的所有人平分。组局成功或失败后鸽子费将全额返还。</text>
|
<view :style="{ height: lineHeight }"></view>
|
||||||
</card-container>
|
<text class="note-text">鸽子费(保证金),参与人需缴纳鸽子费。若有参与者在预约后没有赴约,其鸽子费由在场的所有人平分。组局成功或失败后鸽子费将全额返还。</text>
|
||||||
|
</card-container>
|
||||||
|
|
||||||
<view class="action-row">
|
<view class="action-row">
|
||||||
<view class="center reset-button" @click="resetForm">
|
<view class="center reset-button" @click="resetForm">
|
||||||
|
|
@ -137,34 +138,34 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<up-datetime-picker :show="datePickerVisible" v-model="datePickerValue" mode="date"
|
<up-datetime-picker :show="datePickerVisible" v-model="datePickerValue" mode="date" :minDate="datePickerMinDate"
|
||||||
:minDate="datePickerMinDate" :maxDate="datePickerMaxDate" title="选择日期" @confirm="onDatePickerConfirm"
|
:maxDate="datePickerMaxDate" title="选择日期" @confirm="onDatePickerConfirm"
|
||||||
@cancel="() => datePickerVisible = false" @close="() => datePickerVisible = false"></up-datetime-picker>
|
@cancel="() => datePickerVisible = false" @close="() => datePickerVisible = false"></up-datetime-picker>
|
||||||
<up-datetime-picker :show="latestDateTimePickerVisible" v-model="latestDateTimePickerValue" mode="time"
|
<up-datetime-picker :show="latestDateTimePickerVisible" v-model="latestDateTimePickerValue" mode="time"
|
||||||
:minHour="latestDateTimeMinHour" :maxHour="latestDateTimeMaxHour"
|
:minHour="latestDateTimeMinHour" :maxHour="latestDateTimeMaxHour" :minMinute="latestDateTimeMinMinute"
|
||||||
:minMinute="latestDateTimeMinMinute" :maxMinute="latestDateTimeMaxMinute"
|
:maxMinute="latestDateTimeMaxMinute" title="选择最晚到店时间" @confirm="onLatestDateTimePickerConfirm"
|
||||||
title="选择最晚到店时间" @confirm="onLatestDateTimePickerConfirm"
|
@cancel="() => latestDateTimePickerVisible = false"
|
||||||
@cancel="() => latestDateTimePickerVisible = false" @close="() => latestDateTimePickerVisible = false"></up-datetime-picker>
|
@close="() => latestDateTimePickerVisible = false"></up-datetime-picker>
|
||||||
<up-picker title="年龄范围选择" :show="agePickerVisible" :columns="agePickerColumns" :keyName="'text'"
|
<up-picker title="年龄范围选择" :show="agePickerVisible" :columns="agePickerColumns" :keyName="'text'"
|
||||||
:defaultIndex="agePickerDefaultIndex" @confirm="onAgePickerConfirm" @cancel="() => agePickerVisible = false"
|
:defaultIndex="agePickerDefaultIndex" @confirm="onAgePickerConfirm" @cancel="() => agePickerVisible = false"
|
||||||
@close="() => agePickerVisible = false"></up-picker>
|
@close="() => agePickerVisible = false"></up-picker>
|
||||||
|
|
||||||
<uni-popup ref="submitPopupRef" type="center" :isMaskClick="false">
|
<uni-popup ref="submitPopupRef" type="center" :isMaskClick="false">
|
||||||
|
|
||||||
<view style="width: 90vw;height:300rpx;background-color: #fff;border-radius: 20rpx;">
|
<view style="width: 90vw; background-color: #fff; border-radius: 20rpx; padding: 20rpx;">
|
||||||
<view>
|
<view>
|
||||||
<view style="height: 80rpx;"></view>
|
<view style="height: 80rpx;"></view>
|
||||||
<view style="font-size: 32rpx;font-weight: 500;color: #000;text-align: center;">发起预约成功!</view>
|
<view style="font-size: 32rpx;font-weight: 500;color: #000;text-align: center;">发起预约成功!</view>
|
||||||
<view style="height:100rpx;"></view>
|
<view style="height:100rpx;"></view>
|
||||||
<view style="display: flex;width: 100%;height:100rpx;">
|
<view style="display: flex; width: 100%; height:100rpx;">
|
||||||
<button @click.stop open-type="share"
|
<button @click.stop open-type="share"
|
||||||
style=" background-color:#00AC4E;color: #fff;width: 50%;height: 100%; background-color:#00AC4E;"
|
style="background-color:#00AC4E; color: #fff;width: 45%;height: 100%; margin-left: 0;" class="center"
|
||||||
class="center evaluate-btn" :data-item="reservationData">
|
:data-item="reservationData">
|
||||||
<text class="evaluate-btn-text">分享给好友</text>
|
<text class="evaluate-btn-text">分享给好友</text>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
style="width: 50%;height: 100%;background-color: #f7f7f7;display: flex;align-items: center;justify-content: center;"
|
style="width: 45%; height: 100%;background-color: #f7f7f7;display: flex;align-items: center;justify-content: center; border-radius: 10rpx;"
|
||||||
@click="handleClosePopup">
|
@click="handleClosePopup">
|
||||||
<text>关闭</text>
|
<text>关闭</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -189,7 +190,9 @@
|
||||||
getSubscribeMessage,
|
getSubscribeMessage,
|
||||||
configData
|
configData
|
||||||
} from '@/common/server/config'
|
} from '@/common/server/config'
|
||||||
import { onShareAppMessage } from '@dcloudio/uni-app';
|
import {
|
||||||
|
onShareAppMessage
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
import {
|
import {
|
||||||
usePay
|
usePay
|
||||||
} from '@/common/server/interface/user'
|
} from '@/common/server/interface/user'
|
||||||
|
|
@ -281,7 +284,7 @@
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||||
const dayAfterTomorrow = new Date(today);
|
const dayAfterTomorrow = new Date(today);
|
||||||
dayAfterTomorrow.setDate(dayAfterTomorrow.getDate() + 2);
|
dayAfterTomorrow.setDate(dayAfterTomorrow.getDate() + 2);
|
||||||
|
|
||||||
let dateText = '';
|
let dateText = '';
|
||||||
if (targetDate.getTime() === today.getTime()) {
|
if (targetDate.getTime() === today.getTime()) {
|
||||||
dateText = '今天';
|
dateText = '今天';
|
||||||
|
|
@ -294,11 +297,11 @@
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
dateText = `${month}月${day}日`;
|
dateText = `${month}月${day}日`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取星期
|
// 获取星期
|
||||||
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||||
const weekday = weekdays[date.getDay()];
|
const weekday = weekdays[date.getDay()];
|
||||||
|
|
||||||
return `${dateText} ${weekday}`;
|
return `${dateText} ${weekday}`;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -318,11 +321,11 @@
|
||||||
const onDatePickerConfirm = async (e) => {
|
const onDatePickerConfirm = async (e) => {
|
||||||
console.log('日期选择器确认事件:', e);
|
console.log('日期选择器确认事件:', e);
|
||||||
console.log('datePickerValue.value:', datePickerValue.value);
|
console.log('datePickerValue.value:', datePickerValue.value);
|
||||||
|
|
||||||
// up-datetime-picker 的 confirm 事件返回的是对象 { value: 毫秒级时间戳, mode: 'date' }
|
// up-datetime-picker 的 confirm 事件返回的是对象 { value: 毫秒级时间戳, mode: 'date' }
|
||||||
// 优先使用 v-model 绑定的 datePickerValue.value,因为它会在用户选择后自动更新
|
// 优先使用 v-model 绑定的 datePickerValue.value,因为它会在用户选择后自动更新
|
||||||
let timestampMs = datePickerValue.value;
|
let timestampMs = datePickerValue.value;
|
||||||
|
|
||||||
// 如果 v-model 的值无效,尝试从事件参数获取
|
// 如果 v-model 的值无效,尝试从事件参数获取
|
||||||
if (!timestampMs || isNaN(timestampMs) || timestampMs <= 0) {
|
if (!timestampMs || isNaN(timestampMs) || timestampMs <= 0) {
|
||||||
if (e && typeof e === 'object' && e.value !== undefined) {
|
if (e && typeof e === 'object' && e.value !== undefined) {
|
||||||
|
|
@ -331,9 +334,9 @@
|
||||||
timestampMs = e;
|
timestampMs = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('提取的时间戳(毫秒):', timestampMs);
|
console.log('提取的时间戳(毫秒):', timestampMs);
|
||||||
|
|
||||||
// 确保是数字类型且有效
|
// 确保是数字类型且有效
|
||||||
if (typeof timestampMs !== 'number' || isNaN(timestampMs) || timestampMs <= 0) {
|
if (typeof timestampMs !== 'number' || isNaN(timestampMs) || timestampMs <= 0) {
|
||||||
console.error('日期选择器返回的时间戳无效:', e, 'datePickerValue:', datePickerValue.value);
|
console.error('日期选择器返回的时间戳无效:', e, 'datePickerValue:', datePickerValue.value);
|
||||||
|
|
@ -344,7 +347,7 @@
|
||||||
datePickerVisible.value = false;
|
datePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将日期转换为当天的 0 点(只取日期,不取时间)
|
// 将日期转换为当天的 0 点(只取日期,不取时间)
|
||||||
const date = new Date(timestampMs);
|
const date = new Date(timestampMs);
|
||||||
if (isNaN(date.getTime())) {
|
if (isNaN(date.getTime())) {
|
||||||
|
|
@ -356,17 +359,17 @@
|
||||||
datePickerVisible.value = false;
|
datePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = date.getMonth();
|
const month = date.getMonth();
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
const dateAtMidnight = new Date(year, month, day, 0, 0, 0);
|
const dateAtMidnight = new Date(year, month, day, 0, 0, 0);
|
||||||
|
|
||||||
// 转换为秒级时间戳
|
// 转换为秒级时间戳
|
||||||
const selectedTimestamp = Math.floor(dateAtMidnight.getTime() / 1000);
|
const selectedTimestamp = Math.floor(dateAtMidnight.getTime() / 1000);
|
||||||
|
|
||||||
console.log('转换后的秒级时间戳:', selectedTimestamp);
|
console.log('转换后的秒级时间戳:', selectedTimestamp);
|
||||||
|
|
||||||
// 验证转换后的时间戳是否有效
|
// 验证转换后的时间戳是否有效
|
||||||
if (isNaN(selectedTimestamp) || selectedTimestamp <= 0) {
|
if (isNaN(selectedTimestamp) || selectedTimestamp <= 0) {
|
||||||
console.error('时间戳转换失败:', dateAtMidnight, selectedTimestamp);
|
console.error('时间戳转换失败:', dateAtMidnight, selectedTimestamp);
|
||||||
|
|
@ -377,29 +380,29 @@
|
||||||
datePickerVisible.value = false;
|
datePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果是同一天,不需要重新加载
|
// 如果是同一天,不需要重新加载
|
||||||
if (selectedDate.value && selectedDate.value === selectedTimestamp) {
|
if (selectedDate.value && selectedDate.value === selectedTimestamp) {
|
||||||
datePickerVisible.value = false;
|
datePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新选中的日期
|
// 更新选中的日期
|
||||||
selectedDate.value = selectedTimestamp;
|
selectedDate.value = selectedTimestamp;
|
||||||
|
|
||||||
// 重置时段选择
|
// 重置时段选择
|
||||||
selectedTimeSlot.value = null;
|
selectedTimeSlot.value = null;
|
||||||
reservationInfo.value.start_time = 0;
|
reservationInfo.value.start_time = 0;
|
||||||
reservationInfo.value.end_time = 0;
|
reservationInfo.value.end_time = 0;
|
||||||
// 重置最晚到店时间
|
// 重置最晚到店时间
|
||||||
latestDateTime.value = null;
|
latestDateTime.value = null;
|
||||||
|
|
||||||
// 重新加载房间详情
|
// 重新加载房间详情
|
||||||
if (reservationInfo.value.room_id) {
|
if (reservationInfo.value.room_id) {
|
||||||
console.log('重新加载房间详情, roomId:', reservationInfo.value.room_id, 'date:', selectedTimestamp);
|
console.log('重新加载房间详情, roomId:', reservationInfo.value.room_id, 'date:', selectedTimestamp);
|
||||||
await loadRoomDetailForReservation(reservationInfo.value.room_id, selectedTimestamp);
|
await loadRoomDetailForReservation(reservationInfo.value.room_id, selectedTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
datePickerVisible.value = false;
|
datePickerVisible.value = false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -421,12 +424,20 @@
|
||||||
* 获取时间段的时间范围限制
|
* 获取时间段的时间范围限制
|
||||||
*/
|
*/
|
||||||
const getTimeSlotRange = () => {
|
const getTimeSlotRange = () => {
|
||||||
if (!selectedTimeSlot.value || selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) {
|
if (selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) {
|
||||||
return { minHour: 0, maxHour: 23, minMinute: 0, maxMinute: 59 };
|
return {
|
||||||
|
minHour: 0,
|
||||||
|
maxHour: 23,
|
||||||
|
minMinute: 0,
|
||||||
|
maxMinute: 59
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let minHour = 0, maxHour = 23, minMinute = 0, maxMinute = 59;
|
let minHour = 0,
|
||||||
|
maxHour = 23,
|
||||||
|
minMinute = 0,
|
||||||
|
maxMinute = 59;
|
||||||
|
|
||||||
switch (selectedTimeSlot.value) {
|
switch (selectedTimeSlot.value) {
|
||||||
case 0: // 凌晨 00:00-05:59
|
case 0: // 凌晨 00:00-05:59
|
||||||
minHour = 0;
|
minHour = 0;
|
||||||
|
|
@ -453,10 +464,15 @@
|
||||||
maxMinute = 59;
|
maxMinute = 59;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { minHour, maxHour, minMinute, maxMinute };
|
return {
|
||||||
|
minHour,
|
||||||
|
maxHour,
|
||||||
|
minMinute,
|
||||||
|
maxMinute
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开最晚到店时间选择器
|
* 打开最晚到店时间选择器
|
||||||
*/
|
*/
|
||||||
|
|
@ -468,25 +484,25 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!selectedTimeSlot.value || selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) {
|
if (selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请先选择时间段',
|
title: '请先选择时间段',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置时间段范围限制
|
// 设置时间段范围限制
|
||||||
const timeRange = getTimeSlotRange();
|
const timeRange = getTimeSlotRange();
|
||||||
latestDateTimeMinHour.value = timeRange.minHour;
|
latestDateTimeMinHour.value = timeRange.minHour;
|
||||||
latestDateTimeMaxHour.value = timeRange.maxHour;
|
latestDateTimeMaxHour.value = timeRange.maxHour;
|
||||||
latestDateTimeMinMinute.value = timeRange.minMinute;
|
latestDateTimeMinMinute.value = timeRange.minMinute;
|
||||||
latestDateTimeMaxMinute.value = timeRange.maxMinute;
|
latestDateTimeMaxMinute.value = timeRange.maxMinute;
|
||||||
|
|
||||||
// 如果有选择时间段,使用自动计算的时间
|
// 如果有选择时间段,使用自动计算的时间
|
||||||
updateLatestDateTimeFromSlot();
|
updateLatestDateTimeFromSlot();
|
||||||
|
|
||||||
// 将时间戳转换为 HH:MM 格式字符串
|
// 将时间戳转换为 HH:MM 格式字符串
|
||||||
let timeString = null;
|
let timeString = null;
|
||||||
if (latestDateTime.value) {
|
if (latestDateTime.value) {
|
||||||
|
|
@ -504,7 +520,7 @@
|
||||||
}
|
}
|
||||||
timeString = `${String(defaultHour).padStart(2, '0')}:${String(defaultMinute).padStart(2, '0')}`;
|
timeString = `${String(defaultHour).padStart(2, '0')}:${String(defaultMinute).padStart(2, '0')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保时间字符串格式正确(必须是 "HH:MM" 格式)
|
// 确保时间字符串格式正确(必须是 "HH:MM" 格式)
|
||||||
if (timeString && typeof timeString === 'string' && timeString.match(/^\d{2}:\d{2}$/)) {
|
if (timeString && typeof timeString === 'string' && timeString.match(/^\d{2}:\d{2}$/)) {
|
||||||
latestDateTimePickerValue.value = timeString;
|
latestDateTimePickerValue.value = timeString;
|
||||||
|
|
@ -513,7 +529,7 @@
|
||||||
const timeRangeForFallback = getTimeSlotRange();
|
const timeRangeForFallback = getTimeSlotRange();
|
||||||
latestDateTimePickerValue.value = `${String(timeRangeForFallback.minHour).padStart(2, '0')}:00`;
|
latestDateTimePickerValue.value = `${String(timeRangeForFallback.minHour).padStart(2, '0')}:00`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保值设置完成后再打开选择器
|
// 确保值设置完成后再打开选择器
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
latestDateTimePickerVisible.value = true;
|
latestDateTimePickerVisible.value = true;
|
||||||
|
|
@ -526,7 +542,7 @@
|
||||||
// up-datetime-picker mode="time" 时,v-model 绑定的值应该是 "HH:MM" 格式字符串
|
// up-datetime-picker mode="time" 时,v-model 绑定的值应该是 "HH:MM" 格式字符串
|
||||||
// 事件参数 e 可能是对象 { value: "HH:MM", mode: 'time' } 或直接是字符串 "HH:MM"
|
// 事件参数 e 可能是对象 { value: "HH:MM", mode: 'time' } 或直接是字符串 "HH:MM"
|
||||||
let timeString = latestDateTimePickerValue.value;
|
let timeString = latestDateTimePickerValue.value;
|
||||||
|
|
||||||
// 如果 v-model 的值无效,尝试从事件参数获取
|
// 如果 v-model 的值无效,尝试从事件参数获取
|
||||||
if (!timeString || typeof timeString !== 'string') {
|
if (!timeString || typeof timeString !== 'string') {
|
||||||
if (e && typeof e === 'object' && e.value !== undefined) {
|
if (e && typeof e === 'object' && e.value !== undefined) {
|
||||||
|
|
@ -535,7 +551,7 @@
|
||||||
timeString = e;
|
timeString = e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证时间字符串格式
|
// 验证时间字符串格式
|
||||||
if (!timeString || typeof timeString !== 'string' || !timeString.includes(':')) {
|
if (!timeString || typeof timeString !== 'string' || !timeString.includes(':')) {
|
||||||
console.error('时间选择器返回的值格式无效:', e, 'latestDateTimePickerValue:', latestDateTimePickerValue.value);
|
console.error('时间选择器返回的值格式无效:', e, 'latestDateTimePickerValue:', latestDateTimePickerValue.value);
|
||||||
|
|
@ -546,7 +562,7 @@
|
||||||
latestDateTimePickerVisible.value = false;
|
latestDateTimePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析时间字符串 "HH:MM"
|
// 解析时间字符串 "HH:MM"
|
||||||
const timeParts = timeString.split(':');
|
const timeParts = timeString.split(':');
|
||||||
if (timeParts.length !== 2) {
|
if (timeParts.length !== 2) {
|
||||||
|
|
@ -558,10 +574,10 @@
|
||||||
latestDateTimePickerVisible.value = false;
|
latestDateTimePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hours = parseInt(timeParts[0], 10);
|
const hours = parseInt(timeParts[0], 10);
|
||||||
const minutes = parseInt(timeParts[1], 10);
|
const minutes = parseInt(timeParts[1], 10);
|
||||||
|
|
||||||
if (isNaN(hours) || isNaN(minutes) || hours < 0 || hours > 23 || minutes < 0 || minutes > 59) {
|
if (isNaN(hours) || isNaN(minutes) || hours < 0 || hours > 23 || minutes < 0 || minutes > 59) {
|
||||||
console.error('时间值无效:', hours, minutes);
|
console.error('时间值无效:', hours, minutes);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -571,7 +587,7 @@
|
||||||
latestDateTimePickerVisible.value = false;
|
latestDateTimePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证选择的时间是否在时间段范围内
|
// 验证选择的时间是否在时间段范围内
|
||||||
if (selectedTimeSlot.value !== null && selectedTimeSlot.value !== undefined) {
|
if (selectedTimeSlot.value !== null && selectedTimeSlot.value !== undefined) {
|
||||||
const timeRange = getTimeSlotRange();
|
const timeRange = getTimeSlotRange();
|
||||||
|
|
@ -600,7 +616,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有选择日期,使用当前日期
|
// 如果没有选择日期,使用当前日期
|
||||||
if (!selectedDate.value) {
|
if (!selectedDate.value) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -610,17 +626,17 @@
|
||||||
latestDateTimePickerVisible.value = false;
|
latestDateTimePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将选择的日期和时间组合
|
// 将选择的日期和时间组合
|
||||||
const date = new Date(selectedDate.value * 1000);
|
const date = new Date(selectedDate.value * 1000);
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = date.getMonth();
|
const month = date.getMonth();
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
const dateTime = new Date(year, month, day, hours, minutes, 0);
|
const dateTime = new Date(year, month, day, hours, minutes, 0);
|
||||||
|
|
||||||
// 转换为秒级时间戳
|
// 转换为秒级时间戳
|
||||||
const selectedTimestamp = Math.floor(dateTime.getTime() / 1000);
|
const selectedTimestamp = Math.floor(dateTime.getTime() / 1000);
|
||||||
|
|
||||||
// 验证转换后的时间戳是否有效
|
// 验证转换后的时间戳是否有效
|
||||||
if (isNaN(selectedTimestamp) || selectedTimestamp <= 0) {
|
if (isNaN(selectedTimestamp) || selectedTimestamp <= 0) {
|
||||||
console.error('时间戳转换失败:', dateTime, selectedTimestamp);
|
console.error('时间戳转换失败:', dateTime, selectedTimestamp);
|
||||||
|
|
@ -631,10 +647,10 @@
|
||||||
latestDateTimePickerVisible.value = false;
|
latestDateTimePickerVisible.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新最晚到店时间
|
// 更新最晚到店时间
|
||||||
latestDateTime.value = selectedTimestamp;
|
latestDateTime.value = selectedTimestamp;
|
||||||
|
|
||||||
latestDateTimePickerVisible.value = false;
|
latestDateTimePickerVisible.value = false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -644,17 +660,17 @@
|
||||||
if (!selectedDate.value || selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) {
|
if (!selectedDate.value || selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将日期时间戳转换为日期对象
|
// 将日期时间戳转换为日期对象
|
||||||
const date = new Date(selectedDate.value * 1000);
|
const date = new Date(selectedDate.value * 1000);
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = date.getMonth();
|
const month = date.getMonth();
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
|
|
||||||
// 根据时段类型设置开始时间
|
// 根据时段类型设置开始时间
|
||||||
let startHour = 0;
|
let startHour = 0;
|
||||||
let startMinute = 30; // 默认加30分钟
|
let startMinute = 30; // 默认加30分钟
|
||||||
|
|
||||||
switch (selectedTimeSlot.value) {
|
switch (selectedTimeSlot.value) {
|
||||||
case 0: // 凌晨 00:00-05:59
|
case 0: // 凌晨 00:00-05:59
|
||||||
startHour = 0;
|
startHour = 0;
|
||||||
|
|
@ -673,22 +689,38 @@
|
||||||
startMinute = 30;
|
startMinute = 30;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建最晚到店时间(开始时间+30分钟)
|
// 创建最晚到店时间(开始时间+30分钟)
|
||||||
const latestDateTimeObj = new Date(year, month, day, startHour, startMinute, 0);
|
const latestDateTimeObj = new Date(year, month, day, startHour, startMinute, 0);
|
||||||
|
|
||||||
// 转换为秒级时间戳
|
// 转换为秒级时间戳
|
||||||
latestDateTime.value = Math.floor(latestDateTimeObj.getTime() / 1000);
|
latestDateTime.value = Math.floor(latestDateTimeObj.getTime() / 1000);
|
||||||
}
|
}
|
||||||
const tipsShow = () => {
|
const tipsShow = () => {
|
||||||
submitPopupRef.value.open()
|
submitPopupRef.value.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理关闭弹窗,返回上一页
|
// 处理关闭弹窗,返回上一页
|
||||||
const handleClosePopup = () => {
|
const handleClosePopup = () => {
|
||||||
submitPopupRef.value.close()
|
submitPopupRef.value.close()
|
||||||
|
refreshPrevPageRoomList()
|
||||||
goBack()
|
goBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 刷新上一页的房间列表(发起预约入口页)
|
||||||
|
const refreshPrevPageRoomList = () => {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
if (!pages || pages.length < 2) return
|
||||||
|
const prevPage = pages[pages.length - 2]
|
||||||
|
const vm = prevPage?.$vm || prevPage
|
||||||
|
if (vm && typeof vm.loadRoomList === 'function') {
|
||||||
|
vm.loadRoomList()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (vm && typeof vm.loadDates === 'function') {
|
||||||
|
vm.loadDates()
|
||||||
|
}
|
||||||
|
}
|
||||||
const maxPlayerCount = ref(0)
|
const maxPlayerCount = ref(0)
|
||||||
|
|
||||||
const peopleRange = ref([])
|
const peopleRange = ref([])
|
||||||
|
|
@ -744,34 +776,58 @@
|
||||||
return gameRule ? gameRule.text : '';
|
return gameRule ? gameRule.text : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const smokingOptions = ref([
|
const smokingOptions = ref([{
|
||||||
{ value: 2, text: '不禁烟' },
|
value: 2,
|
||||||
{ value: 1, text: '禁烟' },
|
text: '不禁烟'
|
||||||
])
|
},
|
||||||
const genderOptions = ref([
|
{
|
||||||
{ value: 0, text: '不限' },
|
value: 1,
|
||||||
{ value: 1, text: '男' },
|
text: '禁烟'
|
||||||
{ value: 2, text: '女' },
|
},
|
||||||
])
|
])
|
||||||
const depositOptions = ref([
|
const genderOptions = ref([{
|
||||||
{ value: 0, text: '0元' },
|
value: 0,
|
||||||
{ value: 5, text: '5元' },
|
text: '不限'
|
||||||
{ value: 10, text: '10元' },
|
},
|
||||||
{ value: -1, text: '自定义' },
|
{
|
||||||
])
|
value: 1,
|
||||||
|
text: '男'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
text: '女'
|
||||||
|
},
|
||||||
|
])
|
||||||
|
const depositOptions = ref([{
|
||||||
|
value: 0,
|
||||||
|
text: '0元'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 5,
|
||||||
|
text: '5元'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 10,
|
||||||
|
text: '10元'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: -1,
|
||||||
|
text: '自定义'
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
const currentValue = ref(0)
|
const currentValue = ref(0)
|
||||||
const customDeposit = ref('')
|
const customDeposit = ref('')
|
||||||
|
|
||||||
const onCustomDepositInput = (val) => {
|
const onCustomDepositInput = (val) => {
|
||||||
// 仅保留数字与小数点,但需求是整数金额,按只允许数字处理
|
// 仅保留数字与小数点,但需求是整数金额,按只允许数字处理
|
||||||
let v = String(val).replace(/[^0-9]/g, '')
|
let v = String(val).replace(/[^0-9]/g, '')
|
||||||
if (v === '') v = '0'
|
if (v === '') v = '0'
|
||||||
let n = Number(v)
|
let n = Number(v)
|
||||||
if (n > 50) n = 50
|
if (n > 50) n = 50
|
||||||
if (n < 0) n = 0
|
if (n < 0) n = 0
|
||||||
customDeposit.value = String(n)
|
customDeposit.value = String(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
const increment = () => {
|
const increment = () => {
|
||||||
if (currentValue.value < 5) {
|
if (currentValue.value < 5) {
|
||||||
|
|
@ -823,13 +879,13 @@ const onCustomDepositInput = (val) => {
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证选择的时段是否仍然可预约
|
// 验证选择的时段是否仍然可预约
|
||||||
if (roomDetail.value && roomDetail.value.time_slots) {
|
if (roomDetail.value && roomDetail.value.time_slots) {
|
||||||
const selectedSlot = roomDetail.value.time_slots.find(
|
const selectedSlot = roomDetail.value.time_slots.find(
|
||||||
slot => slot.slot_type === selectedTimeSlot.value
|
slot => slot.slot_type === selectedTimeSlot.value
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!selectedSlot || selectedSlot.status !== 'available') {
|
if (!selectedSlot || selectedSlot.status !== 'available') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '该时段已不可预约,请重新选择',
|
title: '该时段已不可预约,请重新选择',
|
||||||
|
|
@ -843,7 +899,7 @@ const onCustomDepositInput = (val) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.start_time || info.start_time === 0) {
|
if (!info.start_time || info.start_time === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择时间段',
|
title: '请选择时间段',
|
||||||
|
|
@ -927,38 +983,41 @@ const onCustomDepositInput = (val) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var messageId = await getSubscribeMessage(reservationInfo.value.deposit_fee);
|
var messageId = await getSubscribeMessage(reservationInfo.value.deposit_fee);
|
||||||
console.log("messageId", messageId);
|
console.log("messageId", messageId);
|
||||||
var subscribeMessage = await requestSubscribeMessage(messageId);
|
var subscribeMessage = await requestSubscribeMessage(messageId);
|
||||||
console.log("message", subscribeMessage);
|
console.log("message", subscribeMessage);
|
||||||
|
|
||||||
// 显示加载状态
|
// 显示加载状态
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '提交中...'
|
title: '提交中...'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 处理自定义鸽子费
|
// 处理自定义鸽子费
|
||||||
let finalDeposit = reservationInfo.value.deposit_fee
|
let finalDeposit = reservationInfo.value.deposit_fee
|
||||||
if (finalDeposit === -1) {
|
if (finalDeposit === -1) {
|
||||||
const n = Number(customDeposit.value || 0)
|
const n = Number(customDeposit.value || 0)
|
||||||
if (isNaN(n) || n < 0 || n > 50) {
|
if (isNaN(n) || n < 0 || n > 50) {
|
||||||
uni.showToast({ title: '自定义金额需在0-50之间', icon: 'none' })
|
uni.showToast({
|
||||||
return
|
title: '自定义金额需在0-50之间',
|
||||||
}
|
icon: 'none'
|
||||||
finalDeposit = n
|
})
|
||||||
}
|
return
|
||||||
|
}
|
||||||
|
finalDeposit = n
|
||||||
|
}
|
||||||
|
|
||||||
// 准备提交数据
|
// 准备提交数据
|
||||||
const submitData = {
|
const submitData = {
|
||||||
...reservationInfo.value,
|
...reservationInfo.value,
|
||||||
// 确保信誉限制同步
|
// 确保信誉限制同步
|
||||||
credit_limit: currentValue.value,
|
credit_limit: currentValue.value,
|
||||||
deposit_fee: finalDeposit,
|
deposit_fee: finalDeposit,
|
||||||
important_data: {},
|
important_data: {},
|
||||||
// 添加最晚到店时间参数
|
// 添加最晚到店时间参数
|
||||||
latestDateTime: latestDateTime.value || null
|
latestDateTime: latestDateTime.value || null
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将玩法类型和具体规则从数字转换为字符串
|
// 将玩法类型和具体规则从数字转换为字符串
|
||||||
submitData.game_type = getGameTypeText(submitData.game_type);
|
submitData.game_type = getGameTypeText(submitData.game_type);
|
||||||
|
|
@ -979,22 +1038,22 @@ const onCustomDepositInput = (val) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var resPay = null;
|
var resPay = null;
|
||||||
if (submitData.deposit_fee > 0) {
|
if (submitData.deposit_fee > 0) {
|
||||||
resPay = await usePay(submitData.deposit_fee);
|
resPay = await usePay(submitData.deposit_fee);
|
||||||
if (resPay == null) {
|
if (resPay == null) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '鸽子费订单创建失败,请重新提交预约数据!',
|
title: '鸽子费订单创建失败,请重新提交预约数据!',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
subscribeMessage.result.paymentId = resPay.paymentId;
|
||||||
|
if (subscribeMessage.result != null) {
|
||||||
|
important_data = JSON.stringify(subscribeMessage.result);
|
||||||
|
}
|
||||||
|
submitData.important_data = important_data;
|
||||||
}
|
}
|
||||||
subscribeMessage.result.paymentId = resPay.paymentId;
|
|
||||||
if (subscribeMessage.result != null) {
|
|
||||||
important_data = JSON.stringify(subscribeMessage.result);
|
|
||||||
}
|
|
||||||
submitData.important_data = important_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: 调用后端API提交预约
|
// TODO: 调用后端API提交预约
|
||||||
// 调用后端API提交预约
|
// 调用后端API提交预约
|
||||||
|
|
@ -1061,7 +1120,7 @@ const onCustomDepositInput = (val) => {
|
||||||
const savedMaxPlayerCount = maxPlayerCount.value;
|
const savedMaxPlayerCount = maxPlayerCount.value;
|
||||||
const savedPeopleRange = [...peopleRange.value];
|
const savedPeopleRange = [...peopleRange.value];
|
||||||
const savedPeopleText = peopleText.value;
|
const savedPeopleText = peopleText.value;
|
||||||
|
|
||||||
reservationInfo.value = {
|
reservationInfo.value = {
|
||||||
room_id: savedRoomId,
|
room_id: savedRoomId,
|
||||||
room_name: savedRoomName,
|
room_name: savedRoomName,
|
||||||
|
|
@ -1082,19 +1141,19 @@ const onCustomDepositInput = (val) => {
|
||||||
currentValue.value = 0
|
currentValue.value = 0
|
||||||
gameRuleRange.value = []
|
gameRuleRange.value = []
|
||||||
customDeposit.value = '' // 重置自定义鸽子费
|
customDeposit.value = '' // 重置自定义鸽子费
|
||||||
|
|
||||||
// 保留人数范围
|
// 保留人数范围
|
||||||
maxPlayerCount.value = savedMaxPlayerCount;
|
maxPlayerCount.value = savedMaxPlayerCount;
|
||||||
peopleRange.value = savedPeopleRange;
|
peopleRange.value = savedPeopleRange;
|
||||||
peopleText.value = savedPeopleText;
|
peopleText.value = savedPeopleText;
|
||||||
|
|
||||||
// 重置时段选择
|
// 重置时段选择
|
||||||
selectedTimeSlot.value = null;
|
selectedTimeSlot.value = null;
|
||||||
reservationInfo.value.start_time = 0;
|
reservationInfo.value.start_time = 0;
|
||||||
reservationInfo.value.end_time = 0;
|
reservationInfo.value.end_time = 0;
|
||||||
// 重置最晚到店时间
|
// 重置最晚到店时间
|
||||||
latestDateTime.value = null;
|
latestDateTime.value = null;
|
||||||
|
|
||||||
gameRuleText.value = "请先选择玩法类型"
|
gameRuleText.value = "请先选择玩法类型"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1102,11 +1161,18 @@ const onCustomDepositInput = (val) => {
|
||||||
* 加载房间详情,用于预约页面
|
* 加载房间详情,用于预约页面
|
||||||
*/
|
*/
|
||||||
const loadRoomDetailForReservation = async (roomId, date) => {
|
const loadRoomDetailForReservation = async (roomId, date) => {
|
||||||
console.log('loadRoomDetailForReservation 调用参数:', { roomId, date, dateType: typeof date });
|
console.log('loadRoomDetailForReservation 调用参数:', {
|
||||||
|
roomId,
|
||||||
|
date,
|
||||||
|
dateType: typeof date
|
||||||
|
});
|
||||||
|
|
||||||
// 验证参数
|
// 验证参数
|
||||||
if (!roomId || !date) {
|
if (!roomId || !date) {
|
||||||
console.error('loadRoomDetailForReservation 参数无效:', { roomId, date });
|
console.error('loadRoomDetailForReservation 参数无效:', {
|
||||||
|
roomId,
|
||||||
|
date
|
||||||
|
});
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '参数错误',
|
title: '参数错误',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|
@ -1114,7 +1180,7 @@ const onCustomDepositInput = (val) => {
|
||||||
roomDetailLoading.value = false;
|
roomDetailLoading.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保 date 是数字类型
|
// 确保 date 是数字类型
|
||||||
const dateTimestamp = Number(date);
|
const dateTimestamp = Number(date);
|
||||||
if (isNaN(dateTimestamp) || dateTimestamp <= 0) {
|
if (isNaN(dateTimestamp) || dateTimestamp <= 0) {
|
||||||
|
|
@ -1126,14 +1192,14 @@ const onCustomDepositInput = (val) => {
|
||||||
roomDetailLoading.value = false;
|
roomDetailLoading.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
roomDetailLoading.value = true;
|
roomDetailLoading.value = true;
|
||||||
try {
|
try {
|
||||||
console.log('调用 getRoomDetail, roomId:', roomId, 'date:', dateTimestamp);
|
console.log('调用 getRoomDetail, roomId:', roomId, 'date:', dateTimestamp);
|
||||||
const detail = await getRoomDetail(roomId, dateTimestamp);
|
const detail = await getRoomDetail(roomId, dateTimestamp);
|
||||||
if (detail) {
|
if (detail) {
|
||||||
roomDetail.value = detail;
|
roomDetail.value = detail;
|
||||||
|
|
||||||
// 设置容量和人数范围
|
// 设置容量和人数范围
|
||||||
if (detail.capacity && detail.capacity > 0) {
|
if (detail.capacity && detail.capacity > 0) {
|
||||||
maxPlayerCount.value = detail.capacity;
|
maxPlayerCount.value = detail.capacity;
|
||||||
|
|
@ -1141,7 +1207,7 @@ const onCustomDepositInput = (val) => {
|
||||||
peopleText.value = "请选择游玩人数";
|
peopleText.value = "请选择游玩人数";
|
||||||
t.push({
|
t.push({
|
||||||
value: 1,
|
value: 1,
|
||||||
text:'无需组局'
|
text: '无需组局'
|
||||||
});
|
});
|
||||||
for (let i = 2; i <= detail.capacity; i++) {
|
for (let i = 2; i <= detail.capacity; i++) {
|
||||||
t.push({
|
t.push({
|
||||||
|
|
@ -1153,7 +1219,7 @@ const onCustomDepositInput = (val) => {
|
||||||
} else {
|
} else {
|
||||||
peopleText.value = "请选择游玩人数";
|
peopleText.value = "请选择游玩人数";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从 time_slots 中过滤出可预约的时段,动态生成时间段选项
|
// 从 time_slots 中过滤出可预约的时段,动态生成时间段选项
|
||||||
generateTimeSlotOptions(detail.time_slots);
|
generateTimeSlotOptions(detail.time_slots);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1172,7 +1238,7 @@ const onCustomDepositInput = (val) => {
|
||||||
roomDetailLoading.value = false;
|
roomDetailLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据房间的 time_slots 动态生成时间段选项
|
* 根据房间的 time_slots 动态生成时间段选项
|
||||||
* 只显示可预约的时段(status === 'available')
|
* 只显示可预约的时段(status === 'available')
|
||||||
|
|
@ -1182,20 +1248,35 @@ const onCustomDepositInput = (val) => {
|
||||||
timeSlotOptions.value = [];
|
timeSlotOptions.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 时段时间范围映射
|
// 时段时间范围映射
|
||||||
const timeRangeMap = {
|
const timeRangeMap = {
|
||||||
0: { text: '凌晨', range: '00:00-05:59' },
|
0: {
|
||||||
1: { text: '上午', range: '06:00-11:59' },
|
text: '凌晨',
|
||||||
2: { text: '下午', range: '12:00-17:59' },
|
range: '00:00-05:59'
|
||||||
3: { text: '晚上', range: '18:00-23:59' }
|
},
|
||||||
|
1: {
|
||||||
|
text: '上午',
|
||||||
|
range: '06:00-11:59'
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
text: '下午',
|
||||||
|
range: '12:00-17:59'
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
text: '晚上',
|
||||||
|
range: '18:00-23:59'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 过滤出可预约的时段并生成选项
|
// 过滤出可预约的时段并生成选项
|
||||||
const availableSlots = timeSlots.filter(slot => slot.status === 'available');
|
const availableSlots = timeSlots.filter(slot => slot.status === 'available');
|
||||||
|
|
||||||
timeSlotOptions.value = availableSlots.map(slot => {
|
timeSlotOptions.value = availableSlots.map(slot => {
|
||||||
const slotInfo = timeRangeMap[slot.slot_type] || { text: slot.slot_name, range: '' };
|
const slotInfo = timeRangeMap[slot.slot_type] || {
|
||||||
|
text: slot.slot_name,
|
||||||
|
range: ''
|
||||||
|
};
|
||||||
// 生成显示文本
|
// 生成显示文本
|
||||||
let displayText = slotInfo.text;
|
let displayText = slotInfo.text;
|
||||||
if (slotInfo.range) {
|
if (slotInfo.range) {
|
||||||
|
|
@ -1205,14 +1286,14 @@ const onCustomDepositInput = (val) => {
|
||||||
if (slot.price_desc_standard) {
|
if (slot.price_desc_standard) {
|
||||||
displayText += ` ${slot.price_desc_standard}`;
|
displayText += ` ${slot.price_desc_standard}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
value: slot.slot_type,
|
value: slot.slot_type,
|
||||||
text: displayText
|
text: displayText
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时段选择改变事件
|
* 时段选择改变事件
|
||||||
*/
|
*/
|
||||||
|
|
@ -1224,23 +1305,23 @@ const onCustomDepositInput = (val) => {
|
||||||
// 自动更新最晚到店时间(时间段开始时间+30分钟)
|
// 自动更新最晚到店时间(时间段开始时间+30分钟)
|
||||||
updateLatestDateTimeFromSlot();
|
updateLatestDateTimeFromSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据选择的日期和时段计算开始时间和结束时间
|
* 根据选择的日期和时段计算开始时间和结束时间
|
||||||
*/
|
*/
|
||||||
const calculateTimeFromSlot = () => {
|
const calculateTimeFromSlot = () => {
|
||||||
if (!selectedDate.value || selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) return;
|
if (!selectedDate.value || selectedTimeSlot.value === null || selectedTimeSlot.value === undefined) return;
|
||||||
|
|
||||||
// 将日期时间戳转换为日期对象
|
// 将日期时间戳转换为日期对象
|
||||||
const date = new Date(selectedDate.value * 1000);
|
const date = new Date(selectedDate.value * 1000);
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = date.getMonth();
|
const month = date.getMonth();
|
||||||
const day = date.getDate();
|
const day = date.getDate();
|
||||||
|
|
||||||
// 根据时段类型设置开始时间
|
// 根据时段类型设置开始时间
|
||||||
let startHour = 0;
|
let startHour = 0;
|
||||||
let endHour = 0;
|
let endHour = 0;
|
||||||
|
|
||||||
switch (selectedTimeSlot.value) {
|
switch (selectedTimeSlot.value) {
|
||||||
case 0: // 凌晨 00:00-05:59
|
case 0: // 凌晨 00:00-05:59
|
||||||
startHour = 0;
|
startHour = 0;
|
||||||
|
|
@ -1259,23 +1340,23 @@ const onCustomDepositInput = (val) => {
|
||||||
endHour = 24;
|
endHour = 24;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建开始时间和结束时间
|
// 创建开始时间和结束时间
|
||||||
const startTime = new Date(year, month, day, startHour, 0, 0);
|
const startTime = new Date(year, month, day, startHour, 0, 0);
|
||||||
const endTime = new Date(year, month, day, endHour, 0, 0);
|
const endTime = new Date(year, month, day, endHour, 0, 0);
|
||||||
|
|
||||||
// 转换为秒级时间戳
|
// 转换为秒级时间戳
|
||||||
reservationInfo.value.start_time = Math.floor(startTime.getTime() / 1000);
|
reservationInfo.value.start_time = Math.floor(startTime.getTime() / 1000);
|
||||||
reservationInfo.value.end_time = Math.floor(endTime.getTime() / 1000);
|
reservationInfo.value.end_time = Math.floor(endTime.getTime() / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
const config = await getConfigData();
|
const config = await getConfigData();
|
||||||
console.log('config', config);
|
console.log('config', config);
|
||||||
if (config != null && config.config != null) {
|
if (config != null && config.config != null) {
|
||||||
gameTypeRange.value = [...config.config.playingMethodOptions];
|
gameTypeRange.value = [...config.config.playingMethodOptions];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 必须从房间页跳转,需要传入房间信息
|
// 必须从房间页跳转,需要传入房间信息
|
||||||
if (!options || !options.roomId) {
|
if (!options || !options.roomId) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -1287,12 +1368,12 @@ const onCustomDepositInput = (val) => {
|
||||||
}, 1500);
|
}, 1500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 接收房间信息
|
// 接收房间信息
|
||||||
const roomId = Number(options.roomId);
|
const roomId = Number(options.roomId);
|
||||||
const roomName = decodeURIComponent(options.roomName || '未知房间');
|
const roomName = decodeURIComponent(options.roomName || '未知房间');
|
||||||
const date = Number(options.date);
|
const date = Number(options.date);
|
||||||
|
|
||||||
if (!roomId || !date) {
|
if (!roomId || !date) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '房间信息不完整',
|
title: '房间信息不完整',
|
||||||
|
|
@ -1303,12 +1384,12 @@ const onCustomDepositInput = (val) => {
|
||||||
}, 1500);
|
}, 1500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自动填充房间信息
|
// 自动填充房间信息
|
||||||
reservationInfo.value.room_id = roomId;
|
reservationInfo.value.room_id = roomId;
|
||||||
reservationInfo.value.room_name = roomName;
|
reservationInfo.value.room_name = roomName;
|
||||||
selectedDate.value = date;
|
selectedDate.value = date;
|
||||||
|
|
||||||
// 加载房间详情,获取可预约时段和容量信息
|
// 加载房间详情,获取可预约时段和容量信息
|
||||||
await loadRoomDetailForReservation(roomId, date);
|
await loadRoomDetailForReservation(roomId, date);
|
||||||
})
|
})
|
||||||
|
|
@ -1380,9 +1461,13 @@ const onCustomDepositInput = (val) => {
|
||||||
reservationInfo.value.max_age = maxAge
|
reservationInfo.value.max_age = maxAge
|
||||||
agePickerVisible.value = false
|
agePickerVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分享处理函数
|
// 分享处理函数
|
||||||
onShareAppMessage(({ from, target, webViewUrl }) => {
|
onShareAppMessage(({
|
||||||
|
from,
|
||||||
|
target,
|
||||||
|
webViewUrl
|
||||||
|
}) => {
|
||||||
console.log('onShareAppMessage', from, target, webViewUrl);
|
console.log('onShareAppMessage', from, target, webViewUrl);
|
||||||
var resid = 0;
|
var resid = 0;
|
||||||
if (target != null && target.dataset && target.dataset.item) {
|
if (target != null && target.dataset && target.dataset.item) {
|
||||||
|
|
@ -1405,7 +1490,7 @@ const onCustomDepositInput = (val) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('分享的预约ID:', resid);
|
console.log('分享的预约ID:', resid);
|
||||||
|
|
||||||
// 同步获取分享配置(因为 onShareAppMessage 需要同步返回)
|
// 同步获取分享配置(因为 onShareAppMessage 需要同步返回)
|
||||||
const path = "pages/index/loading?id=" + resid;
|
const path = "pages/index/loading?id=" + resid;
|
||||||
// 直接访问 configData.value,避免异步调用
|
// 直接访问 configData.value,避免异步调用
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<uni-popup ref="userInfo_popup" type="center">
|
<!-- <uni-popup ref="userInfo_popup" type="center">
|
||||||
|
|
||||||
<view class="column" style="width: 500rpx; background-color: white; padding: 20rpx;">
|
<view class="column" style="width: 500rpx; background-color: white; padding: 20rpx;">
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</uni-popup>
|
</uni-popup> -->
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="loading-container">
|
<view class="loading-container">
|
||||||
<image class="logo" src="/static/Logo.jpg" mode="widthFix"></image>
|
<image class="logo" src="/static/logo.png" mode="widthFix"></image>
|
||||||
<view class="spinner"></view>
|
<view class="spinner"></view>
|
||||||
<text class="tip">{{ tips_text }}</text>
|
<text class="tip">{{ tips_text }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -100,10 +100,10 @@
|
||||||
<text style="font-size: 30rpx; margin-top: 26rpx; margin-left: 36rpx;">常用功能</text>
|
<text style="font-size: 30rpx; margin-top: 26rpx; margin-left: 36rpx;">常用功能</text>
|
||||||
|
|
||||||
<view class="row" style="flex-wrap: wrap; justify-content: flex-start; margin: 40rpx;">
|
<view class="row" style="flex-wrap: wrap; justify-content: flex-start; margin: 40rpx;">
|
||||||
<view class="column" v-for="item in commonActions" :key="item.label"
|
<view class="column common-action-item" v-for="item in commonActions" :key="item.label"
|
||||||
@click="handleCommonAction(item)"
|
@click="handleCommonAction(item)">
|
||||||
style="width: 25%; align-items: center; margin-bottom: 30rpx;">
|
|
||||||
<image :src="item.icon" style="width: 50rpx; height: 50rpx;" mode=""></image>
|
<image :src="item.icon" style="width: 50rpx; height: 50rpx;" mode=""></image>
|
||||||
|
<view v-if="item.action === 'message' && unreadCount > 0" class="red-dot"></view>
|
||||||
<text style="font-size: 24rpx; margin-top: 20rpx;">{{ item.label }}</text>
|
<text style="font-size: 24rpx; margin-top: 20rpx;">{{ item.label }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -124,6 +124,7 @@ import {
|
||||||
} from '@/common/server/user'
|
} from '@/common/server/user'
|
||||||
import { navigateToAgreement } from '@/common/system/router'
|
import { navigateToAgreement } from '@/common/system/router'
|
||||||
import { sqInterface } from '@/common/server/interface/sq'
|
import { sqInterface } from '@/common/server/interface/sq'
|
||||||
|
import { getUnreadCount } from '@/common/server/interface/message'
|
||||||
import ReservationEvaluate from '@/components/com/page/reservation-evaluate.vue'
|
import ReservationEvaluate from '@/components/com/page/reservation-evaluate.vue'
|
||||||
import ContainerBase from '@/components/com/page/container-base.vue'
|
import ContainerBase from '@/components/com/page/container-base.vue'
|
||||||
import {
|
import {
|
||||||
|
|
@ -139,6 +140,7 @@ import ReservationItem from '@/components/com/page/reservation-item.vue'
|
||||||
const rateValue = ref(4.5)
|
const rateValue = ref(4.5)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const _containerBase = ref(null)
|
const _containerBase = ref(null)
|
||||||
|
const unreadCount = ref(0)
|
||||||
|
|
||||||
|
|
||||||
// 当前预约信息
|
// 当前预约信息
|
||||||
|
|
@ -146,16 +148,15 @@ const currentAppointment = ref(null)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 常用功能 - 动态项
|
// 常用功能 - 动态项
|
||||||
const commonActions = [
|
const commonActions = [
|
||||||
{ label: '预约记录', icon: '@@:app/static/me/wodd.png', action: 'appointment' },
|
{ label: '预约记录', icon: '@@:app/static/me/wdyy.png', action: 'appointment' },
|
||||||
{ label: '订单记录', icon: '@@:app/static/me/wodd.png', action: 'payment' },
|
{ label: '订单记录', icon: '@@:app/static/me/wodd.png', action: 'payment' },
|
||||||
{ label: '常见问题', icon: '@@:app/static/me/cjwt.png', action: 'faq' },
|
{ label: '常见问题', icon: '@@:app/static/me/cjwt.png', action: 'faq' },
|
||||||
{ label: '黑名单', icon: '@@:app/static/me/hmd.png', action: 'blacklist' },
|
{ label: '黑名单', icon: '@@:app/static/me/hmd.png', action: 'blacklist' },
|
||||||
{ label: '联系我们', icon: '@@:app/static/me/lxwm.png', action: 'contact' },
|
{ label: '联系我们', icon: '@@:app/static/me/lxwm.png', action: 'contact' },
|
||||||
{ label: '我的消息', icon: '@@:app/static/me/lxwm.png', action: 'message' },
|
{ label: '我的消息', icon: '@@:app/static/me/wdxx.png', action: 'message' },
|
||||||
{ label: '我的收益', icon: '@@:app/static/me/lxwm.png', action: 'revenue' },
|
{ label: '我的收益', icon: '@@:app/static/me/wdsy.png', action: 'revenue' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const handleCommonAction = (item) => {
|
const handleCommonAction = (item) => {
|
||||||
|
|
@ -294,6 +295,28 @@ const loadCurrentAppointment = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载未读消息数量并更新红点状态
|
||||||
|
const loadUnreadCount = async () => {
|
||||||
|
const _isLogin = await isLogin();
|
||||||
|
if (!_isLogin) {
|
||||||
|
unreadCount.value = 0;
|
||||||
|
uni.hideTabBarRedDot({ index: 2 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const count = await getUnreadCount();
|
||||||
|
unreadCount.value = count;
|
||||||
|
if (count > 0) {
|
||||||
|
uni.showTabBarRedDot({ index: 2 });
|
||||||
|
} else {
|
||||||
|
uni.hideTabBarRedDot({ index: 2 });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载未读消息失败:', error);
|
||||||
|
uni.hideTabBarRedDot({ index: 2 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onShareAppMessage(({ from, target, webViewUrl }) => {
|
onShareAppMessage(({ from, target, webViewUrl }) => {
|
||||||
// console.log('onShareAppMessage', from, target, webViewUrl);
|
// console.log('onShareAppMessage', from, target, webViewUrl);
|
||||||
var resid = 0;
|
var resid = 0;
|
||||||
|
|
@ -311,6 +334,7 @@ onShow(async () => {
|
||||||
// getUserInfoData();
|
// getUserInfoData();
|
||||||
loadCurrentAppointment();
|
loadCurrentAppointment();
|
||||||
await loadUserInfo();
|
await loadUserInfo();
|
||||||
|
await loadUnreadCount();
|
||||||
})
|
})
|
||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
|
|
||||||
|
|
@ -336,4 +360,21 @@ onLoad(async () => {
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.common-action-item {
|
||||||
|
position: relative;
|
||||||
|
width: 25%;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.red-dot {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 35rpx;
|
||||||
|
width: 14rpx;
|
||||||
|
height: 14rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #ff3b30;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -114,7 +114,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="center"
|
<view class="center"
|
||||||
style="width: 304rpx; height: 90rpx; background-color: #00AC4E; color: #FFFFFF; margin: 30rpx auto 0; font-size: 32rpx;"
|
style="width: 304rpx; height: 90rpx; background-color: #00AC4E; color: #FFFFFF; margin: 30rpx auto 30rpx; border-radius: 20rpx; font-size: 32rpx;"
|
||||||
@click="submitWithdraw">
|
@click="submitWithdraw">
|
||||||
申请提现
|
申请提现
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user