From 2f57b8560987ce1d9969a7b717c9b5379ab5cbbf Mon Sep 17 00:00:00 2001 From: tangxinyue <524779910@qq.com> Date: Tue, 30 Jun 2026 13:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E9=93=81=E7=A5=A8=E5=87=BA=E5=8F=91?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=8D=E4=BA=86=E5=B9=B4=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/other/train-tickets/edit/edit.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pages/other/train-tickets/edit/edit.vue b/pages/other/train-tickets/edit/edit.vue index 28d7bb1..902f5f1 100644 --- a/pages/other/train-tickets/edit/edit.vue +++ b/pages/other/train-tickets/edit/edit.vue @@ -326,6 +326,19 @@ onMounted(() => { if (stored) { Object.assign(data.ticketsInfo, stored) } + + // 初始化时同步车票日期到出发时间 + const ticketDate = data.ticketsInfo.ticketInfo.date; + if (ticketDate) { + const parts = ticketDate.split('.'); + if (parts.length === 3) { + const mmdd = `${parts[1]}-${parts[2]}`; + const oldDepTime = data.ticketsInfo.ticketInfo.departureTime || ''; + const timePart = oldDepTime.split(' ')[1] || '00:00'; + data.ticketsInfo.ticketInfo.departureTime = `${mmdd} ${timePart}`; + } + } + updateDuration(); }) /** @@ -482,6 +495,15 @@ const onTicketDateChange = (e) => { const dateObj = new Date(val.replace(/-/g, '/')); // Compatible const days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; data.ticketsInfo.ticketInfo.weekDay = days[dateObj.getDay()]; + + // 同步出发时间日期 + const parts = val.split('-'); + if (parts.length === 3) { + const mmdd = `${parts[1]}-${parts[2]}`; + const oldDepTime = data.ticketsInfo.ticketInfo.departureTime || ''; + const timePart = oldDepTime.split(' ')[1] || '00:00'; + data.ticketsInfo.ticketInfo.departureTime = `${mmdd} ${timePart}`; + } } }