|
@@ -70,24 +70,69 @@ watch(quantity, (newVal) => {
|
|
|
const orderPopup = ref(false)
|
|
const orderPopup = ref(false)
|
|
|
const orderMemo = ref('')
|
|
const orderMemo = ref('')
|
|
|
|
|
|
|
|
|
|
+interface ParsedDate {
|
|
|
|
|
+ year: number
|
|
|
|
|
+ month: string
|
|
|
|
|
+ day: string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function formatDateParts(date: Date): ParsedDate | null {
|
|
|
|
|
+ if (Number.isNaN(date.getTime()))
|
|
|
|
|
+ return null
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ year: date.getFullYear(),
|
|
|
|
|
+ month: String(date.getMonth() + 1).padStart(2, '0'),
|
|
|
|
|
+ day: String(date.getDate()).padStart(2, '0'),
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function parseSelectDate(value: string): ParsedDate | null {
|
|
|
|
|
+ const dateText = value.trim()
|
|
|
|
|
+ if (!dateText)
|
|
|
|
|
+ return null
|
|
|
|
|
+
|
|
|
|
|
+ const dateMatch = dateText.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/)
|
|
|
|
|
+ if (dateMatch) {
|
|
|
|
|
+ const year = Number(dateMatch[1])
|
|
|
|
|
+ const month = Number(dateMatch[2])
|
|
|
|
|
+ const day = Number(dateMatch[3])
|
|
|
|
|
+ const parsedDate = new Date(year, month - 1, day)
|
|
|
|
|
+
|
|
|
|
|
+ if (
|
|
|
|
|
+ parsedDate.getFullYear() !== year
|
|
|
|
|
+ || parsedDate.getMonth() !== month - 1
|
|
|
|
|
+ || parsedDate.getDate() !== day
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return null
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ year,
|
|
|
|
|
+ month: String(month).padStart(2, '0'),
|
|
|
|
|
+ day: String(day).padStart(2, '0'),
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return formatDateParts(new Date(dateText))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const parsedSelectDate = computed(() => parseSelectDate(selectDate.value))
|
|
|
|
|
+
|
|
|
const formattedDate = computed(() => {
|
|
const formattedDate = computed(() => {
|
|
|
- if (!selectDate.value)
|
|
|
|
|
|
|
+ if (!parsedSelectDate.value)
|
|
|
return ''
|
|
return ''
|
|
|
- const date = new Date(selectDate.value)
|
|
|
|
|
- const year = date.getFullYear()
|
|
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
- const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const { year, month, day } = parsedSelectDate.value
|
|
|
return `${year}年${month}月${day}日`
|
|
return `${year}年${month}月${day}日`
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 接口需要的日期格式 yyyy-MM-dd
|
|
// 接口需要的日期格式 yyyy-MM-dd
|
|
|
const travelDate = computed(() => {
|
|
const travelDate = computed(() => {
|
|
|
- if (!selectDate.value)
|
|
|
|
|
|
|
+ if (!parsedSelectDate.value)
|
|
|
return ''
|
|
return ''
|
|
|
- const date = new Date(selectDate.value)
|
|
|
|
|
- const year = date.getFullYear()
|
|
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
- const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const { year, month, day } = parsedSelectDate.value
|
|
|
return `${year}-${month}-${day}`
|
|
return `${year}-${month}-${day}`
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -105,6 +150,11 @@ function handlePeopleCreditConfirm(index: number, { value: selectedValue }: { va
|
|
|
|
|
|
|
|
// 表单校验
|
|
// 表单校验
|
|
|
function validateForm(): boolean {
|
|
function validateForm(): boolean {
|
|
|
|
|
+ if (!travelDate.value) {
|
|
|
|
|
+ useGlobalToast().show({ msg: '请选择游玩日期' })
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 联系人姓名校验
|
|
// 联系人姓名校验
|
|
|
if (!linkMan.value.trim()) {
|
|
if (!linkMan.value.trim()) {
|
|
|
useGlobalToast().show({ msg: '请输入联系人姓名' })
|
|
useGlobalToast().show({ msg: '请输入联系人姓名' })
|
|
@@ -204,7 +254,7 @@ async function handleSubmit() {
|
|
|
<view class="flex items-center gap-24rpx">
|
|
<view class="flex items-center gap-24rpx">
|
|
|
<view
|
|
<view
|
|
|
class="h-36rpx w-36rpx rounded-50% text-center text-28rpx font-600 line-height-[36rpx]"
|
|
class="h-36rpx w-36rpx rounded-50% text-center text-28rpx font-600 line-height-[36rpx]"
|
|
|
- :class="quantity > 1 ? 'bg-#E8FFA7 text-#9ED605' : 'bg-#F0F0F0 text-#AAAAAA'"
|
|
|
|
|
|
|
+ :class="quantity > 1 ? 'bg-[var(--them-color)] text-white' : 'bg-#F0F0F0 text-#AAAAAA'"
|
|
|
@click="handleMinus"
|
|
@click="handleMinus"
|
|
|
>
|
|
>
|
|
|
-
|
|
-
|
|
@@ -213,7 +263,7 @@ async function handleSubmit() {
|
|
|
{{ quantity }}
|
|
{{ quantity }}
|
|
|
</view>
|
|
</view>
|
|
|
<view
|
|
<view
|
|
|
- class="h-36rpx w-36rpx rounded-50% bg-#E8FFA7 text-center text-28rpx text-#9ED605 font-600 line-height-[36rpx]"
|
|
|
|
|
|
|
+ class="h-36rpx w-36rpx rounded-50% bg-[var(--them-color)] text-center text-28rpx text-white font-600 line-height-[36rpx]"
|
|
|
@click="handlePlus"
|
|
@click="handlePlus"
|
|
|
>
|
|
>
|
|
|
+
|
|
+
|
|
@@ -264,7 +314,7 @@ async function handleSubmit() {
|
|
|
</view>
|
|
</view>
|
|
|
<view class="h-2rpx w-full bg-#F0F0F0" />
|
|
<view class="h-2rpx w-full bg-#F0F0F0" />
|
|
|
<view>
|
|
<view>
|
|
|
- <wd-picker v-model="people.linkCreditType" required :columns="columns" label="证件类型" @confirm="(e: { value: number }) => handlePeopleCreditConfirm(index, e)" />
|
|
|
|
|
|
|
+ <wd-picker v-model="people.linkCreditType" required :columns="columns" label="证件类型" @confirm="e => handlePeopleCreditConfirm(index, e)" />
|
|
|
</view>
|
|
</view>
|
|
|
<view class="h-2rpx w-full bg-#F0F0F0" />
|
|
<view class="h-2rpx w-full bg-#F0F0F0" />
|
|
|
<view>
|
|
<view>
|
|
@@ -307,7 +357,7 @@ async function handleSubmit() {
|
|
|
<wd-icon name="arrow-up" size="18px" />
|
|
<wd-icon name="arrow-up" size="18px" />
|
|
|
</view>
|
|
</view>
|
|
|
<view
|
|
<view
|
|
|
- class="h-80rpx w-180rpx rounded-40rpx bg-#9ED605 text-center text-28rpx text-#FFF font-bold line-height-[80rpx]"
|
|
|
|
|
|
|
+ class="h-80rpx w-180rpx rounded-40rpx bg-[var(--them-color)] text-center text-28rpx text-#FFF font-bold line-height-[80rpx]"
|
|
|
@click="handleSubmit"
|
|
@click="handleSubmit"
|
|
|
>
|
|
>
|
|
|
提交
|
|
提交
|