feat: 价格试算模块优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 05 入库与导出(docs/v2.1/trial-page.md §7):
|
||||
* 入库即各区块自动落库;此处提供 本商品CSV / 批量CSV(16 列,对齐 v1 web)与 组合码(SKU 预留₽价)。
|
||||
* 入库即各区块自动落库;此处提供 本商品CSV / 批量CSV(16 列,对齐 v1 web)与 组合码(SKU 划线₽价)。
|
||||
* Phase A 由前端拼装(逐个拉详情),Phase D 可换 GET /api/export/trial-csv。
|
||||
*/
|
||||
import { useState } from 'react';
|
||||
@@ -50,11 +50,11 @@ function buildRow(p: ProductDetail): Array<string | number | null> {
|
||||
];
|
||||
}
|
||||
|
||||
/** 组合码一行:`货号 预留₽价(两位)`,无预留价回退销售价₽ */
|
||||
/** 组合码一行:`货号 划线₽价(两位)`,无划线价回退销售价₽ */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function comboCode(p: ProductDetail): string {
|
||||
const pr = (p.pricing ?? {}) as Record<string, any>;
|
||||
const rub = pr.reservedPriceRub ?? pr.sellingPriceRub;
|
||||
const rub = pr.linePriceRub ?? pr.reservedPriceRub ?? pr.sellingPriceRub;
|
||||
if (!p.offer_id || rub == null) return '';
|
||||
return `${p.offer_id} ${Number(rub).toFixed(2)}`;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export default function TrialExportPanel({ product }: Props) {
|
||||
const copyCurrentCombo = async () => {
|
||||
const code = comboCode(product);
|
||||
if (!code) {
|
||||
message.warning('缺少货号或计价结果(卢布预留价)');
|
||||
message.warning('缺少货号或计价结果(卢布划线价)');
|
||||
return;
|
||||
}
|
||||
const ok = await copyText(code);
|
||||
@@ -141,7 +141,7 @@ export default function TrialExportPanel({ product }: Props) {
|
||||
const list = await fetchAllPricedProducts();
|
||||
const lines = list.map(comboCode).filter(Boolean);
|
||||
if (lines.length === 0) {
|
||||
message.warning('没有可用的组合码(需要货号 + 卢布预留价)');
|
||||
message.warning('没有可用的组合码(需要货号 + 卢布划线价)');
|
||||
return;
|
||||
}
|
||||
setComboText(lines.join('\n'));
|
||||
@@ -188,7 +188,7 @@ export default function TrialExportPanel({ product }: Props) {
|
||||
</Space>
|
||||
|
||||
<Text type="secondary" style={{ fontSize: 12, display: 'block', marginTop: 12 }}>
|
||||
组合码格式:`货号 预留₽价`(无预留价回退销售价₽),用于 Ozon 后台批量改价;
|
||||
组合码格式:`货号 划线₽价`(无划线价回退销售价₽),用于 Ozon 后台批量改价;
|
||||
CSV 为 16 列(对齐 v1 工具台),UTF-8 BOM 编码可直接用 Excel 打开。
|
||||
</Text>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user