From 608085bc3e25333b55e18017afb152b2d90d5fc0 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 14 Nov 2026 12:53:49 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-11-14 12:53:30 --- App.jsx | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/App.jsx b/App.jsx index daa2c59..5120713 100644 --- a/App.jsx +++ b/App.jsx @@ -5,7 +5,7 @@ import { Building2, Globe, Phone, Save, RefreshCw, LayoutDashboard, Users, Package, Layers, Zap, Tag, Inbox, Paperclip, Menu, LogOut, GripVertical, BookOpen, FileText, FolderTree, Lock, Sparkles, Printer, Image as ImageIcon, - ShieldCheck, Settings2, Boxes, Download, Wifi, Radio, QrCode, Folder, FolderPlus, Factory, UploadCloud, ClipboardList, MessageCircle, CalendarDays, MapPin + ShieldCheck, Settings2, Boxes, Download, Wifi, Radio, QrCode, Folder, FolderPlus, Factory, UploadCloud, ClipboardList, MessageCircle, CalendarDays, MapPin, Wrench, Hash } from 'lucide-react'; import { MicUploadPage } from './mic-upload/MicUploadPage'; import { ImageToolPage } from './mic-upload/ImageToolPage'; @@ -2186,6 +2186,18 @@ const Styles = () => ( .web-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 11px; font-weight: 500; color: #1d7a3e; background: #dcf1e2; padding: 2px 8px; border-radius: 99px; } .visit-card { display: grid; grid-template-columns: 120px 1fr 150px; gap: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel); } .visit-card.no-lic { grid-template-columns: 120px 1fr; } + .svc-card { grid-template-columns: 150px 1fr 150px; } + .svc-card.no-lic { grid-template-columns: 150px 1fr; } + .svc-ref { font: 700 13px 'IBM Plex Mono', monospace; letter-spacing: .02em; } + .visit-st.svc-st-new { background: #fee2e2; color: #991b1b; } + .visit-st.svc-st-processing { background: #dbeafe; color: #1e40af; } + .visit-st.svc-st-waiting { background: #fef3c7; color: #92400e; } + .visit-st.svc-st-resolved { background: #dcfce7; color: #166534; } + .svc-run { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; margin-top: 4px; } + .svc-run.run-no { background: #fee2e2; color: #991b1b; } .svc-run.run-partial { background: #fef3c7; color: #92400e; } .svc-run.run-yes { background: #eef2f7; color: #475467; } + .svc-code { font: 600 12px 'IBM Plex Mono', monospace; background: #fef1ef; color: #b42318; padding: 1px 7px; border-radius: 5px; } + .svc-sn { font: 12px 'IBM Plex Mono', monospace; background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; } + .visit-card.st-resolved, .visit-card.st-closed { opacity: .7; } .visit-card.focus { box-shadow: 0 0 0 2px #2563eb; } .visit-card.st-done, .visit-card.st-cancelled { opacity: .7; } .visit-when { text-align: center; border-right: 1px dashed var(--line); padding-right: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; } @@ -2479,6 +2491,7 @@ const NAV_GROUPS = [ { id: 'website', label: '网站管理', icon: Globe, children: [ { id: 'webnews', label: '新闻 / 动态', icon: FileText }, { id: 'webvisits', label: '预约拜访', icon: CalendarDays }, + { id: 'webservice', label: '售后服务', icon: Wrench }, ] }, { id: 'backpanel', label: '后板图模板', icon: Settings2 }, { id: 'mic-upload', label: 'MIC产品上传', icon: UploadCloud }, @@ -2605,7 +2618,8 @@ function MainApp({ username, onLogout }) { const chatLinkSid = useMemo(() => { try { return new URLSearchParams(window.location.search).get('chat') || null; } catch (e) { return null; } }, []); // 推送消息里的链接 /?visit=预约id → 打开"网站管理 → 预约拜访"并定位到这条 const visitLinkId = useMemo(() => { try { return new URLSearchParams(window.location.search).get('visit') || null; } catch (e) { return null; } }, []); - const [view, setView] = useState(chatLinkSid ? 'chat' : visitLinkId ? 'webvisits' : 'monitor'); + const serviceLinkId = useMemo(() => { try { return new URLSearchParams(window.location.search).get('service') || null; } catch (e) { return null; } }, []); + const [view, setView] = useState(chatLinkSid ? 'chat' : visitLinkId ? 'webvisits' : serviceLinkId ? 'webservice' : 'monitor'); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [selectedId, setSelectedId] = useState(null); @@ -4362,6 +4376,10 @@ function MainApp({ username, onLogout }) { }} /> )} + {view === 'webservice' && ( + + )} + {view === 'webvisits' && ( { @@ -10644,6 +10662,99 @@ function VisitManager({ onNotify, onSaveCustomer, focusId }) { ); } +/* ------------------------------ 售后服务申请(网站 /service/ 页面提交) ------------------------------ */ +const SVC_STATUS_ZH = { new: '新申请', processing: '处理中', waiting: '等客户回复', resolved: '已解决', closed: '已关闭' }; +const SVC_ISSUE_ZH = { no_power: '无法开机 / 无输出', alarm: '报警 / 故障代码', battery: '电池问题', no_backup: '断电不切换 / 后备时间短', noise: '异响 / 发热 / 异味', install: '安装 / 调试 / 设置', parts: '需要备件', warranty: '保修咨询', other: '其他' }; +const SVC_RUNNING_ZH = { yes: '还在运行', partial: '部分功能可用', no: '已停机' }; +const SVC_CHANNEL_ZH = { direct: '直接从 SKE 购买', distributor: '经销商', other: '其他渠道' }; +function ServiceManager({ onNotify, focusId }) { + const [list, setList] = useState(null); + const [filter, setFilter] = useState('open'); + const [q, setQ] = useState(''); + const [memo, setMemo] = useState({}); + const load = async () => { try { const j = await chApi('GET', '/api/chat/admin/services'); setList(j.list || []); } catch (e) { setList([]); onNotify('读取售后申请失败:' + e.message); } }; + useEffect(() => { load(); const t = setInterval(load, 60000); return () => clearInterval(t); }, []); + useEffect(() => { if (focusId && list) { const el = document.getElementById('svc-' + focusId); if (el) el.scrollIntoView({ block: 'center' }); } }, [focusId, list && list.length]); + const patch = async (v, body, msg) => { + try { const j = await chApi('POST', `/api/chat/admin/services/${v.id}`, body); setList(l => l.map(x => (x.id === v.id ? j.item : x))); if (msg) onNotify(msg); } + catch (e) { onNotify('保存失败:' + e.message); } + }; + const del = async (v) => { + if (!window.confirm(`删除工单 ${v.ref}?附件也会一起删除。`)) return; + try { await chApi('POST', `/api/chat/admin/services/${v.id}/delete`); setList(l => l.filter(x => x.id !== v.id)); onNotify('已删除'); } + catch (e) { onNotify('删除失败:' + e.message); } + }; + if (!list) return
加载中…
; + const isOpen = (v) => ['new', 'processing', 'waiting'].includes(v.status); + const nq = q.trim().toLowerCase(); + const hit = (v) => !nq || [v.ref, v.model, v.category, v.company, v.name, v.email, v.phone, v.country, v.city, v.errorCode, ...(v.sns || [])].some(x => String(x || '').toLowerCase().includes(nq)); + const shown = list.filter(v => (filter === 'open' ? isOpen(v) : filter === 'all' ? true : v.status === filter) && hit(v)).sort((a, b) => b.at - a.at); + const count = (k) => list.filter(v => (k === 'open' ? isOpen(v) : k === 'all' || v.status === k)).length; + const waOf = (ph) => String(ph || '').replace(/[^\d]/g, ''); + return ( +
+
+
售后服务
+ 客户在网站 Support → After-sale service 提交 +
+ setQ(e.target.value)} placeholder="搜单号 / 型号 / SN / 公司 / 电话" /> + {[['open', '未完成'], ['new', '新申请'], ['processing', '处理中'], ['waiting', '等客户回复'], ['resolved', '已解决'], ['closed', '已关闭'], ['all', '全部']].map(([k, l]) => ( + + ))} + +
+
+
+ {shown.length === 0 &&
没有{nq ? '匹配的' : filter === 'all' ? '' : '这类'}售后申请
} + {shown.map(v => ( +
+
+
{v.ref}
+
{new Date(v.at).toLocaleString('zh-CN', { hour12: false, month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}
+ {SVC_STATUS_ZH[v.status] || v.status} + {v.running && {SVC_RUNNING_ZH[v.running]}} +
+
+
{v.model}{v.qty > 1 ? ` × ${v.qty}` : ''}{v.category && {v.category}}
+
{(v.issues || []).map(k => SVC_ISSUE_ZH[k] || k).join('、')}{v.errorCode && 代码 {v.errorCode}}
+ {v.desc &&
{v.desc}
} + {(v.sns || []).length > 0 &&
SN:{v.sns.map(x => {x})}
} +
{[v.purchase && `购买于 ${v.purchase}`, v.channel && SVC_CHANNEL_ZH[v.channel], v.seller, v.order && `订单/发票 ${v.order}`].filter(Boolean).join(' · ') || '购买信息未填'}
+
{[v.site, v.city, v.country].filter(Boolean).join(', ')}{v.ipCountry && (IP {chFlag(v.ipCountry)} {v.ipCountry})}
+
{v.name}{v.company ? ` · ${v.company}` : ''} + {v.phone}{waOf(v.phone).length >= 7 && WhatsApp} + {v.email} +
+
提交于 {new Date(v.at).toLocaleString('zh-CN', { hour12: false })}{v.lang ? ` · 网站语言 ${v.lang}` : ''}{v.updated ? ` · 更新于 ${new Date(v.updated).toLocaleString('zh-CN', { hour12: false })}` : ''}
+
+ + +
+