Files
wxapp_escort/pages/escort/itemorder.wxml
T
lik 3755e1283b style(order): 预约下单页兜底与项目切换入口强化
初始化拆出 loadPageContent,协议、医院列表与登录状态失败各自降级,不再挡整页;
陪诊项目「更换」改为品牌橙胶囊并改名「更换服务」,箭头同步换色;
就诊人胶囊补同名提示,导航栏统一为浅色纸面。
2026-11-16 19:30:44 +08:00

288 lines
14 KiB
Plaintext

<!--pages/escort/itemorder.wxml-->
<view class="page-bg">
<view class="container" wx:if="{{!pageLoading && !pageError && service.id}}">
<!-- 四组信息按填写顺序组织;不改变预约、协议与支付逻辑。 -->
<view class="booking-form">
<view class="form-section">
<view class="form-section-head">
<text class="form-section-number">01</text>
<text class="form-section-title">选择服务</text>
</view>
<!-- 陪诊项目:保留原项目卡片展示,点击卡片展开下拉列表切换 -->
<view class="service-picker-row">
<view class="service-picker {{submitting ? 'is-disabled' : ''}}">
<view class="order-service-info" bindtap="onToggleServicePanel" aria-role="button" aria-label="切换陪诊项目" aria-expanded="{{servicePanelOpen}}">
<view class="order-service-mark">
<view class="assist-icon {{serviceIconClass}}"></view>
</view>
<view class="order-service-text">
<text class="order-service-title">{{service.title}}</text>
<text class="order-service-price">¥{{service.price}}/次</text>
</view>
<view class="service-switch">
<text>更换服务</text>
<view class="service-picker-arrow {{servicePanelOpen ? 'is-open' : ''}}">
<t-icon name="chevron-down" size="28rpx" color="#9B4508" />
</view>
</view>
</view>
<view class="service-panel" wx:if="{{servicePanelOpen}}">
<scroll-view wx:if="{{services.length > 0}}" class="service-options" scroll-y
style="height: {{serviceOptionsHeight}}rpx;">
<view class="service-option {{index === serviceIndex ? 'active' : ''}}" wx:for="{{services}}" wx:key="id"
data-index="{{index}}" bindtap="onServiceOptionTap">
<view class="service-option-mark">
<view class="assist-icon {{item.iconClass}}"></view>
</view>
<text class="service-option-name">{{item.title}}</text>
<text class="service-option-sub">¥{{item.price}}/次</text>
<text class="service-option-selected" wx:if="{{index === serviceIndex}}">已选</text>
</view>
</scroll-view>
<view wx:else class="service-empty">
<text class="service-empty-text">暂无可选项目</text>
</view>
</view>
</view>
</view>
<text class="service-fee-note">费用仅含人工服务费,不含就医、药品及快递费用。</text>
</view>
<view class="form-section">
<view class="form-section-head">
<text class="form-section-number">02</text>
<text class="form-section-title">就诊人信息</text>
</view>
<!-- 选择就诊人:订单必须关联健康档案,就诊人信息全部由此带入 -->
<view class="order-row column patient-select-row">
<scroll-view class="patient-scroll" scroll-x wx:if="{{profiles.length > 0}}">
<view class="patient-chips">
<view class="patient-chip {{selectedProfileId === item._id ? 'active' : ''}}" wx:for="{{profiles}}" wx:key="_id"
data-id="{{item._id}}" bindtap="onSelectProfile" aria-role="radio" aria-checked="{{selectedProfileId === item._id}}">
<view wx:if="{{selectedProfileId === item._id}}" class="selection-check"></view>
<view class="patient-chip-copy">
<text class="patient-chip-name">{{item.name}}</text>
<text class="patient-chip-note" wx:if="{{item.nameHint}}">{{item.nameHint}}</text>
</view>
</view>
<view class="patient-chip patient-chip-add" bindtap="goToAddProfile" aria-role="button" aria-label="增加就诊人">
<t-icon name="add" size="28rpx" color="#9B4508" />
<text class="patient-chip-name">增加</text>
</view>
</view>
</scroll-view>
<view class="add-profile-tip" wx:else bindtap="goToAddProfile">
<text class="add-profile-tip-text">还没有就诊人,去添加后可一键带入</text>
<t-icon name="chevron-right" size="24rpx" color="#9B4508" />
</view>
</view>
<view class="order-row">
<text class="order-label">联系电话</text>
<text class="order-value {{patientPhone ? '' : 'placeholder'}}">{{patientPhone || '请先选择就诊人'}}</text>
</view>
</view>
<view class="form-section">
<view class="form-section-head">
<text class="form-section-number">03</text>
<text class="form-section-title">就诊安排</text>
</view>
<view class="order-row">
<text class="order-label">就诊省份</text>
<picker class="order-picker" mode="selector" range="{{provinces}}" value="{{provinceIndex}}" bindchange="onProvinceChange">
<view class="picker-value-wrap">
<text class="picker-value {{province ? '' : 'placeholder'}}">{{province || '请选择省份'}}</text>
<view class="picker-chevron"></view>
</view>
</picker>
</view>
<hospital-select
label="就诊医院"
value="{{hospital}}"
options="{{hospitalOptions}}"
placeholder="请选择就诊医院"
disabled="{{submitting}}"
bindchange="onHospitalChange"
/>
<!-- 陪诊师性别:先隐藏,下单固定按「不限」提交(js 中 gender 默认值),恢复时取消注释
<view class="order-row">
<text class="order-label">陪诊师性别</text>
<picker class="order-picker" mode="selector" range="{{genderOptions}}" value="{{genderIndex}}" bindchange="onGenderChange">
<view class="picker-value-wrap">
<text class="picker-value {{gender ? '' : 'placeholder'}}">{{gender || '请选择性别要求'}}</text>
<view class="picker-chevron"></view>
</view>
</picker>
</view>
-->
<view class="order-row">
<text class="order-label">预约日期</text>
<picker class="order-picker" mode="date" value="{{appointmentDate}}" start="{{minAppointmentDate}}" bindchange="onDateChange">
<view class="picker-value-wrap">
<text class="picker-value {{appointmentDate ? '' : 'placeholder'}}">{{appointmentDate || '请选择预约日期'}}</text>
<view class="picker-chevron"></view>
</view>
</picker>
</view>
<!-- 预约时间:整点/半点一档,所有服务统一可选到 23:30 -->
<view class="order-row">
<text class="order-label">预约时间</text>
<picker class="order-picker" mode="selector" range="{{timeSlots}}" value="{{timeSlotIndex}}" bindchange="onTimeChange">
<view class="picker-value-wrap">
<text class="picker-value {{appointmentTime ? '' : 'placeholder'}}">{{appointmentTime || '请选择预约时间'}}</text>
<view class="picker-chevron"></view>
</view>
</picker>
</view>
</view>
<view class="form-section">
<view class="form-section-head">
<text class="form-section-number">04</text>
<text class="form-section-title">补充信息</text>
<text class="form-section-optional">选填</text>
</view>
<!-- 收货地址仅对快递/跑腿服务展示,随订单保存快照 -->
<view class="order-row column" wx:if="{{requiresAddress}}">
<text class="order-label">收货地址(选填)</text>
<textarea class="order-textarea" value="{{shippingAddress}}" placeholder="请输入省市区、街道门牌等完整收货地址" maxlength="200" placeholder-class="input-placeholder" bindinput="onShippingAddressChange" />
<text class="address-tip">收货人与联系电话使用所选就诊人信息</text>
</view>
<view class="order-row column remark-row">
<textarea class="order-textarea" aria-label="补充信息(选填)" value="{{remark}}" placeholder="如行动不便、需要轮椅或其他陪诊需求" maxlength="200" placeholder-class="input-placeholder" bindinput="onRemarkChange" />
<text class="textarea-count">{{remark.length}}/200</text>
</view>
</view>
<!-- 下单前置确认:勾选后才允许提交预约 -->
<view class="agreement-block {{agreementHint ? 'is-hint' : ''}}">
<view class="agreement-row" bindtap="onToggleAgreement" aria-role="checkbox" aria-checked="{{agreementAgreed}}">
<view class="agreement-check {{agreementAgreed ? 'checked' : ''}}">
<view wx:if="{{agreementAgreed}}" class="selection-check"></view>
</view>
<view class="agreement-consent">
<text class="agreement-consent-text">我已阅读并同意</text>
<text class="agreement-link" catchtap="onOpenAgreement">《{{agreementTitle}}》</text>
</view>
</view>
<text class="agreement-hint" wx:if="{{agreementHint}}">请勾选同意后再提交预约</text>
</view>
</view>
<view class="bottom-placeholder"></view>
<view class="bottom-bar">
<view class="bottom-summary">
<text class="bottom-price-label">服务费用</text>
<view class="bottom-price">
<text class="price-sym">¥</text>
<text class="bottom-price-value">{{totalPrice}}</text>
</view>
</view>
<button class="submit-btn" bindtap="submitOrder" disabled="{{submitting}}" loading="{{submitting}}">{{submitting ? '提交中' : '提交预约'}}</button>
</view>
</view>
<view class="page-state" wx:if="{{pageLoading}}">
<t-loading theme="circular" size="40rpx" text="加载中..." />
</view>
<view class="page-state" wx:if="{{!pageLoading && pageError}}">
<text class="page-state-text">{{pageError}}</text>
<button class="page-retry" bindtap="retryLoad">重新加载</button>
</view>
<!-- 支付方式选择弹窗:点击「提交预约」后出现,默认线下支付 -->
<view class="popup-mask {{showPayPopup ? 'show' : ''}}" bindtap="onClosePayPopup"></view>
<view class="popup-content {{showPayPopup ? 'show' : ''}}">
<view class="popup-header">
<text class="popup-title">选择支付方式</text>
<view class="popup-close" aria-role="button" aria-label="关闭弹窗" bindtap="onClosePayPopup">
<t-icon name="close" size="40rpx" color="#6F655C" />
</view>
</view>
<view class="popup-body">
<view class="pay-channel-options">
<view
class="pay-channel-option {{payChannel === 'online_wechat' ? 'active' : ''}}"
data-channel="online_wechat"
bindtap="onPayChannelChange"
>
<view class="pay-channel-text">
<text class="pay-channel-title">微信支付</text>
<text class="pay-channel-desc">提交后立即拉起收银台</text>
</view>
<view class="pay-channel-radio {{payChannel === 'online_wechat' ? 'checked' : ''}}"></view>
</view>
<view
class="pay-channel-option {{payChannel === 'offline' ? 'active' : ''}}"
data-channel="offline"
bindtap="onPayChannelChange"
>
<view class="pay-channel-text">
<text class="pay-channel-title">线下支付</text>
<text class="pay-channel-desc">平台收款后确认订单</text>
</view>
<view class="pay-channel-radio {{payChannel === 'offline' ? 'checked' : ''}}"></view>
</view>
</view>
<text class="pay-popup-tip">微信支付可立即完成付款;线下支付由平台收款后再确认订单。</text>
</view>
<view class="popup-footer">
<view class="popup-btn popup-btn-ghost" bindtap="onClosePayPopup">取消</view>
<view class="popup-btn popup-btn-primary" bindtap="onConfirmPay">
{{submitting ? '提交中...' : '确认提交'}}
</view>
</view>
</view>
<!-- 免责协议弹层:下单前必须阅读并勾选同意 -->
<view class="popup-mask {{showAgreementPopup ? 'show' : ''}}" bindtap="onCloseAgreementPopup"></view>
<view class="popup-content agreement-popup {{showAgreementPopup ? 'show' : ''}}">
<view class="popup-header">
<text class="popup-title">{{agreementTitle}}</text>
<view class="popup-close" aria-role="button" aria-label="关闭弹窗" bindtap="onCloseAgreementPopup">
<t-icon name="close" size="40rpx" color="#6F655C" />
</view>
</view>
<scroll-view class="agreement-popup-body" scroll-y>
<block wx:if="{{disclaimer}}">
<text class="agreement-popup-subtitle" wx:if="{{disclaimer.subtitle}}">{{disclaimer.subtitle}}</text>
<view class="agreement-section" wx:for="{{disclaimer.sections}}" wx:key="number">
<view class="agreement-section-title">
<view class="agreement-section-number">{{item.number}}</view>
<text>{{item.title}}</text>
</view>
<block wx:if="{{item.type === 'list'}}">
<view class="agreement-item" wx:for="{{item.items}}" wx:for-item="subItem" wx:key="*this">
<view class="agreement-item-dot"></view>
<text class="agreement-item-text">{{subItem}}</text>
</view>
</block>
</view>
<view class="agreement-popup-footer" wx:if="{{disclaimer.footer.length}}">
<text class="agreement-popup-footer-text" wx:for="{{disclaimer.footer}}" wx:for-item="footItem" wx:key="*this">{{footItem}}</text>
</view>
</block>
<view class="agreement-popup-state" wx:elif="{{disclaimerLoading}}">
<t-loading theme="circular" size="40rpx" text="加载中..." />
</view>
<view class="agreement-popup-state" wx:elif="{{disclaimerError}}">
<text class="page-state-text">协议加载失败,请重试</text>
<button class="page-retry" bindtap="retryLoadDisclaimer">重新加载</button>
</view>
</scroll-view>
<view class="popup-footer">
<view class="popup-btn popup-btn-ghost" bindtap="onCloseAgreementPopup">暂不</view>
<view class="popup-btn popup-btn-primary" wx:if="{{disclaimer}}" bindtap="onAgreeFromPopup">我已阅读并同意</view>
<view class="popup-btn popup-btn-primary" wx:else bindtap="retryLoadDisclaimer">重新加载</view>
</view>
</view>
</view>