committed by
trae-solo-agent
co-authored by
Kimi-K3.1-Pro
parent
d731fc1da3
commit
a45a3d7a86
@@ -1,28 +1,8 @@
|
||||
const API = require('../../utils/api.js')
|
||||
|
||||
// 状态配色遵循 doc/DESIGN.md §三:四档状态色 + 状态说明文字,
|
||||
// 颜色只做强化,文字才是信息。待确认与已确认同属「等待」阶段,共用待服务档
|
||||
const STATUS_MAP = {
|
||||
// 待确认是唯一「等用户自己决定」的阶段(底栏此时一定有「取消订单」),
|
||||
// 说明文字因此带上可执行动作,靠文字而不是靠再叠一层色块来提请注意
|
||||
pending: { text: '待确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已提交,等待陪诊师确认;确认前可取消' },
|
||||
confirmed: { text: '已确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已确认,陪诊师将准时为您服务' },
|
||||
in_progress: { text: '进行中', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', desc: '陪诊服务正在进行中' },
|
||||
completed: { text: '已完成', color: '#1F7A4D', bg: '#EAF6EE', border: '#CDE9D7', desc: '陪诊服务已完成,感谢您的使用' },
|
||||
cancelled: { text: '已取消', color: '#B4231A', bg: '#FCF0EE', border: '#F2D6D1', desc: '该订单已取消' }
|
||||
}
|
||||
|
||||
// 支付状态胶囊:未支付 / 部分支付复用主色浅档提示待处理;已退款走中性档(--muted 字 + --sep 描边 + 透明底);
|
||||
// 已支付不显示胶囊(支付完成是常态,不需要状态强调),paid 档仅为映射兜底保留。
|
||||
// hint 是未付清时的出口指引:全站没有线上支付入口,只能引导走客服;
|
||||
// 部分支付要说清是「补齐」而不是「完成支付」,否则用户会以为要再付一次全款
|
||||
const PAYMENT_STATUS_MAP = {
|
||||
unpaid: { text: '未支付', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', hint: '请联系客服完成支付' },
|
||||
partial: { text: '部分支付', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', hint: '请联系客服补齐剩余费用' },
|
||||
paid: { text: '已支付', color: '#1F7A4D', bg: '#EAF6EE', border: '#CDE9D7' },
|
||||
refunding: { text: '退款中', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', hint: '退款处理中,如需了解进度请联系客服' },
|
||||
refunded: { text: '已退款', color: '#6F655C', bg: 'transparent', border: '#E5DACC' }
|
||||
}
|
||||
const { parseDate, formatDate, formatDateTime, calcAge } = require('../../utils/date.js')
|
||||
const { STATUS_MAP, PAYMENT_STATUS_MAP } = require('../../utils/order.js')
|
||||
const { maskIdNumber, maskOrderId } = require('../../utils/privacy.js')
|
||||
|
||||
const SEX_MAP = {
|
||||
male: '男',
|
||||
@@ -132,7 +112,7 @@ Page({
|
||||
const firstSession = sessions[0] || {}
|
||||
const minDate = new Date()
|
||||
minDate.setDate(minDate.getDate() + Number(booking.advanceDays || 0))
|
||||
const minAppointmentDate = `${minDate.getFullYear()}-${String(minDate.getMonth() + 1).padStart(2, '0')}-${String(minDate.getDate()).padStart(2, '0')}`
|
||||
const minAppointmentDate = formatDate(minDate)
|
||||
let timeEnd = firstSession.end || ''
|
||||
if (!fixedTime && firstSession.end && booking.durationMinutes) {
|
||||
const [hour, minute] = firstSession.end.split(':').map(Number)
|
||||
@@ -165,7 +145,7 @@ Page({
|
||||
const patient = {
|
||||
name: profile.name || '',
|
||||
sexText: SEX_MAP[profile.sex] || '',
|
||||
age: this.calcAge(profile.birth),
|
||||
age: calcAge(profile.birth),
|
||||
weight: health.weight || 0,
|
||||
height: health.height || 0,
|
||||
mobile: profile.mobile || '',
|
||||
@@ -177,7 +157,7 @@ Page({
|
||||
'record.patientWeight': patient.weight,
|
||||
'record.patientHeight': patient.height,
|
||||
'record.patientMobile': patient.mobile,
|
||||
'record.patientIdnumber': this.maskIdNumber(patient.idnumber),
|
||||
'record.patientIdnumber': maskIdNumber(patient.idnumber),
|
||||
'record.patientInitial': patient.name.charAt(0),
|
||||
'record.patientMeta': this.buildPatientMeta(patient)
|
||||
})
|
||||
@@ -207,7 +187,7 @@ Page({
|
||||
const patient = {
|
||||
name: item.patient?.name || '',
|
||||
sexText: SEX_MAP[item.patient?.sex] || '',
|
||||
age: this.calcAge(item.patient?.birth),
|
||||
age: calcAge(item.patient?.birth),
|
||||
weight: item.patient?.weight || 0,
|
||||
height: item.patient?.height || 0,
|
||||
mobile: item.patient?.mobile || '',
|
||||
@@ -219,13 +199,13 @@ Page({
|
||||
|
||||
return {
|
||||
_id: item._id,
|
||||
displayId: item._id ? `****${String(item._id).slice(-8).toUpperCase()}` : '--',
|
||||
displayId: maskOrderId(item._id),
|
||||
healthProfileId: item.healthProfileId || '',
|
||||
serviceId: item.escort?.serviceId || 0,
|
||||
patientName: patient.name,
|
||||
patientAge: patient.age,
|
||||
patientMobile: patient.mobile,
|
||||
patientIdnumber: this.maskIdNumber(patient.idnumber),
|
||||
patientIdnumber: maskIdNumber(patient.idnumber),
|
||||
patientInitial: patient.name.charAt(0),
|
||||
patientMeta: this.buildPatientMeta(patient),
|
||||
hospitalProvince: item.hospital?.province || '',
|
||||
@@ -237,7 +217,7 @@ Page({
|
||||
hospitalDoctor: item.hospital?.doctor || '',
|
||||
medicalRecordNo: item.hospital?.medicalRecordNo || '',
|
||||
// scheduleDate 保留 YYYY-MM-DD 原格式:编辑弹窗的 date picker 直接喂它
|
||||
scheduleDate: item.schedule?.date ? this.formatDate(item.schedule.date) : '',
|
||||
scheduleDate: item.schedule?.date ? formatDate(item.schedule.date) : '',
|
||||
scheduleStartTime: item.schedule?.startTime || '',
|
||||
scheduleEndTime: item.schedule?.endTime || '',
|
||||
scheduleDateText: scheduleMeta.dateText,
|
||||
@@ -270,8 +250,8 @@ Page({
|
||||
canEditOrder,
|
||||
// 底栏只在确实有按钮时出现,避免无动作状态空留一条白栏
|
||||
showBottomBar: canCancel || canDelete || canRebook,
|
||||
createTime: item.meta?.createtime ? this.formatDateTime(item.meta.createtime) : '',
|
||||
updateTime: item.meta?.updatetime ? this.formatDateTime(item.meta.updatetime) : ''
|
||||
createTime: item.meta?.createtime ? formatDateTime(item.meta.createtime) : '',
|
||||
updateTime: item.meta?.updatetime ? formatDateTime(item.meta.updatetime) : ''
|
||||
}
|
||||
},
|
||||
|
||||
@@ -301,8 +281,8 @@ Page({
|
||||
buildScheduleMeta(schedule) {
|
||||
const result = { dateText: '', timeText: '' }
|
||||
if (schedule.date) {
|
||||
const d = new Date(schedule.date)
|
||||
if (!isNaN(d.getTime())) {
|
||||
const d = parseDate(schedule.date)
|
||||
if (d) {
|
||||
result.dateText = `${d.getFullYear()}年${d.getMonth() + 1}月${d.getDate()}日 ${WEEKDAYS[d.getDay()]}`
|
||||
}
|
||||
}
|
||||
@@ -322,43 +302,6 @@ Page({
|
||||
return result
|
||||
},
|
||||
|
||||
// 根据出生年月(YYYY-MM-DD)计算年龄
|
||||
calcAge(birth) {
|
||||
if (!birth) return 0
|
||||
const d = new Date(birth)
|
||||
if (isNaN(d.getTime())) return 0
|
||||
const now = new Date()
|
||||
let age = now.getFullYear() - d.getFullYear()
|
||||
const m = now.getMonth() - d.getMonth()
|
||||
if (m < 0 || (m === 0 && now.getDate() < d.getDate())) age--
|
||||
return age > 0 ? age : 0
|
||||
},
|
||||
|
||||
formatDate(dateStr) {
|
||||
const d = new Date(dateStr)
|
||||
const year = d.getFullYear()
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
},
|
||||
|
||||
formatDateTime(dateStr) {
|
||||
const d = new Date(dateStr)
|
||||
const year = d.getFullYear()
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
const hour = String(d.getHours()).padStart(2, '0')
|
||||
const minute = String(d.getMinutes()).padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hour}:${minute}`
|
||||
},
|
||||
|
||||
maskIdNumber(idNumber) {
|
||||
const value = String(idNumber || '').trim()
|
||||
if (!value) return ''
|
||||
if (value.length <= 8) return '********'
|
||||
return `${value.slice(0, 4)}********${value.slice(-4)}`
|
||||
},
|
||||
|
||||
onContactSupport() {
|
||||
const record = this.data.record
|
||||
if (!record._id) return
|
||||
|
||||
Reference in New Issue
Block a user