修改了页面样式。

This commit is contained in:
lik
2026-11-03 16:15:41 +08:00
parent f78025e935
commit 82ed5c31a7
30 changed files with 3791 additions and 2989 deletions
+35 -43
View File
@@ -2,8 +2,8 @@ const API = require('../../utils/api.js')
const { parseDate } = require('../../utils/date.js')
// 首页未完成预约预览:服务端按预约日期倒序,这里取一页后在本地正序,
// 让最近的一场排在最前。20 条覆盖常见未完成量;更多时卡头仍显示总数,
// 由「查看全部」承接完整列表
// 让最近的一场排在最前。20 条覆盖常见未完成量;首页只展示最近三条,
// 更多由「常用功能 · 预约记录」承接
const PENDING_PREVIEW_LIMIT = 3
const PENDING_FETCH_SIZE = 20
@@ -33,8 +33,7 @@ const SERVICE_ORDER = [1, 2, 7, 3, 4, 5, 8, 6]
Page({
data: {
escortServices: [], // 陪诊服务(来自后端,按 SERVICE_ORDER 展示)
pendingCount: 0, // 未完成预约数,用于预览卡头徽标
pendingRecords: [], // 按预约时间正序的最近几条未完成预约,最多 3 条
pendingRecords: [], // 按预约时间正序的最近几条未完成预约,每条渲染成一张卡,最多 3 条
quickEntries: [{
id: 'records',
name: '预约记录',
@@ -65,6 +64,12 @@ Page({
},
onLoad() {
// 先用上次成功拉取的列表渲染宫格,避免首屏出现一块空白;
// 紧接着请求最新数据,回来后覆盖
const cached = getApp().getCachedServices()
if (cached) {
this.setData({ escortServices: this.buildEscortServices(cached) })
}
this.loadServices()
},
@@ -84,42 +89,42 @@ Page({
app.loadServices()
.then((services) => {
if (!services) {
this.setData({ escortServices: [] })
// 失败时保留缓存渲染结果,避免宫格从有到无闪一下
console.error('首页服务列表加载失败')
return
}
const serviceMap = {}
services.forEach((service) => {
serviceMap[service.id] = service
})
// 按展示顺序拼装。首页宫格不取 price / subtitle——
// 定价与服务介绍分别留到指南页、详情页展示
const escortServices = SERVICE_ORDER
.filter((id) => serviceMap[id])
.map((id) => {
const service = serviceMap[id]
const ui = SERVICE_UI[id] || {}
return {
id,
name: ui.name || service.title,
// 图标类名:与 index.wxss 中 .assist-icon-{id} 对应
iconClass: 'assist-icon-' + id
}
})
this.setData({
escortServices
escortServices: this.buildEscortServices(services)
})
})
.catch((err) => {
this.setData({ escortServices: [] })
console.error('首页服务列表加载失败', err)
})
},
// 未完成预约预览:等待鉴权完成,登录后由后端按状态汇总并取一页用于逐条展示
// 按展示顺序把后端服务拼成宫格数据。
// 首页宫格不取 price / subtitle——定价与服务介绍分别留到指南页、详情页展示
buildEscortServices(services) {
const serviceMap = {}
services.forEach((service) => {
serviceMap[service.id] = service
})
return SERVICE_ORDER
.filter((id) => serviceMap[id])
.map((id) => {
const service = serviceMap[id]
const ui = SERVICE_UI[id] || {}
return {
id,
name: ui.name || service.title,
// 图标类名:与 index.wxss 中 .assist-icon-{id} 对应
iconClass: 'assist-icon-' + id
}
})
},
// 未完成预约预览:等待鉴权完成,登录后由后端按「未完成」状态筛选并取一页用于逐条展示
refreshPendingPreview() {
if (this.pendingRequest) return this.pendingRequest
@@ -128,7 +133,7 @@ Page({
.then(() => {
const user = app.globalData.user
if (!user || !user._id) {
this.setData({ pendingCount: 0, pendingRecords: [] })
this.setData({ pendingRecords: [] })
return null
}
@@ -144,14 +149,7 @@ Page({
if (!res || res.code !== 0) return
const data = res.data || {}
const counts = data.counts || {}
const pendingCount = Number(
counts.ongoing === undefined || counts.ongoing === null
? (data.total || 0)
: counts.ongoing
) || 0
this.setData({
pendingCount,
pendingRecords: this.buildPendingPreview(data.records || [])
})
})
@@ -241,12 +239,6 @@ Page({
})
},
goToRecords() {
wx.navigateTo({
url: '/pages/escort/recordlist'
})
},
// 未完成预约预览:点单条直达详情
goToRecordDetail(e) {
const id = e.currentTarget.dataset.id
+18 -35
View File
@@ -50,43 +50,26 @@
<t-icon name="chevron-right" size="28rpx" color="#FFFFFF" />
</view>
<!-- 未完成预约预览:每条一行,给出日期 / 就诊人 / 医院 / 服务项目,最多 3 条。
原先只给「您有 N 个未完成预约」一个数字,用户无法判断是哪一场、给谁、去哪儿,
仍要再点进预约记录;直接给出最近三条可少一次跳转。
<!-- 未完成预约预览:不设卡头(无「未完成预约」标题、无数量、无「查看全部」),
每条预约单独一张卡,卡内给出日期 / 就诊人 / 医院 / 服务项目,最多 3 条。
不把全部未完成预约铺在首屏:首屏优先保住主 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>
第 4 条起由「常用功能 · 预约记录」承接,避免订单多的用户把首页压成清单页。
数据按预约时间正序取最近三条;无未完成预约时整块不渲染,新用户首屏不受影响 -->
<view class="pending-card" wx:for="{{ pendingRecords }}" wx:key="id" 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>
<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>
+17 -85
View File
@@ -7,12 +7,11 @@
page {
/* 配色令牌已上移到 app.wxss(全站唯一来源,改配色只改那一处),本页不再留副本。
这里只剩本页专属的一样:「未完成预约」预览卡的状态色——全页唯一的冷色面。
这里只剩本页专属的一样:「未完成预约」逐条卡的状态色——全页唯一的冷色面。
语义由 DESIGN.md §3 管(只给「等你去处理」),且已登记为整卡底色的例外;
其余卡片仍走中性填充 */
--status-soft: #ECF7F4;
--status-line: #C7E5DF;
--status-ink: #0F766E; /* #ECF7F4 上 5.0:1、白底 5.47:1,过 AA 正文 */
}
.page-bg {
@@ -167,103 +166,36 @@ page {
margin-right: 6rpx;
}
/* 未完成预约预览:整卡铺淡绿状态底(status-soft)+ 2rpx status-line 描边,
/* 未完成预约预览:去掉卡头后,每条预约独立成一卡。
整卡铺淡绿状态底(status-soft)+ 2rpx status-line 描边,
与下方白卡服务宫格明显区分——返回用户一眼先看到「还有事没办完」。
浅色块落纸面靠描边托形、不加阴影(与浅橙介绍卡同一做法),
否则会在暖白纸面上糊成一块。
数量仍留在卡头徽标里,正文最多 3 条,
避免订单多的用户把首屏压成清单页;第 4 条起交给「查看全部」。
卡间距 20rpx(与 .quick-list 同档),三条叠成短清单而不连成一整块。
最多 3 条,第 4 条起由「常用功能 · 预约记录」承接;
只对未完成预约的用户渲染,新用户首屏不变 */
.pending-card {
margin-top: 24rpx;
padding: 20rpx 24rpx 8rpx;
display: flex;
align-items: center;
margin-top: 20rpx;
padding: 26rpx 24rpx;
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 {
.pending-card:active {
opacity: 0.7;
}
.pending-arrow {
display: flex;
align-items: center;
flex-shrink: 0;
margin-left: 12rpx;
}
/* 单行排完四项:日期 · 就诊人 · 医院 · 服务项目。
医院名可收缩省略,日期、就诊人、项目保持完整 */
.pending-line {