/** 热卖标签展示数量上限 */ export const HOT_SALE_MAX = 9999 /** 商品是否展示热卖标签 */ export function hasHotSaleTag(item) { return item != null && item.hotSaleTags != null } /** 热卖计数 map 的 key(按商品 id) */ export function getProductHotKey(item) { if (!item) return '' return String(item.productId || item.packageId || '') } /** 限制热卖数量在 0 ~ HOT_SALE_MAX */ export function clampHotSaleCount(count) { const n = Number(count) || 0 return Math.min(HOT_SALE_MAX, Math.max(0, Math.floor(n))) }