电商组件 / 发票 / cu-shop-invoice-selector 开票信息选择
01 / Overview

cu-shop-invoice-selector

开票信息选择面板:发票类型(不开票 / 普票 / 专票)、抬头单选、收票人单选、开票内容与邮箱,自带 `none` / `normal` / `special` 三套校验;抬头与收票人只做选择,编辑位只发事件。

发票 9 条 props 4 事件 已实现
02 / Demo

实时预览

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

依赖

  • 基础件:cu-radio、cu-input、cu-button、cu-loading-icon
  • Shop 共享件:locale/index.uts(cuShopT)
03 / Props · Events · Slots

全量契约

props

参数说明类型默认值
value选择结果,按 ShopInvoiceSelection 读;type 认 none / normal / specialObject{ type: 'none', content: 'detail', titleId: '', receiveInvoiceId: '', email: '' }
titles抬头列表,元素读 id / title / titleType / type / isDefaultArray[]
receives收票人列表,元素读 id / name / phone / province / city / district / detail / isDefaultArray[]
contents开票内容选项;元素认枚举 detail / category,也认标签「商品明细」/「商品类别」Array['商品明细']
loading加载中替换主体,只保留 header / footer 插槽booleanfalse
customStyle根节点自定义样式Object{}
customClass根节点自定义类名string''
url透传字段,本件未接线string''
linkType透传字段,本件未接线string'navigateTo'

events

事件说明载荷
@update:value切类型 / 选抬头 / 选收票人 / 选开票内容 / 改邮箱{ type, content, titleId, receiveInvoiceId, email }
@click-title点抬头行尾「编辑」{ item, index }
@click-receive点收票人行尾「编辑」{ item, index }
@submit点提交;errors 为错误码数组,见注意事项{ data, valid, errors }

slots

插槽作用域说明
header无面板顶部
footer无面板底部
04 / Example

代码示例

uvue
<cu-shop-invoice-selector :value="selection" :titles="titles" :receives="receives"
	:contents="['商品明细', '商品类别']" :loading="loading"
	@update:value="onUpdateValue" @click-title="onClickTitle" @click-receive="onClickReceive"
	@submit="onSubmit">
	<template #header><text>开票信息仅在订单完成后开具</text></template>
	<template #footer><text>电子发票将发送至所填邮箱</text></template>
</cu-shop-invoice-selector>
05 / Notes

注意事项

type=none 时隐藏抬头 / 收票人 / 开票内容 / 邮箱四段;提交 valid=true、errors=[]。

special 须企业抬头(titleType=company):选中个人抬头记 titleCompany;企业抬头再逐项校验 taxNo / bankName / bankAccount / companyAddress / companyPhone,缺失分别记同名字段码。

未选抬头记 title;normal 邮箱 trim 后为空记 email,邮箱只校验非空、不校验格式。

contents 元素归一为枚举写进 content;认不出的字符串原样输出。

字段名以数据字典 ShopInvoiceSelection.receiveInvoiceId 为准(方案 §6.7 的 receiveId 不作准)。

抬头与收票人只做选择,行尾「编辑」只 emit click-title / click-receive,组件内不展开编辑表单。

错误只在提交后以汇总列表展示,字段旁无红点;切换类型与抬头会清空上一次错误。

不请求接口、不持久化、不弹 toast。

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