feat(hospital-select): 重构医院选择组件与相关样式

- 移除列表/手填切换模式,改为「其他医院」常驻入口内联手填
- 选项行高按放大后的字号重算,搜索框不再自动聚焦
- 服务详情、预约表单与相关页面同步 hospitalCustom 状态
- 统一就诊人添加按钮、个人档案、首页与培训页字号样式
This commit is contained in:
lik
2026-11-05 18:55:13 +08:00
parent 67157fa919
commit f70a8f8b72
9 changed files with 167 additions and 165 deletions
+13 -12
View File
@@ -21,7 +21,7 @@ Page({
provinces: [],
hospital: '',
hospitalOptions: [],
hospitalManual: false,
hospitalCustom: false,
appointmentDate: '',
appointmentTime: '',
minAppointmentDate: '',
@@ -66,12 +66,10 @@ Page({
}
this.applyBookingConfig(service)
// 启动时 app 已在预取医院;这里等它落定后刷新下拉,失败则退回手动输入
// 启动时 app 已在预取医院;这里等它落定后刷新下拉,
// 列表为空时组件内的「其他医院」入口仍可手填
getApp().loadHospitals().then(() => {
this.refreshHospitalOptions()
if (!this.data.hospitalOptions.length && !this.data.hospitalManual) {
this.setData({ hospitalManual: true })
}
})
const serviceView = {
...service,
@@ -129,7 +127,7 @@ Page({
province: provinces[0] || '',
provinceIndex: 0,
hospital: '',
hospitalManual: false,
hospitalCustom: false,
requiresAddress: !!booking.requiresAddress
}, () => this.refreshHospitalOptions(provinces[0] || ''))
},
@@ -234,7 +232,7 @@ Page({
provinceIndex: index,
province,
hospital: '',
hospitalManual: false
hospitalCustom: false
}, () => this.refreshHospitalOptions(province))
},
@@ -243,7 +241,8 @@ Page({
const hospitalOptions = getApp().getHospitalsByProvince(province)
let hospital = ''
if (this.data.hospitalManual) {
if (this.data.hospitalCustom) {
// 「其他医院」手填的名称不在库内,刷新列表时原样保留
hospital = this.data.hospital
} else {
const selected = hospitalOptions.find((item) => item._id === this.selectedHospitalId)
@@ -258,11 +257,11 @@ Page({
this.setData({ hospitalOptions, hospital })
},
// 医院选择组件回传:name 为最终值,manual 表示是否手动输入,hospital 为库内记录
// 医院选择组件回传:name 为最终值,manual 表示是否为「其他医院」手填,hospital 为库内记录
onHospitalChange(e) {
const { name, manual, hospital } = e.detail
this.selectedHospitalId = hospital?._id || ''
this.setData({ hospital: name, hospitalManual: manual })
this.setData({ hospital: name, hospitalCustom: manual })
},
onDateChange(e) {
@@ -295,7 +294,9 @@ Page({
validateOrder() {
const data = this.data
if (!data.selectedProfileId || !data.selectedPatient) return '请选择就诊人'
if (!data.hospital.trim()) return data.hospitalManual ? '请输入就诊医院' : '请选择就诊医院'
if (!data.hospital.trim()) {
return data.hospitalOptions.length ? '请选择就诊医院' : '请填写就诊医院名称'
}
if (!data.appointmentDate) return '请选择预约日期'
if (!data.appointmentTime) return '请选择预约时间'
if (data.requiresAddress && !data.shippingAddress.trim()) return '请填写完整收货地址'
@@ -362,7 +363,7 @@ Page({
province: provinces[0] || '',
provinceIndex: 0,
hospital: '',
hospitalManual: false,
hospitalCustom: false,
appointmentDate: '',
appointmentTime: '',
sessionIndex: 0,
+3 -4
View File
@@ -115,10 +115,10 @@
<view class="patient-chip {{selectedProfileId === item._id ? 'active' : ''}}" wx:for="{{profiles}}" wx:key="_id"
data-id="{{item._id}}" bindtap="onSelectProfile">
<text class="patient-chip-name">{{item.name}}</text>
<text class="patient-chip-phone">{{item.mobile}}</text>
</view>
<view class="patient-chip patient-chip-add" bindtap="goToAddProfile">
<text class="patient-chip-name">+ 添加就诊人</text>
<view class="patient-chip patient-chip-add" bindtap="goToAddProfile" aria-role="button" aria-label="增加就诊人">
<t-icon name="add" size="28rpx" color="#9B4508" />
<text class="patient-chip-name">增加</text>
</view>
</view>
</scroll-view>
@@ -154,7 +154,6 @@
<hospital-select
label="就诊医院"
value="{{hospital}}"
manual="{{hospitalManual}}"
options="{{hospitalOptions}}"
placeholder="请选择就诊医院"
disabled="{{submitting}}"
+20 -17
View File
@@ -463,7 +463,7 @@ page {
.order-service-title {
display: block;
font-size: var(--fs-30);
font-size: var(--fs-32);
font-weight: 700;
color: var(--ink);
line-height: 1.4;
@@ -499,7 +499,7 @@ page {
.order-label {
flex-shrink: 0;
font-size: var(--fs-28);
font-size: var(--fs-30);
color: var(--muted);
letter-spacing: 1rpx;
}
@@ -509,7 +509,7 @@ page {
min-width: 0;
margin-left: 24rpx;
text-align: right;
font-size: var(--fs-28);
font-size: var(--fs-30);
font-weight: 700;
color: var(--ink);
}
@@ -525,7 +525,7 @@ page {
min-width: 0;
margin-left: 24rpx;
text-align: right;
font-size: var(--fs-28);
font-size: var(--fs-30);
font-weight: 700;
color: var(--ink);
}
@@ -545,7 +545,7 @@ page {
.picker-value {
display: block;
text-align: right;
font-size: var(--fs-28);
font-size: var(--fs-30);
font-weight: 700;
color: var(--ink);
}
@@ -565,7 +565,7 @@ page {
border-radius: 12rpx;
background: var(--paper);
border: 2rpx solid var(--line);
font-size: var(--fs-28);
font-size: var(--fs-30);
color: var(--ink);
line-height: 1.5;
}
@@ -573,14 +573,14 @@ page {
.textarea-count {
align-self: flex-end;
margin-top: 10rpx;
font-size: var(--fs-24);
font-size: var(--fs-26);
color: var(--muted);
}
.address-tip {
align-self: flex-start;
margin-top: 10rpx;
font-size: var(--fs-24);
font-size: var(--fs-26);
color: var(--muted);
line-height: 1.6;
}
@@ -600,7 +600,9 @@ page {
.patient-chip {
display: inline-flex;
flex-direction: column;
min-width: 180rpx;
align-items: center;
justify-content: center;
min-width: 140rpx;
padding: 16rpx 24rpx;
border-radius: 16rpx;
background: var(--paper);
@@ -620,7 +622,7 @@ page {
}
.patient-chip-name {
font-size: var(--fs-26);
font-size: var(--fs-28);
font-weight: 700;
color: var(--ink-2);
}
@@ -629,14 +631,15 @@ page {
color: var(--brand-ink);
}
.patient-chip-phone {
margin-top: 6rpx;
font-size: var(--fs-26);
color: var(--ink-2);
}
.patient-chip-add {
flex-direction: row;
align-items: center;
justify-content: center;
gap: 4rpx;
/* 虚线描边 + 白底:与「已选就诊人」的实心浅橙底区分开,
一眼看出这是动作入口而不是某个就诊人 */
background: var(--white);
border: 2rpx dashed var(--brand-line);
}
.patient-chip-add .patient-chip-name {
@@ -665,7 +668,7 @@ page {
flex: 1;
min-width: 0;
margin-right: 8rpx;
font-size: var(--fs-24);
font-size: var(--fs-26);
font-weight: 700;
color: var(--brand-ink);
}