You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.6 KiB
TypeScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import request from '@/config/axios'
// ERP 产品 VO
export interface ProductVO {
id: number // 产品编号
name: string // 产品名称
barCode: string // 产品条码
categoryId: number // 产品类型编号
subCategoryId: number // 产品类型子类编号
subCategoryName: string // 产品类型子类名称
unitId: number // 单位编号
unitName?: string // 单位名字
status: number // 产品状态
standard: string // 产品规格
remark: string // 产品备注
expiryDay: number // 保质期天数
weight: number // 重量kg
purchasePrice: number // 采购价格,单位:元
salePrice: number // 销售价格,单位:元
minPrice: number // 最低价格,单位:元
}
// ERP 产品 API
export const ProductApi = {
// 查询产品分页
getProductPage: async (params: any) => {
return await request.get({ url: `/erp/product/page`, params })
},
// 查询产品精简列表
getProductSimpleList: async () => {
return await request.get({ url: `/erp/product/simple-list-all` })
},
// 查询原料精简列表
getItemSimpleList: async () => {
return await request.get({ url: `/erp/product/simple-list-item` })
},
// 查询采购商品精简列表
getOrderSimpleList: async () => {
return await request.get({ url: `/erp/product/simple-list-order` })
},
// 查询所有商品精简列表
getMesProductSimpleList: async () => {
return await request.get({ url: `/erp/product/simple-list-product` })
},
// 查询备件精简列表
getComponentSimpleList: async () => {
return await request.get({ url: `/erp/product/simple-list-component` })
},
// 查询产品详情
getProduct: async (id: number) => {
return await request.get({ url: `/erp/product/get?id=` + id })
},
// 新增产品
createProduct: async (data: ProductVO) => {
return await request.post({ url: `/erp/product/create`, data })
},
// 修改产品
updateProduct: async (data: ProductVO) => {
return await request.put({ url: `/erp/product/update`, data })
},
// 删除产品
deleteProduct: async (id: number) => {
return await request.delete({ url: `/erp/product/delete?id=` + id })
},
// 导出产品 Excel
exportProduct: async (params) => {
return await request.download({ url: `/erp/product/export-excel`, params })
},
// 下载产品导入模板
importProductTemplate: async () => {
return await request.download({ url: `/erp/product/get-import-template` })
},
// 导入产品
importProduct: async (data: FormData) => {
return await request.upload({ url: `/erp/product/import`, data })
}
}