tmp
This commit is contained in:
@@ -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}` })
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载档案详情
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user