电商组件 / 账户与会员 / cu-shop-wallet-card 钱包余额卡
01 / Overview

cu-shop-wallet-card

钱包余额卡:卡头(余额标签 + `extra` 插槽位)、大号余额、冻结说明行、充值与余额明细两个操作按钮、`footer` 插槽位;余额为 0 时充值按钮升为实心主按钮,加载中只替换金额与操作区。

账户与会员 9 条 props 2 事件 已实现
02 / Demo

实时预览

演示页:/pages/shop-order/wallet-card。右侧的预览由站点脚本把 H5 演示页装进 iframe;数据与交互在演示页内操作,不在此处留静态截图。

依赖

  • 基础件:cu-button、cu-loading-icon
  • Shop 共享件:locale/index.uts(cuShopT / cuShopTf)、utils/price.uts(formatFen)、store/shop-config.uts(shopCurrencySymbol)
03 / Props · Events · Slots

全量契约

props

参数说明类型默认值
balanceFen可用余额(分),走 formatFen 显示两位小数;为 0 时充值按钮变实心主按钮number0
frozenFen冻结金额(分),大于 0 才出冻结说明行number0
showRecharge是否显示充值按钮booleantrue
showDetail是否显示余额明细按钮booleantrue
loading加载中只替换金额、冻结与操作三行,卡头与 footer 插槽仍渲染booleanfalse
customStyle根节点自定义样式Object{}
customClass根节点自定义类名string''
url透传字段,本件未接线string''
linkType透传字段,本件未接线string'navigateTo'

events

事件说明载荷
@recharge点「充值」,组件不接支付无
@click-detail点「余额明细」,组件不跳页无

slots

插槽作用域说明
extra无卡头右侧(与「余额」标签同行)
footer无卡片底部(操作行之后)
04 / Example

代码示例

uvue
<cu-shop-wallet-card :balanceFen="balanceFen" :frozenFen="frozenFen" :showRecharge="true"
	:showDetail="true" :loading="loading" @recharge="onRecharge" @click-detail="onClickDetail">
	<template #extra><text>提现规则</text></template>
	<template #footer><text>对账单有疑问请联系客服</text></template>
</cu-shop-wallet-card>
05 / Notes

注意事项

金额一律走 utils/price.uts 的 formatFen(fen, true, shopCurrencySymbol.value):千分位与两位小数由 formatFen 承担,组件不自行拼符号、不自行除 100。

冻结行文案用 {amount} 占位(shop.walletCard.frozenText),金额部分同样是 formatFen 的结果;frozenFen 为 0 时整行不渲染,不占位。

充值按钮的主/次级由 balanceFen 决定:为 0 走 type="primary" 实心,大于 0 走 type="warning" + plain;文案不换,仍是同一个按钮。

ShopWallet 的 updatedAt / canWithdraw / withdrawTip 不在本件 5 条 props 内 ⇒ 不渲染、不读,提现相关一律由宿主自行处理。

卡面底图与主题渐变不进本件:background-image 属禁用串,样式只用 $shop-* token。

不请求接口、不持久化、不弹 toast;充值与明细只 emit。

安装 colorui-shop 全量包与安装任意 cu-shop-* 单件包二选一,不要同时装。单件包的前提是已安装完整 colorui-x。