From f71a8be81a3a2e735cba931c9d8d5db23de489c4 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 22 Oct 2026 14:56:34 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-10-22 14:56:30 --- App.jsx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/App.jsx b/App.jsx index bfc2851..53463d0 100644 --- a/App.jsx +++ b/App.jsx @@ -857,6 +857,7 @@ function upsertProductByName(list, product) { webDetailImages: existing.webDetailImages, webDetailTemplateIds: existing.webDetailTemplateIds, webSockets: existing.webSockets, + webPack: existing.webPack, youtubeUrl: product.youtubeUrl ?? existing.youtubeUrl, webDescription: product.webDescription ?? existing.webDescription, webSale: product.webSale ?? existing.webSale, @@ -1043,6 +1044,7 @@ const blankProduct = () => ({ webImages: [], // 网站主图文件名,最多6张,第一张为封面;为空时网站用 productImageFileName webDetailImages: [], // 网站产品详情图,最多20张,显示在规格表下方 webSockets: [], // 离线式/在线互动式UPS:网站展示的默认插座 [{ type, count }] + webPack: { per: '', nw: '', gw: '', l: '', w: '', h: '' }, // 箱规:每箱数量、每箱净重/毛重(kg)、外箱长宽高(mm),网站按数量自动生成箱单 webDetailTemplateIds: [], // 引用的详情模板id,按顺序显示在详情图下方(模板改了,所有引用它的产品下次更新网站时一起变) youtubeUrl: '', // 网站产品视频(YouTube链接) webDescription: { en: '', es: '', ru: '' }, // 网站产品介绍:只需填英文,其他语言在网站构建时用DeepSeek自动翻译;es/ru填了就用手动译文 @@ -6368,6 +6370,39 @@ function HtmlTemplateEditor({ tpl, update, products, onNotify }) { ); } +// 箱规(所有品类通用):填了每箱数量、每箱毛重和外箱尺寸,网站产品页就按客户选的数量自动生成箱单 +function WebPackEditor({ value, onChange }) { + const v = { per: '', nw: '', gw: '', l: '', w: '', h: '', ...(value || {}) }; + const set = (patch) => onChange({ ...v, ...patch }); + const n = (x) => parseFloat(String(x).replace(',', '.')) || 0; + const per = n(v.per), nw = n(v.nw), gw = n(v.gw), box = n(v.l) * n(v.w) * n(v.h) / 1e9; + const ready = per > 0 && gw > 0 && box > 0; + const num = (k, label, ph) => ( + + ); + return ( +
+ 箱规(网站按客户选的数量自动生成箱单;不填则网站不显示箱单) +
+ {num('per', '每箱数量(台)', '20')} + {num('nw', '每箱净重(kg)', '19.00')} + {num('gw', '每箱毛重(kg)', '19.61')} + {num('l', '外箱长(mm)', '465')} + {num('w', '外箱宽(mm)', '375')} + {num('h', '外箱高(mm)', '240')} +
+
+ {!ready ? '每箱数量、每箱毛重、外箱尺寸都填上,网站才显示箱单' + : nw && gw < nw ? '! 毛重比净重还小,请检查' + : `每箱体积 ${box.toFixed(4)} m³${nw ? ` · 单台净重 ${(nw / per).toFixed(3)} kg · 纸箱 ${(gw - nw).toFixed(2)} kg` : ''} · 1000 台 = ${Math.ceil(1000 / per)} 箱 / ${(Math.ceil(1000 / per) * box).toFixed(2)} m³`} +
+
+ ); +} + // 离线式 / 在线互动式 UPS:网站上只做询价(不填价格),改为配置默认插座 const isQuoteOnlyType = (t) => isOfflineFamily(t); const WEB_SOCKET_TYPES = [ @@ -6483,6 +6518,8 @@ function WebPublishSection({ draft, set, onNotify, templates, setTemplates, prod ))} + set({ webPack: v })} /> + {isQuoteOnlyType(draft.type) ? ( set({ webSockets: v })} /> ) : (