diff --git a/pages/escort/itemorder.js b/pages/escort/itemorder.js index 5e80887..8e94ccb 100644 --- a/pages/escort/itemorder.js +++ b/pages/escort/itemorder.js @@ -1,4 +1,6 @@ const API = require('../../utils/api.js') +const { restoreLightNavigation } = require('../../utils/navigation.js') +const { withDuplicateNameHints } = require('../../utils/booking-profiles.js') const { formatDate, LATEST_APPOINTMENT_TIME, buildTimeSlots } = require('../../utils/date.js') const { ensureLogin } = require('../../utils/auth.js') @@ -64,6 +66,7 @@ Page({ }, onShow() { + restoreLightNavigation() // 从新增/编辑就诊人页返回时刷新档案,首次进入由 initializePage 加载。 if (this.pageReady && getApp().globalData.user?._id) this.loadProfiles() }, @@ -81,6 +84,9 @@ Page({ disclaimerLoading: false, disclaimerError: !disclaimer }) + }).catch((err) => { + console.error('免责协议加载失败', err) + this.setData({ disclaimerLoading: false, disclaimerError: true }) }) }, @@ -116,6 +122,17 @@ Page({ async initializePage() { this.pageReady = false this.setData({ pageLoading: true, pageError: '' }) + try { + await this.loadPageContent() + } catch (err) { + console.error('预约页面初始化失败', err) + this.setData({ pageError: '服务加载失败,请重试' }) + } finally { + this.setData({ pageLoading: false }) + } + }, + + async loadPageContent() { // 免责协议与表单并行加载,避免用户点开协议时再空等 this.loadDisclaimer() const services = await getApp().loadServices() @@ -142,9 +159,16 @@ Page({ // 列表为空时组件内的「其他医院」入口仍可手填,不会阻断下单 app.loadHospitals().then(() => { this.refreshHospitalOptions() + }).catch((err) => { + console.error('医院列表加载失败', err) }) - await app.waitForAuth() - if (app.globalData.user?._id) this.loadProfiles() + // 登录失败不应隐藏已加载的预约表单,提交时仍会经过登录守卫。 + try { + await app.waitForAuth() + if (app.globalData.user?._id) this.loadProfiles() + } catch (err) { + console.error('预约页面登录状态加载失败', err) + } }, retryLoad() { @@ -247,13 +271,13 @@ Page({ return API.healthProfile.getMyProfiles({ page: 1, pageSize: 50 }) .then((res) => { if (res.code !== 0) throw new Error(res.msg || '就诊人加载失败') - const profiles = (res.data?.list || []).map((item) => ({ + const profiles = withDuplicateNameHints((res.data?.list || []).map((item) => ({ _id: item._id, name: item.profile?.name || '', mobile: item.profile?.mobile || '', sex: item.profile?.sex || '', birth: item.profile?.birth || '' - })) + }))) // 默认选中第一个就诊人,信息随档案一键带入 const first = profiles[0] if (first && !this.data.selectedProfileId) { diff --git a/pages/escort/itemorder.json b/pages/escort/itemorder.json index 3750dc5..3ab49c7 100644 --- a/pages/escort/itemorder.json +++ b/pages/escort/itemorder.json @@ -4,5 +4,7 @@ "t-loading": "tdesign-miniprogram/loading/loading", "hospital-select": "/components/hospital-select/index" }, - "navigationBarTitleText": "立即预约" + "navigationBarTitleText": "立即预约", + "navigationBarTextStyle": "black", + "navigationBarBackgroundColor": "#FAF8F5" } \ No newline at end of file diff --git a/pages/escort/itemorder.wxml b/pages/escort/itemorder.wxml index 13cb533..535ed61 100644 --- a/pages/escort/itemorder.wxml +++ b/pages/escort/itemorder.wxml @@ -1,19 +1,17 @@ - - - - - 选择陪诊项目,填写信息后即可提交预约 - - + + + + + 01 + 选择服务 + - 陪诊项目 - + @@ -21,8 +19,11 @@ {{service.title}} ¥{{service.price}}/次 - - + + 更换服务 + + + @@ -45,15 +46,25 @@ + 费用仅含人工服务费,不含就医、药品及快递费用。 + + + + 02 + 就诊人信息 + - - 选择就诊人 + - {{item.name}} + data-id="{{item._id}}" bindtap="onSelectProfile" aria-role="radio" aria-checked="{{selectedProfileId === item._id}}"> + + + {{item.name}} + {{item.nameHint}} + @@ -67,17 +78,17 @@ - - - 就诊人姓名 - {{patientName || '请先选择就诊人'}} - - 联系电话 {{patientPhone || '请先选择就诊人'}} + + + + 03 + 就诊安排 + 就诊省份 @@ -94,7 +105,6 @@ options="{{hospitalOptions}}" placeholder="请选择就诊医院" disabled="{{submitting}}" - scroll-anchor-offset="{{200}}" bindchange="onHospitalChange" /> @@ -130,7 +140,14 @@ + + + + 04 + 补充信息 + 选填 + 收货地址(选填) @@ -138,17 +155,17 @@ 收货人与联系电话使用所选就诊人信息 - - 备注说明 -