01 / Overview
cu-shop-settle-bar
购物车 / 结算页底部栏:全选、合计金额、提示语与结算按钮;6 个具名插槽分别替换全选、提示、合计、附加金额、按钮与页脚,结算数量与置灰由 props 控制。
交易
16 条 props
2 事件
已实现
02 / Demo
实时预览
演示页:/pages/shop/settle-bar。右侧的预览由站点脚本把 H5 演示页装进 iframe;数据与交互在演示页内操作,不在此处留静态截图。
依赖
- 基础件:
cu-checkbox(prefix插槽的兜底全选) - Shop 共享件:
locale/index.uts(cuShopT/cuShopTf)、utils/price.uts(formatFen)、store/shop-config.uts(shopCurrencySymbol) - 实体:无
03 / Props · Events · Slots
全量契约
props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| totalFen | 合计金额,单位分;只展示不重算 | number | 0 |
| totalText | 合计标签;默认值按 locale 取词 | string | '合计' |
| totalAlign | 合计区对齐:right / left | string | 'right' |
| settleButtonText | 结算按钮文案;默认值按 locale 取词 | string | '去结算' |
| disabled | 置灰并拦截结算点击 | boolean | false |
| loading | 结算中;按钮文案换成「结算中…」并拦截点击 | boolean | false |
| safeAreaInsetBottom | 底部补 env(safe-area-inset-bottom) | boolean | true |
| placeholder | 在文档流补一段 120rpx 的等高占位块 | boolean | false |
| settleCount | 结算件数,拼在按钮文案后 | number | 0 |
| showZero | settleCount=0 时是否显示「(0)」 | boolean | true |
| noCount | 不显示件数后缀 | boolean | false |
| isCheckedAll | 全选态,受控;改动发 selectAll | boolean | false |
| customStyle | 根节点自定义样式(作用于贴底栏) | Object | {} |
| customClass | 根节点自定义类名 | string | '' |
| url | 透传字段,本件未接线 | string | '' |
| linkType | 透传字段,本件未接线 | string | 'navigateTo' |
events
| 事件 | 说明 | 载荷 |
|---|---|---|
| @clickButton | 点结算按钮;disabled / loading 时不发 | 无 |
| @selectAll | 兜底全选勾选切换 | boolean |
slots
| 插槽 | 作用域 | 说明 |
|---|---|---|
| tip | 无 | 主行上方的提示条;默认空 |
| prefix | 无 | 主行左侧;兜底为 cu-checkbox 全选 |
| total | 无 | 合计区;兜底为「合计」+ 金额 |
| extra | 无 | 合计区下方附加行(优惠、积分等) |
| button | 无 | 结算按钮;兜底为内置胶囊按钮 |
| footer | 无 | 主行下方页脚;默认空 |
04 / Example
代码示例
<cu-shop-settle-bar :totalFen="25600" :settleCount="2" :isCheckedAll="false"
:disabled="false" :loading="false" :safeAreaInsetBottom="true" :placeholder="true"
@clickButton="onSettle" @selectAll="onSelectAll">
<template #tip><text class="bar-tip">满 199 元减 30 元</text></template>
</cu-shop-settle-bar>
05 / Notes
注意事项
参考实现的 6 个 customXxx 插槽改具名插槽:customSelectAll → prefix、customWarning → tip、customTotal → total、customTotalPrice → extra、customTotalExtra → footer、customButton → button
金额只展示不重算;totalFen 由宿主从已选行汇总后传入
件数后缀走 cuShopTf('shop.settleBar.count');noCount=true 或 showZero=false && settleCount<=0 时不拼后缀
disabled / loading 只拦兜底按钮;替换成 button 插槽时,拦截逻辑由宿主负责
栏体 position: fixed;placeholder=true 补 120rpx 等高占位,安全区同时作用于栏体与占位块
同一页面只挂一个吸底件;不请求接口、不持久化、不弹 toast
安装 colorui-shop 全量包与安装任意 cu-shop-* 单件包二选一,不要同时装。单件包的前提是已安装完整 colorui-x。