feat: 快速预定交互调整
This commit is contained in:
@@ -78,12 +78,9 @@ import {
|
||||
commodityDailyPriceList,
|
||||
orderPay,
|
||||
} from "@/request/api/GoodsApi";
|
||||
import { ThrottleUtils } from "@/utils";
|
||||
import { ThrottleUtils, DateUtils } from "@/utils";
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import ImageSwiper from "@/components/ImageSwiper/index.vue";
|
||||
|
||||
// 导航栏透明度 - 默认透明,随滚动变为不透明
|
||||
const navOpacity = ref(0);
|
||||
import GoodInfo from "./components/GoodInfo/index.vue";
|
||||
import GoodConfirm from "./components/GoodConfirm/index.vue";
|
||||
import Calender from "@/components/Calender/index.vue";
|
||||
@@ -91,7 +88,10 @@ import LocationCard from "@/components/LocationCard/index.vue";
|
||||
import DateSelector from "./components/DateSelector/index.vue";
|
||||
import GoodDetail from "@/components/GoodDetail/index.vue";
|
||||
import GoodFacility from "./components/GoodFacility/index.vue";
|
||||
import { useSelectedDateStore } from "@/store";
|
||||
|
||||
// 导航栏透明度 - 默认透明,随滚动变为不透明
|
||||
const navOpacity = ref(0);
|
||||
const calendarVisible = ref(false);
|
||||
const goodsData = ref({});
|
||||
const goodConfirmRef = ref(null);
|
||||
@@ -105,22 +105,9 @@ const handleScroll = (e) => {
|
||||
navOpacity.value = Math.min(scrollTop / threshold, 1);
|
||||
};
|
||||
|
||||
// 格式化日期为 yyyy-mm-dd 格式
|
||||
const formatDate = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
// 获取今天和明天的日期
|
||||
const today = new Date();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(today.getDate() + 1);
|
||||
|
||||
const selectedDate = ref({
|
||||
startDate: formatDate(today),
|
||||
endDate: formatDate(tomorrow),
|
||||
startDate: DateUtils.formatDate(), // 当天日期
|
||||
endDate: DateUtils.formatDate(new Date(Date.now() + 24 * 60 * 60 * 1000)), // 第二天日期
|
||||
totalDays: 1,
|
||||
});
|
||||
const priceData = ref([]);
|
||||
@@ -302,7 +289,11 @@ const handleCloseConfirm = () => {
|
||||
console.log("关闭确认弹窗");
|
||||
};
|
||||
|
||||
const selectedDateStore = useSelectedDateStore();
|
||||
onLoad(({ commodityId = "1950766939442774018" }) => {
|
||||
// 从store中获取选中的日期
|
||||
selectedDate.value = selectedDateStore.selectedDate;
|
||||
|
||||
goodsInfo({ commodityId });
|
||||
});
|
||||
|
||||
@@ -321,6 +312,8 @@ const handleDateSelect = (data) => {
|
||||
totalDays: data.totalDays,
|
||||
};
|
||||
|
||||
selectedDateStore.setData(selectedDate.value);
|
||||
|
||||
// 根据商品类型计算价格
|
||||
if (goodsData.value.commodityTypeCode === "0") {
|
||||
// 酒店类型:计算dateRange总价格,排除最后一天(同一天除外)
|
||||
|
||||
Reference in New Issue
Block a user