fix: 添加行程结束日期验证

- 往返行程必须填写结束日期
- 避免提交时 end_date 为空导致数据库错误
This commit is contained in:
root
2026-02-28 14:46:58 +08:00
parent 4789b8f394
commit 675c559d47
+11 -2
View File
@@ -287,9 +287,18 @@ export default function BusinessTripApply() {
return
}
const hasValidItinerary = itineraries.some(item => item.startTime && item.destination.trim())
const hasValidItinerary = itineraries.some(item => {
if (!item.startTime || !item.destination.trim()) {
return false
}
// 如果是往返行程,必须有结束时间
if (item.tripType === 'roundtrip' && !item.endTime) {
return false
}
return true
})
if (!hasValidItinerary) {
Toast.show('请至少填写一条完整行程')
Toast.show('请至少填写一条完整行程(往返行程需填写结束日期)')
return
}