客户等级设置

This commit is contained in:
liu
2026-08-17 16:27:15 +08:00
parent 2eb27127c9
commit a06c45dc49
31 changed files with 548 additions and 1142 deletions
+2
View File
@@ -5,6 +5,8 @@ export default interface ICustomerLevel {
id?: number;
/** 等级名称 */
name?: string;
/** 价格上浮比例(%,售价 = 成本价 × (100 + percent) / 100 */
percent?: string | number;
sort?: number;
status?: number;
icon_id?: number;
+12 -27
View File
@@ -2,19 +2,14 @@ import type IProductCategory from '@/domain/iProductCategory.ts';
import type ISupplier from '@/domain/iSupplier.ts';
import type {ISysFileInfo} from "@/domain/iSysFile.ts";
/** 商品等级价格行(null = 该等级未设定价格,编辑时移除该行 */
/** 商品等级展示价(后端按等级上浮比例换算:售价 = 成本价 × (100 + percent) / 100 */
export interface IProductPrice {
id?: number;
product_id?: number;
/** 客户等级ID */
level_id?: number;
/** 单价:固定价=实际单价;成本百分比=等价固定价 */
/** 该等级的价格上浮比例(% */
percent?: 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 };
}
@@ -45,7 +40,7 @@ export default interface IProduct {
stock?: number;
/** 状态 */
status?: number;
/** 成本价(元,成本百分比计价的基数) */
/** 成本价(元,等级上浮计价的基数) */
cost_price?: string | number;
/** 描述 */
remark?: string;
@@ -53,7 +48,7 @@ export default interface IProduct {
category?: IProductCategory;
/** 供应商关联数据 */
supplier?: ISupplier;
/** 多等级价格 */
/** 各启用等级的换算展示价 */
prices?: IProductPrice[];
/** 创建时间 */
created_at?: string;
@@ -65,7 +60,7 @@ export const PRODUCT_STATUS_MAP: Record<number, { text: string; color: string }>
};
/**
* 价格矩阵行:固定列 + price_{level_id}实际价)/ price_type_{level_id} / percent_{level_id} 动态列
* 价格矩阵行:固定列 + price_{level_id}按等级上浮比例换算的售价)动态列
*/
export type IPriceMatrixRow = {
id: number;
@@ -77,27 +72,17 @@ export type IPriceMatrixRow = {
} & Record<string, string | number | null | undefined>;
export interface IPriceMatrix {
levels: { id: number; name: string }[];
levels: { id: number; name: string; percent: string | number }[];
rows: IPriceMatrixRow[];
total: number;
}
/**
* 批量调价更新行(三类,可混合同一行):
* - 成本行 { product_id, cost_price }
* - 固定价行 { product_id, level_id, price_type: 0, price }
* - 百分比行 { product_id, level_id, price_type: 1, percent }price 可选,等价固定价)
* 批量调价更新行{ product_id, cost_price }
* (等级售价 = 成本价 × (100 + 等级上浮比例) / 100,调价即调成本价)
*/
export interface IBatchPriceUpdate {
product_id: number;
/** 成本价(成本行) */
/** 成本价 */
cost_price?: number;
/** 客户等级ID(等级价格行) */
level_id?: number;
/** 计价类型:0 固定价(默认) 1 成本百分比 */
price_type?: number;
/** 固定价 / 百分比行的等价固定价 */
price?: number;
/** 成本上浮百分点(price_type=1 时必填) */
percent?: number;
}