committed by
trae-solo-agent
co-authored by
Kimi-K3.1-Pro noreply@moonshot.cn
parent
1181d598b4
commit
df96cb3b07
@@ -20,13 +20,36 @@ Page({
|
||||
this.setData({ loading: true, error: false })
|
||||
getApp().loadAgreement().then((agreement) => {
|
||||
this.setData({
|
||||
agreement: agreement || null,
|
||||
agreement: agreement ? this.formatAgreement(agreement) : null,
|
||||
loading: false,
|
||||
error: !agreement
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 服务端协议保留简洁文案结构,页面渲染前补稳定键,不在 WXML 使用索引或值本身作 key。
|
||||
formatAgreement(agreement) {
|
||||
const toItems = list => (list || []).map((text, index) => ({
|
||||
id: `${index}_${text}`,
|
||||
text
|
||||
}))
|
||||
return {
|
||||
...agreement,
|
||||
sections: (agreement.sections || []).map(section => ({
|
||||
...section,
|
||||
items: section.items ? toItems(section.items) : section.items,
|
||||
table: section.table ? {
|
||||
headers: toItems(section.table.headers),
|
||||
rows: (section.table.rows || []).map(row => ({
|
||||
id: row.join('|'),
|
||||
cells: toItems(row)
|
||||
}))
|
||||
} : section.table
|
||||
})),
|
||||
footer: toItems(agreement.footer)
|
||||
}
|
||||
},
|
||||
|
||||
retry() {
|
||||
this.loadAgreement()
|
||||
},
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
<view class="section-content">
|
||||
<!-- list / mixed 类型的 items -->
|
||||
<block wx:if="{{item.type === 'list' || item.type === 'mixed'}}">
|
||||
<view wx:for="{{item.items}}" wx:for-item="subItem" wx:for-index="subIdx" wx:key="subIdx" class="list-item">
|
||||
<view wx:for="{{item.items}}" wx:for-item="subItem" wx:key="id" class="list-item">
|
||||
<view class="list-dot"></view>
|
||||
<text class="list-text">{{subItem}}</text>
|
||||
<text class="list-text">{{subItem.text}}</text>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
<block wx:if="{{item.type === 'mixed' && item.table}}">
|
||||
<view class="refund-table">
|
||||
<view class="table-row header">
|
||||
<text wx:for="{{item.table.headers}}" wx:for-item="h" wx:key="*this" class="table-cell">{{h}}</text>
|
||||
<text wx:for="{{item.table.headers}}" wx:for-item="h" wx:key="id" class="table-cell">{{h.text}}</text>
|
||||
</view>
|
||||
<view wx:for="{{item.table.rows}}" wx:for-item="row" wx:key="*this" class="table-row">
|
||||
<text wx:for="{{row}}" wx:for-item="cell" wx:key="*this" class="table-cell">{{cell}}</text>
|
||||
<view wx:for="{{item.table.rows}}" wx:for-item="row" wx:key="id" class="table-row">
|
||||
<text wx:for="{{row.cells}}" wx:for-item="cell" wx:key="id" class="table-cell">{{cell.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
@@ -52,7 +52,7 @@
|
||||
</view>
|
||||
|
||||
<view class="footer-section">
|
||||
<text wx:for="{{agreement.footer}}" wx:key="*this" class="footer-text">{{item}}</text>
|
||||
<text wx:for="{{agreement.footer}}" wx:key="id" class="footer-text">{{item.text}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
@@ -63,6 +63,14 @@ Page({
|
||||
]
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
const toItems = list => list.map(text => ({ id: text, text }))
|
||||
this.setData({
|
||||
preparations: toItems(this.data.preparations),
|
||||
tips: toItems(this.data.tips)
|
||||
})
|
||||
},
|
||||
|
||||
// 下一步:进入陪诊服务列表
|
||||
goToServiceList() {
|
||||
wx.navigateTo({
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
<text class="card-title">就诊前准备</text>
|
||||
</view>
|
||||
<view class="dot-list">
|
||||
<view class="dot-item" wx:for="{{ preparations }}" wx:key="*this">
|
||||
<view class="dot-item" wx:for="{{ preparations }}" wx:key="id">
|
||||
<view class="dot"></view>
|
||||
<text class="dot-text">{{ item }}</text>
|
||||
<text class="dot-text">{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -61,9 +61,9 @@
|
||||
<text class="card-title">温馨提示</text>
|
||||
</view>
|
||||
<view class="dot-list">
|
||||
<view class="dot-item" wx:for="{{ tips }}" wx:key="*this">
|
||||
<view class="dot-item" wx:for="{{ tips }}" wx:key="id">
|
||||
<view class="dot"></view>
|
||||
<text class="dot-text">{{ item }}</text>
|
||||
<text class="dot-text">{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -65,8 +65,12 @@ Page({
|
||||
}
|
||||
|
||||
this.applyBookingConfig(service)
|
||||
const serviceView = {
|
||||
...service,
|
||||
notices: (service.notices || []).map(text => ({ id: text, text }))
|
||||
}
|
||||
this.setData({
|
||||
service,
|
||||
service: serviceView,
|
||||
serviceIcon: this.getServiceIcon(service.title),
|
||||
totalPrice: service.price,
|
||||
pageLoading: false
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<text class="section-title">服务流程</text>
|
||||
</view>
|
||||
<view class="step-list">
|
||||
<view class="step" wx:for="{{ service.flow }}" wx:key="index">
|
||||
<view class="step" wx:for="{{ service.flow }}" wx:key="title">
|
||||
<view class="step-rail">
|
||||
<view class="step-dot">{{ index + 1 }}</view>
|
||||
<view class="step-line" wx:if="{{ index < service.flow.length - 1 }}"></view>
|
||||
@@ -49,9 +49,9 @@
|
||||
<text class="section-title">注意事项</text>
|
||||
</view>
|
||||
<view class="dot-list">
|
||||
<view class="dot-item" wx:for="{{ service.notices }}" wx:key="index">
|
||||
<view class="dot-item" wx:for="{{ service.notices }}" wx:key="id">
|
||||
<view class="dot"></view>
|
||||
<text class="dot-text">{{ item }}</text>
|
||||
<text class="dot-text">{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -39,11 +39,11 @@ Page({
|
||||
showCancelPopup: false,
|
||||
cancelReason: '',
|
||||
cancelReasons: [
|
||||
'临时有事,无法前往',
|
||||
'病情好转,无需陪诊',
|
||||
'医院停诊/改期',
|
||||
'陪诊师无法到达',
|
||||
'其他原因'
|
||||
{ id: 'schedule', text: '临时有事,无法前往' },
|
||||
{ id: 'recovered', text: '病情好转,无需陪诊' },
|
||||
{ id: 'hospital', text: '医院停诊/改期' },
|
||||
{ id: 'escort', text: '陪诊师无法到达' },
|
||||
{ id: 'other', text: '其他原因' }
|
||||
]
|
||||
},
|
||||
|
||||
@@ -259,10 +259,10 @@ Page({
|
||||
// 不靠一串 && 条件去猜哪条分隔线该出现(避免留下孤立的分隔线)
|
||||
buildPatientMeta(patient) {
|
||||
const list = []
|
||||
if (patient.sexText) list.push(patient.sexText)
|
||||
if (patient.age) list.push(`${patient.age}岁`)
|
||||
if (patient.height) list.push(`身高 ${patient.height}cm`)
|
||||
if (patient.weight) list.push(`体重 ${patient.weight}kg`)
|
||||
if (patient.sexText) list.push({ id: 'sex', text: patient.sexText })
|
||||
if (patient.age) list.push({ id: 'age', text: `${patient.age}岁` })
|
||||
if (patient.height) list.push({ id: 'height', text: `身高 ${patient.height}cm` })
|
||||
if (patient.weight) list.push({ id: 'weight', text: `体重 ${patient.weight}kg` })
|
||||
return list
|
||||
},
|
||||
|
||||
@@ -270,9 +270,11 @@ Page({
|
||||
// 省份不进元信息行,由 hospitalProvince 单独提到卡内右上角
|
||||
buildHospitalMeta(hospital) {
|
||||
const list = []
|
||||
if (hospital.department) list.push(hospital.department)
|
||||
if (hospital.doctor) list.push(hospital.doctor)
|
||||
if (hospital.medicalRecordNo) list.push(`病历号 ${hospital.medicalRecordNo}`)
|
||||
if (hospital.department) list.push({ id: 'department', text: hospital.department })
|
||||
if (hospital.doctor) list.push({ id: 'doctor', text: hospital.doctor })
|
||||
if (hospital.medicalRecordNo) {
|
||||
list.push({ id: 'medicalRecordNo', text: `病历号 ${hospital.medicalRecordNo}` })
|
||||
}
|
||||
return list
|
||||
},
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
|
||||
<!-- 体征行:空值已在 JS 里整项剔除,这里只按序插竖线 -->
|
||||
<view class="meta-list patient-meta-row" wx:if="{{record.patientMeta.length > 0}}">
|
||||
<block wx:for="{{record.patientMeta}}" wx:key="*this">
|
||||
<block wx:for="{{record.patientMeta}}" wx:key="id">
|
||||
<view class="meta-sep" wx:if="{{index > 0}}"></view>
|
||||
<text class="meta-item">{{item}}</text>
|
||||
<text class="meta-item">{{item.text}}</text>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
@@ -85,9 +85,9 @@
|
||||
</view>
|
||||
|
||||
<view class="meta-list hospital-meta" wx:if="{{record.hospitalMeta.length > 0}}">
|
||||
<block wx:for="{{record.hospitalMeta}}" wx:key="*this">
|
||||
<block wx:for="{{record.hospitalMeta}}" wx:key="id">
|
||||
<view class="meta-sep" wx:if="{{index > 0}}"></view>
|
||||
<text class="meta-item">{{item}}</text>
|
||||
<text class="meta-item">{{item.text}}</text>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
@@ -392,16 +392,16 @@
|
||||
<text class="cancel-tip">确定要取消该陪诊订单吗?取消后陪诊师将收到通知。</text>
|
||||
<view class="cancel-reason-list">
|
||||
<view
|
||||
class="cancel-reason-item {{cancelReason === item ? 'active' : ''}}"
|
||||
class="cancel-reason-item {{cancelReason === item.text ? 'active' : ''}}"
|
||||
wx:for="{{cancelReasons}}"
|
||||
wx:key="*this"
|
||||
data-reason="{{item}}"
|
||||
wx:key="id"
|
||||
data-reason="{{item.text}}"
|
||||
bindtap="onSelectCancelReason"
|
||||
>
|
||||
<view class="reason-radio">
|
||||
<view class="reason-radio-inner" wx:if="{{cancelReason === item}}"></view>
|
||||
<view class="reason-radio-inner" wx:if="{{cancelReason === item.text}}"></view>
|
||||
</view>
|
||||
<text class="reason-text">{{item}}</text>
|
||||
<text class="reason-text">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user