Files
gao-customer-h5/src/utils/event.ts
T
2026-09-04 23:07:59 +08:00

28 lines
1.0 KiB
TypeScript

import type { EventBizType, EventItem } from "@/types/EventItem";
/** 返回事件业务类型的前端文案。 */
export function getEventBizTypeText(bizType?: EventBizType): string {
if (bizType === "PACKAGE_PURCHASE") {
return "套餐购买";
}
if (bizType === "LEGACY_CONSUMPTION") {
return "历史消费(退役)";
}
return "普通登记";
}
/** 判断事件是否为套餐购买事件。 */
export function isPackagePurchaseEvent(event?: Pick<EventItem, "bizType">): boolean {
return event?.bizType === "PACKAGE_PURCHASE";
}
/** 判断事件是否为历史消费退役事件,此类事件不可再登记或作为规则触发对象。 */
export function isLegacyConsumptionEvent(event?: Pick<EventItem, "bizType">): boolean {
return event?.bizType === "LEGACY_CONSUMPTION";
}
/** 判断事件是否已退役,退役事件只能通过历史详情查看。 */
export function isRetiredEvent(event?: Pick<EventItem, "bizType">): boolean {
return isPackagePurchaseEvent(event) || isLegacyConsumptionEvent(event);
}