front/src/api/system/warehouse.ts
zzh 640562654d
All checks were successful
Build and Deploy Front / deploy (push) Successful in 6m25s
feat: 仓库地址排序备注与映射明细性能、脏检查误报修复
下单/H5 仓库地址展示与排序备注;映射明细加载优化与发布后保留选中;接口明细加载期不再误报未保存。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-09 14:12:32 +08:00

51 lines
1.5 KiB
TypeScript

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<WarehouseDto>(res.data)
}
export async function createWarehouse(body: Omit<WarehouseDto, 'id'>) {
const res = await axiosInstance.post(omsUrl('/system/warehouse/create'), body)
assertBusinessOk(res.data)
}
export async function updateWarehouse(body: Omit<WarehouseDto, 'id'> & { 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)
}