feat(escort): 预约页取消指定陪诊师并默认线下支付

下单不再提供陪诊师选择,统一由平台安排;itemorder 移除选择入口、选择状态与 attendant 载荷。两个预约页的支付方式弹窗默认改为线下支付,仍可手动切换微信支付。
This commit is contained in:
lik
2026-11-13 16:01:37 +08:00
parent e6517e3cae
commit 811ec321f1
5 changed files with 9 additions and 85 deletions
+4 -43
View File
@@ -6,8 +6,6 @@ const { ensureLogin } = require('../../utils/auth.js')
const SERVICE_OPTION_HEIGHT = 108
// 下拉面板最多占用的屏高:扣掉底部固定操作栏与页面留白,项目再多也能整屏看到
const SERVICE_PANEL_RESERVED = 200
// 与陪诊师列表 / 详情页共用的选择结果 key
const SELECTED_ATTENDANT_KEY = 'escort_selected_attendant'
// 免责协议标题兜底:接口未返回时也能在勾选行展示协议名称
const DEFAULT_DISCLAIMER_TITLE = '全程陪诊服务免责协议'
@@ -43,14 +41,12 @@ Page({
remark: '',
shippingAddress: '',
requiresAddress: false,
payChannel: 'online_wechat',
// 点击「提交预约」后弹出支付方式选择,默认微信支付
payChannel: 'offline',
// 点击「提交预约」后弹出支付方式选择,默认线下支付
showPayPopup: false,
gender: '不限',
genderIndex: 0,
genderOptions: ['不限', '男', '女'],
// 用户指定陪诊师(选填);为空则由平台抢单或管理端指派
selectedAttendant: null,
// 下单前必须勾选确认《全程陪诊服务免责协议》
agreementAgreed: false,
agreementHint: false,
@@ -68,40 +64,10 @@ 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 })
},
/**
* 免责协议:与表单并行预加载,用户点开弹层或直接提交时都能立即展示
*/
@@ -423,7 +389,7 @@ Page({
this.loadDisclaimer()
return
}
this.setData({ showPayPopup: true, payChannel: 'online_wechat' })
this.setData({ showPayPopup: true, payChannel: 'offline' })
},
onClosePayPopup() {
@@ -506,11 +472,7 @@ Page({
notes: { patientNote: data.remark.trim() },
payment: { payChannel: data.payChannel },
// 协议确认快照:回传用户实际阅读的协议版本,服务端与当前版本比对,不一致则拒绝
agreement: { accepted: true, version: data.disclaimer?.version || '' },
// 只传 employeeId,姓名 / 电话由服务端按员工档案回填
...(data.selectedAttendant
? { attendant: { employeeId: data.selectedAttendant.id } }
: {})
agreement: { accepted: true, version: data.disclaimer?.version || '' }
}
},
@@ -583,7 +545,6 @@ Page({
genderIndex: 0,
remark: '',
shippingAddress: '',
selectedAttendant: null,
// 协议按单次服务确认,重置表单后需重新勾选
agreementAgreed: false,
agreementHint: false,