采购单优化
This commit is contained in:
+4
-30
@@ -1,8 +1,7 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type IStoreOrder from '@/domain/iStoreOrder.ts';
|
||||
import type { IOrderSummaryRow, IStoreOrderItem, IStoreOrderItemUpdate } from '@/domain/iStoreOrder.ts';
|
||||
|
||||
/** 订单详情(头 + 明细) */
|
||||
/** 订单详情 */
|
||||
export async function getStoreOrder(id: number) {
|
||||
return createAxios<IStoreOrder>({
|
||||
url: `/order/store/${id}`,
|
||||
@@ -10,7 +9,7 @@ export async function getStoreOrder(id: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 订单状态流转(1已接单 3配送中 4已完成 9取消;已接单→采购中由生成采购单完成) */
|
||||
/** 订单状态流转 */
|
||||
export async function updateOrderStatus(id: number, status: number) {
|
||||
return createAxios({
|
||||
url: `/order/store/${id}/status`,
|
||||
@@ -19,7 +18,7 @@ export async function updateOrderStatus(id: number, status: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量订单状态流转(全量校验,任一订单不允许流转则整批中止) */
|
||||
/** 批量订单状态流转 */
|
||||
export async function batchUpdateOrderStatus(ids: number[], status: number) {
|
||||
return createAxios<{ success: number }>({
|
||||
url: '/order/store/batchStatus',
|
||||
@@ -37,32 +36,7 @@ export async function updateOrderContainer(id: number, data: { box_num: number;
|
||||
});
|
||||
}
|
||||
|
||||
/** 已接单预览(按商品聚合,生成采购单前确认) */
|
||||
export async function getOrderSummary() {
|
||||
return createAxios<IOrderSummaryRow[]>({
|
||||
url: '/order/store/summary',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 修改订单明细(供应商/品名/规格/单位/单价/成本价/订货量/重量,后端重算订单总价) */
|
||||
export async function updateOrderItem(itemId: number, data: IStoreOrderItemUpdate) {
|
||||
return createAxios<IStoreOrderItem>({
|
||||
url: `/order/store/item/${itemId}`,
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 一键同步明细商品快照为最新商品档案信息(供应商/品名/规格/单位/单价/成本价) */
|
||||
export async function syncOrderItem(itemId: number) {
|
||||
return createAxios<IStoreOrderItem>({
|
||||
url: `/order/store/item/${itemId}/sync`,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除订单(软删除,仅已取消订单允许) */
|
||||
/** 删除订单 */
|
||||
export async function deleteStoreOrder(id: number) {
|
||||
return createAxios({
|
||||
url: `/order/store/${id}`,
|
||||
|
||||
+40
-32
@@ -1,12 +1,27 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type {
|
||||
ExportFormat,
|
||||
IPurchaseCell,
|
||||
IPurchaseDetail,
|
||||
PurchaseExportType,
|
||||
} from '@/domain/iPurchaseOrder.ts';
|
||||
import { downloadBlob } from '@/api/common/download.ts';
|
||||
|
||||
/** C1 合并「已接单」门店订单生成采购单(order_ids 为空 = 全部已接单;生成后源订单转采购中) */
|
||||
/** 订单商品参数修改 */
|
||||
export interface PurchaseRowUpdateParams {
|
||||
product_name: string;
|
||||
supplier_id: number;
|
||||
product_spec: string;
|
||||
unit: string;
|
||||
cost_price: number;
|
||||
}
|
||||
|
||||
/** 修改门店订单明细参数 */
|
||||
export interface PurchaseCellUpdateParams {
|
||||
quantity: number;
|
||||
price: number;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
|
||||
/** 生成采购单 */
|
||||
export async function generatePurchase(purchase_date: string, order_ids?: number[]) {
|
||||
return createAxios<{ id: number; purchase_no: string }>({
|
||||
url: '/purchase/order/generate',
|
||||
@@ -15,7 +30,7 @@ export async function generatePurchase(purchase_date: string, order_ids?: number
|
||||
});
|
||||
}
|
||||
|
||||
/** 采购单详情(商品行 × 门店列矩阵) */
|
||||
/** 采购单详情 */
|
||||
export async function getPurchaseDetail(id: number) {
|
||||
return createAxios<IPurchaseDetail>({
|
||||
url: `/purchase/order/${id}`,
|
||||
@@ -23,36 +38,29 @@ export async function getPurchaseDetail(id: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/** C2/C3 导出采购单(blob 下载) */
|
||||
export async function exportPurchase(id: number, type: PurchaseExportType, format: ExportFormat) {
|
||||
return downloadBlob(
|
||||
`/purchase/order/${id}/export`,
|
||||
{ type, format },
|
||||
`采购单_${id}.${format}`
|
||||
);
|
||||
}
|
||||
|
||||
/** C4 商品行修改参数(品名/供应商/包规/单位/成本/称重,一键同步该商品全部订货明细;sync_product 追加同步商品档案) */
|
||||
export interface PurchaseRowUpdateParams {
|
||||
product_name?: string;
|
||||
supplier_id?: number;
|
||||
product_spec?: string;
|
||||
unit?: string;
|
||||
cost_price?: number;
|
||||
weight?: number;
|
||||
/** true = 同时同步至商品档案(product 表) */
|
||||
sync_product?: boolean;
|
||||
}
|
||||
|
||||
/** C4 商品行修改 */
|
||||
export async function updatePurchaseRow(
|
||||
purchaseId: number,
|
||||
productId: number,
|
||||
data: PurchaseRowUpdateParams,
|
||||
) {
|
||||
/** 商品行修改 */
|
||||
export async function updatePurchaseRow(purchaseId: number, productId: number, data: PurchaseRowUpdateParams) {
|
||||
return createAxios<{ count: number }>({
|
||||
url: `/purchase/order/${purchaseId}/row/${productId}`,
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 单元格下钻:采购单中某门店某商品的全部订货明细 */
|
||||
export async function getPurchaseCell(purchaseId: number, productId: number, storeId: number) {
|
||||
return createAxios<IPurchaseCell>({
|
||||
url: `/purchase/order/${purchaseId}/cell`,
|
||||
method: 'get',
|
||||
params: { product_id: productId, store_id: storeId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 门店订单明细修改(订货量、重量、单价),自动重算价格 */
|
||||
export async function updatePurchaseCellItem(itemId: number, data: PurchaseCellUpdateParams) {
|
||||
return createAxios({
|
||||
url: `/purchase/order/cell/${itemId}`,
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user