价格增加百分比上浮

This commit is contained in:
liu
2026-08-06 14:52:56 +08:00
parent 07b08c8915
commit c6f69c5c55
19 changed files with 958 additions and 93 deletions
+32 -5
View File
@@ -2,12 +2,19 @@ import type IProductCategory from '@/domain/iProductCategory.ts';
import type ISupplier from '@/domain/iSupplier.ts';
import type {ISysFileInfo} from "@/domain/iSysFile.ts";
/** 商品等级价格行 */
/** 商品等级价格行(null = 该等级未设定价格,编辑时移除该行) */
export interface IProductPrice {
id?: number;
product_id?: number;
level_id?: number;
price?: string | number;
/** 单价:固定价=实际单价;成本百分比=等价固定价 */
price?: string | number | null;
/** 计价类型:0 固定价(默认) 1 成本百分比 */
price_type?: number;
/** 成本上浮百分点(price_type=1 时生效,如 30 = 上浮 30% */
percent?: string | number | null;
/** 实际销售价(模型换算:百分比 = 成本价 × (100 + percent) / 100 */
actual_price?: string | number;
level?: { id: number; name: string };
}
@@ -38,6 +45,8 @@ export default interface IProduct {
stock?: number;
/** 状态 */
status?: number;
/** 成本价(元,成本百分比计价的基数) */
cost_price?: string | number;
/** 描述 */
remark?: string;
/** 分类关联数据 */
@@ -55,12 +64,16 @@ export const PRODUCT_STATUS_MAP: Record<number, { text: string; color: string }>
1: { text: '上架', color: 'success' },
};
/** 价格矩阵行(price_{level_id} 动态列) */
/**
* 价格矩阵行:固定列 + price_{level_id}(实际价)/ price_type_{level_id} / percent_{level_id} 动态列
*/
export type IPriceMatrixRow = {
id: number;
name: string;
spec?: string;
unit?: string;
/** 成本价(null = 未设置或已清除) */
cost_price?: string | number | null;
} & Record<string, string | number | null | undefined>;
export interface IPriceMatrix {
@@ -69,8 +82,22 @@ export interface IPriceMatrix {
total: number;
}
/**
* 批量调价更新行(三类,可混合同一行):
* - 成本行 { product_id, cost_price }
* - 固定价行 { product_id, level_id, price_type: 0, price }
* - 百分比行 { product_id, level_id, price_type: 1, percent }price 可选,等价固定价)
*/
export interface IBatchPriceUpdate {
product_id: number;
level_id: number;
price: number | string;
/** 成本价(成本行) */
cost_price?: number;
/** 客户等级ID(等级价格行) */
level_id?: number;
/** 计价类型:0 固定价(默认) 1 成本百分比 */
price_type?: number;
/** 固定价 / 百分比行的等价固定价 */
price?: number;
/** 成本上浮百分点(price_type=1 时必填) */
percent?: number;
}