diff --git a/.gitignore b/.gitignore index 33eb9d1..1884a20 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,8 @@ website/dist.zip # go go/go-platform.zip -go/server.exe +# Go 构建产物(go build 默认输出 main.exe / server.exe 等),不入库 +go/*.exe go/conf # codegraph diff --git a/backend/src/api/erpDocument.js b/backend/src/api/erpDocument.js new file mode 100644 index 0000000..87605c6 --- /dev/null +++ b/backend/src/api/erpDocument.js @@ -0,0 +1,96 @@ +import request from '@/utils/request' + +/** + * 进销存单据中心接口(/backend/erp/document*) + * 采购/销售/库存十类单据共用同一套接口,用 doc_type 区分。 + */ + +export function getDocumentList(params) { + return request({ + url: '/backend/erp/document/list', + method: 'get', + params + }) +} + +export function getDocumentDetail(id) { + return request({ + url: `/backend/erp/document/${id}`, + method: 'get' + }) +} + +/** 新建或覆盖保存草稿:payload 带 id 即为编辑 */ +export function saveDocument(data) { + return request({ + url: '/backend/erp/document', + method: 'post', + data + }) +} + +export function deleteDocument(id) { + return request({ + url: `/backend/erp/document/${id}`, + method: 'delete' + }) +} + +/** 提交审批:flow_id 走查询参数(后端从 query 取),不传则由后端按单据类型挑选审批流 */ +export function submitDocument(id, params) { + return request({ + url: `/backend/erp/document/${id}/submit`, + method: 'post', + params: params || {} + }) +} + +export function approveDocument(id) { + return request({ + url: `/backend/erp/document/${id}/approve`, + method: 'post', + data: {} + }) +} + +export function cancelDocument(id) { + return request({ + url: `/backend/erp/document/${id}/cancel`, + method: 'post', + data: {} + }) +} + +/** 该单据类型当前可用的审批流,为空时前端只显示「直接审核」 */ +export function getDocumentFlows(docType) { + return request({ + url: '/backend/erp/document/flows', + method: 'get', + params: { doc_type: docType } + }) +} + +/** 来源订单/原单中尚可执行的明细行(含 remain_qty),用于按行带出 */ +export function getExecutableItems(id) { + return request({ + url: `/backend/erp/document/${id}/executable`, + method: 'get' + }) +} + +/** 盘点表:带出仓库当前账面数量与加权成本 */ +export function getTakeSheet(warehouseId) { + return request({ + url: '/backend/erp/document/takeSheet', + method: 'get', + params: { warehouse_id: warehouseId } + }) +} + +/** 开单页所需字典与默认值(单据类型、状态、默认仓、售价口径、负库存开关) */ +export function getDocumentMeta() { + return request({ + url: '/backend/erp/document/meta', + method: 'get' + }) +} diff --git a/backend/src/api/erpFinance.js b/backend/src/api/erpFinance.js new file mode 100644 index 0000000..0763d42 --- /dev/null +++ b/backend/src/api/erpFinance.js @@ -0,0 +1,103 @@ +import request from '@/utils/request' + +/** + * 进销存财务接口(/backend/erp/finance*) + * 往来账(应收/应付)由已生效单据自动生成,收付款单确认时按单核销或 FIFO 核销。 + */ + +export function getBillList(params) { + return request({ + url: '/backend/erp/finance/bill/list', + method: 'get', + params + }) +} + +export function getBillDetail(id) { + return request({ + url: `/backend/erp/finance/bill/${id}`, + method: 'get' + }) +} + +export function getAging(params) { + return request({ + url: '/backend/erp/finance/aging', + method: 'get', + params + }) +} + +export function getCashFlow(params) { + return request({ + url: '/backend/erp/finance/cashflow', + method: 'get', + params + }) +} + +/** 往来单位对账汇总(应收/应付累计与未结) */ +export function getPartnerSummary(params) { + return request({ + url: '/backend/erp/finance/partner', + method: 'get', + params + }) +} + +export function getFundList(params) { + return request({ + url: '/backend/erp/finance/fund/list', + method: 'get', + params + }) +} + +export function getFundDetail(id) { + return request({ + url: `/backend/erp/finance/fund/${id}`, + method: 'get' + }) +} + +/** 新建/修改收付款草稿,返回 {id, fund_no} */ +export function saveFund(data) { + return request({ + url: '/backend/erp/finance/fund', + method: 'post', + data + }) +} + +/** 确认收付款:body 传 {settles:[{partner_bill_id,amount}]},不传则按账期 FIFO 自动核销 */ +export function confirmFund(id, data) { + return request({ + url: `/backend/erp/finance/fund/${id}/confirm`, + method: 'post', + data: data || {} + }) +} + +export function voidFund(id) { + return request({ + url: `/backend/erp/finance/fund/${id}/void`, + method: 'post', + data: {} + }) +} + +export function deleteFund(id) { + return request({ + url: `/backend/erp/finance/fund/${id}`, + method: 'delete' + }) +} + +/** 某往来单位当前未结的往来账,供核销勾选 */ +export function getFundOpenBills(params) { + return request({ + url: '/backend/erp/finance/fund/openBills', + method: 'get', + params + }) +} diff --git a/backend/src/api/erpProduct.js b/backend/src/api/erpProduct.js new file mode 100644 index 0000000..01fe54f --- /dev/null +++ b/backend/src/api/erpProduct.js @@ -0,0 +1,74 @@ +import request from '@/utils/request' + +/** + * 进销存商品档案接口(/backend/erp/product*) + * 商品支持基础单位+辅助单位换算、五级价格、安全/最高库存与保质期批次开关。 + */ + +export function getProductList(params) { + return request({ + url: '/backend/erp/product/list', + method: 'get', + params + }) +} + +export function getProductDetail(id) { + return request({ + url: `/backend/erp/product/${id}`, + method: 'get' + }) +} + +export function createProduct(data) { + return request({ + url: '/backend/erp/product', + method: 'post', + data + }) +} + +export function updateProduct(id, data) { + return request({ + url: `/backend/erp/product/${id}`, + method: 'put', + data + }) +} + +export function deleteProduct(id) { + return request({ + url: `/backend/erp/product/${id}`, + method: 'delete' + }) +} + +export function toggleProductStatus(id, status) { + return request({ + url: `/backend/erp/product/${id}/status`, + method: 'post', + data: { status } + }) +} + +export function getCategoryList() { + return request({ + url: '/backend/erp/product/category/list', + method: 'get' + }) +} + +export function saveCategory(data) { + return request({ + url: '/backend/erp/product/category', + method: 'post', + data + }) +} + +export function deleteCategory(id) { + return request({ + url: `/backend/erp/product/category/${id}`, + method: 'delete' + }) +} diff --git a/backend/src/api/erpReport.js b/backend/src/api/erpReport.js new file mode 100644 index 0000000..87be346 --- /dev/null +++ b/backend/src/api/erpReport.js @@ -0,0 +1,63 @@ +import request from '@/utils/request' + +/** + * 进销存报表接口(/backend/erp/report*) + * 统计口径只含「已生效」单据与库存流水,因此报表数字与往来账、库存结存永远一致。 + * 公共参数:date_from、date_to(YYYY-MM-DD,缺省为当月)。 + */ + +export function getPurchaseSummary(params) { + return request({ + url: '/backend/erp/report/purchase', + method: 'get', + params + }) +} + +export function getSalesSummary(params) { + return request({ + url: '/backend/erp/report/sales', + method: 'get', + params + }) +} + +export function getSalesRank(params) { + return request({ + url: '/backend/erp/report/rank', + method: 'get', + params + }) +} + +export function getStockMoveReport(params) { + return request({ + url: '/backend/erp/report/stockmove', + method: 'get', + params + }) +} + +export function getProfitReport(params) { + return request({ + url: '/backend/erp/report/profit', + method: 'get', + params + }) +} + +export function getRfmReport(params) { + return request({ + url: '/backend/erp/report/rfm', + method: 'get', + params + }) +} + +export function getErpDashboard(params) { + return request({ + url: '/backend/erp/report/dashboard', + method: 'get', + params + }) +} diff --git a/backend/src/api/erpStock.js b/backend/src/api/erpStock.js new file mode 100644 index 0000000..7dd7be2 --- /dev/null +++ b/backend/src/api/erpStock.js @@ -0,0 +1,46 @@ +import request from '@/utils/request' + +/** + * 进销存库存查询接口(/backend/erp/stock*) + * 结存全部由流水驱动,这里只有读接口 + 补货建议。 + */ + +export function getStockList(params) { + return request({ + url: '/backend/erp/stock/list', + method: 'get', + params + }) +} + +export function getStockLedger(params) { + return request({ + url: '/backend/erp/stock/ledger', + method: 'get', + params + }) +} + +export function getStockWarning(params) { + return request({ + url: '/backend/erp/stock/warning', + method: 'get', + params + }) +} + +export function getReplenishList(params) { + return request({ + url: '/backend/erp/stock/replenish', + method: 'get', + params + }) +} + +export function getBatchList(params) { + return request({ + url: '/backend/erp/stock/batch', + method: 'get', + params + }) +} diff --git a/backend/src/api/erpWarehouse.js b/backend/src/api/erpWarehouse.js new file mode 100644 index 0000000..a45f005 --- /dev/null +++ b/backend/src/api/erpWarehouse.js @@ -0,0 +1,50 @@ +import request from '@/utils/request' + +/** 进销存仓库档案接口(/backend/erp/warehouse*),列表带库存品种数与货值 */ + +export async function getWarehouseList(params) { + const res = await request({ + url: '/backend/erp/warehouse/list', + method: 'get', + params + }) + // 后端按 {warehouse, stock_kinds, stock_value} 嵌套返回,拍平后下拉与表格可共用同一行结构 + if (res && res.code === 200 && Array.isArray(res.data?.list)) { + res.data.list = res.data.list.map((row) => ({ + ...(row.warehouse || {}), + stock_kinds: row.stock_kinds, + stock_value: row.stock_value + })) + } + return res +} + +export function getWarehouseDetail(id) { + return request({ + url: `/backend/erp/warehouse/${id}`, + method: 'get' + }) +} + +export function createWarehouse(data) { + return request({ + url: '/backend/erp/warehouse', + method: 'post', + data + }) +} + +export function updateWarehouse(id, data) { + return request({ + url: `/backend/erp/warehouse/${id}`, + method: 'put', + data + }) +} + +export function deleteWarehouse(id) { + return request({ + url: `/backend/erp/warehouse/${id}`, + method: 'delete' + }) +} diff --git a/backend/src/views/apps/erp/basic/product.vue b/backend/src/views/apps/erp/basic/product.vue new file mode 100644 index 0000000..4c347e2 --- /dev/null +++ b/backend/src/views/apps/erp/basic/product.vue @@ -0,0 +1,658 @@ + + + + + diff --git a/backend/src/views/apps/erp/basic/warehouse.vue b/backend/src/views/apps/erp/basic/warehouse.vue new file mode 100644 index 0000000..3a1bd32 --- /dev/null +++ b/backend/src/views/apps/erp/basic/warehouse.vue @@ -0,0 +1,247 @@ + + + + + diff --git a/backend/src/views/apps/erp/customer/components/edit.vue b/backend/src/views/apps/erp/customer/components/edit.vue index 64d637d..3b923cf 100644 --- a/backend/src/views/apps/erp/customer/components/edit.vue +++ b/backend/src/views/apps/erp/customer/components/edit.vue @@ -148,6 +148,37 @@ + + + + + + + + + + + +
+ 信用额度用于销售出库审核时的超限拦截,账期决定应收单的到期日与逾期起算。 +
+
({ address: "", status: "1", is_draft: 0, + credit_limit: 0, + payment_days: 0, remark: "", invoice_title: "", tax_number: "", @@ -499,6 +532,12 @@ function handleSaveDraft() { padding: 0 20px; } +.credit-tip { + margin: -8px 0 12px; + font-size: 12px; + color: var(--el-text-color-secondary); +} + .dialog-footer { display: flex; justify-content: space-between; diff --git a/backend/src/views/apps/erp/dashboard/index.vue b/backend/src/views/apps/erp/dashboard/index.vue index 42eeb48..8143520 100644 --- a/backend/src/views/apps/erp/dashboard/index.vue +++ b/backend/src/views/apps/erp/dashboard/index.vue @@ -1,5 +1,5 @@