01 / Overview
cu-shop-amount-summary
结算与退款页的金额拆解清单:商品金额、运费、优惠、积分抵扣逐行展示,合计与优惠公式自动拼装。组件只做展示与带符号核对,不重算任何金额;行合计与 `totalFen` 不一致时在合计下方给出红字提示。
通用
10 条 props
2 事件
已实现
02 / Demo
实时预览
演示页:/pages/shop/amount-summary。右侧的预览由站点脚本把 H5 演示页装进 iframe;数据与交互在演示页内操作,不在此处留静态截图。
依赖
- 基础件:无
- Shop 共享件:
utils/price.uts(formatFen/sumFen)、store/shop-config.uts(shopCurrencySymbol)、locale/index.uts(cuShopT取核对提示) - 实体:不消费业务实体(行数据为
ShopAmountRow嵌套类型,字段见docs/01-交付与接入/电商数据字典.md)
03 / Props · Events · Slots
全量契约
props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| rows | 金额行数组(type / label / amountFen / isEmphasized / formula) | Array | [] |
| totalFen | 合计(整数分) | number | 0 |
| totalLabel | 合计行文案 | string | '合计' |
| showFormula | 是否显示计算公式 | boolean | true |
| emphasize | 合计是否强调显示 | boolean | true |
| loading | 骨架态:隐藏合计与核对提示 | boolean | false |
| customStyle | 根节点自定义样式 | Object | {} |
| customClass | 根节点自定义类名 | string | '' |
| url | 透传字段,本件未接线 | string | '' |
| linkType | 透传字段,本件未接线 | string | 'navigateTo' |
events
| 事件 | 说明 | 载荷 |
|---|---|---|
| @clickRow | 金额行点击 | { row, index } |
| @clickTotal | 合计行点击 | 无 |
slots
| 插槽 | 作用域 | 说明 |
|---|---|---|
| extra | 无 | 明细与合计之间的补充内容 |
| footer | 无 | 合计与核对提示下方内容 |
04 / Example
代码示例
<cu-shop-amount-summary
:rows="rows"
:totalFen="totalFen"
totalLabel="合计"
@clickRow="onClickRow"
@clickTotal="onClickTotal"
/>
05 / Notes
注意事项
不重算展示金额:行值按 amountFen 原样格式化,合计只展示 totalFen
优惠行传正数即可:type 为 discount / refund / points 时显示为 − 加金额
带符号合计与 totalFen 不等时显示 shop.amountSummary.mismatch 红字,核对只在组件内提示、不拦截
公式行由 rows 的 label 拼装,label 为空的行不参与
不请求接口、不持久化,金额全部由 props 驱动
安装 colorui-shop 全量包与安装任意 cu-shop-* 单件包二选一,不要同时装。单件包的前提是已安装完整 colorui-x。