修改了页面样式。

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
+40 -6
View File
@@ -2,6 +2,9 @@ const AIChatSocket = require('./utils/chatmsg.js')
const API = require('./utils/api.js') const API = require('./utils/api.js')
const request = require('./utils/request.js') const request = require('./utils/request.js')
// 服务列表缓存:只服务首屏秒开,命中后仍会请求最新数据覆盖
const SERVICES_CACHE_KEY = 'servicesCacheV1'
App({ App({
onLaunch() { onLaunch() {
// request 层遇到 code 401(token 已失效)时回调这里:静默重登后自动重试原请求。 // request 层遇到 code 401(token 已失效)时回调这里:静默重登后自动重试原请求。
@@ -9,12 +12,20 @@ App({
request.setUnauthorizedHandler(() => this.silentSignin()) request.setUnauthorizedHandler(() => this.silentSignin())
this.loadServices() this.loadServices()
this.loadAgreement() // 服务协议只有协议页用,改成该页首次进入时再拉(页面里已有 loadAgreement),
// 启动期少一次并发请求
this.checkUpdate(); this.checkUpdate();
}, },
// 已有登录态时不再重签:每次 wxsignin 都会把 token 轮换一遍,
// 既多一次网络往返(真机实测 ~105ms),也会让在飞的请求拿着旧 token 收到 401。
// token 真正失效时由 request 层的 401 兜底触发 silentSignin。
// 用户主动退出过(has_logout)时 silentSignin 本身会直接返回 false
onShow() { onShow() {
if (this.globalData.user?._id) {
return
}
this.globalData.authReady = this.silentSignin() this.globalData.authReady = this.silentSignin()
}, },
@@ -25,6 +36,7 @@ App({
.then((res) => { .then((res) => {
if (res.code !== 0 || !Array.isArray(res.data?.services)) throw new Error(res.msg || '服务列表加载失败') if (res.code !== 0 || !Array.isArray(res.data?.services)) throw new Error(res.msg || '服务列表加载失败')
this.globalData.services = res.data.services this.globalData.services = res.data.services
this.cacheServices(this.globalData.services)
return this.globalData.services return this.globalData.services
}) })
.catch((err) => { .catch((err) => {
@@ -35,6 +47,26 @@ App({
return this.globalData.servicesReady return this.globalData.servicesReady
}, },
// 服务列表只影响展示,落一份本地缓存让首页首屏先有内容:
// 缓存失败不影响主链路,下一帧网络数据会覆盖
cacheServices(services) {
try {
wx.setStorageSync(SERVICES_CACHE_KEY, services)
} catch (err) {
console.warn('缓存服务列表失败', err)
}
},
// 读缓存用于首屏占位;数据形态与后端一致,写入前已校验过是数组
getCachedServices() {
try {
const cached = wx.getStorageSync(SERVICES_CACHE_KEY)
return Array.isArray(cached) && cached.length ? cached : null
} catch (err) {
return null
}
},
loadAgreement() { loadAgreement() {
if (this.globalData.agreementReady) return this.globalData.agreementReady if (this.globalData.agreementReady) return this.globalData.agreementReady
this.globalData.agreementReady = API.resource.getAgreement() this.globalData.agreementReady = API.resource.getAgreement()
@@ -52,13 +84,15 @@ App({
}, },
// 已经拿到用户(如「我的」页手机号授权登录成功)就直接返回成功。 // 已经拿到用户(如「我的」页手机号授权登录成功)就直接返回成功。
// authReady 是 onShow 启动期静默登录的 Promise,登录/退出都不会刷新它: // 但若此刻有静默登录在飞(token 可能正在轮换),要先等它落定:
// 直接把旧 Promise 的 false 回放给调用方,会误判「已登录用户未登录」 // 抢跑会让页面拿旧 token 发请求、收到 401 再触发一次重登 + 重试。
// 登录失败时旧用户/旧 token 仍在,仍然返回 true,由 request 层的 401 兜底决定成败
waitForAuth() { waitForAuth() {
if (this.globalData.user?._id) { const hasUser = () => !!this.globalData.user?._id
return Promise.resolve(true) if (this.signinPromise) {
return this.signinPromise.then(hasUser)
} }
return this.globalData.authReady || this.silentSignin() return hasUser() ? Promise.resolve(true) : this.silentSignin()
}, },
// 静默重登:app.onShow 与 request 层的 401 兜底共用这一个入口 // 静默重登:app.onShow 与 request 层的 401 兜底共用这一个入口
-5
View File
@@ -22,11 +22,6 @@
"navigationBarTitleText": "暖橙陪诊", "navigationBarTitleText": "暖橙陪诊",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"permission": {
"scope.record": {
"desc": "用于语音输入陪诊问题,录音仅用于本次转写,不会保存"
}
},
"tabBar": { "tabBar": {
"custom": true, "custom": true,
"color": "#6F655C", "color": "#6F655C",
+6 -4
View File
@@ -1,8 +1,9 @@
// 自定义 tabBar:固定在底部,选中态只换颜色、不换图形。 // 自定义 tabBar:固定在底部,选中态只换颜色、不换图形。
// 「首页」「AI客服」用自定义圆润线性 SVG(wxss 里 base64 data URI): // 三个 tab 全部用自绘圆润线性 SVG(wxss 里 base64 data URI):
// TDesign 字体图标 home 是尖屋顶、chat 带尖角尾巴,造型偏尖不够圆润; // TDesign 字体图标 home 是尖屋顶、chat 带尖角尾巴、user 与另两个不同族,
// 自绘 SVG 描边 4/64(与字体图标 1/16 同粗细)、圆头线帽,选中态换橙色版图。 // 自绘 SVG 描边 4/64(与字体图标 1/16 同粗细)、圆头线帽,选中态换橙色版图。
// 「我的」仍走 TDesign 线性图标字体:user。 // 不引 t-icon 组件是有意为之:它会在冷启动时实例化字体图标组件并注入
// icon.wxss(历史体积 485KB、内嵌 278KB 字体),真机实测组件构造 59ms。
// 「AI客服」曾用位图(气泡内嵌 AI 字:灰色 ai.png、暖橙 ai-ink.png)当图标, // 「AI客服」曾用位图(气泡内嵌 AI 字:灰色 ai.png、暖橙 ai-ink.png)当图标,
// 其轮廓笔画比图标字体细一档,与另外两个并排时粗细不搭,故弃用。 // 其轮廓笔画比图标字体细一档,与另外两个并排时粗细不搭,故弃用。
// 位图文件仍留在 images/ 下未删(app.json 的 tabBar 项也在引用,见 DESIGN.md §5.2) // 位图文件仍留在 images/ 下未删(app.json 的 tabBar 项也在引用,见 DESIGN.md §5.2)
@@ -24,7 +25,8 @@ Component({
}, { }, {
pagePath: '/pages/mine/mine', pagePath: '/pages/mine/mine',
text: '我的', text: '我的',
icon: 'user' // 圆头 + 圆弧肩,与 .ic-home / .ic-chat 同族描边,见 index.wxss .ic-user
cls: 'ic-user'
}] }]
}, },
+1 -4
View File
@@ -1,6 +1,3 @@
{ {
"component": true, "component": true
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon"
}
} }
+2 -11
View File
@@ -7,17 +7,8 @@
data-path="{{ item.pagePath }}" data-path="{{ item.pagePath }}"
bindtap="onTap" bindtap="onTap"
> >
<!-- 首页 / AI客服 走自定义圆润 SVG(.tab-icon),「我的」仍用 TDesign 字体图标 --> <!-- 三个 tab 都是自绘圆润 SVG(.tab-icon),不引 t-icon,冷启动无需注入图标字体 -->
<view <view class="tab-icon {{ item.cls }} {{ selected === index ? 'on' : '' }}"></view>
wx:if="{{ item.cls }}"
class="tab-icon {{ item.cls }} {{ selected === index ? 'on' : '' }}"
></view>
<t-icon
wx:else
name="{{ item.icon }}"
size="44rpx"
color="{{ selected === index ? activeColor : inactiveColor }}"
/>
<text class="tab-text">{{ item.text }}</text> <text class="tab-text">{{ item.text }}</text>
</view> </view>
</view> </view>
+12 -3
View File
@@ -29,9 +29,9 @@
color: #6F655C; color: #6F655C;
} }
/* 首页 / AI客服 走自定义圆润线性 SVG(base64 data URI,背景图不占布局)。 /* 三个 tab 都是自绘圆润线性 SVG(base64 data URI,背景图不占布局)。
TDesign 字体图标 home(尖屋顶)与 chat(尖角尾巴)造型偏尖, TDesign 字体图标 home(尖屋顶)与 chat(尖角尾巴)造型偏尖,user 与另两个不同族,
故此两 tab 换手绘 SVG:描边 4/64(=字体图标同族 1/16 粗细)、圆头线帽。 故全部换手绘 SVG:描边 4/64(=字体图标同族 1/16 粗细)、圆头线帽。
颜色只能烤进图里:data URI 读不到 CSS 变量,灰 #6F655C / 橙 #B8520A 与字体图标同源。 */ 颜色只能烤进图里:data URI 读不到 CSS 变量,灰 #6F655C / 橙 #B8520A 与字体图标同源。 */
.tab-icon { .tab-icon {
width: 44rpx; width: 44rpx;
@@ -56,6 +56,15 @@
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTMyIDggQzE3LjYgOCA2IDE4LjMgNiAzMSBDNiAzOC40IDkuOSA0NSAxNiA0OS4xIEMxNS43IDUyLjIgMTQuMyA1NS45IDExLjMgNTguNiBDMTcuMiA1OC4yIDIyLjEgNTUuNyAyNS4zIDUyLjcgQzI3LjUgNTMuMiAyOS43IDUzLjUgMzIgNTMuNSBDNDYuNCA1My41IDU4IDQzLjIgNTggMzAuNyBDNTggMTguMyA0Ni40IDggMzIgOCBaIiBzdHJva2U9IiNCODUyMEEiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iMzEiIHI9IjIuNiIgZmlsbD0iI0I4NTIwQSIvPjxjaXJjbGUgY3g9IjMyIiBjeT0iMzEiIHI9IjIuNiIgZmlsbD0iI0I4NTIwQSIvPjxjaXJjbGUgY3g9IjQ0IiBjeT0iMzEiIHI9IjIuNiIgZmlsbD0iI0I4NTIwQSIvPjwvc3ZnPg=="); background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTMyIDggQzE3LjYgOCA2IDE4LjMgNiAzMSBDNiAzOC40IDkuOSA0NSAxNiA0OS4xIEMxNS43IDUyLjIgMTQuMyA1NS45IDExLjMgNTguNiBDMTcuMiA1OC4yIDIyLjEgNTUuNyAyNS4zIDUyLjcgQzI3LjUgNTMuMiAyOS43IDUzLjUgMzIgNTMuNSBDNDYuNCA1My41IDU4IDQzLjIgNTggMzAuNyBDNTggMTguMyA0Ni40IDggMzIgOCBaIiBzdHJva2U9IiNCODUyMEEiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iMzEiIHI9IjIuNiIgZmlsbD0iI0I4NTIwQSIvPjxjaXJjbGUgY3g9IjMyIiBjeT0iMzEiIHI9IjIuNiIgZmlsbD0iI0I4NTIwQSIvPjxjaXJjbGUgY3g9IjQ0IiBjeT0iMzEiIHI9IjIuNiIgZmlsbD0iI0I4NTIwQSIvPjwvc3ZnPg==");
} }
/* 「我的」:圆头 + 圆弧肩,与上面两个同族描边宽度与线帽 */
.tab-icon.ic-user {
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGNpcmNsZSBjeD0iMzIiIGN5PSIyMSIgcj0iMTAiIHN0cm9rZT0iIzZGNjU1QyIgc3Ryb2tlLXdpZHRoPSI0Ii8+PHBhdGggZD0iTTEyIDUzIEMxMiA0MyAyMCAzNiAzMiAzNiBDNDQgMzYgNTIgNDMgNTIgNTMiIHN0cm9rZT0iIzZGNjU1QyIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L3N2Zz4=");
}
.tab-icon.ic-user.on {
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGNpcmNsZSBjeD0iMzIiIGN5PSIyMSIgcj0iMTAiIHN0cm9rZT0iI0I4NTIwQSIgc3Ryb2tlLXdpZHRoPSI0Ii8+PHBhdGggZD0iTTEyIDUzIEMxMiA0MyAyMCAzNiAzMiAzNiBDNDQgMzYgNTIgNDMgNTIgNTMiIHN0cm9rZT0iI0I4NTIwQSIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L3N2Zz4=");
}
.tab-item.is-active .tab-text { .tab-item.is-active .tab-text {
/* 选中文字:暖橙 --brand-strong 的硬编码(组件读不到 page 级变量),白底 4.94:1,过 AA */ /* 选中文字:暖橙 --brand-strong 的硬编码(组件读不到 page 级变量),白底 4.94:1,过 AA */
color: #B8520A; color: #B8520A;
+1 -1
View File
@@ -93,7 +93,7 @@
- 青绿(待服务)是全站唯一冷色,只给"等你去处理"这一个语义。 - 青绿(待服务)是全站唯一冷色,只给"等你去处理"这一个语义。
- 服务中复用主色浅档,字色跟随该页 `--brand-strong`(已迁移页 `#B8520A`,未迁移页 `#C2410C`)。 - 服务中复用主色浅档,字色跟随该页 `--brand-strong`(已迁移页 `#B8520A`,未迁移页 `#C2410C`)。
- 状态色不得用于区块标题、图标衬底、按钮、装饰条,只包住状态文字本身。 - 状态色不得用于区块标题、图标衬底、按钮、装饰条,只包住状态文字本身。
- 例外(已登记,2026-11-03):`home/index` 的「未完成预约」预览卡以整卡 `#ECF7F4` 底 + 2rpx `#C7E5DF` 描边(不加阴影)承载「等你去处理」,是首屏唯一冷色面;卡内正文仍走暖墨/暖橙,状态色只保留数量胶囊(实心 `#0F766E` + 白字)。此例外不复制到其他卡片,其余卡片填充仍须中性(§四.5)。 - 例外(已登记,2026-11-03 修订):`home/index` 的「未完成预约」预览不设卡头(无标题、无数量胶囊、无「查看全部」),每条未完成预约独立成一卡:整卡 `#ECF7F4` 底 + 2rpx `#C7E5DF` 描边 + 24rpx 圆角、不加阴影,卡间距 20rpx,是首屏唯一冷色面;卡内正文仍走暖墨/暖橙,状态色只作整卡底色。此例外不复制到其他卡片,其余卡片填充仍须中性(§四.5)。
- 表单错误复用已取消档(`#B4231A` 字 + `#FCF0EE` 底),错误必须带文字。 - 表单错误复用已取消档(`#B4231A` 字 + `#FCF0EE` 底),错误必须带文字。
- 禁用态不用暖橙:`--muted` 字 + `--sep` 描边 + 透明底。 - 禁用态不用暖橙:`--muted` 字 + `--sep` 描边 + 透明底。
+2 -8
View File
@@ -603,15 +603,9 @@ token 失效、服务错误和断线均不会永久转圈;清空或重进后
发布前确认下载域名白名单;字体失败不能导致全站图标空白。优先自托管或提供本地兜底,并在开发者工具断网/资源失败场景验证。 发布前确认下载域名白名单;字体失败不能导致全站图标空白。优先自托管或提供本地兜底,并在开发者工具断网/资源失败场景验证。
(已整改:`icon.wxss` 的 `@font-face` 改为 base64 内嵌 `assets/fonts/t.woff`(data URI),不再请求 `tdesign.gtimg.com`。微信不允许组件 wxss 里用本地路径加载字体(报错带 `-do-not-use-local-path-` 标记),真机也不支持,故放弃本地路径方案;`app.wxss` 原有的 `escort-icons` 本地路径覆盖块已一并移除,字体唯一来源收敛到组件内嵌。注意 `miniprogram_npm` 会在「构建 npm」时由 `node_modules` 重新生成,重建后控制台若再次出现远程字体请求,需重新把 `icon.wxss` 的 `src` 替换为 base64: (已整改:`icon.wxss` 的 `@font-face` 改为 base64 内嵌,不再请求 `tdesign.gtimg.com`。微信不允许组件 wxss 里用本地路径加载字体(报错带 `-do-not-use-local-path-` 标记),真机也不支持,故放弃本地路径方案;`app.wxss` 原有的 `escort-icons` 本地路径覆盖块已一并移除,字体唯一来源收敛到组件内嵌。
```powershell `miniprogram_npm` 会在「构建 npm」时由 `node_modules` 重新生成,重建后 `icon.wxss` 会退回「远程字体 + 2347 个图标 class」的原始形态(约 483KB)。此时执行 `python tools/build-icon-wxss.py` 重新生成:脚本按仓库里实际用到的图标名裁剪字体与 class(42 个字形,483KB → 约 14KB),`assets/fonts/t.woff` 只作为脚本输入、已通过 `packOptions.ignore` 排除出包。脚本依赖 `pip install fonttools`。)
$b64=[Convert]::ToBase64String([IO.File]::ReadAllBytes("ui/wxapp_escort/assets/fonts/t.woff"))
$p="ui/wxapp_escort/miniprogram_npm/tdesign-miniprogram/icon/icon.wxss"
$c=[IO.File]::ReadAllText($p)
$c=[regex]::Replace($c,'src:url\([^)]*\)\s*format\(''woff''\),"src:url(data:font/woff;base64,$b64) format('woff')")
[IO.File]::WriteAllText($p,$c)
```)
## Q-P3-4 其他小项 ## Q-P3-4 其他小项
File diff suppressed because one or more lines are too long
+11 -11
View File
@@ -8,6 +8,7 @@ Page({
pageError: '', pageError: '',
totalPrice: '0.00', totalPrice: '0.00',
serviceIcon: 'user-business', serviceIcon: 'user-business',
activeTab: 'detail',
showOrderPopup: false, showOrderPopup: false,
submitting: false, submitting: false,
profiles: [], profiles: [],
@@ -32,9 +33,7 @@ Page({
requiresAddress: false, requiresAddress: false,
gender: '不限', gender: '不限',
genderIndex: 0, genderIndex: 0,
genderOptions: ['不限', '男', '女'], genderOptions: ['不限', '男', '女']
department: '',
departments: ['内科', '外科', '妇产科', '儿科', '骨科', '神经科', '心血管内科', '消化内科', '呼吸内科', '内分泌科', '皮肤科', '眼科', '耳鼻喉科', '口腔科', '急诊科', '肿瘤科', '康复医学科', '老年病科', '中医科', '针灸推拿科']
}, },
onLoad(options) { onLoad(options) {
@@ -86,6 +85,14 @@ Page({
this.initializePage() this.initializePage()
}, },
onTabChange(e) {
const tab = e.currentTarget.dataset.tab
if (!tab || tab === this.data.activeTab) return
this.setData({ activeTab: tab })
// 两个页签内容高度不同,切换后回到页首,避免停在上一页的滚动位置
wx.pageScrollTo({ scrollTop: 0, duration: 0 })
},
applyBookingConfig(service) { applyBookingConfig(service) {
const booking = service.booking || {} const booking = service.booking || {}
const sessions = booking.sessions || [] const sessions = booking.sessions || []
@@ -214,10 +221,6 @@ Page({
this.setData({ hospital: e.detail.value }) this.setData({ hospital: e.detail.value })
}, },
onDepartmentChange(e) {
this.setData({ department: e.detail.value })
},
onDateChange(e) { onDateChange(e) {
this.setData({ appointmentDate: e.detail.value }) this.setData({ appointmentDate: e.detail.value })
}, },
@@ -249,7 +252,6 @@ Page({
const data = this.data const data = this.data
if (!data.selectedProfileId || !data.selectedPatient) return '请选择就诊人' if (!data.selectedProfileId || !data.selectedPatient) return '请选择就诊人'
if (!data.hospital.trim()) return '请输入就诊医院' if (!data.hospital.trim()) return '请输入就诊医院'
if (!data.department.trim()) return '请输入就诊科室'
if (!data.appointmentDate) return '请选择预约日期' if (!data.appointmentDate) return '请选择预约日期'
if (!data.appointmentTime) return '请选择预约时间' if (!data.appointmentTime) return '请选择预约时间'
if (data.requiresAddress && !data.shippingAddress.trim()) return '请填写完整收货地址' if (data.requiresAddress && !data.shippingAddress.trim()) return '请填写完整收货地址'
@@ -278,8 +280,7 @@ Page({
}, },
hospital: { hospital: {
province: data.province, province: data.province,
name: data.hospital.trim(), name: data.hospital.trim()
department: data.department.trim()
}, },
schedule: { schedule: {
date: data.appointmentDate, date: data.appointmentDate,
@@ -316,7 +317,6 @@ Page({
province: provinces[0] || '', province: provinces[0] || '',
provinceIndex: 0, provinceIndex: 0,
hospital: '', hospital: '',
department: '',
appointmentDate: '', appointmentDate: '',
appointmentTime: '', appointmentTime: '',
sessionIndex: 0, sessionIndex: 0,
+46 -38
View File
@@ -12,46 +12,60 @@
<text class="header-subtitle">{{ service.subtitle }}</text> <text class="header-subtitle">{{ service.subtitle }}</text>
</view> </view>
<!-- 服务详情 --> <!-- 内容分页:「服务详情 + 注意事项」都是读一遍的信息,放同一页;
<view class="section"> 「服务流程」有先后顺序,单独一页,避免首屏被长流程占满 -->
<view class="section-head"> <view class="tab-bar">
<view class="section-bar"></view> <view class="tab-item {{activeTab === 'detail' ? 'active' : ''}}" data-tab="detail" bindtap="onTabChange"
<text class="section-title">服务详情</text> aria-role="tab" aria-label="服务详情">服务详情</view>
</view> <view class="tab-item {{activeTab === 'flow' ? 'active' : ''}}" data-tab="flow" bindtap="onTabChange"
<text class="detail-text">{{ service.description }}</text> aria-role="tab" aria-label="服务流程">服务流程</view>
</view> </view>
<!-- 服务流程:这是真序列,编号在此处合法。橙色导轨是本页唯一的结构性重音, <!-- 详情页:服务说明 + 注意事项 -->
实心橙仍只留给底部与弹窗的提交按钮 --> <view class="tab-panel" wx:if="{{activeTab === 'detail'}}">
<view class="section"> <!-- 服务详情 -->
<view class="section-head"> <view class="section section-first">
<view class="section-bar"></view> <view class="section-head">
<text class="section-title">服务流程</text> <view class="section-bar"></view>
<text class="section-title">服务详情</text>
</view>
<text class="detail-text">{{ service.description }}</text>
</view> </view>
<view class="step-list">
<view class="step" wx:for="{{ service.flow }}" wx:key="title"> <!-- 注意事项:与指南页同一套圆点语言 -->
<view class="step-rail"> <view class="section">
<view class="step-dot">{{ index + 1 }}</view> <view class="section-head">
<view class="step-line" wx:if="{{ index < service.flow.length - 1 }}"></view> <view class="section-bar"></view>
</view> <text class="section-title">注意事项</text>
<view class="step-body"> </view>
<text class="step-title">{{ item.title }}</text> <view class="dot-list">
<text class="step-desc">{{ item.desc }}</text> <view class="dot-item" wx:for="{{ service.notices }}" wx:key="id">
<view class="dot"></view>
<text class="dot-text">{{ item.text }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 注意事项:与指南页同一套圆点语言 --> <!-- 流程页:这是真序列,编号在此处合法。橙色导轨是本页唯一的结构性重音,
<view class="section"> 实心橙仍只留给底部与弹窗的提交按钮 -->
<view class="section-head"> <view class="tab-panel" wx:if="{{activeTab === 'flow'}}">
<view class="section-bar"></view> <view class="section section-first">
<text class="section-title">注意事项</text> <view class="section-head">
</view> <view class="section-bar"></view>
<view class="dot-list"> <text class="section-title">服务流程</text>
<view class="dot-item" wx:for="{{ service.notices }}" wx:key="id"> </view>
<view class="dot"></view> <view class="step-list">
<text class="dot-text">{{ item.text }}</text> <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>
</view>
<view class="step-body">
<text class="step-title">{{ item.title }}</text>
<text class="step-desc">{{ item.desc }}</text>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -142,12 +156,6 @@
<input class="order-input" value="{{hospital}}" placeholder="请输入就诊医院" placeholder-class="input-placeholder" bindinput="onHospitalChange" /> <input class="order-input" value="{{hospital}}" placeholder="请输入就诊医院" placeholder-class="input-placeholder" bindinput="onHospitalChange" />
</view> </view>
<!-- 就诊科室 -->
<view class="order-row">
<text class="order-label">就诊科室</text>
<input class="order-input" value="{{department}}" placeholder="请输入就诊科室" placeholder-class="input-placeholder" bindinput="onDepartmentChange" />
</view>
<!-- 陪诊师性别要求 --> <!-- 陪诊师性别要求 -->
<view class="order-row"> <view class="order-row">
<text class="order-label">陪诊师性别</text> <text class="order-label">陪诊师性别</text>
+33
View File
@@ -106,6 +106,32 @@ page {
line-height: 1.6; line-height: 1.6;
} }
/* ===== 内容页签:纯文字 + 底边,不用圆角胶囊、不加背景块与过渡 =====
选中态只用 --brand-ink 文字 + 一条 --brand-strong 底边,比实心橙轻,不与提交按钮抢重音 */
.tab-bar {
display: flex;
margin-top: 32rpx;
border-bottom: 2rpx solid var(--line);
}
.tab-item {
flex: 1;
padding: 18rpx 0;
/* 下沉 2rpx 压住轨道底边,未选中项留同宽透明底边,切换时高度不跳 */
margin-bottom: -2rpx;
border-bottom: 4rpx solid transparent;
text-align: center;
font-size: 30rpx;
color: var(--muted);
letter-spacing: 1rpx;
}
.tab-item.active {
color: var(--brand-ink);
font-weight: 700;
border-bottom-color: var(--brand-strong);
}
/* ===== 通用区块:靠发丝线切分,不靠白卡浮起来 ===== */ /* ===== 通用区块:靠发丝线切分,不靠白卡浮起来 ===== */
.section { .section {
margin-top: 44rpx; margin-top: 44rpx;
@@ -113,6 +139,13 @@ page {
border-top: 2rpx solid var(--line); border-top: 2rpx solid var(--line);
} }
/* 页签内的首个区块:页签下边线已切分,不再叠一条分隔线 */
.section.section-first {
margin-top: 32rpx;
padding-top: 0;
border-top: none;
}
.section-head { .section-head {
display: flex; display: flex;
align-items: center; align-items: center;
+44 -46
View File
@@ -15,12 +15,20 @@ const SEX_REQUIREMENT_MAP = {
female: '女' female: '女'
} }
// 支付方式:与 schema 的 payment.method 枚举一一对应
const PAYMENT_METHOD_MAP = {
online_wechat: '线上微信',
offline_cash: '线下现金',
offline_transfer: '线下转账'
}
const WEEKDAYS = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] const WEEKDAYS = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
Page({ Page({
data: { data: {
recordId: '', recordId: '',
record: {}, record: {},
showAllDetails: false,
service: null, service: null,
loading: false, loading: false,
loadError: '', loadError: '',
@@ -144,7 +152,7 @@ Page({
const profile = detail.profile || {} const profile = detail.profile || {}
const health = detail.health || {} const health = detail.health || {}
// 与 formatRecord 同一批就诊人字段:档案加载完成后覆盖订单快照, // 与 formatRecord 同一批就诊人字段:档案加载完成后覆盖订单快照,
// 摘要行与首字牌因此需要一起重算 // 展开区资料因此需要一起重算
const patient = { const patient = {
name: profile.name || '', name: profile.name || '',
sexText: SEX_MAP[profile.sex] || '', sexText: SEX_MAP[profile.sex] || '',
@@ -156,13 +164,10 @@ Page({
} }
this.setData({ this.setData({
'record.patientName': patient.name, 'record.patientName': patient.name,
'record.patientAge': patient.age,
'record.patientWeight': patient.weight,
'record.patientHeight': patient.height,
'record.patientMobile': patient.mobile, 'record.patientMobile': patient.mobile,
'record.patientIdnumber': maskIdNumber(patient.idnumber), 'record.patientIdnumber': maskIdNumber(patient.idnumber),
'record.patientInitial': patient.name.charAt(0), 'record.patientMeta': this.buildPatientMeta(patient),
'record.patientMeta': this.buildPatientMeta(patient) 'record.patientBrief': this.buildPatientBrief(patient)
}) })
}) })
.catch((err) => { .catch((err) => {
@@ -182,13 +187,13 @@ Page({
const canDelete = paymentStatus === 'unpaid' const canDelete = paymentStatus === 'unpaid'
&& (status === 'pending' || status === 'confirmed' || status === 'cancelled') && (status === 'pending' || status === 'confirmed' || status === 'cancelled')
const canRebook = (status === 'completed' || status === 'cancelled') && item.escort?.serviceId > 0 const canRebook = (status === 'completed' || status === 'cancelled') && item.escort?.serviceId > 0
// 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「修改」改的是档案,不在此列) // 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「档案」跳的是档案页,不在此列)
// 进行中服务已开始:排期与医院不允许用户单方变更,仅保留就诊人备注(与后端字段白名单一致) // 进行中服务已开始:排期与医院不允许用户单方变更,仅保留就诊人备注(与后端字段白名单一致)
const canEditBooking = status === 'pending' || status === 'confirmed' const canEditBooking = status === 'pending' || status === 'confirmed'
const canEditNote = canEditBooking || status === 'in_progress' const canEditNote = canEditBooking || status === 'in_progress'
// 就诊人字段先落到局部变量:摘要行(patientMeta)与首字牌(patientInitial) // 就诊人字段先落到局部变量:摘要姓名与展开区资料都从同一批值派生,
// 都从同一批值派生,口径不在 WXML 与 JS 两处各写一份 // 口径不在 WXML 与 JS 两处各写一份
const patient = { const patient = {
name: item.patient?.name || '', name: item.patient?.name || '',
sexText: SEX_MAP[item.patient?.sex] || '', sexText: SEX_MAP[item.patient?.sex] || '',
@@ -199,7 +204,7 @@ Page({
idnumber: item.patient?.idnumber || '' idnumber: item.patient?.idnumber || ''
} }
// 预约时间派生:日期行(带星期)、时间行(时段 + 陪诊时长) // 预约时间派生:日期行(带星期)与开始时间同一行
const scheduleMeta = this.buildScheduleMeta(item.schedule || {}) const scheduleMeta = this.buildScheduleMeta(item.schedule || {})
return { return {
@@ -208,16 +213,19 @@ Page({
healthProfileId: item.healthProfileId || '', healthProfileId: item.healthProfileId || '',
serviceId: item.escort?.serviceId || 0, serviceId: item.escort?.serviceId || 0,
patientName: patient.name, patientName: patient.name,
patientAge: patient.age,
patientMobile: patient.mobile, patientMobile: patient.mobile,
patientIdnumber: maskIdNumber(patient.idnumber), patientIdnumber: maskIdNumber(patient.idnumber),
patientInitial: patient.name.charAt(0),
patientMeta: this.buildPatientMeta(patient), patientMeta: this.buildPatientMeta(patient),
patientBrief: this.buildPatientBrief(patient),
// 陪诊师由平台分配:以 id 或 name 任一存在视为已派单,
// 派单若只写了 id 而没冗余姓名,卡片也不会误报「待分配」
hasAttendant: Boolean(item.attendant?.id || item.attendant?.name),
attendantName: item.attendant?.name || '',
attendantMobile: item.attendant?.mobile || '',
hospitalProvince: item.hospital?.province || '', hospitalProvince: item.hospital?.province || '',
hospitalName: item.hospital?.name || '', hospitalName: item.hospital?.name || '',
hospitalAddress: item.hospital?.address || '', hospitalAddress: item.hospital?.address || '',
hospitalMeta: this.buildHospitalMeta(item.hospital || {}), // 科室用于摘要展示;医生、病历号与省份只做编辑弹窗的回填源,不再在展开区重复
// 以下三个原始字段不进展示(展示走 hospitalMeta),是编辑弹窗的表单回填源
hospitalDepartment: item.hospital?.department || '', hospitalDepartment: item.hospital?.department || '',
hospitalDoctor: item.hospital?.doctor || '', hospitalDoctor: item.hospital?.doctor || '',
medicalRecordNo: item.hospital?.medicalRecordNo || '', medicalRecordNo: item.hospital?.medicalRecordNo || '',
@@ -239,7 +247,7 @@ Page({
paymentStatusColor: paymentInfo.color, paymentStatusColor: paymentInfo.color,
paymentStatusBg: paymentInfo.bg, paymentStatusBg: paymentInfo.bg,
paymentStatusBorder: paymentInfo.border, paymentStatusBorder: paymentInfo.border,
paymentHint: paymentInfo.hint || '', paymentMethodText: PAYMENT_METHOD_MAP[item.payment?.method] || '',
patientNote: item.notes?.patientNote || '', patientNote: item.notes?.patientNote || '',
escortNote: item.notes?.escortNote || '', escortNote: item.notes?.escortNote || '',
medicalSummary: item.notes?.medicalSummary || '', medicalSummary: item.notes?.medicalSummary || '',
@@ -261,30 +269,26 @@ Page({
} }
}, },
// 就诊人摘要行的字段序列:空值整项剔除,WXML 只负责在项之间插竖线, // 展开区「就诊人资料」的字段序列:只留摘要卡没展示的核对项(身高体重),
// 不靠一串 && 条件去猜哪条分隔线该出现(避免留下孤立的分隔线) // 性别年龄已在摘要卡的就诊人行给出,此处不再重复;
// 空值整项剔除,WXML 只负责在项之间插竖线
buildPatientMeta(patient) { buildPatientMeta(patient) {
const list = [] const list = []
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.height) list.push({ id: 'height', text: `身高 ${patient.height}cm` })
if (patient.weight) list.push({ id: 'weight', text: `体重 ${patient.weight}kg` }) if (patient.weight) list.push({ id: 'weight', text: `体重 ${patient.weight}kg` })
return list return list
}, },
// 医院元信息行:科室 / 医生 / 病历号,与就诊人摘要同一套插线逻辑; // 摘要卡就诊人行只取性别与年龄:这两项决定陪诊师是否需要额外准备,
// 省份不进元信息行,由 hospitalProvince 单独提到卡内右上角 // 身高体重属核对资料,留在展开区(buildPatientMeta 那份)
buildHospitalMeta(hospital) { buildPatientBrief(patient) {
const list = [] const list = []
if (hospital.department) list.push({ id: 'department', text: hospital.department }) if (patient.sexText) list.push({ id: 'sex', text: patient.sexText })
if (hospital.doctor) list.push({ id: 'doctor', text: hospital.doctor }) if (patient.age) list.push({ id: 'age', text: `${patient.age}岁` })
if (hospital.medicalRecordNo) {
list.push({ id: 'medicalRecordNo', text: `病历号 ${hospital.medicalRecordNo}` })
}
return list return list
}, },
// 预约时间派生:日期行(带星期)、时间行(时段 + 陪诊时长); // 预约时间派生:日期行(带星期)与开始时间同一行;
// 日期无效或缺失时返回空串,由 WXML 走兜底文案 // 日期无效或缺失时返回空串,由 WXML 走兜底文案
buildScheduleMeta(schedule) { buildScheduleMeta(schedule) {
const result = { dateText: '', timeText: '' } const result = { dateText: '', timeText: '' }
@@ -295,18 +299,7 @@ Page({
} }
} }
const start = schedule.startTime || '' const start = schedule.startTime || ''
const end = schedule.endTime || '' result.timeText = start
let timeText = start && end ? `${start} - ${end}` : (start ? `${start} 开始` : '')
const duration = schedule.duration || 0
if (timeText && duration > 0) {
const hours = Math.floor(duration / 60)
const minutes = duration % 60
const durationText = hours > 0
? (minutes > 0 ? `${hours}小时${minutes}分钟` : `${hours}小时`)
: `${minutes}分钟`
timeText = `${timeText} · 陪诊${durationText}`
}
result.timeText = timeText
return result return result
}, },
@@ -318,10 +311,8 @@ Page({
}) })
}, },
onCallPatient() { onToggleDetails() {
const mobile = this.data.record.patientMobile this.setData({ showAllDetails: !this.data.showAllDetails })
if (!mobile || mobile === '--') return
wx.makePhoneCall({ phoneNumber: mobile })
}, },
// ===== 陪诊需求编辑(底部弹窗) ===== // ===== 陪诊需求编辑(底部弹窗) =====
@@ -471,8 +462,8 @@ Page({
}) })
}, },
// 就诊人信息统一在健康档案里维护,这里只负责跳转 // 就诊人信息统一在健康档案里维护,这里只负责跳转查看
onEditProfile() { onViewProfile() {
const profileId = this.data.record.healthProfileId const profileId = this.data.record.healthProfileId
if (!profileId) { if (!profileId) {
return return
@@ -561,6 +552,13 @@ Page({
}) })
}, },
// 回首页:首页是 tabBar 页,必须走 switchTab,navigateTo 跳不过去
onGoHome() {
wx.switchTab({
url: '/pages/home/index'
})
},
// 本页含就诊人姓名 / 手机号 / 身份证号与订单号,转发卡片不指向本页,统一落到首页; // 本页含就诊人姓名 / 手机号 / 身份证号与订单号,转发卡片不指向本页,统一落到首页;
// 也不提供朋友圈分享——朋友圈只能分享当前页 URL,会把订单页地址带出去 // 也不提供朋友圈分享——朋友圈只能分享当前页 URL,会把订单页地址带出去
onShareAppMessage() { onShareAppMessage() {
+188 -156
View File
@@ -1,10 +1,11 @@
<view class="page-bg"> <view class="page-bg">
<!-- 数据到位前不渲染内容:record 初始是 {},直接铺开会先闪一帧 <!-- 数据到位前不渲染内容:record 初始是 {},直接铺开会先闪一帧
「就诊医院待补充 / ¥0.00 / 暂无备注信息」的假数据,用 _id 作到位判据 --> 「就诊医院待补充 / ¥0.00」的假数据,用 _id 作到位判据 -->
<view class="container" wx:if="{{record._id}}"> <view class="container" wx:if="{{record._id}}">
<!-- 状态头:短横色标 + 状态胶囊 + 状态说明,是本页的「单据抬头」,不走卡片。 <!-- 状态头:短横色标 + 状态胶囊 + 状态说明,是本页的「单据抬头」,不走卡片。
状态色只包住胶囊文字本身(DESIGN.md §三),不做整块主色面板 --> 状态色只包住胶囊文字本身(DESIGN.md §三),不做整块主色面板;
客服入口收到抬头右侧:支付、改期、退款等问题不必等某个提示行出现才找得到 -->
<view class="page-header"> <view class="page-header">
<view class="header-accent"></view> <view class="header-accent"></view>
<view class="status-row"> <view class="status-row">
@@ -12,108 +13,190 @@
class="status-chip status-chip-lg" class="status-chip status-chip-lg"
style="background: {{record.statusBg}}; color: {{record.statusColor}}; border-color: {{record.statusBorder}};" style="background: {{record.statusBg}}; color: {{record.statusColor}}; border-color: {{record.statusBorder}};"
>{{record.statusText}}</view> >{{record.statusText}}</view>
<text class="header-subtitle">{{record.statusDesc}}</text> <text class="header-subtitle" wx:if="{{record.status !== 'completed' && record.status !== 'cancelled'}}">{{record.statusDesc}}</text>
</view> <view
</view> class="header-support"
aria-role="button"
<!-- 全页信息架构:抬头之下五张同构白卡(就诊人 / 医院预约 / 需求与症状 / 服务与费用 / 订单), aria-label="联系客服"
标题在纸面上、内容在白卡里——同一层级只用一种载体。 bindtap="onContactSupport"
页面本身纯展示(不铺「标签左/值右」的表单行),所有修改都收进底部弹窗: >
卡片回答「是什么」,弹窗回答「改成什么」,两种语境不混在同一版面里 --> <t-icon name="help-circle" size="32rpx" color="#6F655C" />
<!-- 就诊人信息:订单关联健康档案,就诊人信息以档案为准,
因此「修改」直接去档案页,不在订单侧另开一套编辑(同一意图只保留一个入口) -->
<view class="section">
<view class="section-head">
<view class="section-bar"></view>
<text class="section-title">就诊人信息</text>
<view class="section-link" wx:if="{{record.healthProfileId}}" bindtap="onEditProfile">
<text class="section-link-text">修改</text>
<t-icon name="edit" size="26rpx" color="#6F655C" />
</view>
</view>
<!-- 身份牌:首字牌定位「是谁」,姓名、体征元信息、证件号收进首字牌右侧纵列;
发丝线之下只留一个动作(拨打) -->
<view class="card patient-card">
<view class="patient-head">
<!-- 首字牌沿用「浅橙衬底承载标识」:有姓名取姓氏首字,无则退到 user 图标 -->
<view class="patient-mark">
<text wx:if="{{record.patientInitial}}" class="patient-mark-text">{{record.patientInitial}}</text>
<t-icon wx:else name="user" size="44rpx" color="#9B4508" />
</view>
<view class="patient-info">
<text class="patient-name">{{record.patientName || '--'}}</text>
<!-- 体征行:空值已在 JS 里整项剔除,这里只按序插竖线 -->
<view class="meta-list patient-meta-row" wx:if="{{record.patientMeta.length > 0}}">
<block wx:for="{{record.patientMeta}}" wx:key="id">
<view class="meta-sep" wx:if="{{index > 0}}"></view>
<text class="meta-item">{{item.text}}</text>
</block>
</view>
<text class="patient-id" wx:if="{{record.patientIdnumber}}">身份证号 {{record.patientIdnumber}}</text>
</view>
</view>
<!-- 发丝线之上是「是谁」,之下是唯一动作:整行可点拨打 -->
<view class="patient-contact" bindtap="onCallPatient">
<t-icon name="call" size="30rpx" color="#9B4508" />
<text class="patient-contact-text">{{record.patientMobile || '--'}}</text>
</view> </view>
</view> </view>
</view> </view>
<!-- 医院预约信息:医院名为标题,省份提到标题行右上角,科室/医生/病历号收进元信息行; <!-- 本页面向就诊人或家属,默认只回答「何时、给谁、去哪、什么服务、多少钱」。
预约时间收在卡末发丝线之下——日期左、时段与时长右,一行排开。修改走底部弹窗 --> 档案、支付明细和订单技术信息收进展开区;所有修改仍沿用分区入口 -->
<view class="section">
<view class="section-head">
<view class="section-bar"></view>
<text class="section-title">医院预约信息</text>
<view class="section-link" wx:if="{{record.canEditBooking}}" bindtap="onEditHospital">
<text class="section-link-text">修改</text>
<t-icon name="edit" size="26rpx" color="#6F655C" />
</view>
</view>
<view class="card hospital-card"> <!-- 就诊基本信息卡:这页是就诊人自己看「哪天几点去哪、谁陪我」,
<!-- 省份提到右上角,与医院名同一行:名称是主信息,省份降为右侧小字标签 --> 不是商家认顾客的订单卡——不铺自己的头像与手机号,
<view class="hospital-head"> 时间提到首落点,陪诊师单独一行(平台分配后才是本人最需要认的人) -->
<text class="hospital-name {{!record.hospitalName ? 'is-empty' : ''}}">{{record.hospitalName || '就诊医院待补充'}}</text> <view class="card appointment-card">
<text class="hospital-province" wx:if="{{record.hospitalProvince}}">{{record.hospitalProvince}}</text>
</view>
<view class="meta-list hospital-meta" wx:if="{{record.hospitalMeta.length > 0}}"> <!-- 时间:卡内首落点。日期给全卡最大字号,时段用暖橙同处一行。
<block wx:for="{{record.hospitalMeta}}" wx:key="id"> 完整信息的入口不再是一行文字开关:卡片右上角一枚向下箭头,
<view class="meta-sep" wx:if="{{index > 0}}"></view> 点开后就在原位铺开展开区 -->
<text class="meta-item">{{item.text}}</text> <view class="schedule-row">
</block> <view class="schedule-block">
</view>
<text class="hospital-address" wx:if="{{record.hospitalAddress}}">{{record.hospitalAddress}}</text>
<!-- 预约时间条:日期(带星期)在左、时段与陪诊时长在右,一行排开;空值有兜底文案 -->
<view class="schedule-row">
<text class="schedule-date {{!record.scheduleDateText ? 'is-empty' : ''}}">{{record.scheduleDateText || '预约日期待定'}}</text> <text class="schedule-date {{!record.scheduleDateText ? 'is-empty' : ''}}">{{record.scheduleDateText || '预约日期待定'}}</text>
<text class="schedule-time" wx:if="{{record.scheduleTimeText}}">{{record.scheduleTimeText}}</text> <text class="schedule-time" wx:if="{{record.scheduleTimeText}}">{{record.scheduleTimeText}}</text>
</view> </view>
<view
class="details-expand"
aria-role="button"
aria-label="{{showAllDetails ? '收起完整订单信息' : '展开完整订单信息'}}"
aria-expanded="{{showAllDetails}}"
bindtap="onToggleDetails"
>
<view class="details-expand-icon {{showAllDetails ? 'is-expanded' : ''}}">
<t-icon name="chevron-down" size="32rpx" color="#6F655C" />
</view>
</view>
</view>
<!-- 医院 / 服务 / 就诊人:两字小标签逐行作答 -->
<view class="appt-rows">
<view class="appt-row">
<text class="appt-label">医院</text>
<view class="appt-value">
<text class="appt-text {{!record.hospitalName ? 'is-empty' : ''}}">{{record.hospitalName || '就诊医院待补充'}}</text>
<text class="appt-text" wx:if="{{record.hospitalDepartment}}"> · {{record.hospitalDepartment}}</text>
<text class="appt-sub" wx:if="{{record.hospitalAddress}}">{{record.hospitalAddress}}</text>
</view>
<view
class="row-entry"
wx:if="{{record.canEditBooking}}"
aria-role="button"
aria-label="修改医院预约信息"
bindtap="onEditHospital"
>
<t-icon name="edit" size="28rpx" color="#6F655C" />
</view>
</view>
<view class="appt-row">
<text class="appt-label">服务</text>
<view class="appt-value">
<text class="appt-text">{{record.escortServiceName || '陪诊服务'}}</text>
<text class="appt-text" wx:if="{{record.sexRequirementText}}"> · 性别要求{{record.sexRequirementText}}</text>
</view>
</view>
<!-- 陪诊师不在此行重复,下方独立卡片承载姓名与电话。
就诊人降为一行:核对「是不是我」即可,入口跳健康档案页 -->
<view class="appt-row">
<text class="appt-label">就诊人</text>
<view class="appt-value">
<text class="appt-text">{{record.patientName || '--'}}</text>
<text class="appt-text" wx:if="{{record.patientBrief.length > 0}}"> · {{record.patientBrief[0].text}}</text>
<text class="appt-text" wx:if="{{record.patientBrief.length > 1}}"> · {{record.patientBrief[1].text}}</text>
</view>
<view
class="row-entry"
wx:if="{{record.healthProfileId}}"
aria-role="button"
aria-label="查看就诊人档案"
bindtap="onViewProfile"
>
<t-icon name="chevron-right" size="28rpx" color="#6F655C" />
</view>
</view>
</view>
<!-- 费用:标签与金额同行对齐;支付状态胶囊收在行尾 -->
<view class="fee-line">
<text class="appt-label">费用</text>
<text class="fee-amount">¥{{record.totalFee}}</text>
<view class="fee-side">
<view
class="status-chip"
wx:if="{{record.paymentStatus !== 'paid'}}"
style="background: {{record.paymentStatusBg}}; color: {{record.paymentStatusColor}}; border-color: {{record.paymentStatusBorder}};"
>{{record.paymentStatusText}}</view>
</view>
</view>
<!-- 支付与退款的引导统一由抬头的客服入口承担,
不再在卡内挂一行「请联系客服…」:那句话只对未支付状态成立,
却长期占着卡内一条常驻行位 -->
<view class="cancel-summary" wx:if="{{record.status === 'cancelled' && record.cancelReason}}">
<text class="cancel-summary-label">取消原因</text>
<text class="cancel-summary-value">{{record.cancelReason}}</text>
</view>
<!-- 完整信息按需展开,已完成、已取消等只读订单也始终可以核对 -->
<view class="full-details" wx:if="{{showAllDetails}}">
<!-- 手机号已不在摘要卡里(本人知道自己号码),此处也只留核对用的身高体重与证件号 -->
<view class="detail-group" wx:if="{{record.patientMeta.length > 0 || record.patientIdnumber}}">
<text class="detail-group-title">就诊人资料</text>
<view class="meta-list detail-patient-meta" wx:if="{{record.patientMeta.length > 0}}">
<block wx:for="{{record.patientMeta}}" wx:key="id">
<view class="meta-sep" wx:if="{{index > 0}}"></view>
<text class="meta-item">{{item.text}}</text>
</block>
</view>
<view class="detail-row" wx:if="{{record.patientIdnumber}}">
<text class="detail-label">身份证号</text>
<text class="detail-value">{{record.patientIdnumber}}</text>
</view>
</view>
<!-- 收货信息为下单时的订单快照,不随后续就诊人资料变化 -->
<view class="detail-group" wx:if="{{record.shippingAddress && record.shippingAddress.address}}">
<text class="detail-group-title">收货信息</text>
<text class="shipping-recipient">{{record.shippingAddress.recipientName}} {{record.shippingAddress.mobile}}</text>
<text class="shipping-address">{{record.shippingAddress.address}}</text>
</view>
<view class="detail-group">
<text class="detail-group-title">订单信息</text>
<view class="detail-row">
<text class="detail-label">订单编号</text>
<text class="detail-value order-no">{{record.displayId}}</text>
</view>
<view class="detail-row">
<text class="detail-label">创建时间</text>
<text class="detail-value">{{record.createTime || '--'}}</text>
</view>
<view class="detail-row">
<text class="detail-label">更新时间</text>
<text class="detail-value">{{record.updateTime || '--'}}</text>
</view>
</view>
</view> </view>
</view> </view>
<!-- 陪诊需求与症状:纯文本块展示,修改走底部弹窗(textarea 在弹窗里) --> <!-- 陪诊师卡片:已派单显示名与电话;派单正常时后台会写姓名,
<view class="section"> 若只有 id 未冗余名则退成「已安排」,不误报「待分配」。
未派单(如待确认)显示占位,让用户知道「会有一位陪诊师」;
已取消、已完成且无人可联系时不出现——那是正常结果,不必提示 -->
<view class="section attendant-section" wx:if="{{record.hasAttendant || (record.status !== 'cancelled' && record.status !== 'completed')}}">
<view class="section-head"> <view class="section-head">
<view class="section-bar"></view> <view class="section-bar"></view>
<text class="section-title">陪诊需求与症状</text> <text class="section-title">陪诊师</text>
<view class="section-link" wx:if="{{record.canEditNote}}" bindtap="onEditPatientNote"> </view>
<view class="card attendant-card">
<text class="attendant-name" wx:if="{{record.hasAttendant}}">{{record.attendantName || '已安排'}}</text>
<text class="attendant-empty" wx:else>待分配</text>
<text class="attendant-phone" wx:if="{{record.attendantMobile}}">{{record.attendantMobile}}</text>
</view>
</view>
<!-- 有内容才铺正文;可编辑但内容为空时只留一个添加入口,不让空卡占位。
已完成订单的陪诊记录和就诊摘要直接展示,不收入展开区 -->
<view class="section note-section" wx:if="{{record.patientNote || record.escortNote || record.medicalSummary || record.canEditNote}}">
<view class="section-head">
<view class="section-bar"></view>
<text class="section-title">{{record.status === 'completed' && (record.escortNote || record.medicalSummary) ? '服务结果' : (record.escortNote || record.medicalSummary ? '陪诊需求与记录' : '陪诊需求')}}</text>
<view class="section-link" wx:if="{{record.canEditNote && (record.patientNote || record.escortNote || record.medicalSummary)}}" bindtap="onEditPatientNote">
<text class="section-link-text">修改</text> <text class="section-link-text">修改</text>
<t-icon name="edit" size="26rpx" color="#6F655C" /> <t-icon name="edit" size="26rpx" color="#6F655C" />
</view> </view>
</view> </view>
<view class="card"> <view class="card note-card">
<view class="note-block" wx:if="{{record.patientNote}}"> <view class="note-block" wx:if="{{record.patientNote}}">
<text class="note-label" wx:if="{{record.escortNote || record.medicalSummary}}">陪诊需求</text>
<text class="note-text">{{record.patientNote}}</text> <text class="note-text">{{record.patientNote}}</text>
</view> </view>
<view class="note-block" wx:if="{{record.escortNote}}"> <view class="note-block" wx:if="{{record.escortNote}}">
@@ -124,79 +207,17 @@
<text class="note-label">就诊摘要</text> <text class="note-label">就诊摘要</text>
<text class="note-text">{{record.medicalSummary}}</text> <text class="note-text">{{record.medicalSummary}}</text>
</view> </view>
<view class="note-empty" wx:if="{{!record.patientNote && !record.escortNote && !record.medicalSummary}}">
<text class="note-empty-text">暂无备注信息</text>
</view>
</view>
</view>
<!-- 服务与费用:服务名称为主、支付状态胶囊收尾同行(仅待处理时显示,已付清不出现); <!-- 可编辑且三段全空:给一个轻量添加入口,避免用户失去补充需求的路径 -->
费用行用字号差做层级(金额是全卡唯一的大字号焦点),不铺清单行; <view
未付清时在费用行下补一句客服指引(全站没有线上支付入口,本页给不出可点的动作)。 class="note-add"
位置收在末尾:前面各块回答「服务什么」(人 → 去哪 → 要什么), wx:if="{{record.canEditNote && !record.patientNote && !record.escortNote && !record.medicalSummary}}"
费用与订单号同属「账与单」,连排在最后 --> aria-role="button"
<view class="section"> aria-label="添加陪诊需求"
<view class="section-head"> bindtap="onEditPatientNote"
<view class="section-bar"></view> >
<text class="section-title">服务与费用</text> <t-icon name="add" size="28rpx" color="#9B4508" />
</view> <text class="note-add-text">添加陪诊需求</text>
<view class="card service-card">
<view class="service-head">
<text class="service-name">{{record.escortServiceName || '陪诊服务'}}</text>
<!-- 支付完成(paid)是常态不显示胶囊;只有待处理(未支付/部分支付/已退款)才提示 -->
<view
class="status-chip"
wx:if="{{record.paymentStatus !== 'paid'}}"
style="background: {{record.paymentStatusBg}}; color: {{record.paymentStatusColor}}; border-color: {{record.paymentStatusBorder}};"
>{{record.paymentStatusText}}</view>
</view>
<view class="meta-list service-meta" wx:if="{{record.sexRequirementText}}">
<text class="meta-item">陪诊师性别要求 {{record.sexRequirementText}}</text>
</view>
<view class="fee-row">
<view class="fee-main">
<text class="fee-label">服务费用</text>
<text class="fee-amount">¥{{record.totalFee}}</text>
</view>
<text class="fee-paid" wx:if="{{record.showPaidFee}}">已支付 ¥{{record.paidFee}}</text>
</view>
<!-- 支付与退款问题都进入带订单上下文的客服页 -->
<view class="pay-hint" wx:if="{{record.paymentHint}}" bindtap="onContactSupport">
<text class="pay-hint-text">{{record.paymentHint}}</text>
<t-icon name="chevron-right" size="26rpx" color="#6F655C" />
</view>
</view>
</view>
<!-- 收货信息为下单时的订单快照,不随后续就诊人资料变化 -->
<view class="section" wx:if="{{record.shippingAddress && record.shippingAddress.address}}">
<view class="section-head">
<view class="section-bar"></view>
<text class="section-title">收货信息</text>
</view>
<view class="card">
<text class="shipping-recipient">{{record.shippingAddress.recipientName}} {{record.shippingAddress.mobile}}</text>
<text class="shipping-address">{{record.shippingAddress.address}}</text>
</view>
</view>
<!-- 订单信息:编号脱敏展示,完整编号由客服入口安全携带 -->
<view class="section">
<view class="section-head">
<view class="section-bar"></view>
<text class="section-title">订单信息</text>
</view>
<view class="card order-card">
<text class="order-no">订单编号 {{record.displayId}}</text>
<view class="meta-list order-meta">
<text class="meta-item">创建于 {{record.createTime || '--'}}</text>
<view class="meta-sep"></view>
<text class="meta-item">更新于 {{record.updateTime || '--'}}</text>
</view>
<view class="order-extra" wx:if="{{record.cancelReason}}">
<text class="order-extra-label">取消原因</text>
<text class="order-extra-value">{{record.cancelReason}}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -215,6 +236,17 @@
<!-- 底部操作栏:完成状态仅由平台流转,用户不确认完成 --> <!-- 底部操作栏:完成状态仅由平台流转,用户不确认完成 -->
<view class="bottom-bar" wx:if="{{record.showBottomBar}}"> <view class="bottom-bar" wx:if="{{record.showBottomBar}}">
<!-- 首页入口:底栏最左的固定位图标按钮,点了直接回首页。
独立于订单动作,固定宽度、不参与右侧按钮的等宽分配;
首页是 tabBar 页,必须走 switchTab,navigateTo 跳不过去 -->
<view
class="home-btn"
aria-role="button"
aria-label="返回首页"
bindtap="onGoHome"
>
<view class="home-icon"></view>
</view>
<view <view
class="action-btn action-ghost" class="action-btn action-ghost"
wx:if="{{record.canCancel}}" wx:if="{{record.canCancel}}"
+338 -221
View File
@@ -1,17 +1,17 @@
/* pages/escort/recorddetail.wxss /* pages/escort/recorddetail.wxss
设计方向:本页是一张陪诊订单的详情,按「状态抬头 → 就诊人 → 医院预约 → 需求与症状 → 服务与费用 → 订单」铺开。 设计方向:面向就诊人或家属的预约凭证,而非订单字段清单。
- 配色并入全站暖橙体系(doc/DESIGN.md):令牌来自 app.wxss,本页不留副本; - 首屏用一张信息卡按「何时 → 给谁 → 去哪 → 什么服务 → 多少钱」的顺序作答,
状态色只用 §三 四档,旧版渐变横幅与金色体系全部移除 时间是唯一会过期的强约束信息,放在卡内首落点,避免多张同权重卡片争抢注意力;
- 抬头:短横色标 + 状态胶囊 + 状态说明,是唯一的非卡片区(内页规范,不做整块主色面板); - 摘要卡先回答本人的问题:时间作首落点(日期最大字 + 暖橙色时段),
下方用 2rpx --line 通栏发丝线收口,靠字号两档差(32 胶囊 / 26 说明)与留白立住,不套第二套容器 再列「医院 / 服务 / 就诊人」,最后一行费用;
- 分区:标题在纸面上(8×32rpx 单竖条),内容统一收进同一种白卡 不铺自己的头像与手机号——那是商家认顾客的版式,对本人零信息量;
(§2.3:2rpx --line + 中性阴影 --shadow-card;圆角本页取 24rpx 为例外,见下方 .card 注释) - 陪诊师单独成卡(名 + 电话),平台分配后才出现,不与摘要行重复;
- 展示去表单化:不铺「标签左/值右」清单行,层级由结构给出—— - 档案、支付明细、收货和订单技术信息按需展开,只读的历史订单也能核对完整资料;
就诊人用首字牌、医院预约用预约时间条、费用用字号差;元信息一律竖线分隔行 - 陪诊需求、陪诊记录与就诊摘要仅在有内容时出现,已完成订单的服务结果直接展示;
- 编辑全部收进底部弹窗:页面只读,表单只活在弹窗里 - 修改仍按就诊人、医院预约、陪诊需求分区,表单只存在于档案页或底部弹窗;
- 按钮:底栏与弹窗的主操作实心胶囊、其余空心胶囊,同类实心块全页只保留一处(§2.1) - 配色沿用 app.wxss 暖橙令牌,状态文字与颜色共同传达信息;
- 字号阶梯:40 首字牌 / 32 分节标题 · 卡片主名 · 金额 · 状态胶囊 / 28 服务名 · 备注正文 · 预约日期 - 字号阶梯:36 日期 / 34 金额 / 32 姓名 · 陪诊师名 / 28 行值(医院 · 服务 · 时段 · 电话)
/ 26 次强 · 「修改」入口 · 预约时段 · 订单号 / 24 元信息 · 已支付 · 支付指引,最小 24rpx(12px) */ / 24 标签 · 地址 · 辅助说明,最小 24rpx(12px) */
page { page {
background-color: var(--paper); background-color: var(--paper);
@@ -84,6 +84,24 @@ page {
align-items: center; align-items: center;
} }
/* 抬头右侧客服入口:安静图标,靠位置与热区成立,不抢状态胶囊的焦点。
负 margin 把热区撑到 88rpx 而不再抬高抬头区 */
.header-support {
box-sizing: border-box;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: flex-end;
min-width: 88rpx;
min-height: 88rpx;
margin: -20rpx -8rpx -20rpx auto;
padding-left: 16rpx;
}
.header-support:active {
opacity: 0.6;
}
/* 状态胶囊:底色 + 描边 + 字色三件套,颜色只做强化,文字才是信息(§三) */ /* 状态胶囊:底色 + 描边 + 字色三件套,颜色只做强化,文字才是信息(§三) */
.status-chip { .status-chip {
display: inline-flex; display: inline-flex;
@@ -107,6 +125,10 @@ page {
} }
.header-subtitle { .header-subtitle {
/* 说明文字吃掉剩余宽度,客服入口才被推到最右;
min-width 0 让长说明正常收缩换行,不撑破抬头行 */
flex: 1;
min-width: 0;
margin-left: 20rpx; margin-left: 20rpx;
/* 28rpx 降到 26rpx:说明退到「次强」档,与 32rpx 的胶囊拉开一档差, /* 28rpx 降到 26rpx:说明退到「次强」档,与 32rpx 的胶囊拉开一档差,
抬头内部才有焦点;此前两者同为 28rpx,只靠字重区分,谁都不是主角 */ 抬头内部才有焦点;此前两者同为 28rpx,只靠字重区分,谁都不是主角 */
@@ -207,296 +229,346 @@ page {
background: var(--sep); background: var(--sep);
} }
/* ===== 就诊人卡:首字牌 + 元信息行 + 发丝线下的拨打动作 ===== */ /* ===== 预约摘要卡:就诊人本人的行程卡 =====
.patient-head { 这页是本人看「哪天几点去哪、谁陪我」,不是商家认顾客的订单卡,
display: flex; 所以不铺自己的头像与手机号:时间作首落点,
align-items: center; 「医院 / 服务 / 陪诊师 / 就诊人」四行小标签作答,底部一行费用 */
.appointment-card {
margin-top: 32rpx;
padding: 28rpx;
} }
/* 首字牌:浅橙衬底 + --brand-line 描边,与陪诊师列表的兜底头像同源 */ /* 时间块:卡内首落点。日期给全卡最大字号——它是唯一会过期的
.patient-mark { 强约束信息;时段用暖橙跟在同一行,是当天要准点到的第二关键信息 */
box-sizing: border-box;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 88rpx;
height: 88rpx;
border: 2rpx solid var(--brand-line);
border-radius: 24rpx;
background: var(--brand-soft);
}
.patient-mark-text {
font-size: 40rpx;
font-weight: 700;
color: var(--brand-ink);
letter-spacing: 1rpx;
}
/* 首字牌右侧纵列:姓名 / 体征元信息 / 证件号自上而下 */
.patient-info {
flex: 1;
min-width: 0;
margin-left: 20rpx;
}
/* 姓名 32rpx/700:低于区块标题 34rpx 一档,不与标题争层级 */
.patient-name {
font-size: 32rpx;
font-weight: 700;
color: var(--ink);
letter-spacing: 1rpx;
}
.patient-meta-row {
margin-top: 10rpx;
}
/* 身份证 18 位,折行而不是撑破卡片 */
.patient-id {
display: block;
margin-top: 8rpx;
font-size: 24rpx;
color: var(--muted);
letter-spacing: 1rpx;
word-break: break-all;
}
/* 发丝线之上是「是谁」,之下是「怎么联系」;整行即热区 */
.patient-contact {
display: flex;
align-items: center;
margin-top: 22rpx;
padding-top: 20rpx;
border-top: 2rpx solid var(--line);
}
.patient-contact-text {
margin-left: 10rpx;
font-size: 28rpx;
font-weight: 700;
color: var(--brand-ink);
letter-spacing: 1rpx;
}
.patient-contact:active {
opacity: 0.6;
}
/* ===== 医院预约卡:日历牌是全卡视觉锚点 ===== */
.hospital-head {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.hospital-name {
flex: 1;
min-width: 0;
font-size: 32rpx;
font-weight: 700;
color: var(--ink);
letter-spacing: 1rpx;
line-height: 1.4;
}
.hospital-name.is-empty {
font-weight: 400;
color: var(--muted);
}
.hospital-province {
margin-left: 20rpx;
font-size: 24rpx;
color: var(--muted);
letter-spacing: 1rpx;
line-height: 1.4;
white-space: nowrap;
}
.hospital-meta {
margin-top: 12rpx;
}
.hospital-address {
display: block;
margin-top: 10rpx;
font-size: 24rpx;
color: var(--muted);
letter-spacing: 1rpx;
line-height: 1.5;
}
/* 预约时间条:发丝线之上是「去哪看」,之下是「什么时候看」——日期左、时段右 */
.schedule-row { .schedule-row {
display: flex;
align-items: center;
}
.schedule-block {
flex: 1;
min-width: 0;
display: flex; display: flex;
align-items: baseline; align-items: baseline;
justify-content: space-between; gap: 16rpx;
margin-top: 22rpx; padding-bottom: 20rpx;
padding-top: 20rpx;
border-top: 2rpx solid var(--line);
} }
.schedule-date { .schedule-date {
flex: 1; flex-shrink: 0;
min-width: 0; font-size: 36rpx;
font-size: 28rpx;
font-weight: 700; font-weight: 700;
color: var(--ink); color: var(--ink);
letter-spacing: 1rpx; letter-spacing: 1rpx;
line-height: 1.4;
} }
.schedule-date.is-empty { .schedule-date.is-empty {
font-size: 32rpx;
font-weight: 400; font-weight: 400;
color: var(--muted); color: var(--muted);
} }
.schedule-time { .schedule-time {
margin-left: 20rpx; font-size: 28rpx;
font-size: 26rpx;
font-weight: 700; font-weight: 700;
color: var(--brand-ink); color: var(--brand-ink);
letter-spacing: 1rpx; letter-spacing: 1rpx;
white-space: nowrap;
} }
/* ===== 服务与费用卡:金额是全卡唯一的大字号焦点 ===== */ /* 完整信息入口:卡片右上角的向下箭头,展开后翻转成向上。
.service-head { 负 margin 把热区撑到 88rpx,只占 40rpx 高度,
不把时间行顶高,也不与日期争字号 */
.details-expand {
box-sizing: border-box;
flex-shrink: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: center;
min-width: 88rpx;
min-height: 88rpx;
margin: -24rpx -8rpx -16rpx 16rpx;
} }
.service-name { .details-expand:active {
font-size: 28rpx; opacity: 0.6;
font-weight: 700;
color: var(--ink);
letter-spacing: 1rpx;
} }
.service-meta { .details-expand-icon {
margin-top: 10rpx;
}
.fee-row {
display: flex; display: flex;
align-items: baseline; align-items: center;
justify-content: space-between; transition: transform 0.2s ease;
margin-top: 18rpx; }
padding-top: 18rpx;
.details-expand-icon.is-expanded {
transform: rotate(180deg);
}
/* 行右入口:只留图标,靠位置与热区成立,不靠颜色。
负 margin 把热区撑到 88rpx 而不撑高行 */
.row-entry {
box-sizing: border-box;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: flex-end;
min-width: 64rpx;
min-height: 88rpx;
margin: -24rpx -8rpx -24rpx 16rpx;
padding-left: 16rpx;
}
.row-entry:active {
opacity: 0.6;
}
/* 中段四行:两字小标签 + 值;标签列等宽,值的起点始终在同一竖线上 */
.appt-rows {
border-top: 2rpx solid var(--line); border-top: 2rpx solid var(--line);
} }
.fee-main { .appt-row {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
padding: 16rpx 0;
} }
.fee-label { /* 标签列按最长三字标签(陪诊师 / 就诊人)留宽,值的起点不错位 */
font-size: 26rpx; .appt-label {
color: var(--muted); flex-shrink: 0;
} width: 96rpx;
.fee-amount {
margin-left: 16rpx;
/* 34rpx 降一档到 32rpx,与分区标题同一档,不新增字号档位;
仍明显高于标签(26rpx)与「已支付」(24rpx),保住金额在卡内的大字号焦点地位 */
font-size: 32rpx;
font-weight: 700;
color: var(--brand-strong);
letter-spacing: 1rpx;
}
.fee-paid {
font-size: 24rpx; font-size: 24rpx;
color: var(--muted); color: var(--muted);
letter-spacing: 1rpx; letter-spacing: 1rpx;
line-height: 1.8;
} }
/* 支付/退款指引是可点击的客服入口,用 chevron 给出显性动作暗示 */ .appt-value {
.pay-hint {
display: flex;
align-items: center;
margin-top: 12rpx;
color: var(--muted);
}
.pay-hint:active {
opacity: 0.65;
}
.pay-hint-text {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
font-size: 24rpx; display: flex;
align-items: baseline;
gap: 4rpx;
flex-wrap: wrap;
}
.appt-text {
font-size: 28rpx;
color: var(--ink);
letter-spacing: 1rpx; letter-spacing: 1rpx;
line-height: 1.6; line-height: 1.6;
} }
.appt-text.is-empty {
color: var(--muted);
}
/* 地址:医院行下的灰色副行,换行独占 */
.appt-sub {
flex-basis: 100%;
font-size: 24rpx;
color: var(--muted);
letter-spacing: 1rpx;
line-height: 1.6;
}
/* 费用行:标签列与上行对齐,金额主色,支付状态胶囊收行尾 */
.fee-line {
display: flex;
align-items: center;
padding-top: 20rpx;
border-top: 2rpx solid var(--line);
}
.fee-amount {
font-size: 34rpx;
font-weight: 700;
color: var(--brand-strong);
letter-spacing: 1rpx;
line-height: 1.4;
}
.fee-side {
margin-left: auto;
display: flex;
align-items: center;
}
/* 取消原因:--paper 底在白卡上只差 1.06:1,靠描边托形 */
.cancel-summary {
margin-top: 16rpx;
padding: 16rpx 20rpx;
border: 2rpx solid var(--line);
border-radius: 16rpx;
background: var(--paper);
}
.cancel-summary-label {
display: block;
font-size: 24rpx;
color: var(--muted);
}
.cancel-summary-value {
display: block;
margin-top: 6rpx;
font-size: 26rpx;
color: var(--ink-2);
line-height: 1.5;
}
/* ===== 完整信息:默认折叠,展开后按资料类型分组 ===== */
.full-details {
/* 展开区自带顶边:费用行不画底边,取消原因也自带边,
任一块出现都只落一条分隔线 */
margin-top: 16rpx;
border-top: 2rpx solid var(--line);
}
/* 首个分组不再重复画顶边:它紧接 full-details 的顶边,
两者只差 8rpx,会读成一条粗线或双线 */
.full-details > .detail-group:first-child {
margin-top: 0;
border-top: none;
}
.detail-group {
margin-top: 8rpx;
padding: 24rpx 0 8rpx;
border-top: 2rpx solid var(--line);
}
/* 分隔线由上方 .full-details 的顶边提供,首组不再画第二条,避免双线并行 */
.full-details .detail-group:first-child {
padding-top: 12rpx;
border-top: none;
}
.detail-group-title {
display: block;
font-size: 26rpx;
font-weight: 700;
color: var(--ink);
}
.detail-patient-meta {
margin-top: 12rpx;
}
.detail-row {
display: flex;
align-items: flex-start;
margin-top: 16rpx;
}
.detail-label {
flex-shrink: 0;
font-size: 24rpx;
color: var(--muted);
line-height: 1.6;
}
.detail-value {
flex: 1;
min-width: 0;
margin-left: 24rpx;
font-size: 26rpx;
color: var(--ink-2);
line-height: 1.5;
text-align: right;
}
.shipping-recipient { .shipping-recipient {
display: block; display: block;
font-size: 28rpx; margin-top: 16rpx;
font-size: 26rpx;
font-weight: 700; font-weight: 700;
color: var(--ink); color: var(--ink);
} }
.shipping-address { .shipping-address {
display: block; display: block;
margin-top: 12rpx; margin-top: 8rpx;
font-size: 26rpx; font-size: 24rpx;
color: var(--ink-2); color: var(--muted);
line-height: 1.6; line-height: 1.6;
} }
/* ===== 订单卡:编号为主,时间收进元信息行 ===== */ /* 订单号是需要逐字核对的标识符:左对齐、允许断行,不跟随右侧值的右对齐 */
.order-no { .order-no {
display: block; text-align: left;
font-size: 26rpx;
color: var(--ink-2);
letter-spacing: 1rpx; letter-spacing: 1rpx;
word-break: break-all; word-break: break-all;
} }
.order-meta { /* ===== 陪诊师卡片:平台分配后才出现 =====
margin-top: 10rpx; 就诊当天要联系的人单独成卡,只用「名 + 电话」两段,
名字 32rpx 立住身份,电话弱一档在右侧,扫一眼就能报出是谁 */
.attendant-section {
margin-top: 32rpx;
} }
.order-extra { .attendant-card {
display: flex; display: flex;
align-items: flex-start; align-items: center;
margin-top: 16rpx; gap: 20rpx;
padding-top: 16rpx; padding: 24rpx;
border-top: 2rpx solid var(--line);
} }
.order-extra-label { .attendant-name {
flex-shrink: 0; flex-shrink: 0;
font-size: 24rpx; font-size: 32rpx;
color: var(--muted); font-weight: 700;
color: var(--ink);
letter-spacing: 1rpx;
line-height: 1.4;
} }
.order-extra-value { /* 电话靠右对齐:等宽数字不跳字,长号码也只会压缩自己不会挤名字 */
.attendant-phone {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
margin-left: 20rpx; text-align: right;
font-size: 26rpx; font-size: 28rpx;
color: var(--ink-2); color: var(--ink-2);
letter-spacing: 1rpx;
font-variant-numeric: tabular-nums;
}
/* 待分配占位:与姓名同档字号但退到灰字,读作「还没定」而不是「没有」 */
.attendant-empty {
flex: 1;
min-width: 0;
font-size: 28rpx;
color: var(--muted);
letter-spacing: 1rpx;
line-height: 1.5; line-height: 1.5;
} }
/* ===== 备注(只读文本块) ===== */ /* ===== 需求与服务结果:有内容才出现 ===== */
.note-section {
margin-top: 32rpx;
}
.note-card {
padding: 24rpx;
}
.note-block { .note-block {
margin-top: 18rpx; margin-top: 20rpx;
padding-top: 20rpx;
border-top: 2rpx solid var(--line);
} }
.note-block:first-child { .note-block:first-child {
margin-top: 4rpx; margin-top: 0;
padding-top: 0;
border-top: none;
} }
.note-label { .note-label {
display: block; display: block;
margin-bottom: 6rpx; margin-bottom: 8rpx;
font-size: 24rpx; font-size: 24rpx;
color: var(--muted); color: var(--muted);
} }
@@ -507,15 +579,26 @@ page {
color: var(--ink-2); color: var(--ink-2);
line-height: 1.7; line-height: 1.7;
letter-spacing: 1rpx; letter-spacing: 1rpx;
word-break: break-word;
} }
.note-empty { /* 空态添加入口:整行可点,热区不依赖小图标 */
padding: 6rpx 0; .note-add {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
min-height: 88rpx;
} }
.note-empty-text { .note-add:active {
font-size: 28rpx; opacity: 0.6;
color: var(--muted); }
.note-add-text {
margin-left: 8rpx;
font-size: 26rpx;
color: var(--brand-ink);
} }
/* ===== 表单行:只活在编辑弹窗里 ===== /* ===== 表单行:只活在编辑弹窗里 =====
@@ -598,6 +681,40 @@ page {
box-shadow: var(--shadow-bar); box-shadow: var(--shadow-bar);
} }
/* 首页图标按钮:底栏最左的固定位圆形按钮。
与右侧幽灵按钮同一套语言(--sep 描边 + --muted 图标 + 999rpx 圆角),
但固定宽高、不参与 flex:1 的等宽分配——它是入口,不是订单动作;
固定宽度后「取消 / 删除 / 再约」仍等宽平分剩余空间。
84rpx 见方 = 与右侧幽灵按钮同高(18rpx 上下内距 + 30rpx 文字行高 + 3rpx 描边),
圆形后上下沿齐平;内含 40rpx 图标,触控热区 42px 远高于 24px 下限 */
.home-btn {
box-sizing: border-box;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 84rpx;
height: 84rpx;
border: 3rpx solid var(--sep);
border-radius: 999rpx;
background: transparent;
}
.home-btn:active {
opacity: 0.7;
}
/* 首页图标:复用 custom-tab-bar 的同一份手绘 SVG(灰 #6F655C 档),
与 tabBar「首页」tab 造型完全一致——同一个「首页」不在两处画成两种房子。
TDesign 字体图标 home 是尖屋顶,tabBar 已弃用,此处同样不用 */
.home-icon {
width: 40rpx;
height: 40rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTkgMzEgQzkgMjMuNSAxNi41IDE2LjUgMzIgOC41IEM0Ny41IDE2LjUgNTUgMjMuNSA1NSAzMSIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjxyZWN0IHg9IjE0IiB5PSIyOCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjI2IiByeD0iNyIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNMjcgNTQgVjQ2IGE1IDUgMCAwIDEgMTAgMCBWNTQiIHN0cm9rZT0iIzZGNjU1QyIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L3N2Zz4=");
}
/* 按钮等宽铺满:与同页弹窗脚(.popup-btn 的 flex:1)同一套排布, /* 按钮等宽铺满:与同页弹窗脚(.popup-btn 的 flex:1)同一套排布,
热区也更大;单个按钮时即整条通栏主操作 */ 热区也更大;单个按钮时即整条通栏主操作 */
.action-btn { .action-btn {
+5
View File
@@ -188,5 +188,10 @@ Page({
onTapRecord(e) { onTapRecord(e) {
const id = e.currentTarget.dataset.id const id = e.currentTarget.dataset.id
wx.navigateTo({ url: `/pages/escort/recorddetail?id=${id}` }) wx.navigateTo({ url: `/pages/escort/recorddetail?id=${id}` })
},
// 回首页:首页是 tabBar 页,必须走 switchTab,navigateTo 跳不过去
onGoHome() {
wx.switchTab({ url: '/pages/home/index' })
} }
}) })
+11
View File
@@ -114,4 +114,15 @@
</view> </view>
</view> </view>
<!-- 返回首页:本页没有底部动作栏,不额外立一条只有图标的空底栏,
首页入口做成左下角悬浮圆钮;首页是 tabBar 页,必须走 switchTab -->
<view
class="home-fab"
aria-role="button"
aria-label="返回首页"
bindtap="onGoHome"
>
<view class="home-icon"></view>
</view>
</view> </view>
+37 -1
View File
@@ -24,7 +24,8 @@ page {
} }
.container { .container {
padding: 0 32rpx calc(40rpx + env(safe-area-inset-bottom)); /* 底部多留 110rpx:给左下角悬浮的首页圆钮让位,最后一条不被盖住 */
padding: 0 32rpx calc(150rpx + env(safe-area-inset-bottom));
/* 左右滑动切换的视觉反馈:跟手期间由 .dragging 关闭过渡做到即时响应, /* 左右滑动切换的视觉反馈:跟手期间由 .dragging 关闭过渡做到即时响应,
松手后恢复过渡,内容弹回原位 */ 松手后恢复过渡,内容弹回原位 */
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1); transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
@@ -298,4 +299,39 @@ page {
.no-more-text { .no-more-text {
font-size: 24rpx; font-size: 24rpx;
color: var(--muted); color: var(--muted);
}
/* ===== 返回首页:左下角悬浮圆钮 =====
本页没有底部动作栏,不额外立一条只有图标的空底栏,改成悬浮圆钮:
白面 + 发丝边 + 中性紧阴影,从滚动的卡片上拎起来,滚动时不丢入口;
90rpx 见方、40rpx 图标,触控热区 45px 高于 24px 下限 */
.home-fab {
position: fixed;
left: 32rpx;
bottom: calc(32rpx + env(safe-area-inset-bottom));
z-index: 100;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
width: 90rpx;
height: 90rpx;
border: 3rpx solid var(--sep);
border-radius: 999rpx;
background: var(--white);
box-shadow: var(--shadow-card);
}
.home-fab:active {
opacity: 0.7;
}
/* 首页图标:复用 custom-tab-bar 的同一份手绘 SVG(灰 #6F655C 档),
与 tabBar「首页」tab 造型完全一致——同一个「首页」不在两处画成两种房子 */
.home-icon {
width: 40rpx;
height: 40rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTkgMzEgQzkgMjMuNSAxNi41IDE2LjUgMzIgOC41IEM0Ny41IDE2LjUgNTUgMjMuNSA1NSAzMSIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjxyZWN0IHg9IjE0IiB5PSIyOCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjI2IiByeD0iNyIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNMjcgNTQgVjQ2IGE1IDUgMCAwIDEgMTAgMCBWNTQiIHN0cm9rZT0iIzZGNjU1QyIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L3N2Zz4=");
} }
+25
View File
@@ -247,6 +247,31 @@ Page({
} }
}, },
// 回首页:首页是 tabBar 页,必须走 switchTab,navigateTo 跳不过去。
// switchTab 不保证被 enableAlertBeforeUnload 拦截,未保存时先自行确认再放行,
// 并主动关掉返回询问,避免同一次离开弹两遍。
onGoHome() {
const goHome = () => {
if (this.unsavedGuardActive) setUnsavedGuard(false)
wx.switchTab({ url: '/pages/home/index' })
}
if (!this.unsavedGuardActive) {
goHome()
return
}
wx.showModal({
title: '放弃未保存的修改?',
content: '返回首页后,当前填写的就诊人信息不会保存。',
confirmText: '返回首页',
cancelText: '继续编辑',
success: (res) => {
if (res.confirm) goHome()
}
})
},
// 转发卡片统一落到首页,避免好友打开需要登录的空表单。 // 转发卡片统一落到首页,避免好友打开需要登录的空表单。
onShareAppMessage() { onShareAppMessage() {
return { return {
+10 -1
View File
@@ -87,8 +87,17 @@
<text class="tips-text">信息仅用于陪诊服务,我们会严格保密</text> <text class="tips-text">信息仅用于陪诊服务,我们会严格保密</text>
</view> </view>
<!-- 保存是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 --> <!-- 保存是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度;
首页入口固定在底栏最左,不与保存按钮等宽分配 -->
<view class="footer-bar" wx:if="{{!loading && !loadError}}"> <view class="footer-bar" wx:if="{{!loading && !loadError}}">
<view
class="home-btn"
aria-role="button"
aria-label="返回首页"
bindtap="onGoHome"
>
<view class="home-icon"></view>
</view>
<button class="primary-btn {{saving ? 'primary-btn-disabled' : ''}}" bindtap="onSave">保存</button> <button class="primary-btn {{saving ? 'primary-btn-disabled' : ''}}" bindtap="onSave">保存</button>
</view> </view>
+35
View File
@@ -202,13 +202,48 @@ page {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
display: flex;
align-items: center;
gap: 16rpx;
padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom)); padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom));
background: var(--white); background: var(--white);
box-shadow: 0 -2rpx 8rpx rgba(63, 43, 25, 0.07); box-shadow: 0 -2rpx 8rpx rgba(63, 43, 25, 0.07);
} }
/* 首页图标按钮:底栏最左的固定位圆形按钮,与保存按钮同一套描边语言,
但固定宽高、不参与 flex:1 的等宽分配——它是入口,不是表单动作。
90rpx 见方 = 保存按钮同高(24rpx 上下内距 + 42rpx 文字行高),圆边上下沿齐平;
内含 40rpx 图标,触控热区 45px 高于 24px 下限 */
.home-btn {
box-sizing: border-box;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 90rpx;
height: 90rpx;
border: 3rpx solid var(--sep);
border-radius: 999rpx;
background: transparent;
}
.home-btn:active {
opacity: 0.7;
}
/* 首页图标:复用 custom-tab-bar 的同一份手绘 SVG(灰 #6F655C 档),
与 tabBar「首页」tab 造型完全一致——同一个「首页」不在两处画成两种房子 */
.home-icon {
width: 40rpx;
height: 40rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTkgMzEgQzkgMjMuNSAxNi41IDE2LjUgMzIgOC41IEM0Ny41IDE2LjUgNTUgMjMuNSA1NSAzMSIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjxyZWN0IHg9IjE0IiB5PSIyOCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjI2IiByeD0iNyIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNMjcgNTQgVjQ2IGE1IDUgMCAwIDEgMTAgMCBWNTQiIHN0cm9rZT0iIzZGNjU1QyIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L3N2Zz4=");
}
/* 保存是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 */ /* 保存是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 */
.primary-btn { .primary-btn {
flex: 1;
margin: 0; margin: 0;
padding: 24rpx 0; padding: 24rpx 0;
border: none; border: none;
+7
View File
@@ -79,6 +79,13 @@ Page({
} }
}, },
// 回首页:首页是 tabBar 页,必须走 switchTab,navigateTo 跳不过去
onGoHome() {
wx.switchTab({
url: '/pages/home/index'
})
},
onAdd() { onAdd() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/health/profileedit' url: '/pages/health/profileedit'
+9 -1
View File
@@ -64,8 +64,16 @@
<t-loading theme="circular" size="40rpx" text="加载中..." /> <t-loading theme="circular" size="40rpx" text="加载中..." />
</view> </view>
<!-- 底部固定操作栏 --> <!-- 底部固定操作栏:首页入口固定在左侧,不与新增按钮等宽分配 -->
<view class="footer-bar"> <view class="footer-bar">
<view
class="home-btn"
aria-role="button"
aria-label="返回首页"
bindtap="onGoHome"
>
<view class="home-icon"></view>
</view>
<button class="primary-btn" bindtap="onAdd">新增就诊人</button> <button class="primary-btn" bindtap="onAdd">新增就诊人</button>
</view> </view>
+35
View File
@@ -242,13 +242,48 @@ page {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
display: flex;
align-items: center;
gap: 16rpx;
padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom)); padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom));
background: var(--white); background: var(--white);
box-shadow: 0 -2rpx 8rpx rgba(63, 43, 25, 0.07); box-shadow: 0 -2rpx 8rpx rgba(63, 43, 25, 0.07);
} }
/* 首页图标按钮:底栏最左的固定位圆形按钮,与新增按钮同一套描边语言,
但固定宽高、不参与 flex:1 的等宽分配——它是入口,不是页面动作。
90rpx 见方 = 新增按钮同高(24rpx 上下内距 + 42rpx 文字行高),圆边上下沿齐平;
内含 40rpx 图标,触控热区 45px 高于 24px 下限 */
.home-btn {
box-sizing: border-box;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 90rpx;
height: 90rpx;
border: 3rpx solid var(--sep);
border-radius: 999rpx;
background: transparent;
}
.home-btn:active {
opacity: 0.7;
}
/* 首页图标:复用 custom-tab-bar 的同一份手绘 SVG(灰 #6F655C 档),
与 tabBar「首页」tab 造型完全一致——同一个「首页」不在两处画成两种房子 */
.home-icon {
width: 40rpx;
height: 40rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PHBhdGggZD0iTTkgMzEgQzkgMjMuNSAxNi41IDE2LjUgMzIgOC41IEM0Ny41IDE2LjUgNTUgMjMuNSA1NSAzMSIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPjxyZWN0IHg9IjE0IiB5PSIyOCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjI2IiByeD0iNyIgc3Ryb2tlPSIjNkY2NTVDIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNMjcgNTQgVjQ2IGE1IDUgMCAwIDEgMTAgMCBWNTQiIHN0cm9rZT0iIzZGNjU1QyIgc3Ryb2tlLXdpZHRoPSI0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48L3N2Zz4=");
}
/* 新增是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 */ /* 新增是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 */
.primary-btn { .primary-btn {
flex: 1;
margin: 0; margin: 0;
padding: 24rpx 0; padding: 24rpx 0;
border: none; border: none;
+35 -43
View File
@@ -2,8 +2,8 @@ const API = require('../../utils/api.js')
const { parseDate } = require('../../utils/date.js') const { parseDate } = require('../../utils/date.js')
// 首页未完成预约预览:服务端按预约日期倒序,这里取一页后在本地正序, // 首页未完成预约预览:服务端按预约日期倒序,这里取一页后在本地正序,
// 让最近的一场排在最前。20 条覆盖常见未完成量;更多时卡头仍显示总数, // 让最近的一场排在最前。20 条覆盖常见未完成量;首页只展示最近三条,
// 由「查看全部」承接完整列表 // 更多由「常用功能 · 预约记录」承接
const PENDING_PREVIEW_LIMIT = 3 const PENDING_PREVIEW_LIMIT = 3
const PENDING_FETCH_SIZE = 20 const PENDING_FETCH_SIZE = 20
@@ -33,8 +33,7 @@ const SERVICE_ORDER = [1, 2, 7, 3, 4, 5, 8, 6]
Page({ Page({
data: { data: {
escortServices: [], // 陪诊服务(来自后端,按 SERVICE_ORDER 展示) escortServices: [], // 陪诊服务(来自后端,按 SERVICE_ORDER 展示)
pendingCount: 0, // 未完成预约数,用于预览卡头徽标 pendingRecords: [], // 按预约时间正序的最近几条未完成预约,每条渲染成一张卡,最多 3 条
pendingRecords: [], // 按预约时间正序的最近几条未完成预约,最多 3 条
quickEntries: [{ quickEntries: [{
id: 'records', id: 'records',
name: '预约记录', name: '预约记录',
@@ -65,6 +64,12 @@ Page({
}, },
onLoad() { onLoad() {
// 先用上次成功拉取的列表渲染宫格,避免首屏出现一块空白;
// 紧接着请求最新数据,回来后覆盖
const cached = getApp().getCachedServices()
if (cached) {
this.setData({ escortServices: this.buildEscortServices(cached) })
}
this.loadServices() this.loadServices()
}, },
@@ -84,42 +89,42 @@ Page({
app.loadServices() app.loadServices()
.then((services) => { .then((services) => {
if (!services) { if (!services) {
this.setData({ escortServices: [] }) // 失败时保留缓存渲染结果,避免宫格从有到无闪一下
console.error('首页服务列表加载失败') console.error('首页服务列表加载失败')
return 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({ this.setData({
escortServices escortServices: this.buildEscortServices(services)
}) })
}) })
.catch((err) => { .catch((err) => {
this.setData({ escortServices: [] })
console.error('首页服务列表加载失败', err) 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() { refreshPendingPreview() {
if (this.pendingRequest) return this.pendingRequest if (this.pendingRequest) return this.pendingRequest
@@ -128,7 +133,7 @@ Page({
.then(() => { .then(() => {
const user = app.globalData.user const user = app.globalData.user
if (!user || !user._id) { if (!user || !user._id) {
this.setData({ pendingCount: 0, pendingRecords: [] }) this.setData({ pendingRecords: [] })
return null return null
} }
@@ -144,14 +149,7 @@ Page({
if (!res || res.code !== 0) return if (!res || res.code !== 0) return
const data = res.data || {} 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({ this.setData({
pendingCount,
pendingRecords: this.buildPendingPreview(data.records || []) pendingRecords: this.buildPendingPreview(data.records || [])
}) })
}) })
@@ -241,12 +239,6 @@ Page({
}) })
}, },
goToRecords() {
wx.navigateTo({
url: '/pages/escort/recordlist'
})
},
// 未完成预约预览:点单条直达详情 // 未完成预约预览:点单条直达详情
goToRecordDetail(e) { goToRecordDetail(e) {
const id = e.currentTarget.dataset.id const id = e.currentTarget.dataset.id
+18 -35
View File
@@ -50,43 +50,26 @@
<t-icon name="chevron-right" size="28rpx" color="#FFFFFF" /> <t-icon name="chevron-right" size="28rpx" color="#FFFFFF" />
</view> </view>
<!-- 未完成预约预览:每条一行,给出日期 / 就诊人 / 医院 / 服务项目,最多 3 条。 <!-- 未完成预约预览:不设卡头(无「未完成预约」标题、无数量、无「查看全部」),
原先只给「您有 N 个未完成预约」一个数字,用户无法判断是哪一场、给谁、去哪儿, 每条预约单独一张卡,卡内给出日期 / 就诊人 / 医院 / 服务项目,最多 3 条。
仍要再点进预约记录;直接给出最近三条可少一次跳转。
不把全部未完成预约铺在首屏:首屏优先保住主 CTA 与服务入口, 不把全部未完成预约铺在首屏:首屏优先保住主 CTA 与服务入口,
第 4 条起交给卡头「查看全部」,避免订单多的用户把首页压成清单页。 第 4 条起由「常用功能 · 预约记录」承接,避免订单多的用户把首页压成清单页。
数据按预约时间正序取最近三条;无未完成预约时整卡不渲染,新用户首屏不受影响 --> 数据按预约时间正序取最近三条;无未完成预约时整块不渲染,新用户首屏不受影响 -->
<view class="pending-card" wx:if="{{ pendingRecords.length > 0 }}"> <view class="pending-card" wx:for="{{ pendingRecords }}" wx:key="id" data-id="{{ item.id }}" bindtap="goToRecordDetail">
<view class="pending-head"> <!-- 一条预约压成一行:日期 · 就诊人 · 医院 · 服务项目。
<text class="pending-title">未完成预约</text> 行内不换行,医院名过长时只省略医院,日期、就诊人和项目始终可见 -->
<text class="pending-count">{{ pendingCount }}</text> <view class="pending-line">
<view class="pending-link" bindtap="goToRecords"> <text class="pending-when">{{ item.whenText }}</text>
<text class="pending-link-text">查看全部</text> <text class="pending-dot">·</text>
<view class="pending-link-arrow"> <text class="pending-patient">{{ item.patientName }}</text>
<t-icon name="chevron-right" size="24rpx" color="#6F655C" /> <text class="pending-dot">·</text>
</view> <text class="pending-hospital">{{ item.hospitalName }}</text>
</view> <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 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> </view>
+17 -85
View File
@@ -7,12 +7,11 @@
page { page {
/* 配色令牌已上移到 app.wxss(全站唯一来源,改配色只改那一处),本页不再留副本。 /* 配色令牌已上移到 app.wxss(全站唯一来源,改配色只改那一处),本页不再留副本。
这里只剩本页专属的一样:「未完成预约」预览卡的状态色——全页唯一的冷色面。 这里只剩本页专属的一样:「未完成预约」逐条卡的状态色——全页唯一的冷色面。
语义由 DESIGN.md §3 管(只给「等你去处理」),且已登记为整卡底色的例外; 语义由 DESIGN.md §3 管(只给「等你去处理」),且已登记为整卡底色的例外;
其余卡片仍走中性填充 */ 其余卡片仍走中性填充 */
--status-soft: #ECF7F4; --status-soft: #ECF7F4;
--status-line: #C7E5DF; --status-line: #C7E5DF;
--status-ink: #0F766E; /* #ECF7F4 上 5.0:1、白底 5.47:1,过 AA 正文 */
} }
.page-bg { .page-bg {
@@ -167,103 +166,36 @@ page {
margin-right: 6rpx; margin-right: 6rpx;
} }
/* 未完成预约预览:整卡铺淡绿状态底(status-soft)+ 2rpx status-line 描边, /* 未完成预约预览:去掉卡头后,每条预约独立成一卡。
整卡铺淡绿状态底(status-soft)+ 2rpx status-line 描边,
与下方白卡服务宫格明显区分——返回用户一眼先看到「还有事没办完」。 与下方白卡服务宫格明显区分——返回用户一眼先看到「还有事没办完」。
浅色块落纸面靠描边托形、不加阴影(与浅橙介绍卡同一做法), 浅色块落纸面靠描边托形、不加阴影(与浅橙介绍卡同一做法),
否则会在暖白纸面上糊成一块。 卡间距 20rpx(与 .quick-list 同档),三条叠成短清单而不连成一整块。
数量仍留在卡头徽标里,正文最多 3 条, 最多 3 条,第 4 条起由「常用功能 · 预约记录」承接;
避免订单多的用户把首屏压成清单页;第 4 条起交给「查看全部」。
只对未完成预约的用户渲染,新用户首屏不变 */ 只对未完成预约的用户渲染,新用户首屏不变 */
.pending-card { .pending-card {
margin-top: 24rpx; display: flex;
padding: 20rpx 24rpx 8rpx; align-items: center;
margin-top: 20rpx;
padding: 26rpx 24rpx;
border-radius: 24rpx; border-radius: 24rpx;
background: var(--status-soft); background: var(--status-soft);
border: 2rpx solid var(--status-line); 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,避免任何一项被挤到第二行 */ /* 一条预约只占一行:行级 nowrap,避免任何一项被挤到第二行 */
white-space: nowrap; white-space: nowrap;
} }
.pending-item:active { .pending-card:active {
opacity: 0.7; opacity: 0.7;
} }
.pending-arrow {
display: flex;
align-items: center;
flex-shrink: 0;
margin-left: 12rpx;
}
/* 单行排完四项:日期 · 就诊人 · 医院 · 服务项目。 /* 单行排完四项:日期 · 就诊人 · 医院 · 服务项目。
医院名可收缩省略,日期、就诊人、项目保持完整 */ 医院名可收缩省略,日期、就诊人、项目保持完整 */
.pending-line { .pending-line {
+387 -2
View File
@@ -26,10 +26,395 @@
"compileType": "miniprogram", "compileType": "miniprogram",
"simulatorPluginLibVersion": {}, "simulatorPluginLibVersion": {},
"packOptions": { "packOptions": {
"ignore": [], "ignore": [
{
"type": "folder",
"value": "doc"
},
{
"type": "folder",
"value": "tools"
},
{
"type": "folder",
"value": "assets/fonts"
},
{
"type": "file",
"value": "README.md"
},
{
"type": "file",
"value": "miniprogram_npm/tdesign-miniprogram/.wechatide.ib.json"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/action-sheet"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/attachments"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/avatar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/avatar-group"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/back-top"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/badge"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/button"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/calendar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/cascader"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/cell"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/cell-group"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-actionbar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-content"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-list"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-loading"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-message"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-sender"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/chat-thinking"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/check-tag"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/checkbox"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/checkbox-group"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/col"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/collapse"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/collapse-panel"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/color-picker"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/config-provider"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/count-down"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/date-time-picker"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/dialog"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/divider"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/drawer"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/dropdown-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/dropdown-menu"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/empty"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/fab"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/footer"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/form"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/form-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/grid"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/grid-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/guide"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/image"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/image-viewer"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/indexes"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/indexes-anchor"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/input"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/link"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/locale"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/message"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/message-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/mixins"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/navbar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/notice-bar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/overlay"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/picker"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/picker-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/popover"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/popup"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/progress"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/pull-down-refresh"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/qrcode"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/radio"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/radio-group"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/rate"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/result"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/row"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/scroll-view"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/search"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/side-bar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/side-bar-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/skeleton"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/slider"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/step-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/stepper"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/steps"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/sticky"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/swipe-cell"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/swiper"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/swiper-nav"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/switch"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/tab-bar"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/tab-bar-item"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/tab-panel"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/tabs"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/tag"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/textarea"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/toast"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/transition"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/tree-select"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/upload"
},
{
"type": "folder",
"value": "miniprogram_npm/tdesign-miniprogram/watermark"
}
],
"include": [] "include": []
}, },
"appid": "wxf73c79e16837af07", "appid": "wxf73c79e16837af07",
"editorSetting": {}, "editorSetting": {},
"libVersion": "3.15.2" "libVersion": "3.15.2"
} }
+130
View File
@@ -0,0 +1,130 @@
"""按项目实际用到的 t-icon 名称,子集化图标字体并重写 icon.wxss。
为什么需要这个脚本:
- tdesign 自带的 icon.wxss 是 485KB:2347 个 `.t-icon-{name}` 规则 + 内嵌的
278KB base64 字体。凡是 usingComponents 里引了 t-icon 的页面,都要解析这份
样式并解码字体;真机实测 custom-tab-bar 组件构造因此耗时 59ms。
- 本项目实际只会用到 40 来个字形,脚本把字体裁到这些字形、把规则裁到这些
class,产物约 10KB(-95%),视觉与原字体逐字形一致。
用法(仓库任意目录执行):
pip install fonttools
python tools/build-icon-wxss.py
注意:
1. 微信「构建 npm」会用 node_modules 覆盖 miniprogram_npm/tdesign-miniprogram,
覆盖后 icon.wxss 退回「远程字体 + 全量 class」,需重新执行本脚本。
2. 新增图标时先确认 miniprogram_npm/.../icon/icon.wxss 里的 `.t-icon-{name}`
存在(构建 npm 后是全集),再执行脚本;脚本已扫描全仓库的字符串字面量,
新名字只要出现在模板 `name="xxx"` 或数据里 `icon: 'xxx'` 就会被带上。
"""
import base64
import io
import os
import re
import sys
try:
from fontTools import subset
except ImportError: # pragma: no cover - 只是提示,正常路径不会进来
sys.exit('缺少依赖:请先执行 pip install fonttools')
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ICON_WXSS = os.path.join(ROOT, 'miniprogram_npm', 'tdesign-miniprogram', 'icon', 'icon.wxss')
FONT_FILE = os.path.join(ROOT, 'assets', 'fonts', 't.woff')
# 只扫业务代码:doc/ 里的说明文本、tools/ 自身和 npm 产物不该参与取词
SCAN_EXT = ('.js', '.json', '.wxml', '.wxss')
SKIP_DIRS = {'miniprogram_npm', 'node_modules', 'doc', 'tools', '.git'}
ICON_RULE = re.compile(r"\.t-icon-([a-zA-Z0-9_-]+):before\{content:'\\([0-9a-fA-F]{2,6})';\}")
FONT_FACE = re.compile(r'@font-face\{([^}]*)\}')
def collect_icon_names():
"""从业务代码里收集可能传给 t-icon 的字面量,再与字体 class 表求交集。"""
candidates = set()
for dirpath, dirnames, filenames in os.walk(ROOT):
dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS]
for filename in filenames:
if not filename.endswith(SCAN_EXT):
continue
path = os.path.join(dirpath, filename)
with io.open(path, 'r', encoding='utf-8', errors='ignore') as handle:
text = handle.read()
candidates.update(re.findall(r"'([^'\n]{2,40})'", text))
candidates.update(re.findall(r'name="([^"{]{2,40})"', text))
candidates.update(re.findall(r'icon: "([^"\n]{2,40})"', text))
return candidates
def load_css():
with io.open(ICON_WXSS, 'r', encoding='utf-8') as handle:
return handle.read()
def subset_font(codepoints):
"""把 t.woff 裁到指定码位,返回 woff 字节。"""
options = subset.Options()
options.flavor = 'woff'
options.hinting = False
options.desubroutinize = True
options.layout_features = [] # 图标字体不需要 OpenType 排印特性
font = subset.load_font(FONT_FILE, options)
subsetter = subset.Subsetter(options=options)
subsetter.populate(unicodes=codepoints)
subsetter.subset(font)
buffer = io.BytesIO()
subset.save_font(font, buffer, options)
return buffer.getvalue()
def main():
css = load_css()
mapping = {name: int(code, 16) for name, code in ICON_RULE.findall(css)}
if not mapping:
sys.exit('icon.wxss 里没找到 .t-icon-{name}:before 规则,先执行「构建 npm」再跑本脚本')
used = sorted(name for name in collect_icon_names() if name in mapping)
if not used:
sys.exit('没有从业务代码里扫到任何 t-icon 名称,脚本未做修改')
original_css_size = len(css)
font_bytes = subset_font([mapping[name] for name in used])
font_base64 = base64.b64encode(font_bytes).decode('ascii')
# 1) 替换 @font-face 的 src:全量 base64 → 子集 base64
face_match = FONT_FACE.search(css)
if not face_match:
sys.exit('icon.wxss 里没有 @font-face,无法注入字体')
family_match = re.search(r'font-family:([^;]+);', face_match.group(1))
family = family_match.group(1) if family_match else 't'
new_face = (
'@font-face{font-family:%s;src:url(data:font/woff;base64,%s) format("woff");}'
% (family, font_base64)
)
css = css[:face_match.start()] + new_face + css[face_match.end():]
removed = []
def keep_or_drop(match):
if match.group(1) in used:
return match.group(0)
removed.append(match.group(1))
return ''
css = ICON_RULE.sub(keep_or_drop, css)
with io.open(ICON_WXSS, 'w', encoding='utf-8') as handle:
handle.write(css)
print('保留图标 %d 个:%s' % (len(used), ', '.join(used)))
print('删除图标规则 %d 条' % len(removed))
print('字体 %d -> %d 字节,icon.wxss %d -> %d 字节'
% (os.path.getsize(FONT_FILE), len(font_bytes), original_css_size, len(css)))
if __name__ == '__main__':
main()
+1 -1
View File
@@ -1,6 +1,6 @@
// 订单与支付状态的唯一前端映射,列表和详情只按展示需要读取不同扩展字段。 // 订单与支付状态的唯一前端映射,列表和详情只按展示需要读取不同扩展字段。
const STATUS_MAP = { const STATUS_MAP = {
pending: { text: '待确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已提交,等待陪诊师确认;确认前可取消' }, pending: { text: '待确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已提交,等待陪诊师确认' },
confirmed: { 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: '陪诊服务正在进行中' }, in_progress: { text: '进行中', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', desc: '陪诊服务正在进行中' },
completed: { text: '已完成', color: '#1F7A4D', bg: '#EAF6EE', border: '#CDE9D7', desc: '陪诊服务已完成,感谢您的使用' }, completed: { text: '已完成', color: '#1F7A4D', bg: '#EAF6EE', border: '#CDE9D7', desc: '陪诊服务已完成,感谢您的使用' },