Merge branch 'order-729'

合并order-729分支
This commit is contained in:
duanshuwen
2025-08-05 22:06:50 +08:00
15 changed files with 97 additions and 40 deletions

19
App.vue
View File

@@ -1,6 +1,7 @@
<script setup>
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { checkPhone } from "@/manager/LoginManager";
import { goLogin } from "@/hooks/useGoLogin";
import { goHome } from "@/hooks/useGoHome";
onLaunch(async () => {
@@ -9,13 +10,19 @@ onLaunch(async () => {
const token = uni.getStorageSync("token");
// 检测是否绑定手机号和token
// if (token) {
// const res = await checkPhone();
if (!token) {
goLogin();
// if (res.data) {
// goHome();
// }
// }
return;
}
if (token) {
const res = await checkPhone();
if (res.data) {
goHome();
}
}
});
onShow(() => {

View File

@@ -46,9 +46,9 @@
@tap="handleDateClick(dateInfo)"
>
<template v-if="dateInfo">
<text class="date-label" v-if="dateInfo.label">{{
dateInfo.label
}}</text>
<text class="date-label" v-if="dateInfo.label">
{{ dateInfo.label }}
</text>
<text class="date-number">{{ dateInfo.day }}</text>
<text class="date-price" v-if="dateInfo.price"
>¥{{ dateInfo.price }}</text
@@ -90,10 +90,12 @@ const props = defineProps({
required: true,
},
// 价格数据对象
// 价格数据数组
priceData: {
type: Object,
default: () => ({}),
type: Array,
default: () => [
{date: '', price: '-', stock: '0'}
],
},
// 默认选中日期
@@ -202,6 +204,16 @@ const getFirstDayOfMonth = (year, month) => {
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 daysInMonth = getDaysInMonth(year, month);
@@ -221,7 +233,7 @@ const generateCalendarGrid = (year, month) => {
grid.push({
date: dateStr,
day: day,
price: props.priceData[dateStr] || null,
price: getPriceForDate(dateStr),
disabled: isDateDisabled(dateStr),
selected: isDateSelected(dateStr),
inRange: isDateInRange(dateStr),
@@ -378,8 +390,8 @@ const handleRangeSelection = (dateInfo) => {
emit("range-select", {
startDate: rangeStart.value,
endDate: rangeEnd.value,
startPrice: props.priceData[rangeStart.value],
endPrice: props.priceData[rangeEnd.value],
startPrice: getPriceForDate(rangeStart.value),
endPrice: getPriceForDate(rangeEnd.value),
totalDays: daysBetween,
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,14 +1,18 @@
<template>
<view class="checkbox-wrapper" @click="onChange">
<image class="checkbox-icon" :src="isChecked" mode="aspectFit" />
<uni-icons
class="checkbox-icon"
:type="isChecked"
:checked="isChecked"
:color="iconColor"
size="24"
/>
<slot></slot>
</view>
</template>
<script setup>
import { computed, defineEmits } from "vue";
import uncheckedIcon from "./images/unchecked.png";
import checkedIcon from "./images/checked.png";
const props = defineProps({
modelValue: {
@@ -21,7 +25,12 @@ const emit = defineEmits(["update:modelValue"]);
// 计算属性,确定当前是否选中
const isChecked = computed(() => {
return props.modelValue ? checkedIcon : uncheckedIcon;
return props.modelValue ? "checkbox-filled" : "circle";
});
// 计算图标颜色
const iconColor = computed(() => {
return props.modelValue ? "#1890FF" : "#00A6FF";
});
// 切换选中状态

View File

@@ -3,8 +3,6 @@
align-items: center;
.checkbox-icon {
width: 20px;
height: 20px;
margin-right: 8px;
margin-right: 6px;
}
}

View File

@@ -5,7 +5,7 @@ $form-text-color: #333;
$form-label-color: #86909c;
$form-border-color: #ddd;
$form-input-border-color: #ddd;
$form-bg-color: #fff;
$form-bg-color: #f5f5f5;
$form-header-bg-color: rgba(25, 144, 255, 0.06);
$form-border-radius: 8px;
$form-transition: all 0.2s ease;
@@ -61,6 +61,8 @@ $form-transition: all 0.2s ease;
background-color: $form-bg-color;
border-radius: 0 0 $form-border-radius $form-border-radius;
box-sizing: border-box;
border: 1px solid $form-border-color;
border-top: none;
padding: 12px;
}

View File

@@ -1,6 +1,6 @@
.sum-wrapper {
border-radius: 8px;
background-color: #fff;
background-color: #f5f5f5;
padding: 0 12px;
box-sizing: border-box;
}

1
hooks/useGoLogin.js Normal file
View File

@@ -0,0 +1 @@
export const goLogin = () => uni.reLaunch({ url: "/pages/login/index" });

View File

@@ -2,13 +2,13 @@
"pages": [
//pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/login/index",
"path": "pages/index/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"path": "pages/login/index",
"style": {
"navigationStyle": "custom"
}

View File

@@ -2,7 +2,7 @@
<uni-popup
ref="popup"
type="bottom"
background-color="#E9F3F7"
background-color="#fff"
border-radius="12px 12px 0 0"
mask-background-color="rgba(0,0,0,0.5)"
:safe-area="false"
@@ -98,7 +98,10 @@
</scroll-view>
<!-- 总价区域 -->
<SumCard :referencePrice="goodsData.specificationPrice" :discount="totalPrice" />
<SumCard
:referencePrice="goodsData.specificationPrice"
:discount="totalPrice"
/>
</view>
</scroll-view>
@@ -144,7 +147,7 @@ const isDeleting = ref(false); // 标志位防止删除时watch冲突
// 计算属性
const totalPrice = computed(() => {
const price = props.goodsData.price || 399;
const price = props.goodsData.specificationPrice || 399;
return (price * quantity.value).toFixed(0);
});

View File

@@ -34,7 +34,7 @@
}
.good-content {
background: #e9f3f7;
background: #fff;
box-sizing: border-box;
max-height: 60vh;
overflow: hidden;
@@ -54,7 +54,7 @@
.goods-info {
display: flex;
box-sizing: border-box;
background-color: #fff;
background-color: #f5f5f5;
padding: 12px;
.goods-details {
@@ -105,13 +105,13 @@
font-size: 14px;
font-weight: 500;
color: #333;
margin-bottom: 8px;
}
.goods-service-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
.service-label,
.service-value {

View File

@@ -16,7 +16,7 @@
<ModuleTitle title="购买须知" />
<zero-markdown-view :markdown="goodsData.commodityTip" :fontSize="14" />
<zero-markdown-view :markdown="goodsData.commodityTip" />
</view>
</scroll-view>
@@ -24,7 +24,7 @@
<view class="footer">
<view class="left">
<text class="label">价格</text>
<text class="price">{{ goodsData.commodityPrice || 399 }}</text>
<text class="price">{{ goodsData.specificationPrice || 399 }}</text>
</view>
<view class="buy-button" @click="showConfirmPopup">立即抢购</view>
</view>
@@ -40,6 +40,7 @@
<!-- 日历组件 -->
<Calender
:visible="calendarVisible"
:price-data="priceData"
mode="range"
@close="handleCalendarClose"
@range-select="handleDateSelect"
@@ -50,7 +51,11 @@
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { goodsDetail, orderPay } from "@/request/api/GoodsApi";
import {
goodsDetail,
commodityDailyPriceList,
orderPay,
} from "@/request/api/GoodsApi";
import TopNavBar from "@/components/TopNavBar/index.vue";
import ImageSwiper from "@/components/ImageSwiper/index.vue";
import GoodInfo from "./components/GoodInfo/index.vue";
@@ -62,12 +67,27 @@ const calendarVisible = ref(false);
const goodsData = ref({});
const goodConfirmRef = ref(null);
const selectedDate = ref("");
const priceData = ref([]);
// 获取商品详情数据
const goodsInfo = async (params) => {
const res = await goodsDetail(params);
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;
};
// 显示确认弹窗

View File

@@ -9,4 +9,9 @@ const orderPay = (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 };