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
+6
View File
@@ -201,6 +201,12 @@ export const quotes: MessageDict = {
'priceProposal.col.unit': 'Unit',
'priceProposal.col.before': 'Before',
'priceProposal.col.after': 'After',
'priceProposal.col.productName': 'Item name',
'priceProposal.col.ourPrice': 'Our price',
'priceProposal.col.suggestedPrice': 'Suggested price',
'priceProposal.detailCount': '{n} item(s) in total',
'priceProposal.detailLoading': 'Loading…',
'priceProposal.detailLoadFail': 'Failed to load',
'priceProposal.expand': 'Expand',
'priceProposal.collapse': 'Collapse',
'priceProposal.title': 'Delivery sale price confirmation',
+6
View File
@@ -206,6 +206,12 @@ export const quotes: MessageDict = {
'priceProposal.col.unit': 'Satuan',
'priceProposal.col.before': 'Sebelum',
'priceProposal.col.after': 'Sesudah',
'priceProposal.col.productName': 'Nama barang',
'priceProposal.col.ourPrice': 'Harga kami',
'priceProposal.col.suggestedPrice': 'Harga saran',
'priceProposal.detailCount': 'Total {n} barang',
'priceProposal.detailLoading': 'Memuat…',
'priceProposal.detailLoadFail': 'Gagal memuat',
'priceProposal.expand': 'Buka',
'priceProposal.collapse': 'Tutup',
'priceProposal.title': 'Konfirmasi harga jual pengiriman',
+6
View File
@@ -197,6 +197,12 @@ export const quotes: MessageDict = {
'priceProposal.col.unit': '单位',
'priceProposal.col.before': '原价',
'priceProposal.col.after': '新价',
'priceProposal.col.productName': '商品名',
'priceProposal.col.ourPrice': '我方售价',
'priceProposal.col.suggestedPrice': '建议售价',
'priceProposal.detailCount': '共 {n} 条',
'priceProposal.detailLoading': '加载中…',
'priceProposal.detailLoadFail': '加载失败',
'priceProposal.expand': '展开',
'priceProposal.collapse': '收起',
'priceProposal.title': '配送商销售价确认',
@@ -0,0 +1,127 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
/**
* 「配送商销售价确认 → 展开我方提交待审记录」的**接线契约**(2026-10-19):
* · 后端新增只读端点 `GET /api/workflow/quote/price-proposals/:id`(仅查看权限、开关关 503、
* 不存在 404),服务层按 `branch_code` 收口并补齐 A 方向明细行;
* · 前端 API 走 `preserveErrorBody` 新增 `getQuotePriceProposalApi`;
* · 面板展开 A 方向时按 id 取明细,渲染 `商品名 / 我方售价 / 建议售价 / 差额 / 状态`,
* 差额保留 4 位小数、44 行放进 `max-h-72 + overflow-y-auto` 容器并显示「共 N 条」;
* · 文案只用给定中文(en/id 直译)。
*
* 渲染行为在 `QuoteDeliveryPriceProposalsPanel.detail.test.tsx`(jsdom)里验证,这里钉接线与文案。
*/
const read = (relative: string) => readFileSync(new URL(relative, import.meta.url), 'utf8');
const panel = read('./QuoteDeliveryPriceProposalsPanel.tsx');
const api = read('../../utils/workflowApi.ts');
const routes = read('../../../server/src/modules/workflow/routes/quoteRoutes.ts');
const service = read('../../../server/src/services/quotePriceProposalService.ts');
const zh = read('../../i18n/locales/zh-CN/quotes.ts');
const en = read('../../i18n/locales/en/quotes.ts');
const idLocale = read('../../i18n/locales/id/quotes.ts');
describe('后端:按 proposal id 取明细(只读)', () => {
it('新增 GET /quote/price-proposals/:id,权限同列表,开关关 503、无分公司 400、不存在 404', () => {
const start = routes.indexOf("router.get('/quote/price-proposals/:id'");
expect(start).toBeGreaterThan(-1);
const block = routes.slice(start, start + 1600);
expect(block).toContain('authMiddleware');
expect(block).toContain("requireWorkflowPermission(ctx, ['customer_manage', 'order_manage'])");
expect(block).toContain('getPriceProposalDetail');
expect(block).toContain("error: 'feature_disabled'");
expect(block).toContain("error: 'branch_required'");
expect(block).toContain("error: 'not_found'");
// 只读:这一段里不得出现会改库的服务调用
expect(block).not.toContain('approvePriceProposal');
expect(block).not.toContain('rejectPriceProposal');
expect(block).not.toContain('submitPriceProposal');
});
it('服务层按 id + 分公司取一条,按方向补 lines;A 方向行带「我方售价 / 建议售价 / 状态」', () => {
expect(service).toContain('export async function getPriceProposalDetail');
expect(service).toContain('WHERE p.id = $1::uuid AND p.branch_code = $2');
expect(service).toContain('async function attachOutgoingLines');
expect(service).toContain('async function attachProposalLines');
// 建议售价 = 提议价;我方售价 = 当前报价单明细价
expect(service).toMatch(/after_sale_price: roundPrice\(item\.price\)/);
expect(service).toMatch(/before_sale_price: sheetRow \? readSheetPrice\(sheetRow\) : null/);
// 行状态沿用提议状态
expect(service).toMatch(/status: row\.status/);
// 仅对 to_delivery 生效(不改变 B 方向的既有 lines 计算)
expect(service).toMatch(/rows\.filter\(\(row\) => row\.direction === 'to_delivery'\)/);
});
});
describe('前端 API 契约', () => {
it('getQuotePriceProposalApi 调只读详情端点并透出后端原文', () => {
expect(api).toContain('export async function getQuotePriceProposalApi');
expect(api).toContain('/quote/price-proposals/${encodeURIComponent(id)}');
expect(api).toContain('preserveErrorBody: true');
// lines DTO 增加行状态
expect(api).toMatch(/status\?: 'pending' \| 'approved' \| 'rejected' \| 'cancelled' \| 'superseded'/);
});
});
describe('面板:展开 A 方向时加载并渲染明细表', () => {
it('只在展开「我方提交」行时请求明细(B 方向沿用列表 lines)', () => {
expect(panel).toContain('getQuotePriceProposalApi');
expect(panel).toMatch(/if \(willOpen && row\.direction !== 'from_delivery'\) void loadDetail\(row\.id\);/);
});
it('五列表头 + 共 N 条 + 加载中/加载失败文案', () => {
for (const key of [
'col.productName',
'col.ourPrice',
'col.suggestedPrice',
'col.diff',
'col.status',
]) {
expect(panel).toContain(`t('quotes.priceProposal.${key}')`);
}
expect(panel).toContain("t('quotes.priceProposal.detailCount', { n: lines.length })");
expect(panel).toContain("t('quotes.priceProposal.detailLoading')");
expect(panel).toContain("t('quotes.priceProposal.detailLoadFail')");
});
it('差额 = 建议 − 我方、保留 4 位小数、正负着色沿用既有风格', () => {
expect(panel).toContain('after - before');
expect(panel).toContain('diff.toFixed(4)');
expect(panel).toContain("diff > 0\n");
// 与既有明细同一套颜色:涨红 / 跌绿
expect(panel).toContain('text-red-600');
expect(panel).toContain('text-emerald-600');
});
it('44 行放进最大高度 + 纵向滚动容器(不撑爆弹窗)', () => {
expect(panel).toContain('data-testid="proposal-detail-scroll"');
expect(panel).toContain('max-h-72');
expect(panel).toContain('overflow-y-auto');
});
});
describe('i18n:只用给定中文,en/id 直译', () => {
it('zh-CN 六个新文案逐字一致', () => {
expect(zh).toContain("'priceProposal.col.productName': '商品名'");
expect(zh).toContain("'priceProposal.col.ourPrice': '我方售价'");
expect(zh).toContain("'priceProposal.col.suggestedPrice': '建议售价'");
expect(zh).toContain("'priceProposal.detailCount': '共 {n} 条'");
expect(zh).toContain("'priceProposal.detailLoading': '加载中…'");
expect(zh).toContain("'priceProposal.detailLoadFail': '加载失败'");
// 「差额 / 状态」复用既有 key,未另造文案
expect(zh).toContain("'priceProposal.col.diff': '差额'");
expect(zh).toContain("'priceProposal.col.status': '状态'");
});
it('en / id 同步直译(同一组 key,无缺项)', () => {
for (const locale of [en, idLocale]) {
expect(locale).toContain("'priceProposal.col.productName':");
expect(locale).toContain("'priceProposal.col.ourPrice':");
expect(locale).toContain("'priceProposal.col.suggestedPrice':");
expect(locale).toContain("'priceProposal.detailCount':");
expect(locale).toContain("'priceProposal.detailLoading':");
expect(locale).toContain("'priceProposal.detailLoadFail':");
}
});
});
@@ -0,0 +1,241 @@
// @vitest-environment jsdom
import React from 'react';
import { cleanup, fireEvent, render, screen } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
/**
* 「配送商销售价确认」展开行:**我方提交(A 方向)待审提议的商品明细**(2026-10-19)。
*
* 背景:列表接口只给 B 方向(配送商发起)的 `lines`,A 方向只显示摘要(提交人/时间/44 个商品)。
* 现在展开 A 方向时按 id 调只读明细接口,渲染
* `商品名 / 我方售价 / 建议售价 / 差额 / 状态`,44 行放进最大高度 + 纵向滚动容器,并显示「共 N 条」。
*
* 契约:
* · 展开 ⇒ 调 `getQuotePriceProposalApi(id)`,字段按行渲染,差额 = 建议 − 我方(4 位小数、正负着色);
* · 明细区有 `max-h-72 + overflow-y-auto` 滚动容器(不把弹窗撑爆);
* · 加载中 ⇒ 「加载中…」;失败 ⇒ 「加载失败」(摘要仍在,不白屏、不弹 toast);
* · 配送商发起行沿用列表 `lines`,**不**额外请求明细接口(不改既有审批面)。
*/
const listApi = vi.fn();
const detailApi = vi.fn();
const notify = vi.hoisted(() => ({ success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn() }));
vi.mock('../../utils/notify', () => ({ notify }));
vi.mock('../../utils/workflowApi', () => ({
listQuotePriceProposalsApi: (...args: unknown[]) => listApi(...args),
getQuotePriceProposalApi: (...args: unknown[]) => detailApi(...args),
approveQuotePriceProposalApi: vi.fn(),
rejectQuotePriceProposalApi: vi.fn(),
}));
vi.mock('../../i18n', async () => {
const { quotes } = (await import('../../i18n/locales/zh-CN/quotes')) as unknown as {
quotes: Record<string, string>;
};
const { common } = (await import('../../i18n/locales/zh-CN/common')) as unknown as {
common: Record<string, string>;
};
const dict: Record<string, string> = {};
for (const [key, value] of Object.entries(quotes)) dict[`quotes.${key}`] = value;
for (const [key, value] of Object.entries(common)) dict[`common.${key}`] = value;
const t = (key: string, vars?: Record<string, unknown>) => {
const raw = dict[key] ?? key;
if (!vars) return raw;
return Object.entries(vars).reduce(
(acc, [name, value]) => acc.replace(new RegExp(`\\{${name}\\}`, 'g'), String(value)),
raw
);
};
return { useT: () => t };
});
import { QuoteDeliveryPriceProposalsPanel } from './QuoteDeliveryPriceProposalsPanel';
const LINES = Array.from({ length: 44 }, (_, index) => {
if (index === 0) {
return {
sku_code: 'SKU1',
sku_name: '草鱼',
unit: '斤',
before_sale_price: 10,
after_sale_price: 11.125,
change: 'updated' as const,
status: 'pending' as const,
};
}
if (index === 1) {
return {
sku_code: 'SKU2',
sku_name: '鲤鱼',
unit: '袋',
before_sale_price: 10.1,
after_sale_price: 9.9,
change: 'updated' as const,
status: 'pending' as const,
};
}
return {
sku_code: `SKU${index + 1}`,
sku_name: `商品${index + 1}`,
unit: '斤',
before_sale_price: 10,
after_sale_price: 10,
change: 'updated' as const,
status: 'pending' as const,
};
});
/** 我方提交、待审、44 个商品:列表只给摘要(修复前展开只看得到「44 个商品」) */
const OUTGOING = {
id: '22222222-2222-4222-8222-222222222222',
branch_code: 'BR002',
quote_sheet_code: 'QS2492200796033OTHER',
main_branch_code: 'BR002',
direction: 'to_delivery' as const,
items: LINES.map((line) => ({ sku_code: line.sku_code, unit: line.unit, price: line.after_sale_price })),
status: 'pending' as const,
reject_reason: null,
remote_proposal_id: 'remote-2',
requested_by_name: '张三',
requested_at: '2026-10-15T02:00:00.000Z',
reviewed_by_name: null,
reviewed_at: null,
applied_at: null,
waited_days: 3,
};
const INCOMING = {
id: '11111111-1111-4111-8111-111111111111',
branch_code: 'BR002',
quote_sheet_code: 'QS1792200796033LUTV',
main_branch_code: 'BR002',
direction: 'from_delivery' as const,
items: [{ sku_code: 'SKU1', unit: '斤', price: 11 }],
status: 'pending' as const,
reject_reason: null,
remote_proposal_id: 'remote-1',
requested_by_name: '配送商甲',
requested_at: '2026-10-15T02:00:00.000Z',
reviewed_by_name: null,
reviewed_at: null,
applied_at: null,
waited_days: 3,
lines: [
{
sku_code: 'SKU1',
sku_name: '草鱼',
unit: '斤',
before_sale_price: 10,
after_sale_price: 11,
change: 'updated' as const,
},
],
};
const expandButton = () => screen.getByRole('button', { name: '展开' });
beforeEach(() => {
listApi.mockReset();
detailApi.mockReset();
notify.error.mockReset();
notify.success.mockReset();
listApi.mockResolvedValue({ data: [OUTGOING], sync: null });
detailApi.mockResolvedValue({ data: { ...OUTGOING, lines: LINES } });
});
afterEach(() => {
cleanup();
});
describe('我方提交待审提议 · 展开显示商品明细', () => {
it('展开 ⇒ 调只读明细接口,渲染 44 行「商品名 / 我方售价 / 建议售价 / 差额 / 状态」', async () => {
render(<QuoteDeliveryPriceProposalsPanel canApprove />);
await screen.findByText('QS2492200796033OTHER');
fireEvent.click(expandButton());
expect(await screen.findByText('草鱼')).toBeTruthy();
expect(detailApi).toHaveBeenCalledTimes(1);
expect(detailApi).toHaveBeenCalledWith(OUTGOING.id);
// 共 N 条 + 表头(只用给定中文文案)
expect(screen.getByText('共 44 条')).toBeTruthy();
expect(screen.getByText('商品名')).toBeTruthy();
expect(screen.getByText('我方售价')).toBeTruthy();
expect(screen.getByText('建议售价')).toBeTruthy();
expect(screen.getByText('差额')).toBeTruthy();
// 字段渲染:我方售价 / 建议售价(沿用面板既有 2 位小数格式)
expect(screen.getAllByText('10.00').length).toBeGreaterThan(1);
expect(screen.getByText('11.13')).toBeTruthy();
expect(screen.getByText('10.10')).toBeTruthy();
expect(screen.getByText('9.90')).toBeTruthy();
// 差额 = 建议 − 我方,保留 4 位小数,正负着色沿用页面既有风格
const plus = screen.getByText('+1.1250');
const minus = screen.getByText('-0.2000');
expect(plus.className).toContain('text-red-600');
expect(minus.className).toContain('text-emerald-600');
// 行状态(列表行状态还带「已等待」,明细行 44 条都是「待审」)
expect(screen.getAllByText('待审')).toHaveLength(44);
});
it('44 行明细放在最大高度 + 纵向滚动容器里(不撑爆弹窗)', async () => {
render(<QuoteDeliveryPriceProposalsPanel canApprove />);
await screen.findByText('QS2492200796033OTHER');
fireEvent.click(expandButton());
await screen.findByText('草鱼');
const scroll = screen.getByTestId('proposal-detail-scroll');
expect(scroll.className).toContain('max-h-72');
expect(scroll.className).toContain('overflow-y-auto');
// 44 行都在同一个滚动容器内(靠 max-height 裁切 + 滚动,而不是分页丢行)
expect(screen.getAllByTestId('proposal-detail-row')).toHaveLength(44);
expect(scroll.contains(screen.getAllByTestId('proposal-detail-row')[43])).toBe(true);
});
it('加载中 ⇒ 显示「加载中…」,返回后替换为明细表', async () => {
let resolveDetail: (value: unknown) => void = () => {};
detailApi.mockImplementation(
() =>
new Promise((resolve) => {
resolveDetail = resolve;
})
);
render(<QuoteDeliveryPriceProposalsPanel canApprove />);
await screen.findByText('QS2492200796033OTHER');
fireEvent.click(expandButton());
expect(await screen.findByText('加载中…')).toBeTruthy();
resolveDetail({ data: { ...OUTGOING, lines: LINES } });
expect(await screen.findByText('草鱼')).toBeTruthy();
expect(screen.queryByText('加载中…')).toBeNull();
});
it('明细接口失败 ⇒ 展开区显示「加载失败」,摘要仍在、不白屏、不弹 toast', async () => {
detailApi.mockRejectedValue(new Error('加载提议明细失败'));
render(<QuoteDeliveryPriceProposalsPanel canApprove />);
await screen.findByText('QS2492200796033OTHER');
fireEvent.click(expandButton());
expect(await screen.findByText('加载失败')).toBeTruthy();
// 摘要(提交人/提交时间)没有被错误态吞掉
expect(screen.getByText(/提交人/)).toBeTruthy();
expect(screen.getByText(/张三/)).toBeTruthy();
// 展开失败不该弹全局 toast(复用列表页的错误处理风格,只在本行显示)
expect(notify.error).not.toHaveBeenCalled();
});
it('配送商发起行沿用列表 lines,不额外请求明细接口(既有审批面不变)', async () => {
listApi.mockResolvedValue({ data: [INCOMING], sync: null });
render(<QuoteDeliveryPriceProposalsPanel canApprove />);
await screen.findByText('QS1792200796033LUTV');
fireEvent.click(expandButton());
expect(await screen.findByText('草鱼')).toBeTruthy();
expect(screen.getByText('11.00')).toBeTruthy();
expect(detailApi).not.toHaveBeenCalled();
});
});
@@ -4,6 +4,7 @@ import { notify } from '../../utils/notify';
import { useT } from '../../i18n';
import {
approveQuotePriceProposalApi,
getQuotePriceProposalApi,
listQuotePriceProposalsApi,
rejectQuotePriceProposalApi,
type QuotePriceProposalDto,
@@ -132,7 +133,39 @@ export const QuoteDeliveryPriceProposalsPanel: React.FC<QuoteDeliveryPricePropos
};
const [expanded, setExpanded] = useState<Record<string, boolean>>({});
const toggle = (id: string) => setExpanded((prev) => ({ ...prev, [id]: !prev[id] }));
/**
* 展开行明细:列表只给 B 方向(配送商发起)的 `lines`;A 方向(我方提交)按 id 现取。
* 只读展示,失败只在展开区内显示「加载失败」,不弹 toast、不白屏。
*/
const [details, setDetails] = useState<
Record<string, { loading: boolean; error: string | null; data: QuotePriceProposalDto | null }>
>({});
const loadDetail = useCallback(
async (id: string) => {
setDetails((prev) => ({ ...prev, [id]: { loading: true, error: null, data: null } }));
try {
const { data } = await getQuotePriceProposalApi(id);
setDetails((prev) => ({ ...prev, [id]: { loading: false, error: null, data: data || null } }));
} catch (error: any) {
setDetails((prev) => ({
...prev,
[id]: {
loading: false,
error: error?.message || t('quotes.priceProposal.detailLoadFail'),
data: null,
},
}));
}
},
[t]
);
const toggle = (row: QuotePriceProposalDto) => {
const willOpen = !expanded[row.id];
setExpanded((prev) => ({ ...prev, [row.id]: willOpen }));
if (willOpen && row.direction !== 'from_delivery') void loadDetail(row.id);
};
return (
<div className="space-y-3">
@@ -182,7 +215,7 @@ export const QuoteDeliveryPriceProposalsPanel: React.FC<QuoteDeliveryPricePropos
<td className="px-2 py-1.5">
<button
type="button"
onClick={() => toggle(row.id)}
onClick={() => toggle(row)}
className="inline-flex items-center gap-1 text-xs text-gray-600 dark:text-gray-300"
>
{open ? <ChevronUp className="w-3.5 h-3.5" /> : <ChevronDown className="w-3.5 h-3.5" />}
@@ -303,11 +336,105 @@ export const QuoteDeliveryPriceProposalsPanel: React.FC<QuoteDeliveryPricePropos
))}
</tbody>
</table>
) : (
) : isIncoming ? (
<div className="text-xs text-gray-500">
{t('quotes.priceProposal.itemCount', { count: row.items.length })}
</div>
)}
) : (() => {
// 我方提交(A 方向):展开时按 id 取明细,只读渲染,不触发审核动作
const detail = details[row.id];
if (!detail || detail.loading) {
return (
<div className="text-xs text-gray-500">
{t('quotes.priceProposal.detailLoading')}
</div>
);
}
if (detail.error) {
return (
<div className="text-xs text-red-600" title={detail.error}>
{t('quotes.priceProposal.detailLoadFail')}
</div>
);
}
const lines = detail.data?.lines || [];
return (
<div className="space-y-1">
<div className="text-xs text-gray-500">
{t('quotes.priceProposal.detailCount', { n: lines.length })}
</div>
<div
className="max-h-72 overflow-y-auto rounded border border-gray-200 dark:border-gray-700"
data-testid="proposal-detail-scroll"
>
<table className="min-w-full text-xs">
<thead className="sticky top-0 bg-gray-50 text-left text-gray-500 dark:bg-gray-700/50">
<tr>
<th className="px-1 py-0.5">
{t('quotes.priceProposal.col.productName')}
</th>
<th className="px-1 py-0.5 text-right">
{t('quotes.priceProposal.col.ourPrice')}
</th>
<th className="px-1 py-0.5 text-right">
{t('quotes.priceProposal.col.suggestedPrice')}
</th>
<th className="px-1 py-0.5 text-right">
{t('quotes.priceProposal.col.diff')}
</th>
<th className="px-1 py-0.5">
{t('quotes.priceProposal.col.status')}
</th>
</tr>
</thead>
<tbody>
{lines.map((line) => {
const before =
line.before_sale_price == null ? null : Number(line.before_sale_price);
const after =
line.after_sale_price == null ? null : Number(line.after_sale_price);
const diff =
before == null || after == null || !Number.isFinite(after - before)
? null
: after - before;
return (
<tr key={`${line.change}-${line.sku_code}`} data-testid="proposal-detail-row">
<td className="px-1 py-0.5">{line.sku_name || line.sku_code}</td>
<td className="px-1 py-0.5 text-right tabular-nums">
{formatPrice(line.before_sale_price)}
</td>
<td className="px-1 py-0.5 text-right tabular-nums">
{formatPrice(line.after_sale_price)}
</td>
<td
className={`px-1 py-0.5 text-right tabular-nums ${
diff == null
? 'text-gray-400'
: diff > 0
? 'text-red-600'
: diff < 0
? 'text-emerald-600'
: ''
}`}
>
{diff == null
? '—'
: `${diff > 0 ? '+' : ''}${diff.toFixed(4)}`}
</td>
<td className="px-1 py-0.5">
{line.change === 'unmapped'
? t('quotes.priceProposal.unmapped')
: statusLabel(line.status || row.status)}
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</div>
);
})()}
{row.reject_reason ? (
<div className="text-xs text-red-600">
{t('quotes.priceProposal.rejectReason')}:{row.reject_reason}
+11
View File
@@ -2760,6 +2760,8 @@ export type QuotePriceProposalDto = {
supplier_sku_code?: string | null;
delivery_sku_code?: string | null;
delivery_sku_name?: string | null;
/** 行状态(详情接口给;沿用提议状态,前端用现有状态文案渲染) */
status?: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'superseded';
}>;
};
@@ -2874,6 +2876,15 @@ export async function listQuotePriceProposalsApi(options?: {
);
}
/** 单条提议 + 明细行(**只读**):列表只给 B 方向的 `lines`,展开 A 方向(我方提交)时按 id 取。 */
export async function getQuotePriceProposalApi(id: string) {
return workflowFetch<{ data: QuotePriceProposalDto }>(
`/quote/price-proposals/${encodeURIComponent(id)}`,
{},
{ preserveErrorBody: true }
);
}
/** 方向 B 通过:按行写我方 sale_price + rearm 推配送 cost_price + D3 回执 */
export async function approveQuotePriceProposalApi(id: string) {
return workflowFetch<{