38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
/** 商品「类目」= 电商 / 本地生活。跟商品库已有的「品类」(美妆/食品)是两个维度,不能混用。 */
|
|
|
|
export const BUSINESS_TYPES = {
|
|
ecommerce: "电商",
|
|
local_life: "本地生活",
|
|
} as const;
|
|
|
|
export type BusinessType = keyof typeof BUSINESS_TYPES;
|
|
|
|
export const BUSINESS_TYPE_KEYS = Object.keys(BUSINESS_TYPES) as BusinessType[];
|
|
|
|
/** 电商品类 · 常用项,新建抽屉第一层 */
|
|
export const PC_CAT_PRIMARY = ["美妆个护", "食品饮料", "服饰鞋包", "家居日用", "数码家电", "母婴玩具", "运动健康"];
|
|
|
|
/** 电商品类 · 不常用,点「更多品类」再展开 */
|
|
export const PC_CAT_MORE = ["珠宝配饰", "汽车用品", "宠物用品", "图书文教", "五金农资", "其他商品"];
|
|
|
|
export const PC_CAT_MORE_LABEL = "更多品类";
|
|
|
|
/** 电商品类全集 · 筛选 / 详情编辑 / 提交校验用,不含「更多品类」这个入口文案 */
|
|
export const PC_CAT_OPTIONS = [...PC_CAT_PRIMARY, ...PC_CAT_MORE];
|
|
|
|
/** 本地生活品类 · 团购/到店核销走这条,不跟电商 SKU 混在一个下拉里 */
|
|
export const PC_LOCAL_CAT_OPTIONS = ["餐饮美食", "休闲娱乐", "丽人美发", "酒店民宿", "生活服务", "运动健身", "亲子玩乐", "团购套餐", "更多品类"];
|
|
|
|
export function isLocalLife(product?: { business_type?: string } | null): boolean {
|
|
return product?.business_type === "local_life";
|
|
}
|
|
|
|
export function catOptionsFor(businessType: string): string[] {
|
|
return businessType === "local_life" ? PC_LOCAL_CAT_OPTIONS : PC_CAT_OPTIONS;
|
|
}
|
|
|
|
export function businessTypeLabel(value?: string | null): string {
|
|
if (value === "local_life") return BUSINESS_TYPES.local_life;
|
|
return BUSINESS_TYPES.ecommerce;
|
|
}
|