From d493486b76bc5408ec1dd3ff905da872e3fa3d3c Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 21 Aug 2026 10:02:16 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-08-21 10:01:57 --- App.jsx | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/App.jsx b/App.jsx index f4cc93c..5916b6e 100644 --- a/App.jsx +++ b/App.jsx @@ -766,6 +766,8 @@ function upsertProductByName(list, product) { id: existing.id, productImageFileName: existing.productImageFileName, productImageOriginalName: existing.productImageOriginalName, + brochureFileName: existing.brochureFileName, + brochureOriginalName: existing.brochureOriginalName, sellingPoints: existing.sellingPoints, costPrice: existing.costPrice, notes: existing.notes, @@ -931,6 +933,7 @@ const blankProduct = () => ({ extraSpecs: [], // 动态兜底参数:AI识别到但不在上面任何具名字段里的参数,原样保留 {label, value},如 [{label:'浮充电压', value:'13.7VDC/节'}] backPanelTemplateId: '', // 引用的后板图模板id(可跨产品共用同一个模板),迷你UPS不适用 productImageFileName: '', productImageOriginalName: '', // 产品主图,导出多语言PDF时展示 + brochureFileName: '', brochureOriginalName: '', // 原版彩页(厂家原始彩页PDF/图片),只做保存和下载,不参与PDF导出排版 sellingPoints: '', // 对客卖点/主要特点,每行一条,专门给客户看的(和下面的costPrice/notes内部信息彻底分开,不会一起导出) costPrice: '', notes: '', }); @@ -1748,6 +1751,7 @@ const Styles = () => ( color: var(--ink-soft); font-size: 13px; cursor: pointer; transition: border-color 0.15s, color 0.15s; } .tax-add-category:hover { border-color: var(--blue); color: var(--blue); } + .brochure-file-chip { width: 40px; height: 40px; border-radius: 8px; background: var(--copper-soft); color: var(--copper); display: flex; align-items: center; justify-content: center; flex-shrink: 0; } .catalog-view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; } .cert-view-head { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 14px; } .cert-add-btn { @@ -4924,6 +4928,25 @@ function ProductForm({ draft, setDraft, onSave, onCancel, categories, onManage, try { await deleteFile(draft.id, draft.productImageFileName); } catch (e) {} set({ productImageFileName: '', productImageOriginalName: '' }); } + const [brochureUploading, setBrochureUploading] = useState(false); + async function handleBrochurePick(file) { + if (!file) return; + setBrochureUploading(true); + try { + const res = await uploadFile(draft.id, file); + set({ brochureFileName: res.fileName, brochureOriginalName: res.originalName }); + } catch (e) { + if (onNotify) onNotify('彩页上传失败,请重试'); + } finally { + setBrochureUploading(false); + } + } + async function handleBrochureRemove() { + if (!draft.brochureFileName) return; + if (!window.confirm('确定删除已上传的原版彩页?')) return; + try { await deleteFile(draft.id, draft.brochureFileName); } catch (e) {} + set({ brochureFileName: '', brochureOriginalName: '' }); + } function addExtraName() { set({ extraNames: [...extraNames, ''] }); } function updateExtraName(idx, val) { const arr = [...extraNames]; arr[idx] = val; set({ extraNames: arr }); } function removeExtraName(idx) { set({ extraNames: extraNames.filter((_, i) => i !== idx) }); } @@ -5380,6 +5403,33 @@ function ProductForm({ draft, setDraft, onSave, onCancel, categories, onManage, )} +
+
+ 原版彩页(可选,保存厂家原始彩页文件,支持PDF/图片,仅用于保存和下载) +
+ {draft.brochureFileName ? ( +
+
+ +
+ {draft.brochureOriginalName} + + +
+ ) : ( + + )} +
+
其他参数(AI识别到、但暂未收录成正式字段的参数,原样保留,也会显示在详情页和多语言PDF导出里) {(draft.extraSpecs || []).map((item, idx) => ( @@ -5478,6 +5528,17 @@ function ProductDetail({ product: p, onEdit, onDelete, categories, exportLang, o
)} + {p.brochureFileName && ( +
+ 原版彩页 + + {p.brochureOriginalName || '下载原版彩页'} + +
+ )} {p.notes &&
备注
{p.notes}
}