feat: 新增陪诊师列表与详情页,下单支持指定陪诊师
This commit is contained in:
@@ -6,6 +6,8 @@ const { ensureLogin } = require('../../utils/auth.js')
|
||||
const SERVICE_OPTION_HEIGHT = 108
|
||||
// 下拉面板最多占用的屏高:扣掉底部固定操作栏与页面留白,项目再多也能整屏看到
|
||||
const SERVICE_PANEL_RESERVED = 200
|
||||
// 与陪诊师列表 / 详情页共用的选择结果 key
|
||||
const SELECTED_ATTENDANT_KEY = 'escort_selected_attendant'
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -44,7 +46,9 @@ Page({
|
||||
showPayPopup: false,
|
||||
gender: '不限',
|
||||
genderIndex: 0,
|
||||
genderOptions: ['不限', '男', '女']
|
||||
genderOptions: ['不限', '男', '女'],
|
||||
// 用户指定陪诊师(选填);为空则由平台抢单或管理端指派
|
||||
selectedAttendant: null
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -54,10 +58,40 @@ Page({
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 从陪诊师列表返回时取回用户选择
|
||||
this.consumeSelectedAttendant()
|
||||
// 从新增/编辑就诊人页返回时刷新档案,首次进入由 initializePage 加载。
|
||||
if (this.pageReady && getApp().globalData.user?._id) this.loadProfiles()
|
||||
},
|
||||
|
||||
consumeSelectedAttendant() {
|
||||
const selected = wx.getStorageSync(SELECTED_ATTENDANT_KEY)
|
||||
if (!selected) return
|
||||
wx.removeStorageSync(SELECTED_ATTENDANT_KEY)
|
||||
if (selected.cleared) {
|
||||
this.setData({ selectedAttendant: null })
|
||||
return
|
||||
}
|
||||
if (!selected.id) return
|
||||
this.setData({
|
||||
selectedAttendant: {
|
||||
id: selected.id,
|
||||
name: selected.name || '',
|
||||
workYears: selected.workYears || 0,
|
||||
orderCount: selected.orderCount || 0
|
||||
}
|
||||
})
|
||||
wx.showToast({ title: `已选择 ${selected.name || '陪诊师'}`, icon: 'none' })
|
||||
},
|
||||
|
||||
goToAttendants() {
|
||||
wx.navigateTo({ url: '/pages/escort/attendants?select=1' })
|
||||
},
|
||||
|
||||
onClearAttendant() {
|
||||
this.setData({ selectedAttendant: null })
|
||||
},
|
||||
|
||||
async initializePage() {
|
||||
this.pageReady = false
|
||||
this.setData({ pageLoading: true, pageError: '' })
|
||||
@@ -401,7 +435,11 @@ Page({
|
||||
},
|
||||
shippingAddress: { address: data.shippingAddress.trim() },
|
||||
notes: { patientNote: data.remark.trim() },
|
||||
payment: { payChannel: data.payChannel }
|
||||
payment: { payChannel: data.payChannel },
|
||||
// 只传 employeeId,姓名 / 电话由服务端按员工档案回填
|
||||
...(data.selectedAttendant
|
||||
? { attendant: { employeeId: data.selectedAttendant.id } }
|
||||
: {})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -473,7 +511,8 @@ Page({
|
||||
gender: '不限',
|
||||
genderIndex: 0,
|
||||
remark: '',
|
||||
shippingAddress: ''
|
||||
shippingAddress: '',
|
||||
selectedAttendant: null
|
||||
}, () => this.refreshHospitalOptions(provinces[0] || ''))
|
||||
// 重置后仍默认选中第一个就诊人,方便连续预约
|
||||
const first = this.data.profiles[0]
|
||||
|
||||
Reference in New Issue
Block a user