feat(报价单): 配送商销售价确认——展开「我方提交」待审记录可见商品明细
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s

原来展开只显示摘要(提交人/时间/N 个商品),看不到具体哪些商品在待审。
· 后端新增只读 GET /api/workflow/quote/price-proposals/:id(权限同列表、开关关 503、
  404/400 齐备、全程只 SELECT,不触发审批动作),返回 lines[](商品名/我方售价/建议售价/差额/状态);
· 前端展开 A 方向时按 id 取明细并渲染表格:差额=建议−我方(4 位小数、涨红跌绿),
  max-h-72 内部滚动、显示「共 N 条」、加载中/加载失败三态,失败不白屏、摘要仍在;
· 三语仅新增 5 个文案键(商品名/我方售价/建议售价/共 N 条/加载中…/加载失败);
· 用例:前端 14 条(渲染/滚动/加载中/失败/B 方向不额外请求)+ 后端路由 7 条;
  tsc(根+server)0 错、后端 quotePriceProposal 相关 57 通过。

注:src/pages/customers 里 QuoteVersionManagement.priceProposal.contract.test.ts 有 1 条既有失败
(HEAD 上页面 view 白名单与测试就不一致),非本次引入,未动。
This commit is contained in:
Ubuntu
2026-10-19 11:17:05 +08:00
parent c7dac8d257
commit 492ae97cc6
10 changed files with 905 additions and 15 deletions
@@ -257,11 +257,14 @@ router.post('/quote/sheets/:code/price-proposals', authMiddleware, async (req: A
applied: result.applied,
replayed: result.replayed,
mapping: result.mapping,
// BIZ-13:0/负价行不再静默丢弃,随响应暴露跳过明细
skipped: result.skipped,
});
} catch (error: any) {
return res.status(error?.status || 500).json({
error: error?.code || 'server_error',
error_description: error?.message || '提交配送商审核失败',
skipped: error?.skipped ?? undefined,
});
}
});
@@ -300,6 +303,46 @@ router.get('/quote/price-proposals', authMiddleware, async (req: AuthRequest, re
}
});
/**
* 单条提议明细(**只读**):展开行用。
*
* 列表只给 B 方向(配送商发起)的 `lines`;A 方向(我方提交)不展开明细 ⇒ 这里按 id 补,
* 带 `商品名 / 我方售价 / 建议售价 / 差额 / 状态` 需要的数据,**不写库、不触发审核动作**。
* 权限与列表一致:`customer_manage | order_manage`;开关关闭时同样 503。
*/
router.get('/quote/price-proposals/:id', authMiddleware, async (req: AuthRequest, res: Response) => {
try {
const ctx = await getWorkflowCtx(req);
requireWorkflowPermission(ctx, ['customer_manage', 'order_manage']);
if (!CHANGE_REQUEST_ID_RE.test(String(req.params.id || ''))) {
return res.status(400).json({ error: 'invalid_request', error_description: '提议 ID 无效' });
}
const { isQuotePriceProposalEnabled, getPriceProposalDetail } = await import(
'../../../services/quotePriceProposalService'
);
if (!isQuotePriceProposalEnabled()) {
return res.status(503).json({
error: 'feature_disabled',
error_description: '报价单价格传递未开启(MAIN_SYSTEM_QUOTE_PRICE_PROPOSAL)',
});
}
const branchCode = getEffectiveBranchCode(ctx, readOperatingBranchCode(req));
if (!branchCode) {
return res.status(400).json({ error: 'branch_required', error_description: '请选择当前操作分公司' });
}
const data = await getPriceProposalDetail({ id: String(req.params.id), branchCode });
if (!data) {
return res.status(404).json({ error: 'not_found', error_description: '提议不存在或不属于当前分公司' });
}
return res.json({ data });
} catch (error: any) {
return res.status(error?.status || 500).json({
error: error?.code || 'server_error',
error_description: error?.message || '加载提议明细失败',
});
}
});
router.post('/quote/price-proposals/:id/approve', authMiddleware, async (req: AuthRequest, res: Response) => {
try {
const ctx = await getWorkflowCtx(req);