feat: 增加使用日期组件

This commit is contained in:
2026-03-13 00:06:32 +08:00
parent dde9b037fe
commit 8c3f04b44a
7 changed files with 179 additions and 4 deletions

View File

@@ -16,6 +16,8 @@
</view>
</view>
<UseDateRange v-model:selectedDate="reservationDate"/>
<!-- 联系方式 -->
<view class="bg-white rounded-12 overflow-hidden">
<view
@@ -26,7 +28,7 @@
<view class="font-size-14 font-500 color-525866 mr-12"> 联系手机 </view>
<view class="right">
<input
class="border-box rounded-8 px-4 py-2 font-size-15 color-000 line-height-20"
class="border-box px-4 py-2 font-size-15 color-000 line-height-20"
v-model.trim="userFormList[0].contactPhone"
placeholder="请输入联系手机"
maxlength="11"
@@ -39,6 +41,7 @@
<script setup>
import { computed, defineProps } from "vue";
import Stepper from "@/components/Stepper/index.vue";
import UseDateRange from "@/components/UseDateRange/index.vue";
const props = defineProps({
modelValue: {
@@ -49,15 +52,25 @@ const props = defineProps({
type: Array,
default: () => [{ contactPhone: "" }],
},
reservationDate: {
type: String,
default: null,
},
});
const emit = defineEmits(["update:modelValue"]);
const emit = defineEmits(["update:modelValue", "update:reservationDate"]);
const count = computed({
get: () => props.modelValue,
set: (val) => {
emit("update:modelValue", val);
},
});
const reservationDate = computed({
get: () => props.reservationDate,
set: (val) => {
emit("update:reservationDate", val);
},
});
</script>
<style></style>

View File

@@ -67,6 +67,7 @@
v-if="orderData.commodityTypeCode !== '0'"
v-model="quantity"
:userFormList="userFormList"
v-model:reservationDate="selectedReservationDate"
/>
<!-- 酒店类型 -->
@@ -119,6 +120,7 @@ const selectedDate = ref({
totalDays: 1,
});
const quantity = ref(1);
const selectedReservationDate = ref("");
// 工具函数
const createEmptyUserForm = () => ({ visitorName: "", contactPhone: "" });
@@ -224,6 +226,13 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
return;
}
// 校验预约日期
if (!selectedReservationDate.value) {
uni.hideLoading();
uni.showToast({ title: "请选择预约日期", icon: "none" });
return;
}
// 购买的商品id
const commodityId = goodsData.commodityId;
// 消费者信息
@@ -234,6 +243,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
const payWay = "0";
// 支付渠道 0-app 1-小程序 2-h5
const paySource = "1";
const reservationDate = selectedReservationDate.value; // 预约日期,酒店类型可能不需要,根据实际情况调整
const params = {
commodityId,
@@ -241,6 +251,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
payWay,
paySource,
consumerInfoEntityList,
reservationDate
};
//酒店类型添加入住时间、离店时间