43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import createAxios from '@/utils/request';
|
|
import type IProduct from '@/domain/iProduct.ts';
|
|
import type { IBatchPriceUpdate, IPriceMatrix } from '@/domain/iProduct.ts';
|
|
|
|
export interface PriceMatrixParams {
|
|
category_id?: number;
|
|
keyword?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
}
|
|
|
|
/**
|
|
* A2 价格矩阵:行=商品,列=启用等级,值=实际销售价(缺失 null);
|
|
* 行内含 cost_price 与 price_type_{level_id} / percent_{level_id}
|
|
*/
|
|
export async function getPriceMatrix(params?: PriceMatrixParams) {
|
|
return createAxios<IPriceMatrix>({
|
|
url: '/product/goods/priceMatrix',
|
|
method: 'get',
|
|
params,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* A2 批量调价:支持成本价 / 固定价 / 成本百分比三类更新行(提交后给受影响门店生成价格变更通知)
|
|
*/
|
|
export async function batchPrice(updates: IBatchPriceUpdate[]) {
|
|
return createAxios({
|
|
url: '/product/goods/batchPrice',
|
|
method: 'put',
|
|
data: { updates },
|
|
});
|
|
}
|
|
|
|
/** 商品下拉选项(仅上架) */
|
|
export async function getProductOptions(keyword?: string) {
|
|
return createAxios<IProduct[]>({
|
|
url: '/product/goods/options',
|
|
method: 'get',
|
|
params: keyword ? { keyword } : {},
|
|
});
|
|
}
|