diff --git a/admin/src/views/appointments/index.vue b/admin/src/views/appointments/index.vue index 40ed2f4..979a9f7 100644 --- a/admin/src/views/appointments/index.vue +++ b/admin/src/views/appointments/index.vue @@ -89,31 +89,42 @@ - + - - {{ getContactMethodLabel(row.contactMethod) }} - - {{ row.contactValue }} + + + {{ getContactMethodLabel(row.contactMethod) }} + + {{ row.contactValue }} + + + + 电话 + {{ row.phone }} + + + WhatsApp + {{ row.whatsapp }} + + + 微信 + {{ row.wechatId }} + + + - - + - - {{ row.appointmentDate }} + + {{ row.appointmentDate || row.departureDate || row.checkInDate || row.travelDate }} {{ row.appointmentTime || '-' }} - - - - ¥{{ parseFloat(row.amount).toFixed(2) }} - - - - @@ -345,7 +356,7 @@ const statusOptions = [ async function fetchCategories() { try { const response = await api.get('/api/v1/categories') - if (response.data.code === 0) { + if (response.data.code === 0 || response.data.success) { categories.value = response.data.data.categories || response.data.data || [] } } catch (error) { @@ -371,7 +382,8 @@ async function fetchAppointments() { }) const response = await api.get('/api/v1/admin/appointments', { params }) - if (response.data.code === 0) { + console.log('Appointments response:', response.data) + if (response.data.success || response.data.code === 0) { appointments.value = response.data.data.appointments pagination.total = response.data.data.pagination.total pagination.totalPages = response.data.data.pagination.totalPages @@ -389,7 +401,7 @@ async function fetchAppointmentDetails(appointmentId) { detailsLoading.value = true try { const response = await api.get(`/api/v1/admin/appointments/${appointmentId}`) - if (response.data.code === 0) { + if (response.data.success || response.data.code === 0) { appointmentDetails.value = response.data.data } } catch (error) { @@ -492,7 +504,7 @@ async function confirmUpdateStatus() { status: statusForm.newStatus }) - if (response.data.code === 0) { + if (response.data.success || response.data.code === 0) { ElMessage.success('订单状态更新成功') statusDialogVisible.value = false diff --git a/admin/vite.config.js b/admin/vite.config.js index 9f27a76..38762f6 100644 --- a/admin/vite.config.js +++ b/admin/vite.config.js @@ -6,7 +6,7 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import path from 'path' export default defineConfig({ - base: '/admin/', + // base: '/admin/', plugins: [ vue(), AutoImport({ diff --git a/miniprogram/src/modules/Config.js b/miniprogram/src/modules/Config.js index 09e68e2..362a3b5 100644 --- a/miniprogram/src/modules/Config.js +++ b/miniprogram/src/modules/Config.js @@ -11,7 +11,7 @@ var Config = Config || {} // API 基础地址 // 注意:微信小程序开发工具无法访问localhost,需要使用本机IP地址 -Config.API_BASE_URL = 'http://192.168.1.7:3000' // 本地开发环境(使用本机IP) +Config.API_BASE_URL = 'https://sub.zpc-xy.com' // 本地开发环境(使用本机IP) // Config.API_BASE_URL = 'http://localhost:3000' // 本地开发环境(浏览器可用) // Config.API_BASE_URL = 'https://your-production-domain.com' // 生产环境(待配置) diff --git a/miniprogram/src/pages/appointment/air-logistics-page.vue b/miniprogram/src/pages/appointment/air-logistics-page.vue index 7e40aec..c56e5e3 100644 --- a/miniprogram/src/pages/appointment/air-logistics-page.vue +++ b/miniprogram/src/pages/appointment/air-logistics-page.vue @@ -128,6 +128,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -145,7 +147,12 @@ }, onLoad(options) { if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -219,7 +226,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'air_logistics', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/airfare-info-entry-page.vue b/miniprogram/src/pages/appointment/airfare-info-entry-page.vue index 38b509c..c68efcf 100644 --- a/miniprogram/src/pages/appointment/airfare-info-entry-page.vue +++ b/miniprogram/src/pages/appointment/airfare-info-entry-page.vue @@ -243,7 +243,9 @@ export default { data() { return { - serviceId: "", // 服务ID,从页面参数获取 + serviceId: "", // 服务ID(来自分类页) + hotServiceId: "", // 热门服务ID(来自热门服务) + source: "", // 来源:hot=热门服务,其他=分类页 serviceTitle: "", // 服务标题 userName: "", userWechat: "", @@ -313,7 +315,13 @@ this.initDateRange() // 获取页面参数 if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + // 根据来源判断是 serviceId 还是 hotServiceId + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -466,8 +474,9 @@ try { // 构建预约数据 const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, - serviceType: 'travel', // 机票属于出行类型 + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, + serviceType: 'flight', // 机票类型 realName: this.userName.trim(), // 多联系方式 wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/airport-transfer-page.vue b/miniprogram/src/pages/appointment/airport-transfer-page.vue index 4133afe..01b7f48 100644 --- a/miniprogram/src/pages/appointment/airport-transfer-page.vue +++ b/miniprogram/src/pages/appointment/airport-transfer-page.vue @@ -153,6 +153,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -175,7 +177,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -278,7 +285,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'airport_transfer', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/appointment-page.vue b/miniprogram/src/pages/appointment/appointment-page.vue index 073d10f..1e38686 100644 --- a/miniprogram/src/pages/appointment/appointment-page.vue +++ b/miniprogram/src/pages/appointment/appointment-page.vue @@ -69,7 +69,7 @@ import { updateTabBarI18n } from '@/utils/tabbar-i18n.js' import { AppServer } from '@/modules/api/AppServer.js' import Config from '@/modules/Config.js' - import { isLoggedIn } from '@/utils/auth.js' + import { isLoggedIn, requireAuth } from '@/utils/auth.js' export default { data() { @@ -188,6 +188,11 @@ // 根据服务类型跳转到对应的预约填写页面 goToServiceDetail(service) { + // 检查登录状态 + if (!requireAuth()) { + return + } + // 服务类型到页面的映射 const servicePageMap = { 'flight': 'airfare-info-entry-page', diff --git a/miniprogram/src/pages/appointment/exhibition-service-page.vue b/miniprogram/src/pages/appointment/exhibition-service-page.vue index 8b92dea..669a65d 100644 --- a/miniprogram/src/pages/appointment/exhibition-service-page.vue +++ b/miniprogram/src/pages/appointment/exhibition-service-page.vue @@ -111,6 +111,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -125,7 +127,12 @@ }, onLoad(options) { if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -181,7 +188,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'exhibition_service', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/guide-translation-page.vue b/miniprogram/src/pages/appointment/guide-translation-page.vue index f984359..b64dfb6 100644 --- a/miniprogram/src/pages/appointment/guide-translation-page.vue +++ b/miniprogram/src/pages/appointment/guide-translation-page.vue @@ -122,6 +122,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -141,7 +143,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -226,7 +233,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'guide_translation', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/hotel-reservation-page.vue b/miniprogram/src/pages/appointment/hotel-reservation-page.vue index 89a3db4..d8f1a6c 100644 --- a/miniprogram/src/pages/appointment/hotel-reservation-page.vue +++ b/miniprogram/src/pages/appointment/hotel-reservation-page.vue @@ -215,6 +215,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -308,7 +310,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -471,7 +478,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'hotel', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/insurance-consultation-page.vue b/miniprogram/src/pages/appointment/insurance-consultation-page.vue index 5256ec8..345fc1a 100644 --- a/miniprogram/src/pages/appointment/insurance-consultation-page.vue +++ b/miniprogram/src/pages/appointment/insurance-consultation-page.vue @@ -111,6 +111,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -125,7 +127,12 @@ }, onLoad(options) { if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -181,7 +188,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'insurance_consultation', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/medical-consultation-page.vue b/miniprogram/src/pages/appointment/medical-consultation-page.vue index daab6f4..3734767 100644 --- a/miniprogram/src/pages/appointment/medical-consultation-page.vue +++ b/miniprogram/src/pages/appointment/medical-consultation-page.vue @@ -145,6 +145,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -166,7 +168,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -263,7 +270,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'medical_consultation', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/pet-transportation-page.vue b/miniprogram/src/pages/appointment/pet-transportation-page.vue index 0605582..8b1f221 100644 --- a/miniprogram/src/pages/appointment/pet-transportation-page.vue +++ b/miniprogram/src/pages/appointment/pet-transportation-page.vue @@ -171,6 +171,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -214,7 +216,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -329,7 +336,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'pet_transportation', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/rail-ticket-page.vue b/miniprogram/src/pages/appointment/rail-ticket-page.vue index d024e41..1b0d8a5 100644 --- a/miniprogram/src/pages/appointment/rail-ticket-page.vue +++ b/miniprogram/src/pages/appointment/rail-ticket-page.vue @@ -166,6 +166,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -211,7 +213,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -314,7 +321,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'rail_ticket', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/sea-freight-page.vue b/miniprogram/src/pages/appointment/sea-freight-page.vue index e0109e7..304145b 100644 --- a/miniprogram/src/pages/appointment/sea-freight-page.vue +++ b/miniprogram/src/pages/appointment/sea-freight-page.vue @@ -128,6 +128,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -145,7 +147,12 @@ }, onLoad(options) { if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -219,7 +226,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'sea_freight', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/special-needs-page.vue b/miniprogram/src/pages/appointment/special-needs-page.vue index 9d96e92..89b3c9a 100644 --- a/miniprogram/src/pages/appointment/special-needs-page.vue +++ b/miniprogram/src/pages/appointment/special-needs-page.vue @@ -137,6 +137,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -157,7 +159,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -248,7 +255,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'special_needs', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/travel-planning-page.vue b/miniprogram/src/pages/appointment/travel-planning-page.vue index 01a4c31..fc5202f 100644 --- a/miniprogram/src/pages/appointment/travel-planning-page.vue +++ b/miniprogram/src/pages/appointment/travel-planning-page.vue @@ -196,6 +196,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -220,7 +222,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -341,7 +348,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'travel_planning', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/unaccompanied-minor-page.vue b/miniprogram/src/pages/appointment/unaccompanied-minor-page.vue index 7976923..c2b2086 100644 --- a/miniprogram/src/pages/appointment/unaccompanied-minor-page.vue +++ b/miniprogram/src/pages/appointment/unaccompanied-minor-page.vue @@ -171,6 +171,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -193,7 +195,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -290,7 +297,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'unaccompanied_minor', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/vip-lounge-page.vue b/miniprogram/src/pages/appointment/vip-lounge-page.vue index ee65c43..063c28d 100644 --- a/miniprogram/src/pages/appointment/vip-lounge-page.vue +++ b/miniprogram/src/pages/appointment/vip-lounge-page.vue @@ -176,6 +176,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -199,7 +201,12 @@ onLoad(options) { this.initDateRange() if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -290,7 +297,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'vip_lounge', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/appointment/visa-consultation-page.vue b/miniprogram/src/pages/appointment/visa-consultation-page.vue index 3fbe276..be5f317 100644 --- a/miniprogram/src/pages/appointment/visa-consultation-page.vue +++ b/miniprogram/src/pages/appointment/visa-consultation-page.vue @@ -111,6 +111,8 @@ data() { return { serviceId: "", + hotServiceId: "", + source: "", serviceTitle: "", userName: "", userWechat: "", @@ -125,7 +127,12 @@ }, onLoad(options) { if (options.id) { - this.serviceId = options.id + this.source = options.source || '' + if (this.source === 'hot') { + this.hotServiceId = options.id + } else { + this.serviceId = options.id + } } if (options.title) { this.serviceTitle = decodeURIComponent(options.title) @@ -181,7 +188,8 @@ try { const appointmentData = { - hotServiceId: parseInt(this.serviceId) || null, + serviceId: this.serviceId || null, + hotServiceId: this.hotServiceId ? parseInt(this.hotServiceId) : null, serviceType: 'visa_consultation', realName: this.userName.trim(), wechatId: this.userWechat.trim() || null, diff --git a/miniprogram/src/pages/index/reserve-details-page.vue b/miniprogram/src/pages/index/reserve-details-page.vue index 1a4dbc8..489f1e8 100644 --- a/miniprogram/src/pages/index/reserve-details-page.vue +++ b/miniprogram/src/pages/index/reserve-details-page.vue @@ -118,9 +118,9 @@ const pageName = servicePageMap[this.serviceType] if (pageName) { + // source=hot 表示来自热门服务 uni.navigateTo({ - url: '/pages/appointment/' + pageName + '?id=' + this.id + '&title=' + - encodeURIComponent(this.title) + url: `/pages/appointment/${pageName}?id=${this.id}&source=hot&title=${encodeURIComponent(this.title)}` }); } else { // 未知服务类型,使用通用提示