修改了页面样式。

This commit is contained in:
lik
2026-11-03 16:15:41 +08:00
parent f78025e935
commit 82ed5c31a7
30 changed files with 3791 additions and 2989 deletions
+44 -46
View File
@@ -15,12 +15,20 @@ const SEX_REQUIREMENT_MAP = {
female: '女'
}
// 支付方式:与 schema 的 payment.method 枚举一一对应
const PAYMENT_METHOD_MAP = {
online_wechat: '线上微信',
offline_cash: '线下现金',
offline_transfer: '线下转账'
}
const WEEKDAYS = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
Page({
data: {
recordId: '',
record: {},
showAllDetails: false,
service: null,
loading: false,
loadError: '',
@@ -144,7 +152,7 @@ Page({
const profile = detail.profile || {}
const health = detail.health || {}
// 与 formatRecord 同一批就诊人字段:档案加载完成后覆盖订单快照,
// 摘要行与首字牌因此需要一起重算
// 展开区资料因此需要一起重算
const patient = {
name: profile.name || '',
sexText: SEX_MAP[profile.sex] || '',
@@ -156,13 +164,10 @@ Page({
}
this.setData({
'record.patientName': patient.name,
'record.patientAge': patient.age,
'record.patientWeight': patient.weight,
'record.patientHeight': patient.height,
'record.patientMobile': patient.mobile,
'record.patientIdnumber': maskIdNumber(patient.idnumber),
'record.patientInitial': patient.name.charAt(0),
'record.patientMeta': this.buildPatientMeta(patient)
'record.patientMeta': this.buildPatientMeta(patient),
'record.patientBrief': this.buildPatientBrief(patient)
})
})
.catch((err) => {
@@ -182,13 +187,13 @@ Page({
const canDelete = paymentStatus === 'unpaid'
&& (status === 'pending' || status === 'confirmed' || status === 'cancelled')
const canRebook = (status === 'completed' || status === 'cancelled') && item.escort?.serviceId > 0
// 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「修改」改的是档案,不在此列)
// 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「档案」跳的是档案页,不在此列)
// 进行中服务已开始:排期与医院不允许用户单方变更,仅保留就诊人备注(与后端字段白名单一致)
const canEditBooking = status === 'pending' || status === 'confirmed'
const canEditNote = canEditBooking || status === 'in_progress'
// 就诊人字段先落到局部变量:摘要行(patientMeta)与首字牌(patientInitial)
// 都从同一批值派生,口径不在 WXML 与 JS 两处各写一份
// 就诊人字段先落到局部变量:摘要姓名与展开区资料都从同一批值派生,
// 口径不在 WXML 与 JS 两处各写一份
const patient = {
name: item.patient?.name || '',
sexText: SEX_MAP[item.patient?.sex] || '',
@@ -199,7 +204,7 @@ Page({
idnumber: item.patient?.idnumber || ''
}
// 预约时间派生:日期行(带星期)、时间行(时段 + 陪诊时长)
// 预约时间派生:日期行(带星期)与开始时间同一行
const scheduleMeta = this.buildScheduleMeta(item.schedule || {})
return {
@@ -208,16 +213,19 @@ Page({
healthProfileId: item.healthProfileId || '',
serviceId: item.escort?.serviceId || 0,
patientName: patient.name,
patientAge: patient.age,
patientMobile: patient.mobile,
patientIdnumber: maskIdNumber(patient.idnumber),
patientInitial: patient.name.charAt(0),
patientMeta: this.buildPatientMeta(patient),
patientBrief: this.buildPatientBrief(patient),
// 陪诊师由平台分配:以 id 或 name 任一存在视为已派单,
// 派单若只写了 id 而没冗余姓名,卡片也不会误报「待分配」
hasAttendant: Boolean(item.attendant?.id || item.attendant?.name),
attendantName: item.attendant?.name || '',
attendantMobile: item.attendant?.mobile || '',
hospitalProvince: item.hospital?.province || '',
hospitalName: item.hospital?.name || '',
hospitalAddress: item.hospital?.address || '',
hospitalMeta: this.buildHospitalMeta(item.hospital || {}),
// 以下三个原始字段不进展示(展示走 hospitalMeta),是编辑弹窗的表单回填源
// 科室用于摘要展示;医生、病历号与省份只做编辑弹窗的回填源,不再在展开区重复
hospitalDepartment: item.hospital?.department || '',
hospitalDoctor: item.hospital?.doctor || '',
medicalRecordNo: item.hospital?.medicalRecordNo || '',
@@ -239,7 +247,7 @@ Page({
paymentStatusColor: paymentInfo.color,
paymentStatusBg: paymentInfo.bg,
paymentStatusBorder: paymentInfo.border,
paymentHint: paymentInfo.hint || '',
paymentMethodText: PAYMENT_METHOD_MAP[item.payment?.method] || '',
patientNote: item.notes?.patientNote || '',
escortNote: item.notes?.escortNote || '',
medicalSummary: item.notes?.medicalSummary || '',
@@ -261,30 +269,26 @@ Page({
}
},
// 就诊人摘要行的字段序列:空值整项剔除,WXML 只负责在项之间插竖线,
// 不靠一串 && 条件去猜哪条分隔线该出现(避免留下孤立的分隔线)
// 展开区「就诊人资料」的字段序列:只留摘要卡没展示的核对项(身高体重),
// 性别年龄已在摘要卡的就诊人行给出,此处不再重复;
// 空值整项剔除,WXML 只负责在项之间插竖线
buildPatientMeta(patient) {
const list = []
if (patient.sexText) list.push({ id: 'sex', text: patient.sexText })
if (patient.age) list.push({ id: 'age', text: `${patient.age}岁` })
if (patient.height) list.push({ id: 'height', text: `身高 ${patient.height}cm` })
if (patient.weight) list.push({ id: 'weight', text: `体重 ${patient.weight}kg` })
return list
},
// 医院元信息行:科室 / 医生 / 病历号,与就诊人摘要同一套插线逻辑;
// 省份不进元信息行,由 hospitalProvince 单独提到卡内右上角
buildHospitalMeta(hospital) {
// 摘要卡就诊人行只取性别与年龄:这两项决定陪诊师是否需要额外准备,
// 身高体重属核对资料,留在展开区(buildPatientMeta 那份)
buildPatientBrief(patient) {
const list = []
if (hospital.department) list.push({ id: 'department', text: hospital.department })
if (hospital.doctor) list.push({ id: 'doctor', text: hospital.doctor })
if (hospital.medicalRecordNo) {
list.push({ id: 'medicalRecordNo', text: `病历号 ${hospital.medicalRecordNo}` })
}
if (patient.sexText) list.push({ id: 'sex', text: patient.sexText })
if (patient.age) list.push({ id: 'age', text: `${patient.age}岁` })
return list
},
// 预约时间派生:日期行(带星期)、时间行(时段 + 陪诊时长);
// 预约时间派生:日期行(带星期)与开始时间同一行;
// 日期无效或缺失时返回空串,由 WXML 走兜底文案
buildScheduleMeta(schedule) {
const result = { dateText: '', timeText: '' }
@@ -295,18 +299,7 @@ Page({
}
}
const start = schedule.startTime || ''
const end = schedule.endTime || ''
let timeText = start && end ? `${start} - ${end}` : (start ? `${start} 开始` : '')
const duration = schedule.duration || 0
if (timeText && duration > 0) {
const hours = Math.floor(duration / 60)
const minutes = duration % 60
const durationText = hours > 0
? (minutes > 0 ? `${hours}小时${minutes}分钟` : `${hours}小时`)
: `${minutes}分钟`
timeText = `${timeText} · 陪诊${durationText}`
}
result.timeText = timeText
result.timeText = start
return result
},
@@ -318,10 +311,8 @@ Page({
})
},
onCallPatient() {
const mobile = this.data.record.patientMobile
if (!mobile || mobile === '--') return
wx.makePhoneCall({ phoneNumber: mobile })
onToggleDetails() {
this.setData({ showAllDetails: !this.data.showAllDetails })
},
// ===== 陪诊需求编辑(底部弹窗) =====
@@ -471,8 +462,8 @@ Page({
})
},
// 就诊人信息统一在健康档案里维护,这里只负责跳转
onEditProfile() {
// 就诊人信息统一在健康档案里维护,这里只负责跳转查看
onViewProfile() {
const profileId = this.data.record.healthProfileId
if (!profileId) {
return
@@ -561,6 +552,13 @@ Page({
})
},
// 回首页:首页是 tabBar 页,必须走 switchTab,navigateTo 跳不过去
onGoHome() {
wx.switchTab({
url: '/pages/home/index'
})
},
// 本页含就诊人姓名 / 手机号 / 身份证号与订单号,转发卡片不指向本页,统一落到首页;
// 也不提供朋友圈分享——朋友圈只能分享当前页 URL,会把订单页地址带出去
onShareAppMessage() {