电商组件 / 客服与消息 / cu-shop-message-center 消息中心
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 / itemsArray[]
unreadTotal未读总数;为 0 时隐藏「全部已读」number0
loading加载中booleanfalse
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

代码示例

uvue
<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。