电商组件 / 账户与会员 / cu-shop-member-card 会员卡
01 / Overview

cu-shop-member-card

会员卡面板:等级色小条 + 等级名称、成长值进度条与「成长值 n / m」文案、升级提示行、到期时间与 ≤30 天续费提示、会员权益胶囊(最多 6 条);背景图由插槽给,升级与续费只发事件。

账户与会员 8 条 props 3 事件 已实现
02 / Demo

实时预览

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

依赖

  • 基础件:cu-button、cu-loading-icon
  • Shop 共享件:locale/index.uts(cuShopT / cuShopTf)、utils/account.uts(nextLevel / progressToNext / isExpiringSoon)、colorui-x/utils/number.uts(formatMoney)
03 / Props · Events · Slots

全量契约

props

参数说明类型默认值
member会员实体 ShopMember,读 level / name / growth / nextGrowth / benefits / upgradeTip / renewText / expireAtObject必填
showBenefits显示权益段booleantrue
showUpgrade显示升级提示行booleantrue
loading加载中替换整个主体,background 插槽仍渲染booleanfalse
customStyle根节点自定义样式Object{}
customClass根节点自定义类名string''
url透传字段,本件未接线string''
linkType透传字段,本件未接线string'navigateTo'

events

事件说明载荷
@click-benefit点权益胶囊;benefit 为该条文案字符串,index 为渲染序号(0 起){ benefit, index }
@click-upgrade点升级提示行尾「去升级」无
@click-renew点续费提示行尾按钮无

slots

插槽作用域说明
background无背景层,绝对定位铺满根节点,由宿主放图片或色块
extra无顶行右侧
04 / Example

代码示例

uvue
<cu-shop-member-card :member="member" :showBenefits="true" :showUpgrade="true" :loading="false"
	@click-benefit="onBenefit" @click-upgrade="onUpgrade" @click-renew="onRenew">
	<template #background><image src="/static/member-bg.png" mode="aspectFill"></image></template>
	<template #extra><text>已连续签到 7 天</text></template>
</cu-shop-member-card>
05 / Notes

注意事项

权益元素按 B11 裁定是 plain string;非字符串元素一律跳过不渲染,benefits 缺失按空数组处理。

等级名取字典 ShopMember.name,不另造徽标文案;name 为空显示「会员」。

满级判定只走 utils/account.uts 的 nextLevel(level) == level:满级不显示成长值进度条与升级行。

进度 = progressToNext(growth, 0, nextGrowth),进度条宽度用动态百分比 style(本仓先例 cu-shop-ecard.uvue)。

等级色五档各一个修饰类,色值一律取 $shop-* 变量;level 落在 normal / silver / gold / platinum / diamond 之外走 --unknown 中性色,不猜档名。

升级提示行只在 showUpgrade=true、未满级且 upgradeTip 非空时渲染。

到期行只在 expireAt 前 10 位非空时渲染;续费提示只在 expireAt 可解析且 isExpiringSoon(expireAt, Date.now(), 30) 为真时渲染。

续费提示文案用 {d} 占位(shop.memberCard.expireTip),不在组件内拼语序;renewText 为空只显示提示文字、不显示按钮。

权益最多渲染 6 条,第 7 条起折叠不显示,段尾追加「查看全部」文字;卡面未定义查看更多事件,该行不 emit。

expireAt 按 ISO 串的 YYYY-MM-DD 段拆年月日换算毫秒(本仓无 new Date(字符串) 先例),不转时区、不做相对时间。

不请求接口、不持久化、不弹 toast;升级 / 续费只 emit。

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