import { PromotionCodeData } from "./PromotionCodeData"; import { PromotionItem } from "./PromotionItem"; /** * Order line for promotion calculation * 促销计算的订单行 */ export type PromotionOrderLine = { /** * Real sale price * 实际销售价格 */ price: number; /** * Quantity * 数量 */ qty: number; /** * Current price for promotion calculation, it will be modified by promotion code calculate function * 当前促销计算价格,促销代码的计算函数会修改这个价格以供后续促销计算使用 */ currentPrice?: number | undefined; }; /** * Promotion sale base item * 销售促销基础项目 */ export type PromotionSaleItemBase = { /** * Id * 编号 */ id: number; /** * Amount * 金额 */ amount: number; }; /** * Promotion code calculation result * 促销代码计算结果 */ export type PromotionCodeCalculation = PromotionSaleItemBase & { /** * Times * 次数 */ times: number; /** * Promotion title * 促销标题 */ title: string; }; /** * Promotion code definition * 促销代码定义,如果是面向产品和产品类目的促销,满足的金额是本行的金额;如果是面向订单的促销,满足的金额是订单的总金额 * calculate函数会修改订单行的currentPrice以供后续促销计算使用 */ export type PromotionCode = { id: number; label: string; calculate: (p: PromotionItem, sale: PromotionOrderLine | null | undefined, amount: number) => PromotionCodeCalculation | undefined; validate: (data: PromotionCodeData) => string | void; }; /** * Promotion code name * 促销代码名称 */ export declare enum PromotionCodeName { OMJ = 1,// 订单满{m}减{n} PMJ = 6,// 产品满{m}减{n} PMS = 2,// 产品买{n}送一 PEZ = 3,// 产品第二件{n}折 PKZ = 7,// 产品{n}折 PJH = 8,// 产品{n}件以上{m}优惠价 CKZ = 4,// 客户{n}折 CDZ = 5 } export declare const promotionCodes: PromotionCode[];