For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/templates/price-action-card.md.

价格操作卡

PriceActionCard 用于承载单项或多项价格信息与后续操作,适合报价、权益和服务方案等结果展示。

PriceActionCard 价格操作卡效果

示例

import { PriceActionCard, type PriceActionCardItem } from '@doubao-dev/template';

const items: PriceActionCardItem[] = [
  {
    key: 'standard',
    price: '¥128',
    badgeText: '推荐',
    infoRows: [
      { key: 'car', text: '舒适型专车' },
      { key: 'wait', text: '免费等待 30 分钟' }
    ],
    actionText: '预订',
    onActionClick: () => console.log('book standard')
  },
  {
    key: 'business',
    price: '¥198',
    infoRows: [
      { key: 'car', text: '商务车型' },
      { key: 'cancel', text: '出发前可免费取消' }
    ],
    actionText: '预订',
    onActionClick: () => console.log('book business')
  }
];

export default function RidePriceCard() {
  return (
    <PriceActionCard
      items={items}
      footer={{
        primaryActionButton: {
          text: '查看全部报价',
          onClick: () => console.log('view all')
        }
      }}
    />
  );
}

主要 Props

Prop类型说明
headerTemplateCardHeaderProps标题栏及右侧操作入口
itemsPriceActionCardItem[]价格列表
footerTemplateCardFooterProps底部主、次操作按钮

PriceActionCardItem 的常用字段包括 key、price、badgeText、infoRows、actionText、checkbox、onClick 和 onActionClick。

badgeText 使用豆包蓝文字与浅蓝背景;价格可通过 Price Primitive 的 tone 选择黑色或豆包蓝。

勾选方案

const [selected, setSelected] = useState('express');

<PriceActionCard
  items={[
    {
      key: 'express',
      price: '¥32',
      badgeText: '顺丰特快',
      infoRows: [{ text: '明天18:00前送达' }],
      checkbox: {
        checked: selected === 'express',
        onChange: (checked) => setSelected(checked ? 'express' : '')
      }
    }
  ]}
  footer={{
    primaryActionButton: { text: '去寄件' },
    agreement: { links: [{ text: '电子运单契约条款', onClick: openAgreement }] }
  }}
/>;

使用说明

  • 每个列表项最多展示前 2 行 infoRows;需要更多信息时应在业务侧精简,或选择更匹配的模板。
  • actionText 不传或为空字符串时,不展示列表项右侧按钮。
  • checkbox 为受控配置:checked: boolean、disabled?: boolean、onChange?: (checked, event) => void。配置后优先展示勾选框,不展示按钮;不配置时原有布局不变。
  • 勾选框点击不触发行或卡片点击;单选或多选由业务在 onChange 中维护,禁用时不触发 onChange。
  • onClick 处理整行点击,onActionClick 只处理右侧操作按钮点击。
  • 底部操作统一使用 footer,不要使用旧的 footerActionText。
  • 卡片和列表项内容均使用上述结构化字段配置。