李红攀:V2.0.001小程序的采购管理

This commit is contained in:
2026-04-21 15:55:26 +08:00
parent 45eb9232d7
commit 5586e8e39a
17 changed files with 4444 additions and 2 deletions

View File

@@ -0,0 +1,73 @@
import type { PageParam, PageResult } from '@/http/types'
import { http } from '@/http/http'
/** 农户信息 */
export interface Farmer {
id?: number
name?: string
idCardNumber?: string
mobile?: string
address?: string
plantingBase?: string
contractNumber?: string
contractedArea?: number
orderQuantity?: number
actualArea?: number
transplantTime?: string
transplantQuantity?: number
maturityTime?: string
expectedHarvestTime?: string
usedVariety?: string
plantingMethod?: string
adminName?: string
contact?: string
telephone?: string
email?: string
fax?: string
remark?: string
status?: number
sort?: number
taxNo?: string
taxPercent?: number
bankName?: string
bankAccount?: string
bankAddress?: string
}
/** 品种选项 */
export const VARIETY_OPTIONS = [
{ value: '红宝石', label: '红宝石' },
{ value: '1401', label: '1401' },
{ value: '1501', label: '1501' },
{ value: '3366', label: '3366' },
]
/** 获取农户分页列表 */
export function getFarmerPage(params: PageParam) {
return http.get<PageResult<Farmer>>('/erp/farmer/page', { ...params, type: 2 })
}
/** 获取农户详情 */
export function getFarmer(id: number) {
return http.get<Farmer>(`/erp/farmer/get?id=${id}`)
}
/** 创建农户 */
export function createFarmer(data: Farmer) {
return http.post<number>('/erp/farmer/create', data)
}
/** 更新农户 */
export function updateFarmer(data: Farmer) {
return http.put<boolean>('/erp/farmer/update', data)
}
/** 删除农户 */
export function deleteFarmer(id: number) {
return http.delete<boolean>(`/erp/farmer/delete?id=${id}`)
}
/** 获取农户精简列表 */
export function getFarmerSimpleList() {
return http.get<Farmer[]>('/erp/farmer/simple-list')
}

View File

@@ -0,0 +1,109 @@
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
productName?: string
productBarCode?: string
productUnitName?: string
productSpec?: string
productCategoryName?: string
stockCount?: number
totalCount?: 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
}
/** 审核表单数据 */
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<PageResult<PurchaseIn>>('/erp/purchase-in/page', params)
}
/** 获取采购入库详情 */
export function getPurchaseIn(id: number) {
return http.get<PurchaseIn>(`/erp/purchase-in/get?id=${id}`)
}
/** 创建采购入库 */
export function createPurchaseIn(data: PurchaseIn) {
return http.post<number>('/erp/purchase-in/create', data)
}
/** 更新采购入库 */
export function updatePurchaseIn(data: PurchaseIn) {
return http.put<boolean>('/erp/purchase-in/update', data)
}
/** 更新采购入库状态 */
export function updatePurchaseInStatus(data: AuditFormData) {
return http.put<boolean>('/erp/purchase-in/update-status', data)
}
/** 删除采购入库 */
export function deletePurchaseIn(ids: number[]) {
return http.delete<boolean>(`/erp/purchase-in/delete?ids=${ids.join(',')}`)
}

View File

@@ -0,0 +1,87 @@
import type { PageParam, PageResult } from '@/http/types'
import { http } from '@/http/http'
/** 采购退货项 */
export interface PurchaseReturnItem {
id?: number
productId: number
productUnitId: number
productPrice?: number
count: number
taxPercent?: number
taxPrice?: number
remark?: string
warehouseId?: number
warehouseName?: string
productName?: string
productBarCode?: string
productUnitName?: string
productSpec?: string
productCategoryName?: string
stockCount?: number
totalCount?: number
totalPrice?: number
totalProductPrice?: number
orderItemId?: number
inCount?: number
returnCount?: number
}
/** 采购退货信息 */
export interface PurchaseReturn {
id?: number
no?: string
status?: number
supplierId?: number
supplierName?: string
accountId?: number
accountName?: string
returnTime?: string
totalCount?: number
totalPrice?: number
totalProductPrice?: number
totalTaxPrice?: number
discountPercent?: number
discountPrice?: number
otherPrice?: number
refundPrice?: number
fileUrl?: string
remark?: string
creator?: string
creatorName?: string
createTime?: string
items?: PurchaseReturnItem[]
productNames?: string
orderId?: number
orderNo?: string
}
/** 获取采购退货分页列表 */
export function getPurchaseReturnPage(params: PageParam) {
return http.get<PageResult<PurchaseReturn>>('/erp/purchase-return/page', params)
}
/** 获取采购退货详情 */
export function getPurchaseReturn(id: number) {
return http.get<PurchaseReturn>(`/erp/purchase-return/get?id=${id}`)
}
/** 创建采购退货 */
export function createPurchaseReturn(data: PurchaseReturn) {
return http.post<number>('/erp/purchase-return/create', data)
}
/** 更新采购退货 */
export function updatePurchaseReturn(data: PurchaseReturn) {
return http.put<boolean>('/erp/purchase-return/update', data)
}
/** 更新采购退货状态 */
export function updatePurchaseReturnStatus(id: number, status: number) {
return http.put<boolean>(`/erp/purchase-return/update-status?id=${id}&status=${status}`)
}
/** 删除采购退货 */
export function deletePurchaseReturn(ids: number[]) {
return http.delete<boolean>(`/erp/purchase-return/delete?ids=${ids.join(',')}`)
}

View File

@@ -1,11 +1,56 @@
import type { PageParam, PageResult } from '@/http/types'
import { http } from '@/http/http'
/** 供应商信息 */
export interface Supplier {
id?: number
name?: string
contact?: string
mobile?: string
telephone?: string
email?: string
fax?: string
remark?: string
status?: number
sort?: number
taxNo?: string
taxPercent?: number
bankName?: string
bankAccount?: string
bankAddress?: string
}
/** 供应商精简信息 */
export interface SupplierSimple {
id: number
name: string
}
/** 获取供应商分页列表 */
export function getSupplierPage(params: PageParam) {
return http.get<PageResult<Supplier>>('/erp/supplier/page', { ...params, type: 1 })
}
/** 获取供应商详情 */
export function getSupplier(id: number) {
return http.get<Supplier>(`/erp/supplier/get?id=${id}`)
}
/** 创建供应商 */
export function createSupplier(data: Supplier) {
return http.post<number>('/erp/supplier/create', data)
}
/** 更新供应商 */
export function updateSupplier(data: Supplier) {
return http.put<boolean>('/erp/supplier/update', data)
}
/** 删除供应商 */
export function deleteSupplier(id: number) {
return http.delete<boolean>(`/erp/supplier/delete?id=${id}`)
}
/** 获取供应商精简列表 */
export function getSupplierSimpleList() {
return http.get<SupplierSimple[]>('/erp/supplier/simple-list')