import type { PageParam, PageResult } from '@/http/types' import { http } from '@/http/http' /** 采购入库项 */ export interface PurchaseInItem { id?: number productId: number productUnitId: number productPrice?: number count: number taxPercent?: number taxPrice?: number remark?: string warehouseId?: number warehouseName?: string batchNo?: string locationCode?: string productName?: string productBarCode?: string productUnitName?: string productSpec?: string productCategoryName?: string stockCount?: number totalCount?: number inCount?: number totalPrice?: number totalProductPrice?: number orderItemId?: number } /** 采购入库信息 */ export interface PurchaseIn { id?: number no?: string status?: number supplierId?: number supplierName?: string accountId?: number accountName?: string inTime?: string totalCount?: number totalPrice?: number totalProductPrice?: number totalTaxPrice?: number discountPercent?: number discountPrice?: number otherPrice?: number paymentPrice?: number fileUrl?: string remark?: string creator?: string creatorName?: string createTime?: string items?: PurchaseInItem[] productNames?: string orderId?: number orderNo?: string isQualified?: boolean returnType?: string | null returnRemark?: string hasApprovalRecords?: boolean } /** 审核表单数据 */ export interface AuditFormData { id: number isQualified: boolean returnType?: string returnRemark?: string status: number } /** 返回方式枚举 */ export const RETURN_TYPE_ENUM = { RETURN_BACK: 'return_back', DESTROY: 'destroy', } /** 返回方式选项 */ export const RETURN_TYPE_OPTIONS = [ { label: '原路返回', value: RETURN_TYPE_ENUM.RETURN_BACK }, { label: '就地销毁', value: RETURN_TYPE_ENUM.DESTROY }, ] /** 获取采购入库分页列表 */ export function getPurchaseInPage(params: PageParam) { return http.get>('/erp/purchase-in/page', params) } /** 获取采购入库详情 */ export function getPurchaseIn(id: number) { return http.get(`/erp/purchase-in/get?id=${id}`) } /** 创建采购入库 */ export function createPurchaseIn(data: PurchaseIn) { return http.post('/erp/purchase-in/create', data) } /** 更新采购入库 */ export function updatePurchaseIn(data: PurchaseIn) { return http.put('/erp/purchase-in/update', data) } /** 更新采购入库状态 */ export function updatePurchaseInStatus(data: AuditFormData) { return http.put('/erp/purchase-in/update-status', data) } /** 删除采购入库 */ export function deletePurchaseIn(ids: number[]) { return http.delete(`/erp/purchase-in/delete?ids=${ids.join(',')}`) }