style(escort): 服务详情页统一导航与加载态
导航栏改浅色纸面并补 t-loading,页首样式收口到新版字号与圆角档位; 医院选择改由组件弹层承载,删除页面内的锚点滚动;就诊人胶囊补同名提示, 免责协议、医院列表与登录状态失败各自兜底,不再整页空白。
This commit is contained in:
+21
-10
@@ -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')
|
||||
|
||||
@@ -39,8 +41,6 @@ Page({
|
||||
genderIndex: 0,
|
||||
genderOptions: ['不限', '男', '女'],
|
||||
payChannel: 'offline',
|
||||
// 医院下拉展开时,把医院行滚到弹窗滚动容器顶部,避免列表被裁掉
|
||||
popupScrollIntoView: '',
|
||||
// 点击「提交预约」后弹出支付方式选择,默认线下支付
|
||||
showPayPopup: false,
|
||||
// 下单前必须勾选确认《陪诊服务免责协议》
|
||||
@@ -64,11 +64,23 @@ Page({
|
||||
},
|
||||
|
||||
onShow() {
|
||||
restoreLightNavigation()
|
||||
if (this.data.showOrderPopup) this.loadProfiles()
|
||||
},
|
||||
|
||||
async initializePage() {
|
||||
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()
|
||||
@@ -87,6 +99,8 @@ Page({
|
||||
// 列表为空时组件内的「其他医院」入口仍可手填
|
||||
getApp().loadHospitals().then(() => {
|
||||
this.refreshHospitalOptions()
|
||||
}).catch((err) => {
|
||||
console.error('医院列表加载失败', err)
|
||||
})
|
||||
const serviceView = {
|
||||
...service,
|
||||
@@ -122,6 +136,9 @@ Page({
|
||||
disclaimerLoading: false,
|
||||
disclaimerError: !disclaimer
|
||||
})
|
||||
}).catch((err) => {
|
||||
console.error('免责协议加载失败', err)
|
||||
this.setData({ disclaimerLoading: false, disclaimerError: true })
|
||||
})
|
||||
},
|
||||
|
||||
@@ -220,13 +237,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) {
|
||||
@@ -308,12 +325,6 @@ Page({
|
||||
this.setData({ hospital: name, hospitalCustom: manual })
|
||||
},
|
||||
|
||||
// 展开医院下拉:先清空再下一帧设值,保证重复展开也能触发 scroll-into-view
|
||||
onHospitalOpen() {
|
||||
this.setData({ popupScrollIntoView: '' })
|
||||
wx.nextTick(() => this.setData({ popupScrollIntoView: 'hospital-select-anchor' }))
|
||||
},
|
||||
|
||||
onDateChange(e) {
|
||||
this.setData({ appointmentDate: e.detail.value })
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user