@pisell/pisellos
Version:
一个可扩展的前端模块化SDK框架,支持插件系统
30 lines (29 loc) • 1.11 kB
TypeScript
import Decimal from 'decimal.js';
import { CartItem } from '../Cart/types';
import { ISummaryState } from './types';
export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[]) => ISummaryState['summary'];
/**
* 计算商品小计(不含其他费用)
* @param items - 购物车商品数组
* @returns 商品总价字符串,保留2位小数
*/
export declare const calculateSubtotal: (items: CartItem[]) => string;
/**
* @title: 单个商品的税费
* @description:
* 单个商品的税费 = 商品销售单价(折扣后) * 税率 * is_charge_tax /( 1+ 税率 * is_price_include_tax)
* $taxFee = $price * $taxRate * $isChargeTax / (1 + $taxRate * $isPriceIncludeTax);
* @return {*}
* @Author: xiangfeng.xue
*/
export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
/**
* @title: 计算定金
* @param items - 购物车商品数组
* @returns 定金字符串,保留2位小数
*/
export declare const calculateDeposit: (items: CartItem[]) => {
total: string;
protocols: any[];
hasDeposit: never;
} | undefined;