diff --git a/App.jsx b/App.jsx index 25d9a98..7170875 100644 --- a/App.jsx +++ b/App.jsx @@ -850,6 +850,7 @@ function upsertProductByName(list, product) { webImages: existing.webImages, webDetailImages: existing.webDetailImages, webDetailTemplateIds: existing.webDetailTemplateIds, + webSockets: existing.webSockets, youtubeUrl: product.youtubeUrl ?? existing.youtubeUrl, webDescription: product.webDescription ?? existing.webDescription, webSale: product.webSale ?? existing.webSale, @@ -1035,6 +1036,7 @@ const blankProduct = () => ({ publishToWeb: false, // 是否发布到网站 webImages: [], // 网站主图文件名,最多6张,第一张为封面;为空时网站用 productImageFileName webDetailImages: [], // 网站产品详情图,最多20张,显示在规格表下方 + webSockets: [], // 离线式/在线互动式UPS:网站展示的默认插座 [{ type, count }] webDetailTemplateIds: [], // 引用的详情模板id,按顺序显示在详情图下方(模板改了,所有引用它的产品下次更新网站时一起变) youtubeUrl: '', // 网站产品视频(YouTube链接) webDescription: { en: '', es: '', ru: '' }, // 网站产品介绍:只需填英文,其他语言在网站构建时用DeepSeek自动翻译;es/ru填了就用手动译文 @@ -6053,6 +6055,41 @@ function DetailTemplateManager({ templates, setTemplates, products, onNotify, on ); } +// 离线式 / 在线互动式 UPS:网站上只做询价(不填价格),改为配置默认插座 +const isQuoteOnlyType = (t) => t === '离线式UPS' || t === '在线互动式UPS'; +const WEB_SOCKET_TYPES = [ + ['SCHUKO', 'Schuko 欧标'], ['NEMA', 'NEMA 5-15 美标'], ['UK', 'BS1363 英标'], + ['UNIVERSAL', '万用插座'], ['IEC', 'IEC C13'], ['AU', '澳标 / 国标 Type I'], +]; +const WEB_SOCKET_MAX = 10; +function WebSocketsEditor({ value, onChange }) { + const rows = Array.isArray(value) && value.length ? value : []; + const total = rows.reduce((n, r) => n + (Number(r.count) || 0), 0); + const update = (i, patch) => onChange(rows.map((r, j) => (j === i ? { ...r, ...patch } : r))); + const left = WEB_SOCKET_MAX - total; + return ( +
+ 默认插座配置(网站上展示,最多 {WEB_SOCKET_MAX} 个;客户询价时可以改成其他插座) +
这个品类在网站上只做询价,不显示价格。
+ {rows.map((r, i) => ( +
+ + { const n = Math.max(1, Math.min(Number(e.target.value) || 1, (Number(r.count) || 0) + left)); update(i, { count: n }); }} /> + 个 + +
+ ))} +
+ + WEB_SOCKET_MAX ? '#a5480b' : 'var(--ink-soft)' }}>合计 {total} / {WEB_SOCKET_MAX} 个 +
+
+ ); +} + function WebPublishSection({ draft, set, onNotify, templates, setTemplates, products }) { const desc = draft.webDescription || {}; // 还没设置过销售状态的产品:迷你UPS默认拼单,其他品类默认现货 @@ -6120,6 +6157,10 @@ function WebPublishSection({ draft, set, onNotify, templates, setTemplates, prod ))} + {isQuoteOnlyType(draft.type) ? ( + set({ webSockets: v })} /> + ) : ( + <>
网站销售状态 @@ -6164,6 +6205,8 @@ function WebPublishSection({ draft, set, onNotify, templates, setTemplates, prod
)} + + )} ); }