01 / Overview
cu-shop-message-center
消息中心:交易 / 物流 / 售后 / 活动四组固定顺序,每组显示图标、标题、最新一条、时间、未读徽标;支持全部已读(二次确认),无内容的分组仍占位。
客服与消息
7 条 props
3 事件
已实现
02 / Demo
实时预览
演示页:/pages/shop-order/message-center。右侧的预览由站点脚本把 H5 演示页装进 iframe;数据与交互在演示页内操作,不在此处留静态截图。
依赖
- 基础件:
cu-modal、cu-loading-icon - Shop 共享件:
locale/index.uts(cuShopT) - 框架工具:
colorui-x/utils/date.uts(formatDate)
03 / Props · Events · Slots
全量契约
props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| groups | 分组列表 ShopMessageGroup[],读 type / title / iconUrl / unread / latestText / latestAt / items | Array | [] |
| unreadTotal | 未读总数;为 0 时隐藏「全部已读」 | number | 0 |
| loading | 加载中 | boolean | false |
| customStyle | 根节点自定义样式 | Object | {} |
| customClass | 根节点自定义类名 | string | '' |
| url | 透传字段,本件未接线 | string | '' |
| linkType | 透传字段,本件未接线 | string | 'navigateTo' |
events
| 事件 | 说明 | 载荷 |
|---|---|---|
| @click-group | 点分组图标或标题;占位组不发 | { group } |
| @click-message | 点最新一条,取该组 items[0] | { message } |
| @read-all | 「全部已读」二次确认后 | 无 |
slots
| 插槽 | 作用域 | 说明 |
|---|---|---|
| header | 无 | 整体替换顶部标题与全部已读按钮 |
| empty | 无 | 替换单个分组的占位文案 |
04 / Example
代码示例
<cu-shop-message-center :groups="groups" :unreadTotal="2"
@click-group="onGroup" @click-message="onMessage" @read-all="onReadAll" />
05 / Notes
注意事项
四组固定顺序:交易 / 物流 / 售后 / 活动;groups 里缺哪组,哪组就占位显示「暂无消息」。
分组字段按数据字典 ShopMessageGroup 读(title / latestText / items);方案 §6.6 的 name / latest 写法与字典不一致,以字典为准(台账 209)。
未读 >99 显示 99+;unreadTotal 为 0 时「全部已读」不渲染。
「全部已读」走 cu-modal 二次确认;确认后只 emit,由宿主改数据。
不请求接口、不持久化、不弹 toast。
安装 colorui-shop 全量包与安装任意 cu-shop-* 单件包二选一,不要同时装。单件包的前提是已安装完整 colorui-x。