This commit is contained in:
lik
2026-09-03 13:29:39 +08:00
parent 16ba1f654a
commit e7b27888e3
17 changed files with 565 additions and 265 deletions
+53
View File
@@ -8,6 +8,14 @@ const SEX_MAP = [
]
const BLOOD_TYPES = ['A', 'B', 'O', 'AB']
const STATUS_TEXT_MAP = {
pending: '待确认',
confirmed: '已确认',
in_progress: '进行中',
completed: '已完成',
cancelled: '已取消'
}
Page({
data: {
isEdit: false,
@@ -27,6 +35,7 @@ Page({
},
region: [],
regionLabel: '',
orderList: [],
sexLabels: SEX_MAP.map(item => item.label),
bloodTypes: BLOOD_TYPES
},
@@ -44,6 +53,50 @@ Page({
}
},
onShow() {
// 从订单页返回后刷新关联订单列表
if (this.data.isEdit && this.data.profileId) {
this.loadProfileOrders(this.data.profileId)
}
},
/**
* 加载与本档案关联的预约订单
*/
loadProfileOrders(profileId) {
API.escort.getAllRecords({ page: 1, pageSize: 50, healthProfileId: profileId })
.then(res => {
if (res.code !== 0) return
const pad = (n) => String(n).padStart(2, '0')
const orderList = (res.data.records || []).map(item => {
const d = item.schedule && item.schedule.date ? new Date(item.schedule.date) : null
return {
...item,
statusText: STATUS_TEXT_MAP[item.status] || item.status,
hospitalText: [item.hospital && item.hospital.name, item.hospital && item.hospital.department]
.filter(Boolean).join('·'),
schedule: {
...item.schedule,
dateText: d && !isNaN(d.getTime())
? `${d.getMonth() + 1}${d.getDate()}${pad(d.getHours())}:${pad(d.getMinutes())}`
: ''
}
}
})
this.setData({ orderList })
})
.catch(() => {})
},
/**
* 点击关联订单,进入订单详情
*/
onOrderTap(e) {
const id = e.currentTarget.dataset.id
if (!id) return
wx.navigateTo({ url: `/pages/order/orderDetail?id=${id}` })
},
/**
* 加载档案详情
*/
+127 -3
View File
@@ -21,11 +21,25 @@ page {
}
.section-title {
position: relative;
display: block;
font-size: 32rpx;
font-weight: 700;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
margin-left: 8rpx;
margin-left: 28rpx;
letter-spacing: 1rpx;
&::before {
content: '';
position: absolute;
left: -20rpx;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 28rpx;
border-radius: 4rpx;
background: linear-gradient(180deg, #2dd36f, #17c3a5);
}
}
.form-card {
@@ -68,6 +82,116 @@ page {
background-color: #f0f0f0;
}
/* 关联预约订单 */
.order-list {
margin-top: 16rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.order-card {
background-color: #ffffff;
border-radius: 24rpx;
padding: 28rpx 32rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
&:active {
opacity: 0.85;
}
}
.order-line1 {
display: flex;
align-items: center;
}
.order-patient {
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
margin-right: 16rpx;
}
.order-service {
font-size: 26rpx;
font-weight: 500;
color: #1abc9c;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status-tag {
font-size: 22rpx;
padding: 6rpx 20rpx;
border-radius: 30rpx;
font-weight: 500;
flex-shrink: 0;
}
.status-pending {
background: #fdf3e0;
color: #d99a2b;
}
.status-confirmed {
background: #e6f4ee;
color: #43a08a;
}
.status-in_progress {
background: #e6f4ee;
color: #43a08a;
}
.status-completed {
background: #efedf6;
color: #8a7bb5;
}
.status-cancelled {
background: #f5f5f5;
color: #b0b0b0;
}
.order-line2 {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 12rpx;
}
.order-hospital {
font-size: 26rpx;
color: #888888;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 16rpx;
}
.order-time {
font-size: 26rpx;
color: #a0a3bd;
flex-shrink: 0;
}
.empty-order {
margin-top: 16rpx;
background-color: #ffffff;
border-radius: 24rpx;
padding: 48rpx 0;
text-align: center;
text {
font-size: 26rpx;
color: #b8b8c4;
}
}
/* 操作按钮 */
.btn-group {
display: flex;
+21
View File
@@ -81,6 +81,27 @@
</view>
</view>
<!-- 关联预约订单(仅编辑已有档案时显示) -->
<view wx:if="{{isEdit}}" class="section">
<text class="section-title">预约订单</text>
<view wx:if="{{orderList.length > 0}}" class="order-list">
<view class="order-card" wx:for="{{orderList}}" wx:key="_id" bindtap="onOrderTap" data-id="{{item._id}}">
<view class="order-line1">
<text class="order-patient">{{item.patient.name}}</text>
<text class="order-service">{{item.escort.serviceName}}</text>
<text class="status-tag status-{{item.status}}">{{item.statusText}}</text>
</view>
<view class="order-line2">
<text class="order-hospital">{{item.hospitalText}}</text>
<text class="order-time">{{item.schedule.dateText}}</text>
</view>
</view>
</view>
<view wx:else class="empty-order">
<text>暂无关联的预约订单</text>
</view>
</view>
<!-- 陪诊预约(仅编辑已有档案时显示) -->
<view wx:if="{{isEdit}}" class="btn btn-outline booking-btn" bindtap="onBooking">
<text>陪诊预约</text>