import { axiosInstance } from '@/api/rbac' import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common' export interface WarehouseDto { id?: number warehouseName?: string warehouseType?: string warehouseTypeName?: string recipient?: string contactPhone?: string shippingAddress?: string /** 展示排序,越小越靠前;可不填 */ sort?: number | null /** 备注(选填) */ remark?: string createTime?: string updateTime?: string createBy?: string updateBy?: string } export async function getWarehouseList(params: { page?: number pageSize?: number warehouseType?: string keyword?: string }) { const res = await axiosInstance.get(omsUrl('/system/warehouse/list'), { params }) return parseListPayload(res.data) } export async function getWarehouseDetail(id: number | string) { const res = await axiosInstance.get(omsUrl('/system/warehouse/detail'), { params: { id } }) return unwrapData(res.data) } export async function createWarehouse(body: Omit) { const res = await axiosInstance.post(omsUrl('/system/warehouse/create'), body) assertBusinessOk(res.data) } export async function updateWarehouse(body: Omit & { id: number | string }) { const res = await axiosInstance.post(omsUrl('/system/warehouse/update'), body) assertBusinessOk(res.data) } export async function deleteWarehouse(id: number | string) { const res = await axiosInstance.post(omsUrl('/system/warehouse/delete'), { id }) assertBusinessOk(res.data) }