Compare commits
No commits in common. "c46392b4781c7f8234ef510ae9781c6d4b022796" and "aedc71903d1878f4dfcf8b7bb97313365c65e2ca" have entirely different histories.
c46392b478
...
aedc71903d
19
App.vue
19
App.vue
@ -1,7 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
||||||
import { checkPhone } from "@/manager/LoginManager";
|
import { checkPhone } from "@/manager/LoginManager";
|
||||||
import { goLogin } from "@/hooks/useGoLogin";
|
|
||||||
import { goHome } from "@/hooks/useGoHome";
|
import { goHome } from "@/hooks/useGoHome";
|
||||||
|
|
||||||
onLaunch(async () => {
|
onLaunch(async () => {
|
||||||
@ -10,19 +9,13 @@ onLaunch(async () => {
|
|||||||
const token = uni.getStorageSync("token");
|
const token = uni.getStorageSync("token");
|
||||||
|
|
||||||
// 检测是否绑定手机号和token
|
// 检测是否绑定手机号和token
|
||||||
if (!token) {
|
// if (token) {
|
||||||
goLogin();
|
// const res = await checkPhone();
|
||||||
|
|
||||||
return;
|
// if (res.data) {
|
||||||
}
|
// goHome();
|
||||||
|
// }
|
||||||
if (token) {
|
// }
|
||||||
const res = await checkPhone();
|
|
||||||
|
|
||||||
if (res.data) {
|
|
||||||
goHome();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
|||||||
@ -46,9 +46,9 @@
|
|||||||
@tap="handleDateClick(dateInfo)"
|
@tap="handleDateClick(dateInfo)"
|
||||||
>
|
>
|
||||||
<template v-if="dateInfo">
|
<template v-if="dateInfo">
|
||||||
<text class="date-label" v-if="dateInfo.label">
|
<text class="date-label" v-if="dateInfo.label">{{
|
||||||
{{ dateInfo.label }}
|
dateInfo.label
|
||||||
</text>
|
}}</text>
|
||||||
<text class="date-number">{{ dateInfo.day }}</text>
|
<text class="date-number">{{ dateInfo.day }}</text>
|
||||||
<text class="date-price" v-if="dateInfo.price"
|
<text class="date-price" v-if="dateInfo.price"
|
||||||
>¥{{ dateInfo.price }}</text
|
>¥{{ dateInfo.price }}</text
|
||||||
@ -90,12 +90,10 @@ const props = defineProps({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 价格数据数组
|
// 价格数据对象
|
||||||
priceData: {
|
priceData: {
|
||||||
type: Array,
|
type: Object,
|
||||||
default: () => [
|
default: () => ({}),
|
||||||
{date: '', price: '-', stock: '0'}
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 默认选中日期
|
// 默认选中日期
|
||||||
@ -204,16 +202,6 @@ const getFirstDayOfMonth = (year, month) => {
|
|||||||
return day === 0 ? 6 : day - 1; // 转换为周一开始 (0=周一, 6=周日)
|
return day === 0 ? 6 : day - 1; // 转换为周一开始 (0=周一, 6=周日)
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取指定日期的价格
|
|
||||||
const getPriceForDate = (dateStr) => {
|
|
||||||
if (!props.priceData || !Array.isArray(props.priceData)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const priceItem = props.priceData.find(item => item.date === dateStr);
|
|
||||||
return priceItem ? priceItem.price : null;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 生成日历网格数据
|
// 生成日历网格数据
|
||||||
const generateCalendarGrid = (year, month) => {
|
const generateCalendarGrid = (year, month) => {
|
||||||
const daysInMonth = getDaysInMonth(year, month);
|
const daysInMonth = getDaysInMonth(year, month);
|
||||||
@ -233,7 +221,7 @@ const generateCalendarGrid = (year, month) => {
|
|||||||
grid.push({
|
grid.push({
|
||||||
date: dateStr,
|
date: dateStr,
|
||||||
day: day,
|
day: day,
|
||||||
price: getPriceForDate(dateStr),
|
price: props.priceData[dateStr] || null,
|
||||||
disabled: isDateDisabled(dateStr),
|
disabled: isDateDisabled(dateStr),
|
||||||
selected: isDateSelected(dateStr),
|
selected: isDateSelected(dateStr),
|
||||||
inRange: isDateInRange(dateStr),
|
inRange: isDateInRange(dateStr),
|
||||||
@ -390,8 +378,8 @@ const handleRangeSelection = (dateInfo) => {
|
|||||||
emit("range-select", {
|
emit("range-select", {
|
||||||
startDate: rangeStart.value,
|
startDate: rangeStart.value,
|
||||||
endDate: rangeEnd.value,
|
endDate: rangeEnd.value,
|
||||||
startPrice: getPriceForDate(rangeStart.value),
|
startPrice: props.priceData[rangeStart.value],
|
||||||
endPrice: getPriceForDate(rangeEnd.value),
|
endPrice: props.priceData[rangeEnd.value],
|
||||||
totalDays: daysBetween,
|
totalDays: daysBetween,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
components/CheckBox/images/checked.png
Normal file
BIN
components/CheckBox/images/checked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
BIN
components/CheckBox/images/unchecked.png
Normal file
BIN
components/CheckBox/images/unchecked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@ -1,18 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="checkbox-wrapper" @click="onChange">
|
<view class="checkbox-wrapper" @click="onChange">
|
||||||
<uni-icons
|
<image class="checkbox-icon" :src="isChecked" mode="aspectFit" />
|
||||||
class="checkbox-icon"
|
|
||||||
:type="isChecked"
|
|
||||||
:checked="isChecked"
|
|
||||||
:color="iconColor"
|
|
||||||
size="24"
|
|
||||||
/>
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, defineEmits } from "vue";
|
import { computed, defineEmits } from "vue";
|
||||||
|
import uncheckedIcon from "./images/unchecked.png";
|
||||||
|
import checkedIcon from "./images/checked.png";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -25,12 +21,7 @@ const emit = defineEmits(["update:modelValue"]);
|
|||||||
|
|
||||||
// 计算属性,确定当前是否选中
|
// 计算属性,确定当前是否选中
|
||||||
const isChecked = computed(() => {
|
const isChecked = computed(() => {
|
||||||
return props.modelValue ? "checkbox-filled" : "circle";
|
return props.modelValue ? checkedIcon : uncheckedIcon;
|
||||||
});
|
|
||||||
|
|
||||||
// 计算图标颜色
|
|
||||||
const iconColor = computed(() => {
|
|
||||||
return props.modelValue ? "#1890FF" : "#00A6FF";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 切换选中状态
|
// 切换选中状态
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.checkbox-icon {
|
.checkbox-icon {
|
||||||
margin-right: 6px;
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ $form-text-color: #333;
|
|||||||
$form-label-color: #86909c;
|
$form-label-color: #86909c;
|
||||||
$form-border-color: #ddd;
|
$form-border-color: #ddd;
|
||||||
$form-input-border-color: #ddd;
|
$form-input-border-color: #ddd;
|
||||||
$form-bg-color: #f5f5f5;
|
$form-bg-color: #fff;
|
||||||
$form-header-bg-color: rgba(25, 144, 255, 0.06);
|
$form-header-bg-color: rgba(25, 144, 255, 0.06);
|
||||||
$form-border-radius: 8px;
|
$form-border-radius: 8px;
|
||||||
$form-transition: all 0.2s ease;
|
$form-transition: all 0.2s ease;
|
||||||
@ -61,8 +61,6 @@ $form-transition: all 0.2s ease;
|
|||||||
background-color: $form-bg-color;
|
background-color: $form-bg-color;
|
||||||
border-radius: 0 0 $form-border-radius $form-border-radius;
|
border-radius: 0 0 $form-border-radius $form-border-radius;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid $form-border-color;
|
|
||||||
border-top: none;
|
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
.sum-wrapper {
|
.sum-wrapper {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background-color: #f5f5f5;
|
background-color: #fff;
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
export const goLogin = () => uni.reLaunch({ url: "/pages/login/index" });
|
|
||||||
@ -2,13 +2,13 @@
|
|||||||
"pages": [
|
"pages": [
|
||||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/login/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<uni-popup
|
<uni-popup
|
||||||
ref="popup"
|
ref="popup"
|
||||||
type="bottom"
|
type="bottom"
|
||||||
background-color="#fff"
|
background-color="#E9F3F7"
|
||||||
border-radius="12px 12px 0 0"
|
border-radius="12px 12px 0 0"
|
||||||
mask-background-color="rgba(0,0,0,0.5)"
|
mask-background-color="rgba(0,0,0,0.5)"
|
||||||
:safe-area="false"
|
:safe-area="false"
|
||||||
@ -98,10 +98,7 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<!-- 总价区域 -->
|
<!-- 总价区域 -->
|
||||||
<SumCard
|
<SumCard :referencePrice="goodsData.specificationPrice" :discount="totalPrice" />
|
||||||
:referencePrice="goodsData.specificationPrice"
|
|
||||||
:discount="totalPrice"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
@ -147,7 +144,7 @@ const isDeleting = ref(false); // 标志位,防止删除时watch冲突
|
|||||||
|
|
||||||
// 计算属性
|
// 计算属性
|
||||||
const totalPrice = computed(() => {
|
const totalPrice = computed(() => {
|
||||||
const price = props.goodsData.specificationPrice || 399;
|
const price = props.goodsData.price || 399;
|
||||||
return (price * quantity.value).toFixed(0);
|
return (price * quantity.value).toFixed(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.good-content {
|
.good-content {
|
||||||
background: #fff;
|
background: #e9f3f7;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -54,7 +54,7 @@
|
|||||||
.goods-info {
|
.goods-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #f5f5f5;
|
background-color: #fff;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
|
|
||||||
.goods-details {
|
.goods-details {
|
||||||
@ -105,13 +105,13 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-service-item {
|
.goods-service-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: 8px;
|
|
||||||
|
|
||||||
.service-label,
|
.service-label,
|
||||||
.service-value {
|
.service-value {
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<ModuleTitle title="购买须知" />
|
<ModuleTitle title="购买须知" />
|
||||||
|
|
||||||
<zero-markdown-view :markdown="goodsData.commodityTip" />
|
<zero-markdown-view :markdown="goodsData.commodityTip" :fontSize="14" />
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<text class="label">价格:</text>
|
<text class="label">价格:</text>
|
||||||
<text class="price">{{ goodsData.specificationPrice || 399 }}</text>
|
<text class="price">{{ goodsData.commodityPrice || 399 }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="buy-button" @click="showConfirmPopup">立即抢购</view>
|
<view class="buy-button" @click="showConfirmPopup">立即抢购</view>
|
||||||
</view>
|
</view>
|
||||||
@ -40,7 +40,6 @@
|
|||||||
<!-- 日历组件 -->
|
<!-- 日历组件 -->
|
||||||
<Calender
|
<Calender
|
||||||
:visible="calendarVisible"
|
:visible="calendarVisible"
|
||||||
:price-data="priceData"
|
|
||||||
mode="range"
|
mode="range"
|
||||||
@close="handleCalendarClose"
|
@close="handleCalendarClose"
|
||||||
@range-select="handleDateSelect"
|
@range-select="handleDateSelect"
|
||||||
@ -51,11 +50,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import {
|
import { goodsDetail, orderPay } from "@/request/api/GoodsApi";
|
||||||
goodsDetail,
|
|
||||||
commodityDailyPriceList,
|
|
||||||
orderPay,
|
|
||||||
} from "@/request/api/GoodsApi";
|
|
||||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||||
import ImageSwiper from "@/components/ImageSwiper/index.vue";
|
import ImageSwiper from "@/components/ImageSwiper/index.vue";
|
||||||
import GoodInfo from "./components/GoodInfo/index.vue";
|
import GoodInfo from "./components/GoodInfo/index.vue";
|
||||||
@ -67,27 +62,12 @@ const calendarVisible = ref(false);
|
|||||||
const goodsData = ref({});
|
const goodsData = ref({});
|
||||||
const goodConfirmRef = ref(null);
|
const goodConfirmRef = ref(null);
|
||||||
const selectedDate = ref("");
|
const selectedDate = ref("");
|
||||||
const priceData = ref([]);
|
|
||||||
|
|
||||||
// 获取商品详情数据
|
// 获取商品详情数据
|
||||||
const goodsInfo = async (params) => {
|
const goodsInfo = async (params) => {
|
||||||
const res = await goodsDetail(params);
|
const res = await goodsDetail(params);
|
||||||
|
|
||||||
goodsData.value = res.data;
|
goodsData.value = res.data;
|
||||||
|
|
||||||
// 判断是酒店类型订单再获取获取商品日价格及库存
|
|
||||||
if (goodsData.value.commodityTypeCode === "0") {
|
|
||||||
getGoodsDailyPrice({
|
|
||||||
commodityId: goodsData.value.commodityId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 获取商品日价格及库存
|
|
||||||
const getGoodsDailyPrice = async (params) => {
|
|
||||||
const res = await commodityDailyPriceList(params);
|
|
||||||
|
|
||||||
priceData.value = res.data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 显示确认弹窗
|
// 显示确认弹窗
|
||||||
|
|||||||
@ -9,9 +9,4 @@ const orderPay = (args) => {
|
|||||||
return request.post("/hotelBiz/trade/order", args);
|
return request.post("/hotelBiz/trade/order", args);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取商品日价格及库存
|
export { goodsDetail, orderPay };
|
||||||
const commodityDailyPriceList = (args) => {
|
|
||||||
return request.post("/hotelBiz/commodity/commodityDailyPriceList", args);
|
|
||||||
};
|
|
||||||
|
|
||||||
export { goodsDetail, commodityDailyPriceList, orderPay };
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user