UNPKG

@pisell/pisellos

Version:

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

77 lines (76 loc) 3.53 kB
import { Product, Voucher } from './type'; /** 订单商品数量 */ export declare const getProductQuantity: (product: any) => any; /** * 订单商品行唯一键,用于 maxPassesPerItem 按行、按件配额(同 SPU 不同规格视为不同行)。 */ export declare function resolveWalletPassLineKey(product: any, indexInOrder: number): string; 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 getTaxAndFeeRoundingRemainder: (product: Product, isDeductTaxAndFee: boolean) => number; /** * 获取主商品的商品差额 * @param product 商品 * @returns 商品差额(与数量无关,计算总价时需要减去) */ export declare const getProductDiscountDifference: (product: Product) => number; /** * 获取主商品价格(单价,不含舍入余数) * @param product 商品 * @param isDeductTaxAndFee 是否抵扣税费与附加费 * @returns 商品单价 */ export declare const getMainProductPrice: (product: Product, isDeductTaxAndFee: boolean) => number; /** * 获取套餐子商品税费和附加费的舍入余数 * @param bundleItem 套餐子商品 * @param isDeductTaxAndFee 是否抵扣税费与附加费 * @returns 舍入余数(税费 + 附加费的舍入余数) */ export declare const getBundleItemTaxAndFeeRoundingRemainder: (bundleItem: any, isDeductTaxAndFee: boolean) => number; /** * 获取套餐子商品的商品差额 * @param bundleItem 套餐子商品 * @returns 商品差额(与数量无关,计算总价时需要减去) */ export declare const getBundleItemDiscountDifference: (bundleItem: any) => number; /** * 获取套餐子商品价格(不含舍入余数) * @param bundleItem 套餐子商品 * @param parentQuantity 父商品数量 * @param isDeductTaxAndFee 是否抵扣税费与附加费 * @returns 子商品总价格(不含舍入余数) */ export declare const getBundleItemPrice: (bundleItem: any, parentQuantity: number, isDeductTaxAndFee: boolean) => number; 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;