@@ -1,19 +1,20 @@
|
||||
import { Text, View } from '@tarojs/components';
|
||||
import BenefitFigure from './BenefitFigure';
|
||||
|
||||
type CouponBadgeProps = {
|
||||
amount: number | string;
|
||||
label?: string;
|
||||
};
|
||||
|
||||
/** Taro 友好版权益角标(对齐 shared-ui CouponBadge) */
|
||||
/** 首页商品角标:纯文案「享{amount}好客权益」(无门店图标) */
|
||||
export default function CouponBadge({ amount, label = '好客权益' }: CouponBadgeProps) {
|
||||
const n = Number(amount);
|
||||
const display = Number.isFinite(n) ? (Number.isInteger(n) ? String(n) : n.toFixed(0)) : String(amount);
|
||||
return (
|
||||
<View className="coupon-badge">
|
||||
<Text>享</Text>
|
||||
<BenefitFigure value={`${display} ${label}`} size="sm" />
|
||||
<Text>
|
||||
享{display}
|
||||
{label}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user