import { Text, View } from '@tarojs/components';

type CouponBadgeProps = {
  amount: number | string;
  label?: string;
};

/** 首页商品角标：纯文案「享{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>
        享{display}
        {label}
      </Text>
    </View>
  );
}
