UNPKG

@pisell/pisellos

Version:

一个可扩展的前端模块化SDK框架,支持插件系统

57 lines (56 loc) 1.43 kB
import { Discount } from '../Discount/types'; export declare enum RulesHooks { OnRulesListChange = "rules:onRulesListChange", OnDestroy = "rules:onDestroy" } export interface Rules { id: string; name: string; description: string; discount: number; } export interface RulesState { rulesList: Rules[]; } export interface DiscountResult { productList: any[]; discountList: any[]; } export interface RulesModuleAPI { setRulesList: (rulesList: Rules[]) => Promise<void>; clear: () => Promise<void>; calcDiscount: (params: { discountList: any[]; productList: any[]; }) => DiscountResult; } type ProductDetail = { isClient?: boolean; isManualDiscount?: boolean; booking_id: any; id: number; price: number | string; total: number; discount_list: Discount[]; origin_total: number; _id: string; options?: any[]; bundle?: any[]; original_price?: number | string; num?: number; quantity: number; }; export interface RulesParamsHooks { getProduct: (product: Record<string, any>) => ProductDetail; setProduct: (product: Record<string, any>, values: { _id?: string; total?: number; discount_list: any[]; origin_total?: number; price?: number; quantity?: number; variant?: any[]; original_price?: number; }) => Record<string, any>; } export {};