diff --git a/app.js b/app.js
index a3fb8c9..1fb5438 100644
--- a/app.js
+++ b/app.js
@@ -222,6 +222,29 @@ App({
return this.globalData.agreementReady
},
+ // 下单页的免责协议:与「用户协议」分开缓存,正文修订后随接口即时生效
+ loadDisclaimer() {
+ if (this.globalData.disclaimerReady) return this.globalData.disclaimerReady
+ this.globalData.disclaimerReady = API.resource.getDisclaimer()
+ .then((res) => {
+ if (res.code !== 0 || !res.data?.disclaimer) throw new Error(res.msg || '免责协议加载失败')
+ this.globalData.disclaimer = res.data.disclaimer
+ return this.globalData.disclaimer
+ })
+ .catch((err) => {
+ console.error('获取免责协议失败', err)
+ this.globalData.disclaimerReady = null
+ return null
+ })
+ return this.globalData.disclaimerReady
+ },
+
+ // 服务端判定协议版本不一致后调用:作废缓存,下次 loadDisclaimer 重新拉取最新版
+ invalidateDisclaimer() {
+ this.globalData.disclaimer = null
+ this.globalData.disclaimerReady = null
+ },
+
// 已经拿到用户(如「我的」页手机号授权登录成功)就直接返回成功。
// 但若此刻有静默登录在飞(token 可能正在轮换),要先等它落定:
// 抢跑会让页面拿旧 token 发请求、收到 401 再触发一次重登 + 重试。
@@ -353,6 +376,8 @@ App({
hospitalsReady: null,
agreement: null,
agreementReady: null,
+ disclaimer: null,
+ disclaimerReady: null,
authReady: null,
}
})
\ No newline at end of file
diff --git a/pages/escort/itemorder.js b/pages/escort/itemorder.js
index 1c1391e..08a2848 100644
--- a/pages/escort/itemorder.js
+++ b/pages/escort/itemorder.js
@@ -8,6 +8,8 @@ const SERVICE_OPTION_HEIGHT = 108
const SERVICE_PANEL_RESERVED = 200
// 与陪诊师列表 / 详情页共用的选择结果 key
const SELECTED_ATTENDANT_KEY = 'escort_selected_attendant'
+// 免责协议标题兜底:接口未返回时也能在勾选行展示协议名称
+const DEFAULT_DISCLAIMER_TITLE = '全程陪诊服务免责协议'
Page({
data: {
@@ -48,7 +50,15 @@ Page({
genderIndex: 0,
genderOptions: ['不限', '男', '女'],
// 用户指定陪诊师(选填);为空则由平台抢单或管理端指派
- selectedAttendant: null
+ selectedAttendant: null,
+ // 下单前必须勾选确认《全程陪诊服务免责协议》
+ agreementAgreed: false,
+ agreementHint: false,
+ agreementTitle: DEFAULT_DISCLAIMER_TITLE,
+ showAgreementPopup: false,
+ disclaimer: null,
+ disclaimerLoading: false,
+ disclaimerError: false
},
onLoad(options) {
@@ -92,9 +102,56 @@ Page({
this.setData({ selectedAttendant: null })
},
+ /**
+ * 免责协议:与表单并行预加载,用户点开弹层或直接提交时都能立即展示
+ */
+ loadDisclaimer() {
+ if (this.data.disclaimer || this.data.disclaimerLoading) return
+ this.setData({ disclaimerLoading: true, disclaimerError: false })
+ getApp().loadDisclaimer().then((disclaimer) => {
+ this.setData({
+ disclaimer,
+ agreementTitle: disclaimer?.title || DEFAULT_DISCLAIMER_TITLE,
+ disclaimerLoading: false,
+ disclaimerError: !disclaimer
+ })
+ })
+ },
+
+ onToggleAgreement() {
+ if (this.data.submitting) return
+ this.setData({
+ agreementAgreed: !this.data.agreementAgreed,
+ agreementHint: false
+ })
+ },
+
+ onOpenAgreement() {
+ this.setData({ showAgreementPopup: true })
+ this.loadDisclaimer()
+ },
+
+ onCloseAgreementPopup() {
+ this.setData({ showAgreementPopup: false })
+ },
+
+ onAgreeFromPopup() {
+ this.setData({
+ agreementAgreed: true,
+ agreementHint: false,
+ showAgreementPopup: false
+ })
+ },
+
+ retryLoadDisclaimer() {
+ this.loadDisclaimer()
+ },
+
async initializePage() {
this.pageReady = false
this.setData({ pageLoading: true, pageError: '' })
+ // 免责协议与表单并行加载,避免用户点开协议时再空等
+ this.loadDisclaimer()
const services = await getApp().loadServices()
if (!services || services.length === 0) {
this.setData({ pageLoading: false, pageError: '服务加载失败,请重试' })
@@ -360,6 +417,12 @@ Page({
wx.showToast({ title: error, icon: 'none' })
return
}
+ // 免责协议是下单前置条件:未勾选时直接拉起协议弹层,读完即可勾选
+ if (!this.data.agreementAgreed) {
+ this.setData({ agreementHint: true, showAgreementPopup: true })
+ this.loadDisclaimer()
+ return
+ }
this.setData({ showPayPopup: true, payChannel: 'online_wechat' })
},
@@ -409,6 +472,12 @@ Page({
else wx.navigateTo({ url: '/pages/escort/recordlist?tab=ongoing' })
} catch (err) {
console.log('下单失败', err)
+ // 服务端判定协议版本不一致:作废本地缓存、重新拉取并弹出协议要求重新确认
+ if ((err.message || '').includes('协议已更新')) {
+ getApp().invalidateDisclaimer()
+ this.setData({ disclaimer: null, agreementAgreed: false, showAgreementPopup: true })
+ this.loadDisclaimer()
+ }
wx.showToast({ title: err.message || '网络请求失败,请重试', icon: 'none' })
} finally {
this.setData({ submitting: false })
@@ -436,6 +505,8 @@ Page({
shippingAddress: { address: data.shippingAddress.trim() },
notes: { patientNote: data.remark.trim() },
payment: { payChannel: data.payChannel },
+ // 协议确认快照:回传用户实际阅读的协议版本,服务端与当前版本比对,不一致则拒绝
+ agreement: { accepted: true, version: data.disclaimer?.version || '' },
// 只传 employeeId,姓名 / 电话由服务端按员工档案回填
...(data.selectedAttendant
? { attendant: { employeeId: data.selectedAttendant.id } }
@@ -512,7 +583,11 @@ Page({
genderIndex: 0,
remark: '',
shippingAddress: '',
- selectedAttendant: null
+ selectedAttendant: null,
+ // 协议按单次服务确认,重置表单后需重新勾选
+ agreementAgreed: false,
+ agreementHint: false,
+ showAgreementPopup: false
}, () => this.refreshHospitalOptions(provinces[0] || ''))
// 重置后仍默认选中第一个就诊人,方便连续预约
const first = this.data.profiles[0]
diff --git a/pages/escort/itemorder.wxml b/pages/escort/itemorder.wxml
index 74c846b..e320e79 100644
--- a/pages/escort/itemorder.wxml
+++ b/pages/escort/itemorder.wxml
@@ -155,6 +155,20 @@
{{remark.length}}/200
+
+
+
+
+
+
+
+
+ 我已阅读并同意
+ 《{{agreementTitle}}》
+
+
+ 请勾选同意后再提交预约
+
@@ -220,4 +234,47 @@
+
+
+
+
diff --git a/pages/escort/itemorder.wxss b/pages/escort/itemorder.wxss
index 5d17602..3184ffa 100644
--- a/pages/escort/itemorder.wxss
+++ b/pages/escort/itemorder.wxss
@@ -709,10 +709,170 @@ page {
font-weight: 700;
}
+/* ===== 免责协议确认(下单前置勾选) ===== */
+.agreement-block {
+ padding: 26rpx 0 30rpx;
+}
+
+.agreement-row {
+ display: flex;
+ align-items: flex-start;
+ gap: 16rpx;
+}
+
+.agreement-check {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ box-sizing: border-box;
+ width: 36rpx;
+ height: 36rpx;
+ margin-top: 2rpx;
+ border: 2rpx solid var(--brand-line);
+ border-radius: 50%;
+ background: var(--white);
+ transition: background 0.15s ease, border-color 0.15s ease;
+}
+
+/* 选中态沿用全站唯一实心主色,白色对勾直接落在主色上 */
+.agreement-check.checked {
+ border-color: var(--brand-strong);
+ background: var(--brand-strong);
+}
+
+.agreement-consent {
+ flex: 1;
+ min-width: 0;
+ line-height: 1.6;
+}
+
+.agreement-consent-text {
+ color: var(--muted);
+ font-size: var(--fs-26);
+}
+
+.agreement-link {
+ color: var(--brand-ink);
+ font-size: var(--fs-26);
+ font-weight: 600;
+}
+
+.agreement-block.is-hint .agreement-consent-text {
+ color: var(--ink-2);
+}
+
+.agreement-hint {
+ display: block;
+ margin-top: 10rpx;
+ margin-left: 52rpx;
+ color: var(--brand-strong);
+ font-size: var(--fs-24);
+ line-height: 1.5;
+}
+
+/* ===== 免责协议弹层:正文区可滚动,底部固定同意按钮 ===== */
+.agreement-popup {
+ height: 80vh;
+ max-height: 80vh;
+}
+
+.agreement-popup-body {
+ flex: 1;
+ min-height: 0;
+ box-sizing: border-box;
+ padding: 20rpx 32rpx 8rpx;
+}
+
+.agreement-popup-subtitle {
+ display: block;
+ margin-bottom: 24rpx;
+ padding: 16rpx 20rpx;
+ border-radius: 14rpx;
+ background: var(--brand-soft);
+ color: var(--brand-ink);
+ font-size: var(--fs-24);
+ line-height: 1.6;
+}
+
+.agreement-section {
+ margin-bottom: 28rpx;
+}
+
+.agreement-section-title {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12rpx;
+ color: var(--ink);
+ font-size: var(--fs-28);
+ font-weight: 700;
+ line-height: 1.5;
+}
+
+.agreement-section-number {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ width: 36rpx;
+ height: 36rpx;
+ margin-right: 12rpx;
+ border: 2rpx solid var(--brand-line);
+ border-radius: 50%;
+ background: var(--brand-soft);
+ color: var(--brand-ink);
+ font-size: var(--fs-24);
+ font-weight: 700;
+}
+
+.agreement-item {
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 10rpx;
+}
+
+.agreement-item-dot {
+ flex-shrink: 0;
+ width: 10rpx;
+ height: 10rpx;
+ margin: 14rpx 12rpx 0 0;
+ border-radius: 50%;
+ background: var(--brand-strong);
+}
+
+.agreement-item-text {
+ flex: 1;
+ color: var(--ink-2);
+ font-size: var(--fs-26);
+ line-height: 1.7;
+}
+
+.agreement-popup-footer {
+ margin-top: 8rpx;
+ padding: 16rpx 0 24rpx;
+ border-top: 2rpx dotted var(--sep);
+}
+
+.agreement-popup-footer-text {
+ display: block;
+ color: var(--muted);
+ font-size: var(--fs-24);
+ line-height: 1.6;
+}
+
+.agreement-popup-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 80rpx 0;
+}
+
@media (prefers-reduced-motion: reduce) {
.patient-chip,
.add-profile-tip,
- .submit-btn {
+ .submit-btn,
+ .agreement-check {
transition: none;
}
}
\ No newline at end of file
diff --git a/utils/api.js b/utils/api.js
index 5fc9a19..c6979ff 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -52,6 +52,8 @@ const API = {
resource: {
getServices: (params) => request.get('/health/service', params),
getAgreement: (params) => request.get('/health/agreement', params),
+ // 下单前需勾选确认的《全程陪诊服务免责协议》
+ getDisclaimer: (params) => request.get('/health/disclaimer', params),
getAiQuickQuestions: (params) => request.get('/health/ai-quick-questions', params),
},