feat(home): 未完成预约改逐条单行预览并换淡绿卡

- 首屏主 CTA 下方列出最近 3 条未完成预约,按日期/时段正序
- 每条压成一行:日期 · 就诊人 · 医院 · 服务项目,日期只到月-日
- 卡面改淡绿状态底 + 描边、不加阴影,数量改实心青绿胶囊
- 删除常用功能区的待服务提醒条,介绍卡只留信任行
- DESIGN.md §三登记淡绿整卡为首页唯一例外
This commit is contained in:
lik
2026-11-03 11:15:57 +08:00
parent 71a065d7f8
commit f78025e935
4 changed files with 290 additions and 72 deletions
+1
View File
@@ -93,6 +93,7 @@
- 青绿(待服务)是全站唯一冷色,只给"等你去处理"这一个语义。
- 服务中复用主色浅档,字色跟随该页 `--brand-strong`(已迁移页 `#B8520A`,未迁移页 `#C2410C`)。
- 状态色不得用于区块标题、图标衬底、按钮、装饰条,只包住状态文字本身。
- 例外(已登记,2026-11-03):`home/index` 的「未完成预约」预览卡以整卡 `#ECF7F4` 底 + 2rpx `#C7E5DF` 描边(不加阴影)承载「等你去处理」,是首屏唯一冷色面;卡内正文仍走暖墨/暖橙,状态色只保留数量胶囊(实心 `#0F766E` + 白字)。此例外不复制到其他卡片,其余卡片填充仍须中性(§四.5)。
- 表单错误复用已取消档(`#B4231A` 字 + `#FCF0EE` 底),错误必须带文字。
- 禁用态不用暖橙:`--muted` 字 + `--sep` 描边 + 透明底。
+73 -11
View File
@@ -1,4 +1,15 @@
const API = require('../../utils/api.js')
const { parseDate } = require('../../utils/date.js')
// 首页未完成预约预览:服务端按预约日期倒序,这里取一页后在本地正序,
// 让最近的一场排在最前。20 条覆盖常见未完成量;更多时卡头仍显示总数,
// 由「查看全部」承接完整列表
const PENDING_PREVIEW_LIMIT = 3
const PENDING_FETCH_SIZE = 20
function pad2(value) {
return String(value).padStart(2, '0')
}
// 陪诊服务的展示配置:价格等以后端返回为准,这里只覆盖展示名。
// 图标不走数据,而是按 id 映射到 index.wxss 里内嵌的细线 SVG(.assist-icon-1 ~ .assist-icon-8)
@@ -22,7 +33,8 @@ const SERVICE_ORDER = [1, 2, 7, 3, 4, 5, 8, 6]
Page({
data: {
escortServices: [], // 陪诊服务(来自后端,按 SERVICE_ORDER 展示)
pendingCount: 0, // 待服务订单数,大于 0 时首页顶部展示状态条
pendingCount: 0, // 未完成预约数,用于预览卡头徽标
pendingRecords: [], // 按预约时间正序的最近几条未完成预约,最多 3 条
quickEntries: [{
id: 'records',
name: '预约记录',
@@ -57,7 +69,7 @@ Page({
},
onShow() {
this.refreshPendingCount()
this.refreshPendingPreview()
// 同步自定义 tabBar 选中态(首页为第 0 项)
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
@@ -107,8 +119,8 @@ Page({
})
},
// 统计待服务订单:等待鉴权完成,登录后由后端按状态汇总
refreshPendingCount() {
// 未完成预约预览:等待鉴权完成,登录后由后端按状态汇总并取一页用于逐条展示
refreshPendingPreview() {
if (this.pendingRequest) return this.pendingRequest
const app = getApp()
@@ -116,13 +128,15 @@ Page({
.then(() => {
const user = app.globalData.user
if (!user || !user._id) {
this.setData({ pendingCount: 0 })
this.setData({ pendingCount: 0, pendingRecords: [] })
return null
}
// 「未完成」与预约记录页「进行中的」同一口径:
// 待确认 / 已确认 / 进行中三类都算,已完成与已取消不算
return API.escort.getMyRecords({
page: 1,
pageSize: 1,
pageSize: PENDING_FETCH_SIZE,
status: 'pending,confirmed,in_progress'
})
})
@@ -131,13 +145,18 @@ Page({
const data = res.data || {}
const counts = data.counts || {}
const pendingCount = counts.ongoing === undefined || counts.ongoing === null
? (data.total || 0)
: counts.ongoing
this.setData({ pendingCount })
const pendingCount = Number(
counts.ongoing === undefined || counts.ongoing === null
? (data.total || 0)
: counts.ongoing
) || 0
this.setData({
pendingCount,
pendingRecords: this.buildPendingPreview(data.records || [])
})
})
.catch((err) => {
console.log('获取待服务订单失败', err)
console.log('获取未完成预约失败', err)
})
.finally(() => {
this.pendingRequest = null
@@ -146,6 +165,40 @@ Page({
return this.pendingRequest
},
// 服务端按预约日期倒序;预览按日期、时段正序取最近三条,缺日期的排最后
buildPendingPreview(records) {
const sorted = records.slice().sort((a, b) => {
const dateA = parseDate(a.schedule?.date)
const dateB = parseDate(b.schedule?.date)
if (!dateA && !dateB) return 0
if (!dateA) return 1
if (!dateB) return -1
const byDate = dateA - dateB
if (byDate !== 0) return byDate
return (a.schedule?.startTime || '').localeCompare(b.schedule?.startTime || '')
})
return sorted.slice(0, PENDING_PREVIEW_LIMIT).map((item) => this.formatPendingRecord(item))
},
// 单条只保留首页需要的四项:日期、就诊人、医院、服务项目。
// 日期只到「月-日」:首屏扫读时用户先判断是哪一天,周几和时段交给详情
formatPendingRecord(item) {
const date = parseDate(item.schedule?.date)
const whenText = date
? `${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`
: '日期待定'
return {
id: item._id,
whenText,
patientName: item.patient?.name || '--',
hospitalName: item.hospital?.name || '--',
serviceName: item.escort?.serviceName || '陪诊服务'
}
},
// 页脚三个 B 端入口:都进「合作与入驻」页,用 section 定位到各自的卡片
goToBusiness(e) {
const section = e.currentTarget.dataset.section || ''
@@ -194,6 +247,15 @@ Page({
})
},
// 未完成预约预览:点单条直达详情
goToRecordDetail(e) {
const id = e.currentTarget.dataset.id
if (!id) return
wx.navigateTo({
url: `/pages/escort/recorddetail?id=${id}`
})
},
onShareAppMessage() {
return {
title: '暖橙陪诊', // 转发标题
+46 -13
View File
@@ -11,7 +11,7 @@
</view>
</view>
<!-- ① 头部:大字标题 + 场景行 + 主 CTA。
<!-- ① 头部:大字标题 + 场景行 + 主 CTA + 未完成预约预览(仅有未完成预约时)。
场景行用三个核心使用场景让用户快速对号入座(尤其异地子女),纯展示不点击;
信任数据下沉到陪诊服务区块的介绍卡,在用户开始了解服务时再补上 -->
<view class="hero">
@@ -49,10 +49,49 @@
<text class="hero-cta-text">立即预约</text>
<t-icon name="chevron-right" size="28rpx" color="#FFFFFF" />
</view>
<!-- 未完成预约预览:每条一行,给出日期 / 就诊人 / 医院 / 服务项目,最多 3 条。
原先只给「您有 N 个未完成预约」一个数字,用户无法判断是哪一场、给谁、去哪儿,
仍要再点进预约记录;直接给出最近三条可少一次跳转。
不把全部未完成预约铺在首屏:首屏优先保住主 CTA 与服务入口,
第 4 条起交给卡头「查看全部」,避免订单多的用户把首页压成清单页。
数据按预约时间正序取最近三条;无未完成预约时整卡不渲染,新用户首屏不受影响 -->
<view class="pending-card" wx:if="{{ pendingRecords.length > 0 }}">
<view class="pending-head">
<text class="pending-title">未完成预约</text>
<text class="pending-count">{{ pendingCount }}</text>
<view class="pending-link" bindtap="goToRecords">
<text class="pending-link-text">查看全部</text>
<view class="pending-link-arrow">
<t-icon name="chevron-right" size="24rpx" color="#6F655C" />
</view>
</view>
</view>
<block wx:for="{{ pendingRecords }}" wx:key="id">
<view class="pending-sep" wx:if="{{ index > 0 }}"></view>
<view class="pending-item" data-id="{{ item.id }}" bindtap="goToRecordDetail">
<!-- 一条预约压成一行:日期 · 就诊人 · 医院 · 服务项目。
行内不换行,医院名过长时只省略医院,日期、就诊人和项目始终可见 -->
<view class="pending-line">
<text class="pending-when">{{ item.whenText }}</text>
<text class="pending-dot">·</text>
<text class="pending-patient">{{ item.patientName }}</text>
<text class="pending-dot">·</text>
<text class="pending-hospital">{{ item.hospitalName }}</text>
<text class="pending-dot">·</text>
<text class="pending-service">{{ item.serviceName }}</text>
</view>
<view class="pending-arrow">
<t-icon name="chevron-right" size="26rpx" color="#6F655C" />
</view>
</view>
</block>
</view>
</view>
<!-- ② 陪诊服务:宫格紧贴标题,保证「标题 → 可点服务」路径最短;
介绍卡承接品类教育职责,下移为区块尾部锚点(浅橙衬底) -->
介绍卡只承载信任行,下移为区块尾部锚点(浅橙衬底) -->
<view class="section">
<view class="section-head">
<view class="section-bar"></view>
@@ -75,11 +114,12 @@
</view>
</view>
<!-- 介绍卡:纯展示不可点,一句定位 + 信任行(服务清单交给上方宫格,不重复;
<!-- 介绍卡:纯展示不可点,只保留信任行(服务清单交给上方宫格,不重复;
指南入口在区块标题行右侧)。
"桥"对应国标 7.1.4「协助医患沟通、就诊信息的记录和转达」,是承诺层 -->
原定位句「做你和医生之间,最省心的那座桥」已去掉:
它只是品牌比喻,不解释任何具体服务,且「省心」与 hero 标题重复;
删后本区块改以具体信任背书收尾,信息更实 -->
<view class="intro-card">
<text class="intro-desc">做你和医生之间,最省心的那座桥。</text>
<!-- 信任行:三项信任背书单行小字,从首屏下沉至此。
"专业"是定性描述,故不称"可验证事实"。
三项现状均纯展示不可点——「实名专业陪诊师」原先带 chevron 跳陪诊师公示页,
@@ -94,20 +134,13 @@
</view>
</view>
<!-- ③ 常用功能:待服务提醒 + 双列入口卡 -->
<!-- ③ 常用功能:双列入口卡(未完成预约预览已上移到首屏主 CTA 下方) -->
<view class="section">
<view class="section-head">
<view class="section-bar"></view>
<text class="section-title">常用功能</text>
</view>
<!-- 状态条:仅当存在待服务订单时展示 -->
<view class="order-tip" wx:if="{{ pendingCount > 0 }}" bindtap="goToRecords">
<view class="order-dot"></view>
<text class="order-tip-text">您有 {{ pendingCount }} 个待服务订单</text>
<t-icon name="chevron-right" size="26rpx" color="#0F766E" />
</view>
<view class="quick-list">
<view class="quick-item {{ item.full ? 'quick-item-full' : '' }}" wx:for="{{ quickEntries }}" wx:key="id" data-item="{{ item }}" bindtap="onQuickEntryTap">
<!-- 入口统一走暖橙 + 浅橙衬底,不做色相区分;带 full 标记的卡通栏排布 -->
+170 -48
View File
@@ -7,11 +7,12 @@
page {
/* 配色令牌已上移到 app.wxss(全站唯一来源,改配色只改那一处),本页不再留副本。
这里只剩本页专属的一样:「待服务订单」提醒条的状态色——全页唯一的冷色,
语义由 DESIGN.md §3 管,不随主色走 */
这里只剩本页专属的一样:「未完成预约」预览卡的状态色——全页唯一的冷色面。
语义由 DESIGN.md §3 管(只给「等你去处理」),且已登记为整卡底色的例外;
其余卡片仍走中性填充 */
--status-soft: #ECF7F4;
--status-line: #C7E5DF;
--status-ink: #0F766E; /* #ECF7F4 上 5.0:1,过 AA 正文 */
--status-ink: #0F766E; /* #ECF7F4 上 5.0:1、白底 5.47:1,过 AA 正文 */
}
.page-bg {
@@ -166,14 +167,174 @@ page {
margin-right: 6rpx;
}
/* ===== ② 陪诊服务:服务宫格 + 品类介绍卡 ===== */
/* 未完成预约预览:整卡铺淡绿状态底(status-soft)+ 2rpx status-line 描边,
与下方白卡服务宫格明显区分——返回用户一眼先看到「还有事没办完」。
浅色块落纸面靠描边托形、不加阴影(与浅橙介绍卡同一做法),
否则会在暖白纸面上糊成一块。
数量仍留在卡头徽标里,正文最多 3 条,
避免订单多的用户把首屏压成清单页;第 4 条起交给「查看全部」。
只对未完成预约的用户渲染,新用户首屏不变 */
.pending-card {
margin-top: 24rpx;
padding: 20rpx 24rpx 8rpx;
border-radius: 24rpx;
background: var(--status-soft);
border: 2rpx solid var(--status-line);
}
/* 卡头:标题 + 数量胶囊 + 右对齐「查看全部」。
数量胶囊改实心状态色 + 白字:卡面已是淡绿,原来的同色胶囊会消失;
面积仍很小,状态色只落在数字上,不铺成第二块绿色 */
.pending-head {
display: flex;
align-items: center;
padding-bottom: 4rpx;
}
.pending-title {
font-size: 26rpx;
font-weight: 700;
color: var(--ink);
letter-spacing: 1rpx;
}
.pending-count {
margin-left: 10rpx;
padding: 2rpx 10rpx;
border-radius: 999rpx;
/* 实心状态色小胶囊:淡绿卡上白底胶囊对比只有 1.10:1,形同消失;
数量本身是「待办」的唯一状态数字,用实心反白最醒目,面积仍很小 */
background: var(--status-ink);
font-size: 24rpx;
font-weight: 700;
line-height: 1.2;
color: var(--white); /* 5.47:1,过 AA */
}
/* 「查看全部」沿用区块标题行右侧入口的点击热区做法:
24rpx 文字上下各补 12rpx,再用等量负外边距把卡头高度压回去 */
.pending-link {
display: flex;
align-items: center;
margin: -12rpx 0 -12rpx auto;
padding: 12rpx 0;
}
.pending-link:active {
opacity: 0.7;
}
.pending-link-text {
font-size: 24rpx;
color: var(--muted);
letter-spacing: 1rpx;
}
.pending-link-arrow,
.pending-arrow {
display: flex;
align-items: center;
flex-shrink: 0;
}
.pending-link-arrow {
margin-left: 4rpx;
}
.pending-arrow {
margin-left: 12rpx;
}
/* 行间发丝线:绿底上不能用暖米色 --line(会显脏),
改用同族的 --status-line;每条预约压成一行,整行可点,热区约 90rpx 高 */
.pending-sep {
height: 2rpx;
background: var(--status-line);
}
.pending-item {
display: flex;
align-items: center;
padding: 28rpx 0;
/* 一条预约只占一行:行级 nowrap,避免任何一项被挤到第二行 */
white-space: nowrap;
}
.pending-item:active {
opacity: 0.7;
}
/* 单行排完四项:日期 · 就诊人 · 医院 · 服务项目。
医院名可收缩省略,日期、就诊人、项目保持完整 */
.pending-line {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
/* 明确不换行:四段文字 + 三个分隔点始终保持在同一行,
放不下时由医院名收缩省略,其余项不折行 */
flex-wrap: nowrap;
white-space: nowrap;
overflow: hidden;
}
.pending-when {
font-size: 24rpx;
font-weight: 700;
color: var(--brand-ink); /* 淡绿底上 5.90:1,过 AA */
letter-spacing: 0.5rpx;
flex-shrink: 0;
white-space: nowrap;
}
/* 服务项用深一档的暖橙:--brand-strong 落淡绿底只有 4.51:1,贴线;
退到 --brand-ink 仍是暖橙同色阶,5.90:1,并与日期保持同一支强调色 */
.pending-service {
font-size: 24rpx;
font-weight: 700;
color: var(--brand-ink);
flex-shrink: 0;
white-space: nowrap;
}
.pending-patient {
font-size: 24rpx;
font-weight: 600;
color: var(--ink);
flex-shrink: 0;
white-space: nowrap;
}
.pending-dot {
margin: 0 8rpx;
font-size: 22rpx;
color: var(--muted);
flex-shrink: 0;
}
/* 医院名按内容宽度排,只有整行放不下时才收缩并省略;
24rpx muted 在淡绿底上 5.19:1,过 AA */
.pending-hospital {
flex: 0 1 auto;
min-width: 0;
font-size: 24rpx;
color: var(--muted);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* ===== ② 陪诊服务:服务宫格 + 信任条 ===== */
/* 介绍卡:整卡走浅橙衬底,位于宫格下方,是本区块的尾部视觉锚点;
宫格保持白卡安静语言、紧贴标题。
纯内容展示卡(不可点),指南入口在区块标题行右侧 */
纯内容展示卡(不可点),只承载信任行——原定位句是品牌比喻、
不解释具体服务,且与 hero「省心」重复,已去掉;
指南入口在区块标题行右侧 */
.intro-card {
display: flex;
flex-direction: column;
padding: 28rpx 26rpx;
align-items: center;
justify-content: center;
padding: 24rpx 26rpx;
/* 位于宫格下方,改为上间距;比原 20rpx 略大,与宫格拉开层级 */
margin-top: 24rpx;
border-radius: 28rpx;
@@ -181,20 +342,12 @@ page {
border: 2rpx solid var(--brand-line);
}
/* 介绍卡定位句:一句(14 字)读完全卡主旨,比信任行更深一档做层级,
浅橙底 9.2:1 过 AA */
.intro-desc {
font-size: 26rpx;
line-height: 1.6;
color: var(--ink-2);
}
/* 信任行:三项信任背书单行小字,从首屏下沉至此,
在用户开始了解服务时补上信任背书;位于定位句下方,拉开 16rpx */
在用户开始了解服务时补上信任背书;单行居中,作为区块收尾 */
.intro-trust {
display: flex;
align-items: center;
margin-top: 16rpx;
justify-content: center;
}
.intro-trust-item {
@@ -367,37 +520,6 @@ page {
}
/* ===== ④ 常用功能 ===== */
/* 全页唯一的状态色:这是唯一"需要用户行动"的信息,用它把视线钉住 */
.order-tip {
display: flex;
align-items: center;
padding: 22rpx 24rpx;
margin-bottom: 16rpx;
border-radius: 20rpx;
background: var(--status-soft);
border: 2rpx solid var(--status-line);
}
.order-tip:active {
opacity: 0.75;
}
.order-dot {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: var(--status-ink);
margin-right: 14rpx;
flex-shrink: 0;
}
.order-tip-text {
flex: 1;
font-size: 28rpx;
font-weight: 700;
color: var(--status-ink);
}
/* 双列卡片 + 图标左、文字右的横排结构;
第三张通栏卡靠换行落到第二行 */
.quick-list {