tmp
This commit is contained in:
+19
-13
@@ -55,7 +55,6 @@ Page({
|
||||
// 格式化后的显示字段
|
||||
statusText: '',
|
||||
statusDesc: '',
|
||||
patientFirstChar: '',
|
||||
attendantFirstChar: '',
|
||||
scheduleDateText: '',
|
||||
scheduleStartTimeText: '',
|
||||
@@ -63,7 +62,6 @@ Page({
|
||||
createtimeText: '',
|
||||
updatetimeText: '',
|
||||
paymentStatusText: '',
|
||||
patientSexText: '',
|
||||
attendantSexText: '',
|
||||
sexRequirementText: '',
|
||||
// 操作按钮配置
|
||||
@@ -98,11 +96,11 @@ Page({
|
||||
wx.hideLoading()
|
||||
|
||||
if (res.code !== 0) {
|
||||
wx.showToast({ title: res.message || '加载失败', icon: 'none' })
|
||||
wx.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
const order = res.data || {}
|
||||
const order = res.data?.record || {}
|
||||
this.applyOrderData(order)
|
||||
} catch (err) {
|
||||
wx.hideLoading()
|
||||
@@ -113,7 +111,6 @@ Page({
|
||||
|
||||
applyOrderData(order) {
|
||||
const status = order.status || 'pending'
|
||||
const patient = order.patient || {}
|
||||
const attendant = order.attendant || {}
|
||||
const schedule = order.schedule || {}
|
||||
const payment = order.payment || {}
|
||||
@@ -123,9 +120,10 @@ Page({
|
||||
this.setData({
|
||||
loaded: true,
|
||||
order: order,
|
||||
// 有关联档案时交由 patient-info 按 ID 加载(不读缓存,以档案最新数据为准)
|
||||
healthProfileId: order.healthProfileId || '',
|
||||
statusText: STATUS_MAP[status] || status,
|
||||
statusDesc: STATUS_DESC_MAP[status] || '',
|
||||
patientFirstChar: (patient.name || '?')[0],
|
||||
attendantFirstChar: (attendant.name || '?')[0],
|
||||
scheduleDateText: formatDate(schedule.date),
|
||||
scheduleStartTimeText: schedule.startTime || '',
|
||||
@@ -133,10 +131,10 @@ Page({
|
||||
createtimeText: formatDateTime(meta.createtime),
|
||||
updatetimeText: formatDateTime(meta.updatetime),
|
||||
paymentStatusText: PAYMENT_STATUS_MAP[payment.status] || payment.status || '未支付',
|
||||
patientSexText: patient.sex === 'male' ? '男' : patient.sex === 'female' ? '女' : '',
|
||||
attendantSexText: attendant.sex === 'male' ? '男' : attendant.sex === 'female' ? '女' : '',
|
||||
sexRequirementText: escort.sexRequirement === 'male' ? '要求男陪诊' : escort.sexRequirement === 'female' ? '要求女陪诊' : '不限',
|
||||
// 操作按钮
|
||||
// 操作按钮(待确认/已确认状态下可编辑订单信息)
|
||||
showEditBtn: status === 'pending' || status === 'confirmed',
|
||||
showConfirmBtn: status === 'pending',
|
||||
showCancelBtn: status === 'pending',
|
||||
showStartBtn: status === 'confirmed',
|
||||
@@ -146,7 +144,8 @@ Page({
|
||||
|
||||
// 拨打电话
|
||||
callPhone(e) {
|
||||
const phone = e.currentTarget.dataset.phone
|
||||
// 兼容 patient-info 组件的 call 事件与 data-phone 用法
|
||||
const phone = (e.detail && e.detail.mobile) || e.currentTarget.dataset.phone
|
||||
if (!phone) {
|
||||
wx.showToast({ title: '暂无电话', icon: 'none' })
|
||||
return
|
||||
@@ -154,12 +153,19 @@ Page({
|
||||
wx.makePhoneCall({ phoneNumber: phone })
|
||||
},
|
||||
|
||||
// 编辑订单
|
||||
onEdit() {
|
||||
wx.navigateTo({
|
||||
url: `/pages/order/orderEdit?orderId=${this.data.orderId}`
|
||||
})
|
||||
},
|
||||
|
||||
// 确认订单
|
||||
onConfirm() {
|
||||
wx.showModal({
|
||||
title: '确认订单',
|
||||
content: '确认接受此订单?',
|
||||
confirmColor: '#4c6ef5',
|
||||
confirmColor: '#1abc9c',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('confirmed')
|
||||
@@ -187,7 +193,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '开始服务',
|
||||
content: '确认开始陪诊服务?',
|
||||
confirmColor: '#4c6ef5',
|
||||
confirmColor: '#1abc9c',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('in_progress')
|
||||
@@ -201,7 +207,7 @@ Page({
|
||||
wx.showModal({
|
||||
title: '完成服务',
|
||||
content: '确认陪诊服务已完成?',
|
||||
confirmColor: '#4c6ef5',
|
||||
confirmColor: '#1abc9c',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.updateStatus('completed')
|
||||
@@ -217,7 +223,7 @@ Page({
|
||||
wx.hideLoading()
|
||||
|
||||
if (res.code !== 0) {
|
||||
wx.showToast({ title: res.message || '操作失败', icon: 'none' })
|
||||
wx.showToast({ title: res.msg || '操作失败', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user