UNPKG

@pisell/pisellos

Version:

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

51 lines (50 loc) 2.16 kB
import { Product, Voucher } from './type'; export declare const getApplicableProductIds: (voucher: Voucher) => number[] | null; /** * 优惠券处理函数 * @param applicableVouchers 可用的券列表 * @param orderTotalAmount 订单总金额 * @param products 订单商品列表 * @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status */ export declare function processVouchers(applicableVouchers: Voucher[], orderTotalAmount: number, products: Product[]): { recommended: any[]; transformList: any[]; }; /** * 重新计算优惠券状态(基于已选券的增量计算) * @param allVouchers 所有原始券列表 * @param selectedVouchers 已选中的券列表(按选中顺序) * @param orderTotalAmount 订单总金额 * @param products 订单商品列表 * @returns 返回更新后的所有券列表和已选券的详细抵扣信息 */ export declare function recalculateVouchers(allVouchers: any[], selectedVouchers: any[], orderTotalAmount: number, products: any[]): { allWithUpdatedStatus: any[]; selectedWithDetails: any[]; }; /** * 获取主商品价格 * @param product 商品 * @param isDeductTaxAndFee 是否抵扣税费与附加费 * @returns 商品价格 */ export declare const getMainProductPrice: (product: Product, isDeductTaxAndFee: boolean) => number; /** * 获取套餐子商品价格 * @param bundleItem 套餐子商品 * @param parentQuantity 父商品数量 * @param isDeductTaxAndFee 是否抵扣税费与附加费 * @returns 子商品总价格 */ export declare const getBundleItemPrice: (bundleItem: any, parentQuantity: number, isDeductTaxAndFee: boolean) => number; /** * 获取商品数量 * @param product 商品 * @returns 商品数量 */ export declare const getProductQuantity: (product: any) => any; export declare const getBundleItemIsOriginalPrice: (item: any) => boolean; export declare const getBundleItemIsMarkupPrice: (item: any) => boolean; export declare const getBundleItemIsDiscountPrice: (item: any) => boolean; export declare const getBundleItemIsMarkupOrDiscountPrice: (item: any) => boolean;