fix: 完善同步生命周期并统一前端视觉
- 同步商品与订单时处理线上删除状态并联动自动化规则\n- 过滤卖家系统中的购买订单,修复订单逻辑删除与数据库迁移\n- 修复聊天新消息自动滚动,并统一前端颜色令牌与硬编码颜色检查
This commit is contained in:
1 parent
cf76b8898b
commit
526ac44453
40 files changed
+802
-242
No files matched your search
+7
-7
@@ -147,8 +147,8 @@ const App: React.FC = () => {
|
||||
|
||||
if (checkingAuth) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-[#f5f5f7]">
|
||||
<Loader2 className="w-8 h-8 text-[#0094f7] animate-spin" />
|
||||
<div className="min-h-screen flex items-center justify-center bg-surface">
|
||||
<Loader2 className="w-8 h-8 text-brand animate-spin" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -156,11 +156,11 @@ const App: React.FC = () => {
|
||||
// Init Screen (system not initialized)
|
||||
if (needsInit) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-[#F4F5F7] p-4 relative overflow-hidden font-sans">
|
||||
<div className="min-h-screen flex items-center justify-center bg-canvas p-4 relative overflow-hidden font-sans">
|
||||
<div className="absolute top-[-10%] left-[-10%] w-[60%] h-[60%] bg-blue-200/40 rounded-full blur-[120px] animate-pulse"></div>
|
||||
<div className="absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] bg-blue-200/30 rounded-full blur-[120px] animate-pulse" style={{animationDelay: '2s'}}></div>
|
||||
|
||||
<div className="bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-[0_20px_60px_-15px_rgba(0,0,0,0.05)] w-full max-w-xl border border-white relative z-10 animate-fade-in">
|
||||
<div className="bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-panel w-full max-w-xl border border-white relative z-10 animate-fade-in">
|
||||
<div className="text-center mb-8">
|
||||
<div className="mx-auto mb-6 flex justify-center">
|
||||
<YdisksBrandIcon sizeClass="w-24 h-24" />
|
||||
@@ -198,12 +198,12 @@ const App: React.FC = () => {
|
||||
// Login Screen Component
|
||||
if (!isLoggedIn) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-[#F4F5F7] p-4 relative overflow-hidden font-sans">
|
||||
<div className="min-h-screen flex items-center justify-center bg-canvas p-4 relative overflow-hidden font-sans">
|
||||
{/* Animated Background Blobs */}
|
||||
<div className="absolute top-[-10%] left-[-10%] w-[60%] h-[60%] bg-blue-200/40 rounded-full blur-[120px] animate-pulse"></div>
|
||||
<div className="absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] bg-blue-200/30 rounded-full blur-[120px] animate-pulse" style={{animationDelay: '2s'}}></div>
|
||||
|
||||
<div className="bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-[0_20px_60px_-15px_rgba(0,0,0,0.05)] w-full max-w-lg border border-white relative z-10 animate-fade-in">
|
||||
<div className="bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-panel w-full max-w-lg border border-white relative z-10 animate-fade-in">
|
||||
|
||||
{/* Header with Logo */}
|
||||
<div className="text-center mb-10">
|
||||
@@ -288,7 +288,7 @@ const App: React.FC = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen bg-[#F4F5F7] text-[#111]">
|
||||
<div className="flex min-h-screen bg-canvas text-ink">
|
||||
<Sidebar
|
||||
activeTab={activeTab}
|
||||
isAdmin={isAdmin}
|
||||
|
||||
@@ -43,6 +43,15 @@ describe('online chat UI contract', () => {
|
||||
expect(chat).toContain('justify-center py-1');
|
||||
});
|
||||
|
||||
test('keeps the active chat at the bottom when new messages arrive', () => {
|
||||
const chat = source('components/Chat.tsx');
|
||||
expect(chat).toContain('shouldScrollToBottomRef');
|
||||
expect(chat).toContain('skipNextMessageScrollRef');
|
||||
expect(chat).toContain('onScroll={handleMessageScroll}');
|
||||
expect(chat).toContain('container.scrollHeight - container.scrollTop - container.clientHeight');
|
||||
expect(chat).toContain('[activeAccountID, activeChatID, messages, messagesLoading]');
|
||||
});
|
||||
|
||||
test('sidebar exposes collapse control and chat primary navigation', () => {
|
||||
const sidebar = source('components/Sidebar.tsx');
|
||||
expect(sidebar).toContain("id: 'chat'");
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { readdirSync, readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
const componentsDir = resolve(__dirname, 'components');
|
||||
const pageSources = [
|
||||
resolve(__dirname, 'App.tsx'),
|
||||
...readdirSync(componentsDir)
|
||||
.filter((fileName) => fileName.endsWith('.tsx') && !fileName.endsWith('.test.tsx'))
|
||||
.map((fileName) => resolve(componentsDir, fileName)),
|
||||
];
|
||||
|
||||
// rgb(var(--color-*)), CSS classes and the central index.css are references.
|
||||
// Literal colors in page code would bypass the design-token system.
|
||||
const hardCodedColorPattern = /#[0-9a-f]{3,8}\b|rgba?\((?!var\(--color-)/gi;
|
||||
|
||||
describe('global color token contract', () => {
|
||||
test('page components do not contain hard-coded color values', () => {
|
||||
const violations = pageSources.flatMap((filePath) => {
|
||||
const source = readFileSync(filePath, 'utf8');
|
||||
return [...source.matchAll(hardCodedColorPattern)].map((match) => `${filePath}:${match[0]}`);
|
||||
});
|
||||
|
||||
expect(violations).toEqual([]);
|
||||
});
|
||||
|
||||
test('the primary brand and highlight colors are defined in the central stylesheet', () => {
|
||||
const globalStyles = readFileSync(resolve(__dirname, 'index.css'), 'utf8');
|
||||
|
||||
expect(globalStyles).toContain('--color-brand: 0 148 247;');
|
||||
expect(globalStyles).toContain('--color-brand-highlight: 0 113 227;');
|
||||
expect(globalStyles).toContain('--color-success-500:');
|
||||
expect(globalStyles).toContain('--color-warning-500:');
|
||||
expect(globalStyles).toContain('--color-danger-500:');
|
||||
});
|
||||
});
|
||||
@@ -678,7 +678,7 @@ const AccountList: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) return <div className="p-20 flex justify-center"><Loader2 className="w-8 h-8 text-[#0094f7] animate-spin"/></div>;
|
||||
if (loading) return <div className="p-20 flex justify-center"><Loader2 className="w-8 h-8 text-brand animate-spin"/></div>;
|
||||
|
||||
const filteredAccounts = accounts.filter(account => {
|
||||
const keyword = accountSearch.trim().toLowerCase();
|
||||
@@ -728,7 +728,7 @@ const AccountList: React.FC = () => {
|
||||
const runtime = runtimePresentation(account);
|
||||
const requiresLogin = account.runtime_state === 'auth_expired' || account.runtime_state === 'verification_required';
|
||||
return (
|
||||
<div key={account.id} className="ios-card rounded-xl p-6 group transition-all duration-300 hover:border-[#0094f7]">
|
||||
<div key={account.id} className="ios-card rounded-xl p-6 group transition-all duration-300 hover:border-brand">
|
||||
<div className="flex min-w-0 items-start gap-5 sm:gap-8">
|
||||
<div className="relative">
|
||||
{account.avatar_url ? (
|
||||
@@ -898,7 +898,7 @@ const AccountList: React.FC = () => {
|
||||
{deleteDialogAccount && createPortal(
|
||||
<div className="modal-overlay-centered" role="presentation">
|
||||
<div
|
||||
className="h-fit w-full max-w-[400px] self-center overflow-hidden rounded-2xl border border-white/80 bg-white shadow-[0_24px_64px_rgba(15,23,42,0.22)]"
|
||||
className="h-fit w-full max-w-[400px] self-center overflow-hidden rounded-2xl border border-white/80 bg-white shadow-modal"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="delete-account-title"
|
||||
@@ -947,7 +947,7 @@ const AccountList: React.FC = () => {
|
||||
role="progressbar"
|
||||
aria-label="正在删除账号"
|
||||
>
|
||||
<Loader2 className="h-5 w-5 flex-shrink-0 animate-spin text-[#0094f7]" />
|
||||
<Loader2 className="h-5 w-5 flex-shrink-0 animate-spin text-brand" />
|
||||
<div>
|
||||
<div className="text-sm font-extrabold text-blue-950">正在删除账号</div>
|
||||
<div className="mt-0.5 text-xs text-blue-700">正在清理关联数据,请保持页面打开…</div>
|
||||
@@ -1015,8 +1015,8 @@ const AccountList: React.FC = () => {
|
||||
: '请打开闲鱼APP扫描下方二维码'}
|
||||
</p>
|
||||
|
||||
<div className={`w-full bg-[#F7F8FA] rounded-xl mx-auto flex items-center justify-center overflow-hidden border-4 border-white shadow-inner mb-6 relative ${qrStatus === 'verification' ? 'max-w-72 min-h-64 h-auto p-2' : 'max-w-64 aspect-square'}`}>
|
||||
{qrStatus === 'loading' && <Loader2 className="w-10 h-10 text-[#0094f7] animate-spin" />}
|
||||
<div className={`w-full bg-surface-subtle rounded-xl mx-auto flex items-center justify-center overflow-hidden border-4 border-white shadow-inner mb-6 relative ${qrStatus === 'verification' ? 'max-w-72 min-h-64 h-auto p-2' : 'max-w-64 aspect-square'}`}>
|
||||
{qrStatus === 'loading' && <Loader2 className="w-10 h-10 text-brand animate-spin" />}
|
||||
{qrStatus === 'waiting' && <SquareQRCode src={qrCodeUrl} alt="闲鱼登录二维码" className="p-2" />}
|
||||
{qrStatus === 'success' && (
|
||||
<div className="absolute inset-0 bg-white/95 flex flex-col items-center justify-center text-green-600 animate-fade-in">
|
||||
@@ -1111,7 +1111,7 @@ const AccountList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setEditForm({ ...editForm, auto_confirm: !editForm.auto_confirm })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
editForm.auto_confirm ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
editForm.auto_confirm ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
@@ -1168,7 +1168,7 @@ const AccountList: React.FC = () => {
|
||||
aria-label="保存登录信息"
|
||||
disabled={longLogin.loading || longLogin.saving || !longLogin.canOpen}
|
||||
onClick={() => void handleLongLoginToggle()}
|
||||
className={`relative h-8 w-14 flex-shrink-0 rounded-full transition-colors ${longLogin.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'} disabled:cursor-not-allowed disabled:opacity-50`}
|
||||
className={`relative h-8 w-14 flex-shrink-0 rounded-full transition-colors ${longLogin.enabled ? 'bg-brand' : 'bg-gray-300'} disabled:cursor-not-allowed disabled:opacity-50`}
|
||||
>
|
||||
<span className={`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-md transition-transform ${longLogin.enabled ? 'translate-x-6' : 'translate-x-0'}`} />
|
||||
</button>
|
||||
@@ -1206,7 +1206,7 @@ const AccountList: React.FC = () => {
|
||||
type="checkbox"
|
||||
checked={editForm.clear_password}
|
||||
onChange={(e) => setEditForm({ ...editForm, clear_password: e.target.checked, login_password: e.target.checked ? '' : editForm.login_password })}
|
||||
className="w-4 h-4 accent-[#0094f7]"
|
||||
className="w-4 h-4 accent-brand"
|
||||
/>
|
||||
<span className="text-sm font-bold text-gray-700">清空已保存密码</span>
|
||||
</label>
|
||||
@@ -1220,7 +1220,7 @@ const AccountList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setEditForm({ ...editForm, show_browser: !editForm.show_browser })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
editForm.show_browser ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
editForm.show_browser ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
@@ -1302,7 +1302,7 @@ const AccountList: React.FC = () => {
|
||||
}}
|
||||
disabled={!bindingsLoaded}
|
||||
className={`w-5 h-5 rounded-md border-2 flex items-center justify-center transition-colors flex-shrink-0 ${
|
||||
checked ? 'bg-[#0094f7] border-[#0094f7]' : 'bg-white border-gray-300'
|
||||
checked ? 'bg-brand border-brand' : 'bg-white border-gray-300'
|
||||
}`}
|
||||
>
|
||||
{checked && <Check className="w-3.5 h-3.5 text-white" />}
|
||||
@@ -1377,7 +1377,7 @@ const AccountList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setAiSettings({ ...aiSettings, ai_enabled: !aiSettings.ai_enabled })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
aiSettings.ai_enabled ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
aiSettings.ai_enabled ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
|
||||
@@ -313,7 +313,7 @@ const CardList: React.FC = () => {
|
||||
</div>
|
||||
|
||||
<div className="ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white">
|
||||
<div className="flex flex-col gap-3 border-b border-gray-50 bg-[#FAFAFA] p-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-col gap-3 border-b border-gray-50 bg-surface-muted p-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-1 flex-col gap-3 sm:flex-row">
|
||||
<div className="relative sm:w-48">
|
||||
<SlidersHorizontal className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" />
|
||||
@@ -375,7 +375,7 @@ const CardList: React.FC = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<tr key={card.id} className="hover:bg-[#FFFDE7]/50 transition-colors group">
|
||||
<tr key={card.id} className="hover:bg-warning-50/50 transition-colors group">
|
||||
<td className="px-5 py-5 align-middle">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<div className="shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white">
|
||||
@@ -667,7 +667,7 @@ const CardList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setEditForm({ ...editForm, enabled: !editForm.enabled })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
editForm.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
editForm.enabled ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
@@ -739,7 +739,7 @@ const CardList: React.FC = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAddForm({ ...addForm, type: 'data', content: '' })}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'data' ? 'bg-[#0094f7] text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'}`}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'data' ? 'bg-brand text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'}`}
|
||||
>
|
||||
<CreditCard className="w-5 h-5 mx-auto mb-1" />
|
||||
批量库存
|
||||
@@ -747,7 +747,7 @@ const CardList: React.FC = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAddForm({ ...addForm, type: 'text', content: '' })}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'text' ? 'bg-[#0094f7] text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'text' ? 'bg-brand text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
>
|
||||
<FileText className="w-5 h-5 mx-auto mb-1" />
|
||||
文本
|
||||
@@ -755,7 +755,7 @@ const CardList: React.FC = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAddForm({ ...addForm, type: 'image', content: '' })}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'image' ? 'bg-[#0094f7] text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'image' ? 'bg-brand text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
>
|
||||
<ImageIcon className="w-5 h-5 mx-auto mb-1" />
|
||||
图片
|
||||
@@ -792,7 +792,7 @@ const CardList: React.FC = () => {
|
||||
/>
|
||||
)}
|
||||
{addForm.type === 'data' && (
|
||||
<p className="text-xs text-gray-500">当前库存:<span className="font-bold text-[#0094f7]">{addForm.content.split('\n').filter(line => line.trim()).length}</span> 条</p>
|
||||
<p className="text-xs text-gray-500">当前库存:<span className="font-bold text-brand">{addForm.content.split('\n').filter(line => line.trim()).length}</span> 条</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -879,14 +879,14 @@ const CardList: React.FC = () => {
|
||||
<div className="flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl">
|
||||
<button
|
||||
onClick={() => setBatchTab('create')}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'create' ? 'bg-[#0094f7] text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'create' ? 'bg-brand text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
>
|
||||
<ListPlus className="w-4 h-4" />
|
||||
批量创建卡密组
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setBatchTab('append')}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'append' ? 'bg-[#0094f7] text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'append' ? 'bg-brand text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
>
|
||||
<Upload className="w-4 h-4" />
|
||||
往单个组充卡密
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
AlertCircle, Check, CheckCheck, ImagePlus, Loader2, MessageCircleMore, RefreshCw,
|
||||
Search, Send, Smile, UserRound, Wifi, WifiOff,
|
||||
@@ -53,6 +53,9 @@ const Chat: React.FC = () => {
|
||||
const activeAccountRef = useRef('');
|
||||
const activeChatRef = useRef('');
|
||||
const scrollRef = useRef<HTMLDivElement | null>(null);
|
||||
const scrollContextRef = useRef({ accountID: '', chatID: '' });
|
||||
const shouldScrollToBottomRef = useRef(true);
|
||||
const skipNextMessageScrollRef = useRef(false);
|
||||
const imageInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const refreshedAccountsRef = useRef(new Set<string>());
|
||||
|
||||
@@ -177,6 +180,7 @@ const Chat: React.FC = () => {
|
||||
if (!activeAccountID || !activeChatID || olderLoading || !hasOlder) return;
|
||||
const container = scrollRef.current;
|
||||
const previousHeight = container?.scrollHeight || 0;
|
||||
skipNextMessageScrollRef.current = true;
|
||||
setOlderLoading(true);
|
||||
setError('');
|
||||
try {
|
||||
@@ -192,6 +196,7 @@ const Chat: React.FC = () => {
|
||||
if (container) container.scrollTop += container.scrollHeight - previousHeight;
|
||||
});
|
||||
} catch (loadError) {
|
||||
skipNextMessageScrollRef.current = false;
|
||||
setError(loadError instanceof Error ? loadError.message : '加载历史消息失败');
|
||||
} finally {
|
||||
setOlderLoading(false);
|
||||
@@ -261,10 +266,28 @@ const Chat: React.FC = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handleMessageScroll = () => {
|
||||
const container = scrollRef.current;
|
||||
if (container) container.scrollTop = container.scrollHeight;
|
||||
}, [activeAccountID, activeChatID, messagesLoading]);
|
||||
if (!container) return;
|
||||
const distanceFromBottom = container.scrollHeight - container.scrollTop - container.clientHeight;
|
||||
shouldScrollToBottomRef.current = distanceFromBottom <= 48;
|
||||
};
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const contextChanged = scrollContextRef.current.accountID !== activeAccountID
|
||||
|| scrollContextRef.current.chatID !== activeChatID;
|
||||
scrollContextRef.current = { accountID: activeAccountID, chatID: activeChatID };
|
||||
if (contextChanged) shouldScrollToBottomRef.current = true;
|
||||
|
||||
const container = scrollRef.current;
|
||||
if (!container) return;
|
||||
|
||||
if (skipNextMessageScrollRef.current) {
|
||||
skipNextMessageScrollRef.current = false;
|
||||
return;
|
||||
}
|
||||
if (messagesLoading || shouldScrollToBottomRef.current) container.scrollTop = container.scrollHeight;
|
||||
}, [activeAccountID, activeChatID, messages, messagesLoading]);
|
||||
|
||||
const activeAccount = accounts.find(account => account.id === activeAccountID);
|
||||
const activeSessions = sessionsByAccount[activeAccountID] || [];
|
||||
@@ -343,7 +366,7 @@ const Chat: React.FC = () => {
|
||||
if (loading) return <div className="flex h-[calc(100vh-4rem)] items-center justify-center"><Loader2 className="h-8 w-8 animate-spin text-sky-500" /></div>;
|
||||
|
||||
return (
|
||||
<section className="flex h-[calc(100vh-4rem)] min-h-[560px] flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-[0_16px_45px_rgba(15,23,42,0.06)]">
|
||||
<section className="flex h-[calc(100vh-4rem)] min-h-[560px] flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-chat">
|
||||
<header className="border-b border-slate-200 bg-slate-50/70 px-5 pt-4">
|
||||
<div className="mb-3 flex items-center justify-between gap-4">
|
||||
<div>
|
||||
@@ -400,7 +423,7 @@ const Chat: React.FC = () => {
|
||||
<div className="min-h-0 flex-1 overflow-y-auto">
|
||||
{filteredSessions.map(session => (
|
||||
<button key={session.chat_id} type="button" onClick={() => setActiveChatID(session.chat_id)}
|
||||
className={`flex w-full gap-3 border-b border-slate-100 p-4 text-left transition-colors ${session.chat_id === activeChatID ? 'bg-white shadow-[inset_3px_0_0_#0ea5e9]' : 'hover:bg-white/80'}`}>
|
||||
className={`flex w-full gap-3 border-b border-slate-100 p-4 text-left transition-colors ${session.chat_id === activeChatID ? 'bg-white shadow-chat-active' : 'hover:bg-white/80'}`}>
|
||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-slate-200 text-slate-500">
|
||||
{session.buyer_avatar_url ? <img src={session.buyer_avatar_url} alt="" className="h-full w-full object-cover" /> : <UserRound className="h-5 w-5" />}
|
||||
</div>
|
||||
@@ -427,7 +450,7 @@ const Chat: React.FC = () => {
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-[#f7f8fa]">
|
||||
<main className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-surface-subtle">
|
||||
{selectedSession ? (
|
||||
<>
|
||||
<div className="flex h-16 shrink-0 items-center border-b border-slate-200 bg-white px-5">
|
||||
@@ -439,7 +462,7 @@ const Chat: React.FC = () => {
|
||||
{activeAccount?.runtime_state === 'online' ? '账号在线' : '账号离线'}
|
||||
</span>
|
||||
</div>
|
||||
<div ref={scrollRef} className="min-h-0 flex-1 space-y-5 overflow-y-auto px-6 py-5">
|
||||
<div ref={scrollRef} onScroll={handleMessageScroll} className="min-h-0 flex-1 space-y-5 overflow-y-auto px-6 py-5">
|
||||
{messagesLoading ? <div className="flex justify-center py-12"><Loader2 className="h-6 w-6 animate-spin text-sky-500" /></div> : <>
|
||||
{hasOlder && <div className="flex justify-center pb-1">
|
||||
<button type="button" onClick={() => void loadOlderMessages()} disabled={olderLoading}
|
||||
@@ -490,7 +513,7 @@ const Chat: React.FC = () => {
|
||||
</>}
|
||||
</div>
|
||||
{error && <div className="border-t border-red-100 bg-red-50 px-5 py-2 text-xs font-medium text-red-700">{error}</div>}
|
||||
<div className="relative z-10 shrink-0 border-t border-slate-200 bg-white p-4 shadow-[0_-8px_24px_rgba(15,23,42,0.04)]">
|
||||
<div className="relative z-10 shrink-0 border-t border-slate-200 bg-white p-4 shadow-chat-input">
|
||||
<div className="mb-2 flex items-center gap-1">
|
||||
<div className="relative">
|
||||
<button type="button" onClick={() => setEmojiOpen(value => !value)} disabled={sending || activeAccount?.runtime_state !== 'online'} className="rounded-lg p-2 text-slate-500 hover:bg-sky-50 hover:text-sky-600 disabled:opacity-40" title="闲鱼表情"><Smile className="h-5 w-5" /></button>
|
||||
|
||||
@@ -33,9 +33,8 @@ describe('Dashboard presentation safeguards', () => {
|
||||
expect(globalStyles).toContain('.dashboard-pie-chart .recharts-sector:focus');
|
||||
expect(dashboardSource).toContain('dashboard-revenue-chart h-[350px] w-full');
|
||||
expect(dashboardSource).toContain('activeBar={false}');
|
||||
expect(dashboardSource).not.toContain('stroke="#000000"');
|
||||
expect(dashboardSource).not.toContain("['#0094f7', '#FCD34D', '#0071e3']");
|
||||
expect(dashboardSource).toContain('fill="#0094f7"');
|
||||
expect(dashboardSource).not.toMatch(/#[0-9A-Fa-f]{3,8}/);
|
||||
expect(dashboardSource).toContain("fill={cssColor('brand')}");
|
||||
expect(globalStyles).toContain('.dashboard-revenue-chart .recharts-rectangle:focus');
|
||||
expect(globalStyles).toContain('.dashboard-revenue-chart .recharts-curve:focus');
|
||||
expect(globalStyles).toContain('.dashboard-revenue-chart [class*="recharts-zIndex-layer_"]:focus');
|
||||
|
||||
@@ -6,11 +6,17 @@ import { formatLocalDateTime } from '../dateTime';
|
||||
import { TrendingUp, Users, ShoppingCart, AlertCircle, DollarSign, Activity, Package, ArrowUpRight, Calendar, X, BarChart3, PackageCheck, ExternalLink, Eye, Edit } from 'lucide-react';
|
||||
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, BarChart, Bar, PieChart, Pie, Cell, Legend } from 'recharts';
|
||||
|
||||
const cssColor = (token: string, alpha?: number) => (
|
||||
alpha === undefined
|
||||
? `rgb(var(--color-${token}))`
|
||||
: `rgb(var(--color-${token}) / ${alpha})`
|
||||
);
|
||||
|
||||
// 状态徽章组件
|
||||
export const StatusBadge: React.FC<{ status: OrderStatus }> = ({ status }) => {
|
||||
const styles = {
|
||||
processing: 'bg-blue-100 text-blue-800',
|
||||
pending_ship: 'bg-[#0094f7] text-white',
|
||||
pending_ship: 'bg-brand text-white',
|
||||
shipped: 'bg-blue-100 text-blue-700',
|
||||
completed: 'bg-green-100 text-green-700',
|
||||
cancelled: 'bg-gray-100 text-gray-500',
|
||||
@@ -42,7 +48,7 @@ const StatCard: React.FC<{ title: string; value: string | number; icon: React.El
|
||||
<div className={`p-4 rounded-2xl ${colorClass} bg-opacity-10 backdrop-blur-sm`}>
|
||||
<Icon className={`w-6 h-6 ${colorClass.replace('bg-', 'text-')}`} />
|
||||
</div>
|
||||
{trend && <span className="text-xs font-bold text-white bg-[#0094f7] px-3 py-1.5 rounded-full flex items-center gap-1 shadow-sm">
|
||||
{trend && <span className="text-xs font-bold text-white bg-brand px-3 py-1.5 rounded-full flex items-center gap-1 shadow-sm">
|
||||
<TrendingUp className="w-3 h-3" /> {trend}
|
||||
</span>}
|
||||
</div>
|
||||
@@ -75,7 +81,13 @@ const Dashboard: React.FC = () => {
|
||||
const rangeRequestSequence = useRef(0);
|
||||
|
||||
// 颜色配置
|
||||
const COLORS = ['#0094f7', '#3B82F6', '#10B981', '#F59E0B', '#8B5CF6'];
|
||||
const COLORS = [
|
||||
cssColor('brand'),
|
||||
cssColor('brand-highlight'),
|
||||
cssColor('success-500'),
|
||||
cssColor('warning-500'),
|
||||
cssColor('accent-500'),
|
||||
];
|
||||
const formatCurrency = (value: number) => `¥${Number(value || 0).toLocaleString('zh-CN', { maximumFractionDigits: 2 })}`;
|
||||
const loadRange = async (range: TimeRange) => {
|
||||
let currentRange;
|
||||
@@ -159,7 +171,7 @@ const Dashboard: React.FC = () => {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!stats || !analytics) return <div className="p-8 flex justify-center text-gray-400"><Activity className="w-8 h-8 animate-spin text-[#0094f7]" /></div>;
|
||||
if (!stats || !analytics) return <div className="p-8 flex justify-center text-gray-400"><Activity className="w-8 h-8 animate-spin text-brand" /></div>;
|
||||
|
||||
const chartData = analytics.daily_stats?.map(d => ({
|
||||
name: d.date.slice(5), // MM-DD
|
||||
@@ -267,7 +279,7 @@ const Dashboard: React.FC = () => {
|
||||
onClick={() => setTimeRange(option.key)}
|
||||
className={`px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${
|
||||
timeRange === option.key
|
||||
? 'bg-[#0094f7] text-white shadow-md'
|
||||
? 'bg-brand text-white shadow-md'
|
||||
: 'bg-white text-gray-600 hover:text-black hover:bg-gray-50'
|
||||
}`}
|
||||
>
|
||||
@@ -280,14 +292,14 @@ const Dashboard: React.FC = () => {
|
||||
type="date"
|
||||
value={customStartDate}
|
||||
onChange={(e) => setCustomStartDate(e.target.value)}
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-[#0094f7]"
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-brand"
|
||||
/>
|
||||
<span className="self-center text-gray-400">-</span>
|
||||
<input
|
||||
type="date"
|
||||
value={customEndDate}
|
||||
onChange={(e) => setCustomEndDate(e.target.value)}
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-[#0094f7]"
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-brand"
|
||||
/>
|
||||
<button
|
||||
onClick={() => {
|
||||
@@ -356,26 +368,26 @@ const Dashboard: React.FC = () => {
|
||||
dataKey="name"
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#374151', fontSize: 14, fontWeight: 600}}
|
||||
tick={{fill: cssColor('neutral-700'), fontSize: 14, fontWeight: 600}}
|
||||
dy={10}
|
||||
/>
|
||||
<YAxis
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#9CA3AF', fontSize: 13, fontWeight: 500}}
|
||||
tick={{fill: cssColor('neutral-400'), fontSize: 13, fontWeight: 500}}
|
||||
tickFormatter={(value) => `¥${value}`}
|
||||
/>
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
backgroundColor: cssColor('white'),
|
||||
borderRadius: '8px',
|
||||
border: '1px solid #e5e7eb',
|
||||
boxShadow: '0 10px 25px -5px rgba(0, 0, 0, 0.1)',
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
boxShadow: 'var(--shadow-xl)',
|
||||
padding: '12px 16px'
|
||||
}}
|
||||
labelStyle={{ color: '#6b7280', fontWeight: 500 }}
|
||||
itemStyle={{ color: '#0094f7', fontWeight: 600 }}
|
||||
cursor={{ fill: 'rgba(0, 148, 247, 0.08)' }}
|
||||
labelStyle={{ color: cssColor('neutral-500'), fontWeight: 500 }}
|
||||
itemStyle={{ color: cssColor('brand'), fontWeight: 600 }}
|
||||
cursor={{ fill: cssColor('brand', 0.08) }}
|
||||
formatter={(value) => {
|
||||
const num = Number(value);
|
||||
return [`¥${num.toFixed(2)}`, '营收'];
|
||||
@@ -383,7 +395,7 @@ const Dashboard: React.FC = () => {
|
||||
/>
|
||||
<Bar
|
||||
dataKey="amount"
|
||||
fill="#0094f7"
|
||||
fill={cssColor('brand')}
|
||||
maxBarSize={72}
|
||||
radius={[12, 12, 0, 0]}
|
||||
activeBar={false}
|
||||
@@ -393,7 +405,7 @@ const Dashboard: React.FC = () => {
|
||||
{chartData.map((_, index) => (
|
||||
<Cell
|
||||
key={`cell-${index}`}
|
||||
fill="#0094f7"
|
||||
fill={cssColor('brand')}
|
||||
stroke="none"
|
||||
strokeWidth={0}
|
||||
/>
|
||||
@@ -407,36 +419,36 @@ const Dashboard: React.FC = () => {
|
||||
<AreaChart data={chartData} margin={{ top: 10, right: 10, left: -20, bottom: 0 }}>
|
||||
<defs>
|
||||
<linearGradient id="colorAmount" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="5%" stopColor="#0094f7" stopOpacity={0.5}/>
|
||||
<stop offset="95%" stopColor="#0094f7" stopOpacity={0}/>
|
||||
<stop offset="5%" stopColor={cssColor('brand')} stopOpacity={0.5}/>
|
||||
<stop offset="95%" stopColor={cssColor('brand')} stopOpacity={0}/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<XAxis
|
||||
dataKey="name"
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#9CA3AF', fontSize: 13, fontWeight: 500}}
|
||||
tick={{fill: cssColor('neutral-400'), fontSize: 13, fontWeight: 500}}
|
||||
dy={15}
|
||||
/>
|
||||
<YAxis
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#9CA3AF', fontSize: 13, fontWeight: 500}}
|
||||
tick={{fill: cssColor('neutral-400'), fontSize: 13, fontWeight: 500}}
|
||||
/>
|
||||
<CartesianGrid vertical={false} stroke="#F3F4F6" strokeDasharray="3 3" />
|
||||
<CartesianGrid vertical={false} stroke={cssColor('neutral-100')} strokeDasharray="3 3" />
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
backgroundColor: cssColor('white'),
|
||||
borderRadius: '8px',
|
||||
border: '1px solid #e5e7eb',
|
||||
boxShadow: '0 10px 25px -5px rgba(0, 0, 0, 0.1)',
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
boxShadow: 'var(--shadow-xl)',
|
||||
padding: '12px 16px'
|
||||
}}
|
||||
labelStyle={{ color: '#6b7280', fontWeight: 500 }}
|
||||
itemStyle={{ color: '#0094f7', fontWeight: 600 }}
|
||||
cursor={{ stroke: '#0094f7', strokeWidth: 2, strokeDasharray: '4 4' }}
|
||||
labelStyle={{ color: cssColor('neutral-500'), fontWeight: 500 }}
|
||||
itemStyle={{ color: cssColor('brand'), fontWeight: 600 }}
|
||||
cursor={{ stroke: cssColor('brand'), strokeWidth: 2, strokeDasharray: '4 4' }}
|
||||
/>
|
||||
<Area type="monotone" dataKey="amount" stroke="#0094f7" strokeWidth={4} fillOpacity={1} fill="url(#colorAmount)" activeDot={{ r: 8, fill: '#fff', stroke: "#0094f7", strokeWidth: 2 }} />
|
||||
<Area type="monotone" dataKey="amount" stroke={cssColor('brand')} strokeWidth={4} fillOpacity={1} fill="url(#colorAmount)" activeDot={{ r: 8, fill: cssColor('white'), stroke: cssColor('brand'), strokeWidth: 2 }} />
|
||||
</AreaChart>
|
||||
</ResponsiveContainer>
|
||||
)}
|
||||
@@ -466,7 +478,7 @@ const Dashboard: React.FC = () => {
|
||||
</div>
|
||||
<div className="h-3 rounded-full bg-gray-100 overflow-hidden">
|
||||
<div
|
||||
className="h-full rounded-full bg-[#0094f7]"
|
||||
className="h-full rounded-full bg-brand"
|
||||
style={{ width: `${Math.max(8, (item.sales / maxProductSales) * 100)}%` }}
|
||||
/>
|
||||
</div>
|
||||
@@ -516,17 +528,17 @@ const Dashboard: React.FC = () => {
|
||||
formatter={(value) => `${Number(value || 0)} 单`}
|
||||
wrapperStyle={{ zIndex: 30, outline: 'none' }}
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #e5e7eb',
|
||||
backgroundColor: cssColor('white'),
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
borderRadius: '10px',
|
||||
boxShadow: '0 8px 20px rgba(15, 23, 42, 0.08)'
|
||||
boxShadow: 'var(--shadow-md)'
|
||||
}}
|
||||
/>
|
||||
<Legend
|
||||
verticalAlign="bottom"
|
||||
height={36}
|
||||
iconType="circle"
|
||||
formatter={(value) => <span style={{ color: '#6B7280', fontWeight: 500 }}>{value}</span>}
|
||||
formatter={(value) => <span style={{ color: cssColor('neutral-500'), fontWeight: 500 }}>{value}</span>}
|
||||
/>
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
@@ -544,7 +556,7 @@ const Dashboard: React.FC = () => {
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
||||
{/* 参与统计的订单列表 */}
|
||||
<div className="lg:col-span-2 ios-card p-0 rounded-xl border-0 bg-white overflow-hidden flex flex-col">
|
||||
<div className="p-6 border-b border-gray-50 flex justify-between items-center bg-[#FAFAFA]">
|
||||
<div className="p-6 border-b border-gray-50 flex justify-between items-center bg-surface-muted">
|
||||
<div>
|
||||
<h3 className="font-bold text-lg text-gray-900">参与统计的订单</h3>
|
||||
{validOrdersTruncated && (
|
||||
@@ -603,7 +615,7 @@ const Dashboard: React.FC = () => {
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-50">
|
||||
{filteredValidOrders.map((order) => (
|
||||
<tr key={order.order_id} className="hover:bg-[#FFFDE7]/50 transition-colors group">
|
||||
<tr key={order.order_id} className="hover:bg-warning-50/50 transition-colors group">
|
||||
<td className="px-6 py-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-12 h-12 rounded-xl bg-gray-100 overflow-hidden shadow-sm border border-gray-100 flex-shrink-0">
|
||||
@@ -687,10 +699,10 @@ const Dashboard: React.FC = () => {
|
||||
<Tooltip
|
||||
wrapperStyle={{ zIndex: 30, outline: 'none' }}
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #e5e7eb',
|
||||
backgroundColor: cssColor('white'),
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
borderRadius: '6px',
|
||||
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)'
|
||||
boxShadow: 'var(--shadow-md)'
|
||||
}}
|
||||
formatter={(value) => `¥${Number(value || 0).toLocaleString()}`}
|
||||
/>
|
||||
|
||||
@@ -638,14 +638,14 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
</button>
|
||||
<button
|
||||
onClick={openPublishModal}
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-emerald-600 text-white hover:bg-emerald-700 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100"
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-emerald-500 text-white hover:bg-emerald-600 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100"
|
||||
>
|
||||
<PackagePlus className="w-4 h-4" />
|
||||
发布商品
|
||||
</button>
|
||||
<button
|
||||
onClick={() => void openBatchModal()}
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-2 shadow-lg shadow-blue-100"
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-brand text-white hover:bg-brand-highlight transition-colors flex items-center gap-2 shadow-lg shadow-blue-100"
|
||||
>
|
||||
<UploadCloud className="w-4 h-4" />
|
||||
{recentBatch && ['running', 'canceling'].includes(recentBatch.status) ? '继续批量任务' : '批量铺货'}
|
||||
@@ -670,7 +670,7 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
<div className="absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity z-10">
|
||||
<button
|
||||
onClick={() => handleEdit(item)}
|
||||
className="p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md text-gray-600 hover:bg-[#0094f7] hover:text-white transition-colors"
|
||||
className="p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md text-gray-600 hover:bg-brand hover:text-white transition-colors"
|
||||
title="编辑"
|
||||
>
|
||||
<Edit className="w-3.5 h-3.5" />
|
||||
@@ -710,7 +710,7 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
<div className="space-y-2 mt-auto">
|
||||
<button
|
||||
onClick={() => onConfigureDelivery(item)}
|
||||
className={`w-full flex items-center justify-between gap-1 px-2.5 py-2 rounded-lg text-[11px] font-extrabold transition-all ${hasRule ? 'bg-gray-900 text-white hover:bg-black' : 'bg-[#0094f7] text-white hover:bg-[#0071e3] shadow-md shadow-blue-100'}`}
|
||||
className={`w-full flex items-center justify-between gap-1 px-2.5 py-2 rounded-lg text-[11px] font-extrabold transition-all ${hasRule ? 'bg-gray-900 text-white hover:bg-black' : 'bg-brand text-white hover:bg-brand-highlight shadow-md shadow-blue-100'}`}
|
||||
>
|
||||
<span className="flex items-center gap-1.5"><Link2 className="w-3.5 h-3.5" />{hasRule ? '查看发货规则' : '关联发货规则'}</span>
|
||||
<ArrowRight className="w-3.5 h-3.5" />
|
||||
@@ -892,7 +892,7 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button disabled={publishing} onClick={handlePublishItem} className="w-full bg-emerald-600 hover:bg-emerald-700 disabled:opacity-60 text-white px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2">
|
||||
<button disabled={publishing} onClick={handlePublishItem} className="w-full bg-emerald-500 hover:bg-emerald-600 disabled:opacity-60 text-white px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2">
|
||||
<PackagePlus className="w-4 h-4" />
|
||||
{publishing ? '正在发布...' : '发布到闲鱼'}
|
||||
</button>
|
||||
|
||||
@@ -394,7 +394,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
{/* 说明 */}
|
||||
<div className="ios-card rounded-xl p-5 bg-blue-50/50 border border-blue-100">
|
||||
<div className="flex items-start gap-3">
|
||||
<Bell className="w-5 h-5 text-[#0094f7] mt-0.5 flex-shrink-0" />
|
||||
<Bell className="w-5 h-5 text-brand mt-0.5 flex-shrink-0" />
|
||||
<div className="text-sm text-gray-700 leading-6">
|
||||
配置通知渠道并在「账号管理 → 编辑」里绑定后,以下事件会主动推送到该账号绑定的渠道:
|
||||
<ul className="mt-2 space-y-1 text-gray-600">
|
||||
@@ -409,7 +409,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
{/* 渠道列表 */}
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-20">
|
||||
<Loader2 className="w-8 h-8 text-[#0094f7] animate-spin" />
|
||||
<Loader2 className="w-8 h-8 text-brand animate-spin" />
|
||||
</div>
|
||||
) : channels.length === 0 ? (
|
||||
<div className="ios-card rounded-xl p-12 bg-white text-center">
|
||||
@@ -454,7 +454,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
<button
|
||||
onClick={() => handleTest(ch)}
|
||||
disabled={testingId === ch.id}
|
||||
className="px-3 py-1.5 rounded-lg text-xs font-bold bg-blue-50 text-[#0094f7] hover:bg-blue-100 transition-colors flex items-center gap-1 disabled:opacity-50"
|
||||
className="px-3 py-1.5 rounded-lg text-xs font-bold bg-blue-50 text-brand hover:bg-blue-100 transition-colors flex items-center gap-1 disabled:opacity-50"
|
||||
>
|
||||
{testingId === ch.id ? <Loader2 className="w-3 h-3 animate-spin" /> : <Send className="w-3 h-3" />}
|
||||
测试
|
||||
@@ -639,10 +639,10 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
key={t}
|
||||
type="button"
|
||||
onClick={() => setForm({ ...form, type: t, config: {} })}
|
||||
className={`p-3 rounded-xl border-2 flex flex-col items-center gap-1.5 transition-all ${selected ? 'border-[#0094f7] bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
className={`p-3 rounded-xl border-2 flex flex-col items-center gap-1.5 transition-all ${selected ? 'border-brand bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
>
|
||||
<TIcon className={`w-5 h-5 ${selected ? 'text-[#0094f7]' : 'text-gray-500'}`} />
|
||||
<span className={`text-xs font-bold ${selected ? 'text-[#0094f7]' : 'text-gray-600'}`}>{m.label}</span>
|
||||
<TIcon className={`w-5 h-5 ${selected ? 'text-brand' : 'text-gray-500'}`} />
|
||||
<span className={`text-xs font-bold ${selected ? 'text-brand' : 'text-gray-600'}`}>{m.label}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -712,7 +712,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
: enableCustomSMTP(form.config, smtp),
|
||||
});
|
||||
}}
|
||||
className={`relative h-7 w-12 shrink-0 rounded-full transition-colors ${form.config.use_custom_smtp === true ? 'bg-[#0094f7]' : 'bg-gray-300'}`}
|
||||
className={`relative h-7 w-12 shrink-0 rounded-full transition-colors ${form.config.use_custom_smtp === true ? 'bg-brand' : 'bg-gray-300'}`}
|
||||
aria-label="使用独立 SMTP"
|
||||
>
|
||||
<span className={`absolute left-1 top-1 h-5 w-5 rounded-full bg-white shadow-sm transition-transform ${form.config.use_custom_smtp === true ? 'translate-x-5' : ''}`} />
|
||||
@@ -839,13 +839,13 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
: [...form.event_types, event.value];
|
||||
setForm({ ...form, event_types: next });
|
||||
}}
|
||||
className={`text-left rounded-xl border px-3 py-2.5 transition-colors ${checked ? 'border-[#0094f7] bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
className={`text-left rounded-xl border px-3 py-2.5 transition-colors ${checked ? 'border-brand bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className={`w-4 h-4 rounded border flex items-center justify-center ${checked ? 'bg-[#0094f7] border-[#0094f7]' : 'border-gray-300'}`}>
|
||||
<span className={`w-4 h-4 rounded border flex items-center justify-center ${checked ? 'bg-brand border-brand' : 'border-gray-300'}`}>
|
||||
{checked && <Check className="w-3 h-3 text-white" />}
|
||||
</span>
|
||||
<span className={`text-sm font-bold ${checked ? 'text-[#0094f7]' : 'text-gray-800'}`}>{event.label}</span>
|
||||
<span className={`text-sm font-bold ${checked ? 'text-brand' : 'text-gray-800'}`}>{event.label}</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-1 pl-6 leading-5">{event.description}</p>
|
||||
</button>
|
||||
@@ -858,7 +858,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setForm({ ...form, enabled: !form.enabled })}
|
||||
className={`relative w-11 h-6 rounded-full transition-colors ${form.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'}`}
|
||||
className={`relative w-11 h-6 rounded-full transition-colors ${form.enabled ? 'bg-brand' : 'bg-gray-300'}`}
|
||||
>
|
||||
<span className={`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform ${form.enabled ? 'translate-x-5' : ''}`} />
|
||||
</button>
|
||||
@@ -889,8 +889,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
|
||||
{/* Toast */}
|
||||
{toast && (
|
||||
<div className="fixed bottom-8 left-1/2 -translate-x-1/2 z-[10000] px-5 py-3 rounded-xl shadow-lg font-bold text-sm flex items-center gap-2 animate-fade-in"
|
||||
style={{ background: toast.type === 'success' ? '#10b981' : '#ef4444', color: 'white' }}>
|
||||
<div className={`fixed bottom-8 left-1/2 -translate-x-1/2 z-[10000] px-5 py-3 rounded-xl shadow-lg font-bold text-sm flex items-center gap-2 animate-fade-in text-white ${toast.type === 'success' ? 'bg-success-500' : 'bg-danger-500'}`}>
|
||||
{toast.type === 'success' ? <Check className="w-4 h-4" /> : <X className="w-4 h-4" />}
|
||||
{toast.text}
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { formatLocalDateTime } from '../dateTime';
|
||||
const StatusBadge: React.FC<{ status: OrderStatus }> = ({ status }) => {
|
||||
const styles = {
|
||||
processing: 'bg-blue-100 text-blue-800',
|
||||
pending_ship: 'bg-[#0094f7] text-white',
|
||||
pending_ship: 'bg-brand text-white',
|
||||
shipped: 'bg-blue-100 text-blue-700',
|
||||
completed: 'bg-green-100 text-green-700',
|
||||
cancelled: 'bg-gray-100 text-gray-500',
|
||||
@@ -356,7 +356,7 @@ const OrderList: React.FC = () => {
|
||||
|
||||
<div className="ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white">
|
||||
{/* Toolbar */}
|
||||
<div className="p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-[#FAFAFA]">
|
||||
<div className="p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted">
|
||||
<div className="flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full">
|
||||
{[
|
||||
{k:'all', v:'全部'},
|
||||
@@ -392,7 +392,7 @@ const OrderList: React.FC = () => {
|
||||
</select>
|
||||
</div>
|
||||
<div className="relative group">
|
||||
<Search className="w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-[#0094f7] transition-colors" />
|
||||
<Search className="w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="搜索订单号/商品/买家..."
|
||||
@@ -418,7 +418,7 @@ const OrderList: React.FC = () => {
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-50">
|
||||
{orders.map((order) => (
|
||||
<tr key={order.id} className="hover:bg-[#FFFDE7]/50 transition-colors group">
|
||||
<tr key={order.id} className="hover:bg-warning-50/50 transition-colors group">
|
||||
<td className="px-6 py-5">
|
||||
<div className="flex items-center gap-5">
|
||||
<div className="w-14 h-14 rounded-xl bg-gray-100 overflow-hidden shadow-sm border border-gray-100 flex-shrink-0">
|
||||
@@ -800,7 +800,7 @@ const OrderList: React.FC = () => {
|
||||
<button
|
||||
onClick={() => executeShip('full_delivery')}
|
||||
disabled={shipLoading}
|
||||
className="w-full text-left p-4 rounded-xl border-2 border-gray-200 hover:border-[#0094f7] hover:bg-blue-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="w-full text-left p-4 rounded-xl border-2 border-gray-200 hover:border-brand hover:bg-blue-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center flex-shrink-0 mt-0.5">
|
||||
|
||||
@@ -842,7 +842,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={`inline-flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${
|
||||
activeTab === tab.id
|
||||
? 'bg-[#0094f7] text-white shadow-md'
|
||||
? 'bg-brand text-white shadow-md'
|
||||
: 'bg-white text-gray-600 hover:text-black hover:bg-gray-50'
|
||||
}`}
|
||||
>
|
||||
@@ -949,7 +949,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</aside>
|
||||
|
||||
<section className="min-w-0 space-y-4">
|
||||
<div className="rounded-xl border border-gray-100 bg-[#FAFAFA] p-4 shadow-sm">
|
||||
<div className="rounded-xl border border-gray-100 bg-surface-muted p-4 shadow-sm">
|
||||
<div className="flex flex-col gap-3 xl:flex-row xl:items-center">
|
||||
<div className="relative min-w-0 flex-1">
|
||||
<Search className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" />
|
||||
@@ -1112,7 +1112,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
type="button"
|
||||
disabled={loading}
|
||||
onClick={() => setAutomationPage(pageNumber)}
|
||||
className={`h-9 min-w-9 rounded-lg px-2 text-sm font-bold transition-colors ${pageNumber === automationPage ? 'bg-[#0094f7] text-white' : 'bg-gray-50 text-gray-600 hover:bg-gray-100'} disabled:cursor-not-allowed disabled:opacity-60`}
|
||||
className={`h-9 min-w-9 rounded-lg px-2 text-sm font-bold transition-colors ${pageNumber === automationPage ? 'bg-brand text-white' : 'bg-gray-50 text-gray-600 hover:bg-gray-100'} disabled:cursor-not-allowed disabled:opacity-60`}
|
||||
aria-label={`第 ${pageNumber} 页`}
|
||||
aria-current={pageNumber === automationPage ? 'page' : undefined}
|
||||
>
|
||||
@@ -1144,7 +1144,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{replyRules.map(rule => (
|
||||
<div key={rule.id} className="flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border border-gray-100 bg-[#F7F8FA] hover:bg-white hover:shadow-lg transition-all gap-4">
|
||||
<div key={rule.id} className="flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border border-gray-100 bg-surface-subtle hover:bg-white hover:shadow-lg transition-all gap-4">
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<span className="px-3 py-1 bg-black text-white rounded-lg text-xs font-bold">包含匹配</span>
|
||||
@@ -1187,7 +1187,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
const defaultReply = defaultReplies[account.id];
|
||||
const enabled = Boolean(defaultReply?.enabled);
|
||||
return (
|
||||
<div key={account.id} className={`flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border transition-all gap-4 ${enabled ? 'border-purple-100 bg-purple-50/50 hover:bg-white hover:shadow-lg' : 'border-gray-100 bg-[#F7F8FA] hover:bg-white hover:shadow-lg'}`}>
|
||||
<div key={account.id} className={`flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border transition-all gap-4 ${enabled ? 'border-purple-100 bg-purple-50/50 hover:bg-white hover:shadow-lg' : 'border-gray-100 bg-surface-subtle hover:bg-white hover:shadow-lg'}`}>
|
||||
<div className="flex items-center gap-4 min-w-0">
|
||||
<div className={`w-12 h-12 rounded-2xl flex items-center justify-center ${enabled ? 'bg-purple-600 text-white' : 'bg-gray-200 text-gray-400'}`}>
|
||||
<Bot className="w-5 h-5" />
|
||||
@@ -1272,7 +1272,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<Icon className={`w-5 h-5 mt-0.5 ${selected ? 'text-[#0094f7]' : 'text-white'}`} />
|
||||
<Icon className={`w-5 h-5 mt-0.5 ${selected ? 'text-brand' : 'text-white'}`} />
|
||||
<div>
|
||||
<div className="font-black">{meta.label}</div>
|
||||
<div className={`text-xs mt-1 leading-5 ${selected ? 'text-gray-500' : 'text-gray-400'}`}>{meta.description}</div>
|
||||
@@ -1296,11 +1296,11 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div className="p-6 overflow-y-auto bg-[#F7F8FA]">
|
||||
<div className="p-6 overflow-y-auto bg-surface-subtle">
|
||||
<div className="space-y-5">
|
||||
<section className="bg-white rounded-3xl border border-gray-100 p-5">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<CheckCircle2 className="w-5 h-5 text-[#0094f7]" />
|
||||
<CheckCircle2 className="w-5 h-5 text-brand" />
|
||||
<h4 className="font-black text-gray-900">生效范围</h4>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
@@ -1369,7 +1369,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
<div className="flex items-start justify-between gap-4 mb-4">
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Layers3 className="w-5 h-5 text-[#0094f7]" />
|
||||
<Layers3 className="w-5 h-5 text-brand" />
|
||||
<h4 className="font-black text-gray-900">{currentTrigger === 'buyer_reviewed' ? '赠品库存' : '发货库存'}</h4>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
@@ -1446,7 +1446,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
type="checkbox"
|
||||
checked={variant.delay_override === true}
|
||||
onChange={event => updateVariant(index, { delay_override: event.target.checked })}
|
||||
className="accent-[#0094f7]"
|
||||
className="accent-brand"
|
||||
/>
|
||||
覆盖卡密默认延时
|
||||
</label>
|
||||
@@ -1738,7 +1738,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setDefaultForm({ ...defaultForm, enabled: !defaultForm.enabled })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${defaultForm.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'}`}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${defaultForm.enabled ? 'bg-brand' : 'bg-gray-300'}`}
|
||||
>
|
||||
<span className={`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${defaultForm.enabled ? 'translate-x-7' : 'translate-x-1'}`} />
|
||||
</button>
|
||||
|
||||
@@ -269,7 +269,7 @@ const Settings: React.FC = () => {
|
||||
{/* AI Configuration */}
|
||||
<section className="space-y-4">
|
||||
<h3 className="text-lg font-extrabold text-gray-800 flex items-center gap-2">
|
||||
<div className="p-1.5 rounded-lg bg-[#0094f7] text-white">
|
||||
<div className="p-1.5 rounded-lg bg-brand text-white">
|
||||
<Sparkles className="w-4 h-4" />
|
||||
</div>
|
||||
AI 智能回复配置
|
||||
@@ -346,10 +346,10 @@ const Settings: React.FC = () => {
|
||||
setSettings({...settings, ai_model: model});
|
||||
setModelDropdownOpen(false);
|
||||
}}
|
||||
className="w-full px-4 py-2.5 text-left text-sm text-gray-700 hover:bg-blue-50 hover:text-[#0094f7] flex items-center justify-between gap-3"
|
||||
className="w-full px-4 py-2.5 text-left text-sm text-gray-700 hover:bg-blue-50 hover:text-brand flex items-center justify-between gap-3"
|
||||
>
|
||||
<span className="truncate">{model}</span>
|
||||
{model === currentModel && <Check className="w-4 h-4 shrink-0 text-[#0094f7]" />}
|
||||
{model === currentModel && <Check className="w-4 h-4 shrink-0 text-brand" />}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
|
||||
@@ -30,7 +30,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
];
|
||||
|
||||
return (
|
||||
<aside className={`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-[4px_0_24px_rgba(15,23,42,0.035)] backdrop-blur-xl transition-[width] duration-300 ${collapsed ? 'w-16' : 'w-64'}`}>
|
||||
<aside className={`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-sidebar backdrop-blur-xl transition-[width] duration-300 ${collapsed ? 'w-16' : 'w-64'}`}>
|
||||
<div className={`flex h-20 items-center border-b border-slate-100 ${collapsed ? 'justify-center px-2' : 'gap-3 px-5'}`}>
|
||||
<YdisksBrandIcon sizeClass="h-10 w-10" />
|
||||
{!collapsed && (
|
||||
@@ -55,7 +55,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
onClick={() => onNavigate(item.id)}
|
||||
className={`group relative flex h-11 w-full items-center rounded-xl transition-colors ${collapsed ? 'justify-center' : 'gap-3 px-3.5'} ${
|
||||
active
|
||||
? 'bg-sky-500 text-white shadow-[0_8px_18px_rgba(14,165,233,0.2)]'
|
||||
? 'bg-brand text-white shadow-brand-active'
|
||||
: 'text-slate-500 hover:bg-slate-100 hover:text-slate-900'
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -27,8 +27,8 @@ export const YdisksBrandIcon: React.FC<YdisksBrandIconProps> = ({
|
||||
<svg className="absolute inset-0 w-full h-full" viewBox="0 0 120 120" aria-hidden="true">
|
||||
<defs>
|
||||
<linearGradient id="login-squircle-gradient" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stopColor="#0094f7" />
|
||||
<stop offset="100%" stopColor="#287efe" />
|
||||
<stop offset="0%" stopColor="rgb(var(--color-brand))" />
|
||||
<stop offset="100%" stopColor="rgb(var(--color-brand-light))" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path d="M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23.51 12.25 L 27.29 10.34 L 31.54 8.78 L 36.33 7.56 L 41.84 6.69 L 48.52 6.17 L 60.00 6.00 L 71.48 6.17 L 78.16 6.69 L 83.67 7.56 L 88.46 8.78 L 92.71 10.34 L 96.49 12.25 L 99.87 14.52 L 102.86 17.14 L 105.48 20.13 L 107.75 23.51 L 109.66 27.29 L 111.22 31.54 L 112.44 36.33 L 113.31 41.84 L 113.83 48.52 Z" fill="url(#login-squircle-gradient)" />
|
||||
|
||||
+210
-59
@@ -3,6 +3,157 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/*
|
||||
* 全局颜色令牌:页面组件不得直接写颜色值。
|
||||
* 颜色使用 RGB 通道存储,Tailwind 和 CSS 可以安全地复用透明度。
|
||||
*/
|
||||
:root {
|
||||
--color-transparent: transparent;
|
||||
--color-black: 0 0 0;
|
||||
--color-white: 255 255 255;
|
||||
|
||||
--color-brand: 0 148 247;
|
||||
--color-brand-highlight: 0 113 227;
|
||||
--color-brand-light: 40 126 254;
|
||||
|
||||
--color-ink: 29 29 31;
|
||||
--color-muted: 134 134 139;
|
||||
--color-line: 210 210 215;
|
||||
--color-canvas: 244 245 247;
|
||||
--color-surface: 255 255 255;
|
||||
--color-surface-subtle: 247 248 250;
|
||||
--color-surface-muted: 250 250 250;
|
||||
|
||||
--color-neutral-50: 249 250 251;
|
||||
--color-neutral-100: 243 244 246;
|
||||
--color-neutral-200: 229 231 235;
|
||||
--color-neutral-300: 209 213 219;
|
||||
--color-neutral-400: 156 163 175;
|
||||
--color-neutral-500: 107 114 128;
|
||||
--color-neutral-600: 75 85 99;
|
||||
--color-neutral-700: 55 65 81;
|
||||
--color-neutral-800: 31 41 55;
|
||||
--color-neutral-900: 17 24 39;
|
||||
--color-neutral-950: 3 7 18;
|
||||
|
||||
--color-slate-50: 248 250 252;
|
||||
--color-slate-100: 241 245 249;
|
||||
--color-slate-200: 226 232 240;
|
||||
--color-slate-300: 203 213 225;
|
||||
--color-slate-400: 148 163 184;
|
||||
--color-slate-500: 100 116 139;
|
||||
--color-slate-600: 71 85 105;
|
||||
--color-slate-700: 51 65 85;
|
||||
--color-slate-800: 30 41 59;
|
||||
--color-slate-900: 15 23 42;
|
||||
--color-slate-950: 2 6 23;
|
||||
|
||||
/* 主色阶:蓝色只从品牌色体系中取值,避免 blue/sky 各自漂移。 */
|
||||
--color-brand-50: 239 248 255;
|
||||
--color-brand-100: 223 241 255;
|
||||
--color-brand-200: 191 229 255;
|
||||
--color-brand-300: 143 210 255;
|
||||
--color-brand-400: 83 184 251;
|
||||
--color-brand-500: 0 148 247;
|
||||
--color-brand-600: 0 148 247;
|
||||
--color-brand-700: 0 113 227;
|
||||
--color-brand-800: 0 91 181;
|
||||
--color-brand-900: 0 75 147;
|
||||
--color-brand-950: 0 53 107;
|
||||
|
||||
--color-success-50: 236 253 245;
|
||||
--color-success-100: 209 250 229;
|
||||
--color-success-200: 167 243 208;
|
||||
--color-success-300: 110 231 183;
|
||||
--color-success-400: 52 211 153;
|
||||
--color-success-500: 16 185 129;
|
||||
--color-success-600: 5 150 105;
|
||||
--color-success-700: 4 120 87;
|
||||
--color-success-800: 6 95 70;
|
||||
--color-success-900: 6 78 59;
|
||||
--color-success-950: 2 44 34;
|
||||
|
||||
--color-warning-50: 255 251 235;
|
||||
--color-warning-100: 254 243 199;
|
||||
--color-warning-200: 253 230 138;
|
||||
--color-warning-300: 252 211 77;
|
||||
--color-warning-400: 251 191 36;
|
||||
--color-warning-500: 245 158 11;
|
||||
--color-warning-600: 217 119 6;
|
||||
--color-warning-700: 180 83 9;
|
||||
--color-warning-800: 146 64 14;
|
||||
--color-warning-900: 120 53 15;
|
||||
--color-warning-950: 69 26 3;
|
||||
|
||||
--color-danger-50: 254 242 242;
|
||||
--color-danger-100: 254 226 226;
|
||||
--color-danger-200: 254 202 202;
|
||||
--color-danger-300: 252 165 165;
|
||||
--color-danger-400: 248 113 113;
|
||||
--color-danger-500: 239 68 68;
|
||||
--color-danger-600: 220 38 38;
|
||||
--color-danger-700: 185 28 28;
|
||||
--color-danger-800: 153 27 27;
|
||||
--color-danger-900: 127 29 29;
|
||||
--color-danger-950: 69 10 10;
|
||||
|
||||
--color-info-50: 239 246 255;
|
||||
--color-info-100: 219 234 254;
|
||||
--color-info-200: 191 219 254;
|
||||
--color-info-300: 147 197 253;
|
||||
--color-info-400: 96 165 250;
|
||||
--color-info-500: 59 130 246;
|
||||
--color-info-600: 37 99 235;
|
||||
--color-info-700: 29 78 216;
|
||||
--color-info-800: 30 64 175;
|
||||
--color-info-900: 30 58 138;
|
||||
--color-info-950: 23 37 84;
|
||||
|
||||
/* 非状态性的辅助色只保留一个紫色阶,避免页面出现过多彩色分支。 */
|
||||
--color-accent-50: 250 245 255;
|
||||
--color-accent-100: 243 232 255;
|
||||
--color-accent-200: 233 213 255;
|
||||
--color-accent-300: 216 180 254;
|
||||
--color-accent-400: 192 132 252;
|
||||
--color-accent-500: 168 85 247;
|
||||
--color-accent-600: 147 51 234;
|
||||
--color-accent-700: 126 34 206;
|
||||
--color-accent-800: 107 33 168;
|
||||
--color-accent-900: 88 28 135;
|
||||
--color-accent-950: 59 7 100;
|
||||
|
||||
--shadow-none: 0 0 0 var(--color-transparent);
|
||||
--shadow-default: 0 1px 3px 0 rgb(var(--color-black) / 0.1), 0 1px 2px -1px rgb(var(--color-black) / 0.1);
|
||||
--shadow-sm: 0 1px 2px 0 rgb(var(--color-black) / 0.05);
|
||||
--shadow-md: 0 4px 6px -1px rgb(var(--color-black) / 0.1), 0 2px 4px -2px rgb(var(--color-black) / 0.1);
|
||||
--shadow-lg: 0 10px 15px -3px rgb(var(--color-black) / 0.1), 0 4px 6px -4px rgb(var(--color-black) / 0.1);
|
||||
--shadow-xl: 0 20px 25px -5px rgb(var(--color-black) / 0.1), 0 8px 10px -6px rgb(var(--color-black) / 0.1);
|
||||
--shadow-2xl: 0 25px 50px -12px rgb(var(--color-black) / 0.25);
|
||||
--shadow-inner: inset 0 2px 4px 0 rgb(var(--color-black) / 0.05);
|
||||
--shadow-card: 0 8px 24px rgb(var(--color-black) / 0.04);
|
||||
--shadow-panel: 0 20px 60px -15px rgb(var(--color-black) / 0.05);
|
||||
--shadow-modal: 0 25px 50px -12px rgb(var(--color-black) / 0.25);
|
||||
--shadow-sidebar: 4px 0 24px rgb(var(--color-slate-900) / 0.035);
|
||||
--shadow-chat: 0 16px 45px rgb(var(--color-slate-900) / 0.06);
|
||||
--shadow-chat-input: 0 -8px 24px rgb(var(--color-slate-900) / 0.04);
|
||||
--shadow-chat-active: inset 3px 0 0 rgb(var(--color-brand));
|
||||
--shadow-brand-soft: 0 2px 8px rgb(var(--color-brand) / 0.2);
|
||||
--shadow-brand-active: 0 8px 18px rgb(var(--color-brand) / 0.2);
|
||||
--shadow-brand-strong: 0 8px 20px rgb(var(--color-brand) / 0.3);
|
||||
}
|
||||
|
||||
/* 覆盖 Tailwind 默认的蓝色焦点环和黑色占位阴影,避免预设色偷偷进入页面。 */
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
--tw-ring-offset-color: rgb(var(--color-white));
|
||||
--tw-ring-color: rgb(var(--color-brand-400) / 0.5);
|
||||
--tw-ring-offset-shadow: 0 0 0 var(--color-transparent);
|
||||
--tw-ring-shadow: 0 0 0 var(--color-transparent);
|
||||
--tw-shadow: 0 0 0 var(--color-transparent);
|
||||
--tw-shadow-colored: 0 0 0 var(--color-transparent);
|
||||
}
|
||||
|
||||
/* Ydisks 超椭圆 logo 容器:用 squircle mask 实现真超椭圆(比圆角矩形更鼓)。
|
||||
mask 让容器背景色(蓝)也裁成超椭圆形状。
|
||||
shadow 改用 filter:drop-shadow,跟随 mask 后的实际形状(box-shadow 会被 mask 裁掉)。 */
|
||||
@@ -34,23 +185,23 @@ html, body, #root {
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
|
||||
"Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
background-color: #F4F5F7;
|
||||
color: #ffffff;
|
||||
background-color: rgb(var(--color-canvas));
|
||||
color: rgb(var(--color-ink));
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
/* 闲鱼风格卡片 */
|
||||
.ios-card {
|
||||
background: #FFFFFF;
|
||||
background: rgb(var(--color-surface));
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.02);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
|
||||
border: 1px solid rgb(var(--color-black) / 0.02);
|
||||
box-shadow: var(--shadow-card);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.ios-card:hover {
|
||||
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
|
||||
box-shadow: 0 12px 32px rgb(var(--color-black) / 0.06);
|
||||
}
|
||||
|
||||
/* 仪表盘饼图是展示型图表,避免 Recharts 的 SVG 焦点框和扇区焦点框形成无意义长条。 */
|
||||
@@ -78,29 +229,29 @@ body {
|
||||
|
||||
/* 闲鱼风格输入框 */
|
||||
.ios-input {
|
||||
background: #F7F8FA;
|
||||
border: 1px solid transparent;
|
||||
background: rgb(var(--color-surface-subtle));
|
||||
border: 1px solid var(--color-transparent);
|
||||
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
color: #111;
|
||||
color: rgb(var(--color-ink));
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.ios-input:focus {
|
||||
background: #FFFFFF;
|
||||
border-color: #0094f7;
|
||||
box-shadow: 0 0 0 4px rgba(0, 148, 247, 0.3);
|
||||
background: rgb(var(--color-surface));
|
||||
border-color: rgb(var(--color-brand));
|
||||
box-shadow: 0 0 0 4px rgb(var(--color-brand) / 0.3);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.ios-input::placeholder {
|
||||
color: #9CA3AF;
|
||||
color: rgb(var(--color-neutral-400));
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* 主按钮 */
|
||||
.ios-btn-primary {
|
||||
background: #0094f7;
|
||||
color: #ffffff;
|
||||
background: rgb(var(--color-brand));
|
||||
color: rgb(var(--color-white));
|
||||
font-weight: 700;
|
||||
border: none;
|
||||
transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
@@ -108,19 +259,19 @@ body {
|
||||
}
|
||||
|
||||
.ios-btn-primary:hover:not(:disabled) {
|
||||
background: #0071e3;
|
||||
background: rgb(var(--color-brand-highlight));
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 8px 20px rgba(0, 148, 247, 0.3);
|
||||
box-shadow: var(--shadow-brand-strong);
|
||||
}
|
||||
|
||||
.ios-btn-primary:active:not(:disabled) {
|
||||
transform: translateY(1px);
|
||||
box-shadow: 0 2px 8px rgba(0, 148, 247, 0.2);
|
||||
box-shadow: var(--shadow-brand-soft);
|
||||
}
|
||||
|
||||
.ios-btn-primary:disabled {
|
||||
background: #F0F0F0;
|
||||
color: #AAAAAA;
|
||||
background: rgb(var(--color-neutral-100));
|
||||
color: rgb(var(--color-neutral-400));
|
||||
box-shadow: none;
|
||||
transform: none;
|
||||
cursor: not-allowed;
|
||||
@@ -128,32 +279,32 @@ body {
|
||||
|
||||
/* 次要按钮 */
|
||||
.ios-btn-secondary {
|
||||
background: #F7F8FA;
|
||||
color: #ffffff;
|
||||
background: rgb(var(--color-surface-subtle));
|
||||
color: rgb(var(--color-ink));
|
||||
font-weight: 600;
|
||||
border: 1px solid transparent;
|
||||
border: 1px solid var(--color-transparent);
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ios-btn-secondary:hover {
|
||||
background: #E5E7EB;
|
||||
border-color: #D1D5DB;
|
||||
background: rgb(var(--color-neutral-200));
|
||||
border-color: rgb(var(--color-neutral-300));
|
||||
}
|
||||
|
||||
/* 危险按钮 */
|
||||
.ios-btn-danger {
|
||||
background: #FEE2E2;
|
||||
color: #DC2626;
|
||||
background: rgb(var(--color-danger-100));
|
||||
color: rgb(var(--color-danger-600));
|
||||
font-weight: 600;
|
||||
border: 1px solid transparent;
|
||||
border: 1px solid var(--color-transparent);
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ios-btn-danger:hover {
|
||||
background: #FECACA;
|
||||
border-color: #FCA5A5;
|
||||
background: rgb(var(--color-danger-200));
|
||||
border-color: rgb(var(--color-danger-300));
|
||||
}
|
||||
|
||||
/* 自定义滚动条 */
|
||||
@@ -163,16 +314,16 @@ body {
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
background: var(--color-transparent);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
background: rgb(var(--color-black) / 0.1);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
background: rgb(var(--color-black) / 0.2);
|
||||
}
|
||||
|
||||
/* 动画 */
|
||||
@@ -234,21 +385,21 @@ body {
|
||||
|
||||
/* 文本选择 */
|
||||
::selection {
|
||||
background: #0094f7;
|
||||
color: #fff;
|
||||
background: rgb(var(--color-brand));
|
||||
color: rgb(var(--color-white));
|
||||
}
|
||||
|
||||
/* 工具类 */
|
||||
.text-brand {
|
||||
color: #0094f7;
|
||||
color: rgb(var(--color-brand));
|
||||
}
|
||||
|
||||
.bg-brand {
|
||||
background-color: #0094f7;
|
||||
background-color: rgb(var(--color-brand));
|
||||
}
|
||||
|
||||
.border-brand {
|
||||
border-color: #0094f7;
|
||||
border-color: rgb(var(--color-brand));
|
||||
}
|
||||
|
||||
/* 状态徽章 */
|
||||
@@ -262,31 +413,31 @@ body {
|
||||
}
|
||||
|
||||
.status-badge-success {
|
||||
background-color: #D1FAE5;
|
||||
color: #065F46;
|
||||
background-color: rgb(var(--color-success-100));
|
||||
color: rgb(var(--color-success-800));
|
||||
}
|
||||
|
||||
.status-badge-warning {
|
||||
background-color: #FEF3C7;
|
||||
color: #92400E;
|
||||
background-color: rgb(var(--color-warning-100));
|
||||
color: rgb(var(--color-warning-800));
|
||||
}
|
||||
|
||||
.status-badge-error {
|
||||
background-color: #FEE2E2;
|
||||
color: #991B1B;
|
||||
background-color: rgb(var(--color-danger-100));
|
||||
color: rgb(var(--color-danger-800));
|
||||
}
|
||||
|
||||
.status-badge-info {
|
||||
background-color: #DBEAFE;
|
||||
color: #1E40AF;
|
||||
background-color: rgb(var(--color-info-100));
|
||||
color: rgb(var(--color-info-800));
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading-skeleton {
|
||||
background: linear-gradient(90deg,
|
||||
#F3F4F6 0%,
|
||||
#E5E7EB 50%,
|
||||
#F3F4F6 100%);
|
||||
rgb(var(--color-neutral-100)) 0%,
|
||||
rgb(var(--color-neutral-200)) 50%,
|
||||
rgb(var(--color-neutral-100)) 100%);
|
||||
background-size: 200% 100%;
|
||||
animation: loading 1.5s ease-in-out infinite;
|
||||
}
|
||||
@@ -308,7 +459,7 @@ body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
background-color: rgb(var(--color-black) / 0.4);
|
||||
backdrop-filter: blur(8px);
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
@@ -322,17 +473,17 @@ body {
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: white;
|
||||
background-color: rgb(var(--color-white));
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: var(--shadow-modal);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
flex-shrink: 0;
|
||||
padding: 2rem 2rem 1.5rem;
|
||||
border-bottom: 1px solid #F3F4F6;
|
||||
background-color: white;
|
||||
border-bottom: 1px solid rgb(var(--color-neutral-100));
|
||||
background-color: rgb(var(--color-white));
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
@@ -346,8 +497,8 @@ body {
|
||||
.modal-footer {
|
||||
flex-shrink: 0;
|
||||
padding: 1.5rem 2rem 2rem;
|
||||
border-top: 1px solid #F3F4F6;
|
||||
background-color: white;
|
||||
border-top: 1px solid rgb(var(--color-neutral-100));
|
||||
background-color: rgb(var(--color-white));
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
@@ -363,7 +514,7 @@ body {
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
background-color: rgb(var(--color-black) / 0.4);
|
||||
backdrop-filter: blur(8px);
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
@@ -377,9 +528,9 @@ body {
|
||||
margin: auto 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: white;
|
||||
background-color: rgb(var(--color-white));
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: var(--shadow-modal);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
const itemList = readFileSync(resolve(__dirname, 'components/ItemList.tsx'), 'utf8');
|
||||
|
||||
describe('item list primary action colors', () => {
|
||||
test('uses the shared primary blue for batch publishing', () => {
|
||||
expect(itemList).toContain('bg-brand text-white hover:bg-brand-highlight');
|
||||
expect(itemList).not.toContain('bg-blue-600 text-white hover:bg-blue-700');
|
||||
});
|
||||
|
||||
test('uses the lighter emerald tone for publishing actions', () => {
|
||||
expect(itemList).toContain('bg-emerald-500 text-white hover:bg-emerald-600');
|
||||
expect(itemList).not.toContain('bg-emerald-600 text-white hover:bg-emerald-700');
|
||||
});
|
||||
});
|
||||
@@ -26,6 +26,13 @@ describe('frontend navigation routing', () => {
|
||||
expect([...sidebarIDs].sort()).toEqual([...appRouteIDs].sort());
|
||||
});
|
||||
|
||||
test('active navigation uses the primary action blue', () => {
|
||||
const sidebar = readFrontendFile('components/Sidebar.tsx');
|
||||
|
||||
expect(sidebar).toContain("'bg-brand text-white shadow-brand-active'");
|
||||
expect(sidebar).not.toContain("'bg-sky-500 text-white'");
|
||||
});
|
||||
|
||||
test('logout button invalidates the backend session before clearing UI state', () => {
|
||||
const app = readFrontendFile('App.tsx');
|
||||
|
||||
|
||||
+62
-10
@@ -1,3 +1,10 @@
|
||||
const color = (token) => `rgb(var(--color-${token}) / <alpha-value>)`;
|
||||
|
||||
const palette = (name) => Object.fromEntries(
|
||||
[50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
||||
.map((shade) => [shade, color(`${name}-${shade}`)]),
|
||||
);
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [
|
||||
@@ -8,18 +15,40 @@ export default {
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
// Ydisks 官网配色:Apple 风格蓝色系 + 浅灰背景 + 深色文字。
|
||||
// 具体色值统一维护在 index.css 的 --color-* 令牌中,组件只使用语义化 Tailwind 类名。
|
||||
transparent: 'var(--color-transparent)',
|
||||
current: 'currentColor',
|
||||
black: color('black'),
|
||||
white: color('white'),
|
||||
brand: {
|
||||
DEFAULT: '#0094f7', // 主品牌蓝(Ydisks logo/按钮色)
|
||||
dark: '#0071e3', // 深蓝(hover/强调)
|
||||
light: '#287efe', // 亮蓝(辅助)
|
||||
DEFAULT: color('brand'),
|
||||
highlight: color('brand-highlight'),
|
||||
light: color('brand-light'),
|
||||
},
|
||||
// Ydisks 中性色
|
||||
ink: '#1d1d1f', // 主文字
|
||||
muted: '#86868b', // 次要文字
|
||||
line: '#d2d2d7', // 边框/分隔
|
||||
canvas: '#fbfbfd', // 页面背景
|
||||
surface: '#f5f5f7', // 卡片背景/区块
|
||||
ink: color('ink'),
|
||||
muted: color('muted'),
|
||||
line: color('line'),
|
||||
canvas: color('canvas'),
|
||||
surface: color('surface'),
|
||||
'surface-subtle': color('surface-subtle'),
|
||||
'surface-muted': color('surface-muted'),
|
||||
success: palette('success'),
|
||||
warning: palette('warning'),
|
||||
danger: palette('danger'),
|
||||
info: palette('info'),
|
||||
// 保留现有 Tailwind 语义类,但统一指向同一套设计令牌。
|
||||
gray: palette('neutral'),
|
||||
slate: palette('slate'),
|
||||
blue: palette('brand'),
|
||||
sky: palette('brand'),
|
||||
emerald: palette('success'),
|
||||
green: palette('success'),
|
||||
amber: palette('warning'),
|
||||
orange: palette('warning'),
|
||||
red: palette('danger'),
|
||||
yellow: palette('warning'),
|
||||
purple: palette('accent'),
|
||||
pink: palette('accent'),
|
||||
},
|
||||
// 圆角统一收紧到 5–10px 区间,UI 更紧凑、信息密度更高。
|
||||
borderRadius: {
|
||||
@@ -45,6 +74,29 @@ export default {
|
||||
'sans-serif',
|
||||
],
|
||||
},
|
||||
accentColor: {
|
||||
brand: color('brand'),
|
||||
},
|
||||
boxShadow: {
|
||||
none: 'var(--shadow-none)',
|
||||
sm: 'var(--shadow-sm)',
|
||||
DEFAULT: 'var(--shadow-default)',
|
||||
md: 'var(--shadow-md)',
|
||||
lg: 'var(--shadow-lg)',
|
||||
xl: 'var(--shadow-xl)',
|
||||
'2xl': 'var(--shadow-2xl)',
|
||||
inner: 'var(--shadow-inner)',
|
||||
card: 'var(--shadow-card)',
|
||||
panel: 'var(--shadow-panel)',
|
||||
modal: 'var(--shadow-modal)',
|
||||
sidebar: 'var(--shadow-sidebar)',
|
||||
chat: 'var(--shadow-chat)',
|
||||
'chat-input': 'var(--shadow-chat-input)',
|
||||
'chat-active': 'var(--shadow-chat-active)',
|
||||
'brand-soft': 'var(--shadow-brand-soft)',
|
||||
'brand-active': 'var(--shadow-brand-active)',
|
||||
'brand-strong': 'var(--shadow-brand-strong)',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
|
||||
@@ -98,6 +98,7 @@ type rawFields struct {
|
||||
redReminder string
|
||||
title string
|
||||
detail string
|
||||
orderRole string
|
||||
updateKey string
|
||||
contentType string
|
||||
chatID string
|
||||
@@ -121,8 +122,12 @@ func fieldsFromRaw(raw map[string]any) rawFields {
|
||||
f.reminderURL = strAny(m10["reminderUrl"])
|
||||
f.buyerID = strAny(m10["senderUserId"])
|
||||
f.updateKey, f.contentType = extFields(strAny(m10["extJson"]))
|
||||
f.orderRole = orderRoleFromTaskName(bizTaskName(strAny(m10["bizTag"])))
|
||||
}
|
||||
if contentJSON := nestedString(raw, "1", "6", "3", "5"); contentJSON != "" {
|
||||
if role := extractOrderRoleFromContent(contentJSON); role != "" {
|
||||
f.orderRole = role
|
||||
}
|
||||
if id := extractOrderIDFromContent(contentJSON); id != "" {
|
||||
f.orderID = id
|
||||
}
|
||||
@@ -180,6 +185,9 @@ func fieldsFromRaw(raw map[string]any) rawFields {
|
||||
}
|
||||
|
||||
func isOrderPaidEvent(f rawFields) bool {
|
||||
if f.orderRole == "buyer" {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(f.text, "我已付款,等待你发货") ||
|
||||
strings.Contains(f.text, "已付款,待发货") ||
|
||||
strings.Contains(f.text, "记得及时发货") ||
|
||||
@@ -279,6 +287,61 @@ var orderIDPatterns = []*regexp.Regexp{
|
||||
regexp.MustCompile(`id=(\d{10,})`),
|
||||
}
|
||||
|
||||
func extractOrderRoleFromContent(contentJSON string) string {
|
||||
var c map[string]any
|
||||
if json.Unmarshal([]byte(contentJSON), &c) != nil {
|
||||
return ""
|
||||
}
|
||||
for _, path := range [][]string{
|
||||
{"dxCard", "item", "main", "exContent", "button", "targetUrl"},
|
||||
{"dxCard", "item", "main", "targetUrl"},
|
||||
{"dynamicOperation", "changeContent", "dxCard", "item", "main", "exContent", "button", "targetUrl"},
|
||||
} {
|
||||
if role := orderRoleFromURL(nestedString(c, path...)); role != "" {
|
||||
return role
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func orderRoleFromURL(rawURL string) string {
|
||||
if strings.TrimSpace(rawURL) == "" {
|
||||
return ""
|
||||
}
|
||||
if strings.HasPrefix(rawURL, "fleamarket://") {
|
||||
rawURL = "https://local.invalid/" + strings.TrimPrefix(rawURL, "fleamarket://")
|
||||
}
|
||||
u, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
switch strings.ToLower(strings.TrimSpace(u.Query().Get("role"))) {
|
||||
case "seller", "buyer":
|
||||
return strings.ToLower(strings.TrimSpace(u.Query().Get("role")))
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func bizTaskName(raw string) string {
|
||||
var tag map[string]any
|
||||
if json.Unmarshal([]byte(raw), &tag) != nil {
|
||||
return ""
|
||||
}
|
||||
return strAny(tag["taskName"])
|
||||
}
|
||||
|
||||
func orderRoleFromTaskName(taskName string) string {
|
||||
switch {
|
||||
case strings.Contains(taskName, "买家"):
|
||||
return "buyer"
|
||||
case strings.Contains(taskName, "卖家"):
|
||||
return "seller"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func matchOrderID(s string) string {
|
||||
for _, re := range orderIDPatterns {
|
||||
if m := re.FindStringSubmatch(s); len(m) == 2 {
|
||||
|
||||
@@ -80,6 +80,37 @@ func TestExtractTaskFromWS_OrderPaid(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractTaskFromWS_BuyerOrderPaidIgnored(t *testing.T) {
|
||||
raw := mustMap(t, `{
|
||||
"1": {
|
||||
"2": "63107041124@goofish",
|
||||
"10": {
|
||||
"redReminder": "等待卖家发货",
|
||||
"reminderContent": "[我已付款,等待你发货]",
|
||||
"senderUserId": "2222315258815",
|
||||
"reminderUrl": "fleamarket://message_chat?itemId=1063177864132&peerUserId=2222315258815&sid=63107041124"
|
||||
},
|
||||
"6": {"3": {"5": "{\"dxCard\":{\"item\":{\"main\":{\"targetUrl\":\"fleamarket://order_detail?id=3310145690545023994&role=buyer\"}}}}"}}
|
||||
}
|
||||
}`)
|
||||
if task := ExtractTaskFromWS("acc1", "cookie", raw); task != nil {
|
||||
t.Fatalf("买家订单不应进入卖家自动化和订单管理: %+v", task)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractTaskFromWS_BuyerOrderPaidTaskNameIgnored(t *testing.T) {
|
||||
raw := mustMap(t, `{
|
||||
"1": {"2": "63107041124@goofish", "10": {
|
||||
"bizTag": "{\"taskName\":\"付款完成待发货_买家\"}",
|
||||
"redReminder": "等待卖家发货",
|
||||
"reminderContent": "[我已付款,等待你发货]"
|
||||
}}
|
||||
}`)
|
||||
if task := ExtractTaskFromWS("acc1", "cookie", raw); task != nil {
|
||||
t.Fatalf("买家侧 taskName 不应进入卖家自动化和订单管理: %+v", task)
|
||||
}
|
||||
}
|
||||
|
||||
func mustMap(t *testing.T, s string) map[string]any {
|
||||
t.Helper()
|
||||
var m map[string]any
|
||||
|
||||
@@ -1006,7 +1006,8 @@ SELECT order_id,item_id,buyer_id,spec_name,spec_value,quantity,amount,order_stat
|
||||
COALESCE(buyer_reviewed_at,''),COALESCE(last_review_request_at,''),review_request_count,
|
||||
created_at,updated_at
|
||||
FROM orders o
|
||||
WHERE o.system_shipped=1
|
||||
WHERE o.system_shipped=1
|
||||
AND o.deleted_at IS NULL
|
||||
AND COALESCE(o.buyer_reviewed_at,'')=''
|
||||
AND COALESCE(o.chat_id,'')<>''
|
||||
AND EXISTS (SELECT 1 FROM automation_rules r
|
||||
|
||||
@@ -29,6 +29,7 @@ func TestMigrate_AppliesCleanSchema(t *testing.T) {
|
||||
{"orders", "system_shipped"},
|
||||
{"orders", "receiver_city"},
|
||||
{"orders", "version"},
|
||||
{"orders", "deleted_at"},
|
||||
{"cards", "image_url"},
|
||||
{"cards", "delay_seconds"},
|
||||
{"keywords", "item_id"},
|
||||
@@ -128,7 +129,7 @@ func TestLatestMigrationsDownUpSQLite(t *testing.T) {
|
||||
}
|
||||
goose.SetBaseFS(migrationsFS)
|
||||
// 依次回滚最新版本到 13,再整体升级。
|
||||
for i := 0; i < 13; i++ {
|
||||
for i := 0; i < 14; i++ {
|
||||
if err := goose.Down(d, "migrations/sqlite"); err != nil {
|
||||
t.Fatalf("down migration #%d: %v", i+1, err)
|
||||
}
|
||||
@@ -151,6 +152,9 @@ func TestLatestMigrationsDownUpSQLite(t *testing.T) {
|
||||
if columnExists(t, d, "item_info", "deleted_at") || columnExists(t, d, "automation_rules", "deleted_at") {
|
||||
t.Fatal("soft-delete columns should be removed after migration 26 down")
|
||||
}
|
||||
if columnExists(t, d, "orders", "deleted_at") {
|
||||
t.Fatal("orders.deleted_at should be removed after migration 27 down")
|
||||
}
|
||||
for _, table := range []string{"account_task_settings", "account_task_runs", "chat_sessions", "chat_messages"} {
|
||||
if tableExists(t, d, table) {
|
||||
t.Fatalf("table should be removed after migration 24 down: %s", table)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE orders ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL;
|
||||
CREATE INDEX idx_orders_active ON orders(cookie_id, deleted_at);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX idx_orders_active ON orders;
|
||||
ALTER TABLE orders DROP COLUMN deleted_at;
|
||||
@@ -0,0 +1,7 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE orders ADD COLUMN deleted_at TIMESTAMP NULL DEFAULT NULL;
|
||||
CREATE INDEX idx_orders_active ON orders(cookie_id, deleted_at);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX IF EXISTS idx_orders_active;
|
||||
ALTER TABLE orders DROP COLUMN deleted_at;
|
||||
@@ -0,0 +1,7 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE orders ADD COLUMN deleted_at TIMESTAMP NULL;
|
||||
CREATE INDEX idx_orders_active ON orders(cookie_id, deleted_at);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX IF EXISTS idx_orders_active;
|
||||
ALTER TABLE orders DROP COLUMN deleted_at;
|
||||
@@ -771,7 +771,7 @@ func TestMultiDB_LatestMigrationsDownUp(t *testing.T) {
|
||||
t.Fatalf("set goose dialect: %v", err)
|
||||
}
|
||||
goose.SetBaseFS(migrationsFS)
|
||||
for i := 0; i < 13; i++ {
|
||||
for i := 0; i < 14; i++ {
|
||||
if err := goose.Down(tg.store.DB, "migrations/"+subdir); err != nil {
|
||||
t.Fatalf("migration down #%d: %v", i+1, err)
|
||||
}
|
||||
@@ -818,6 +818,7 @@ func TestMultiDB_LatestMigrationsDownUp(t *testing.T) {
|
||||
{"item_publish_batch_rows", "category_json"},
|
||||
{"item_info", "deleted_at"},
|
||||
{"automation_rules", "deleted_at"},
|
||||
{"orders", "deleted_at"},
|
||||
{"account_task_settings", "auto_rate_enabled"},
|
||||
{"account_task_runs", "run_key"},
|
||||
{"chat_sessions", "unread_count"},
|
||||
|
||||
+19
-4
@@ -130,6 +130,18 @@ func (o *Orders) UpsertTx(ctx context.Context, tx *sql.Tx, orderID string, opts
|
||||
return upsertOrder(ctx, tx, o.Dialect, orderID, opts)
|
||||
}
|
||||
|
||||
// SoftDelete 将订单标记为逻辑删除,保留历史数据供审计和后续恢复。
|
||||
func (o *Orders) SoftDelete(ctx context.Context, orderID string) (bool, error) {
|
||||
result, err := o.DB.ExecContext(ctx,
|
||||
`UPDATE orders SET deleted_at=CURRENT_TIMESTAMP, updated_at=CURRENT_TIMESTAMP
|
||||
WHERE order_id=? AND deleted_at IS NULL`, orderID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
changed, err := result.RowsAffected()
|
||||
return changed > 0, err
|
||||
}
|
||||
|
||||
func upsertOrder(ctx context.Context, execer sqlQueryExecer, dialect Dialect, orderID string, opts OrderUpsertOpts) error {
|
||||
if orderID == "" {
|
||||
return errors.New("order_id 不能为空")
|
||||
@@ -152,11 +164,11 @@ func upsertOrder(ctx context.Context, execer sqlQueryExecer, dialect Dialect, or
|
||||
}
|
||||
|
||||
for attempt := 0; attempt < maxOrderUpsertRetries; attempt++ {
|
||||
var existingCookie, existingStatus sql.NullString
|
||||
var existingCookie, existingStatus, deletedAt sql.NullString
|
||||
var version int
|
||||
if err := execer.QueryRowContext(ctx,
|
||||
`SELECT cookie_id,order_status,version FROM orders WHERE order_id=?`, orderID).
|
||||
Scan(&existingCookie, &existingStatus, &version); err != nil {
|
||||
`SELECT cookie_id,order_status,version,deleted_at FROM orders WHERE order_id=?`, orderID).
|
||||
Scan(&existingCookie, &existingStatus, &version, &deletedAt); err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.CookieID != "" && existingCookie.Valid && existingCookie.String != "" && existingCookie.String != opts.CookieID {
|
||||
@@ -168,6 +180,9 @@ func upsertOrder(ctx context.Context, execer sqlQueryExecer, dialect Dialect, or
|
||||
current.OrderStatus = ""
|
||||
}
|
||||
set, args := orderUpsertAssignments(current)
|
||||
if deletedAt.Valid && deletedAt.String != "" {
|
||||
set = append(set, "deleted_at=NULL")
|
||||
}
|
||||
if len(set) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -296,7 +311,7 @@ func (o *Orders) Get(ctx context.Context, orderID string) (*Order, error) {
|
||||
COALESCE(paid_at,''),COALESCE(shipped_at,''),COALESCE(completed_at,''),
|
||||
COALESCE(buyer_reviewed_at,''),COALESCE(last_review_request_at,''),review_request_count,
|
||||
created_at, updated_at
|
||||
FROM orders WHERE order_id=?`, orderID).Scan(
|
||||
FROM orders WHERE order_id=? AND deleted_at IS NULL`, orderID).Scan(
|
||||
&ord.OrderID, &itemID, &buyerID, &specName, &specValue, &qty, &amount,
|
||||
&status, &cookieID, &isBargain, &receiverName, &receiverPhone, &receiverAddr,
|
||||
&receiverCity, &version, &chatID, &sysShipped, &paidAt, &shippedAt, &completedAt,
|
||||
|
||||
@@ -30,6 +30,31 @@ func TestOrdersByCookiePageScansBeyondLegacyLimit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrdersSoftDeleteMissingForCookie(t *testing.T) {
|
||||
s, cleanup := newTestDB(t)
|
||||
defer cleanup()
|
||||
ctx := context.Background()
|
||||
_, cid := seedAccount(t, s)
|
||||
for _, orderID := range []string{"seller-order", "buyer-order"} {
|
||||
if err := s.Orders.Upsert(ctx, orderID, OrderUpsertOpts{CookieID: cid, OrderStatus: "pending_ship"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
deleted, err := s.Orders.SoftDeleteMissingForCookie(ctx, cid, map[string]struct{}{"seller-order": {}})
|
||||
if err != nil || deleted != 1 {
|
||||
t.Fatalf("deleted=%d err=%v", deleted, err)
|
||||
}
|
||||
if _, err := s.Orders.Get(ctx, "buyer-order"); !errors.Is(err, ErrNotFound) {
|
||||
t.Fatalf("missing order should be hidden, err=%v", err)
|
||||
}
|
||||
if err := s.Orders.Upsert(ctx, "buyer-order", OrderUpsertOpts{CookieID: cid, OrderStatus: "pending_ship"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.Orders.Get(ctx, "buyer-order"); err != nil {
|
||||
t.Fatalf("reappeared order should be restored, err=%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// seedAccount 在临时库里建好 admin 用户 + 一个账号(cookie),返回 (userID, cookieID)。
|
||||
// 多数订单/自动化/卡券测试都需要这两层外键先就位。
|
||||
func seedAccount(t *testing.T, s *Store) (int64, string) {
|
||||
|
||||
@@ -45,7 +45,7 @@ func (o *Orders) ListForUser(ctx context.Context, f OrderListFilter) ([]OrderRow
|
||||
if f.Limit <= 0 {
|
||||
f.Limit = 20
|
||||
}
|
||||
where := []string{"c.user_id=?"}
|
||||
where := []string{"c.user_id=?", "o.deleted_at IS NULL"}
|
||||
args := []any{f.UserID}
|
||||
if f.CookieID != "" {
|
||||
where = append(where, "o.cookie_id=?")
|
||||
@@ -172,7 +172,7 @@ func (o *Orders) ByCookiePage(ctx context.Context, cookieID string, limit, offse
|
||||
`SELECT order_id, item_id, buyer_id, spec_name, spec_value, quantity, amount,
|
||||
order_status, is_bargain, system_shipped, receiver_name, receiver_phone,
|
||||
receiver_address, receiver_city, created_at, updated_at
|
||||
FROM orders WHERE cookie_id=? ORDER BY created_at DESC,order_id DESC LIMIT ? OFFSET ?`, cookieID, limit, offset)
|
||||
FROM orders WHERE cookie_id=? AND deleted_at IS NULL ORDER BY created_at DESC,order_id DESC LIMIT ? OFFSET ?`, cookieID, limit, offset)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -205,6 +205,54 @@ func (o *Orders) ByCookiePage(ctx context.Context, cookieID string, limit, offse
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
// SoftDeleteMissingForCookie 将本次完整卖家订单同步中未出现的本地订单逻辑删除。
|
||||
// activeIDs 为空表示线上已确认没有任何卖家订单;调用方必须确保同步完整成功后再调用。
|
||||
func (o *Orders) SoftDeleteMissingForCookie(ctx context.Context, cookieID string, activeIDs map[string]struct{}) (int, error) {
|
||||
if strings.TrimSpace(cookieID) == "" {
|
||||
return 0, errors.New("cookie_id 不能为空")
|
||||
}
|
||||
rows, err := o.DB.QueryContext(ctx,
|
||||
`SELECT order_id FROM orders WHERE cookie_id=? AND deleted_at IS NULL`, cookieID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
orderIDs := make([]string, 0)
|
||||
for rows.Next() {
|
||||
var orderID string
|
||||
if err := rows.Scan(&orderID); err != nil {
|
||||
_ = rows.Close()
|
||||
return 0, err
|
||||
}
|
||||
orderIDs = append(orderIDs, orderID)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
_ = rows.Close()
|
||||
return 0, err
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
deleted := 0
|
||||
for _, orderID := range orderIDs {
|
||||
if _, ok := activeIDs[orderID]; ok {
|
||||
continue
|
||||
}
|
||||
result, err := o.DB.ExecContext(ctx, `UPDATE orders
|
||||
SET deleted_at=CURRENT_TIMESTAMP, updated_at=CURRENT_TIMESTAMP
|
||||
WHERE cookie_id=? AND order_id=? AND deleted_at IS NULL`, cookieID, orderID)
|
||||
if err != nil {
|
||||
return deleted, err
|
||||
}
|
||||
changed, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return deleted, err
|
||||
}
|
||||
deleted += int(changed)
|
||||
}
|
||||
return deleted, nil
|
||||
}
|
||||
|
||||
// OrderStatusMap 将数字状态码转换为文本状态。
|
||||
var OrderStatusMap = map[string]string{
|
||||
"paid": "pending_ship",
|
||||
|
||||
@@ -120,7 +120,7 @@ func (s *Server) adminStats(w http.ResponseWriter, r *http.Request) {
|
||||
{`SELECT COUNT(*) FROM users`, &totalUsers},
|
||||
{`SELECT COUNT(*) FROM cookies`, &totalCookies},
|
||||
{`SELECT COUNT(*) FROM cards`, &totalCards},
|
||||
{`SELECT COUNT(*) FROM orders`, &totalOrders},
|
||||
{`SELECT COUNT(*) FROM orders WHERE deleted_at IS NULL`, &totalOrders},
|
||||
{`SELECT COUNT(*) FROM keywords`, &totalKeywords},
|
||||
}
|
||||
for _, count := range counts {
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *Server) dashboardStats(w http.ResponseWriter, r *http.Request) {
|
||||
{"total_cards", `SELECT COUNT(*) FROM cards WHERE user_id=?`},
|
||||
{"total_keywords", `SELECT COUNT(*) FROM keywords k WHERE EXISTS (
|
||||
SELECT 1 FROM cookies c WHERE c.id=k.cookie_id AND c.user_id=?)`},
|
||||
{"total_orders", `SELECT COUNT(*) FROM orders o WHERE EXISTS (
|
||||
{"total_orders", `SELECT COUNT(*) FROM orders o WHERE o.deleted_at IS NULL AND EXISTS (
|
||||
SELECT 1 FROM cookies c WHERE c.id=o.cookie_id AND c.user_id=?)`},
|
||||
}
|
||||
for _, item := range queries {
|
||||
@@ -342,7 +342,7 @@ func (s *Server) validOrders(w http.ResponseWriter, r *http.Request) {
|
||||
// buildAnalyticsWhere 构建 WHERE 子句(user_id 经 cookies 关联过滤 + 日期 + 状态)。
|
||||
// 返回 (whereClause, params),whereClause 已含 WHERE 前缀。
|
||||
func buildAnalyticsWhere(startDate, endDate string, userID int64, statuses []string, location *time.Location) (string, []any) {
|
||||
conds := []string{}
|
||||
conds := []string{"orders.deleted_at IS NULL"}
|
||||
params := []any{}
|
||||
if startDate != "" {
|
||||
conds = append(conds, "orders.created_at >= ?")
|
||||
|
||||
@@ -94,6 +94,13 @@ func TestOrderListAndDetail(t *testing.T) {
|
||||
if rec3.Code != 200 {
|
||||
t.Fatalf("delete status=%d", rec3.Code)
|
||||
}
|
||||
var deletedAt string
|
||||
if err := store.DB.QueryRowContext(ctx, `SELECT COALESCE(deleted_at,'') FROM orders WHERE order_id=?`, "ord1").Scan(&deletedAt); err != nil || deletedAt == "" {
|
||||
t.Fatalf("订单删除应为逻辑删除,deleted_at=%q err=%v", deletedAt, err)
|
||||
}
|
||||
if _, err := store.Orders.Get(ctx, "ord1"); err == nil {
|
||||
t.Fatal("逻辑删除订单不应再出现在活动订单查询中")
|
||||
}
|
||||
}
|
||||
|
||||
// TestCardCRUD 卡券增删改查。
|
||||
|
||||
@@ -187,7 +187,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
|
||||
all = map[string]string{cookieID: value}
|
||||
}
|
||||
|
||||
discovered, listUpdated, failed := 0, 0, 0
|
||||
discovered, listUpdated, softDeleted, failed := 0, 0, 0, 0
|
||||
results := []map[string]any{}
|
||||
newOrderIDs := make(map[string]struct{})
|
||||
if fetcher, ok := s.mtopClient().(mtop.SoldOrderFetcher); ok {
|
||||
@@ -207,7 +207,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
all[cid] = latest.Value
|
||||
mtopCtx, cookieSession := withMTopCookieSnapshot(r.Context(), latest)
|
||||
accountDiscovered, accountUpdated, accountNewIDs, discoveryErr := s.discoverSoldOrders(mtopCtx, fetcher, cid, latest.Value)
|
||||
accountDiscovered, accountUpdated, accountNewIDs, accountRemoteIDs, discoveryErr := s.discoverSoldOrders(mtopCtx, fetcher, cid, latest.Value)
|
||||
value, valueChanged, _, persistErr := s.persistMTopCookieSessionLocked(r.Context(), latest, cookieSession)
|
||||
if persistErr != nil {
|
||||
discoveryErr = errors.Join(discoveryErr, fmt.Errorf("保存订单列表响应 Cookie Jar: %w", persistErr))
|
||||
@@ -227,6 +227,16 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
|
||||
"cookie_id": cid, "stage": "discover", "success": discoveryErr == nil,
|
||||
"discovered": accountDiscovered, "updated": accountUpdated,
|
||||
}
|
||||
if discoveryErr == nil {
|
||||
deleted, deleteErr := s.Store.Orders.SoftDeleteMissingForCookie(r.Context(), cid, accountRemoteIDs)
|
||||
if deleteErr != nil {
|
||||
discoveryErr = fmt.Errorf("标记缺失订单失败: %w", deleteErr)
|
||||
result["success"] = false
|
||||
} else {
|
||||
softDeleted += deleted
|
||||
result["soft_deleted"] = deleted
|
||||
}
|
||||
}
|
||||
if discoveryErr != nil {
|
||||
failed++
|
||||
result["error"] = discoveryErr.Error()
|
||||
@@ -280,7 +290,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
|
||||
"success": failed == 0,
|
||||
"message": message,
|
||||
"summary": map[string]int{
|
||||
"discovered": discovered, "list_updated": listUpdated, "detail_total": total,
|
||||
"discovered": discovered, "list_updated": listUpdated, "soft_deleted": softDeleted, "detail_total": total,
|
||||
"total": total, "updated": 0, "no_change": 0, "failed": failed,
|
||||
},
|
||||
"results": results,
|
||||
@@ -292,7 +302,7 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
|
||||
"success": failed == 0,
|
||||
"message": fmt.Sprintf("订单列表同步完成,发现 %d 个新订单;没有需要补全详情的订单", discovered),
|
||||
"summary": map[string]int{
|
||||
"discovered": discovered, "list_updated": listUpdated, "detail_total": 0,
|
||||
"discovered": discovered, "list_updated": listUpdated, "soft_deleted": softDeleted, "detail_total": 0,
|
||||
"total": 0, "updated": 0, "no_change": 0, "failed": failed,
|
||||
},
|
||||
"results": results,
|
||||
@@ -373,30 +383,31 @@ func (s *Server) refreshOrders(w http.ResponseWriter, r *http.Request) {
|
||||
"success": failed == 0,
|
||||
"message": fmt.Sprintf("订单同步完成,发现 %d 个新订单", discovered),
|
||||
"summary": map[string]int{
|
||||
"discovered": discovered, "list_updated": listUpdated, "detail_total": total,
|
||||
"discovered": discovered, "list_updated": listUpdated, "soft_deleted": softDeleted, "detail_total": total,
|
||||
"total": total, "updated": updated, "no_change": noChange, "failed": failed,
|
||||
},
|
||||
"results": results,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) discoverSoldOrders(ctx context.Context, fetcher mtop.SoldOrderFetcher, cookieID, cookies string) (int, int, map[string]struct{}, error) {
|
||||
func (s *Server) discoverSoldOrders(ctx context.Context, fetcher mtop.SoldOrderFetcher, cookieID, cookies string) (int, int, map[string]struct{}, map[string]struct{}, error) {
|
||||
discovered, updated := 0, 0
|
||||
newOrderIDs := make(map[string]struct{})
|
||||
remoteOrderIDs := make(map[string]struct{})
|
||||
for pageNumber := 1; pageNumber <= maxSoldOrderPages; pageNumber++ {
|
||||
page, err := fetcher.FetchSoldOrdersPage(ctx, cookies, pageNumber, 30)
|
||||
if err != nil {
|
||||
return discovered, updated, newOrderIDs, err
|
||||
return discovered, updated, newOrderIDs, remoteOrderIDs, err
|
||||
}
|
||||
pageChanged := false
|
||||
for _, remote := range page.Items {
|
||||
remoteOrderIDs[remote.OrderID] = struct{}{}
|
||||
if normalizedAmount, ok := db.NormalizeOrderAmount(remote.Amount); ok {
|
||||
remote.Amount = normalizedAmount
|
||||
}
|
||||
existing, getErr := s.Store.Orders.Get(ctx, remote.OrderID)
|
||||
isNew := errors.Is(getErr, db.ErrNotFound)
|
||||
if getErr != nil && !isNew {
|
||||
return discovered, updated, newOrderIDs, fmt.Errorf("读取订单 %s 失败: %w", remote.OrderID, getErr)
|
||||
return discovered, updated, newOrderIDs, remoteOrderIDs, fmt.Errorf("读取订单 %s 失败: %w", remote.OrderID, getErr)
|
||||
}
|
||||
changed := isNew || soldOrderChanged(existing, remote)
|
||||
status := remote.OrderStatus
|
||||
@@ -415,7 +426,7 @@ func (s *Server) discoverSoldOrders(ctx context.Context, fetcher mtop.SoldOrderF
|
||||
ReceiverAddr: remote.ReceiverAddr, ReceiverCity: remote.ReceiverCity,
|
||||
IsBargain: isBargain,
|
||||
}); err != nil {
|
||||
return discovered, updated, newOrderIDs, fmt.Errorf("保存订单 %s 失败: %w", remote.OrderID, err)
|
||||
return discovered, updated, newOrderIDs, remoteOrderIDs, fmt.Errorf("保存订单 %s 失败: %w", remote.OrderID, err)
|
||||
}
|
||||
if isNew {
|
||||
discovered++
|
||||
@@ -423,17 +434,12 @@ func (s *Server) discoverSoldOrders(ctx context.Context, fetcher mtop.SoldOrderF
|
||||
} else if changed {
|
||||
updated++
|
||||
}
|
||||
pageChanged = pageChanged || changed
|
||||
}
|
||||
if !page.NextPage || len(page.Items) == 0 {
|
||||
return discovered, updated, newOrderIDs, nil
|
||||
}
|
||||
// 卖家列表按新到旧排列。一整页都已存在且字段未变化时,更早页也无需重复扫描。
|
||||
if !pageChanged {
|
||||
return discovered, updated, newOrderIDs, nil
|
||||
return discovered, updated, newOrderIDs, remoteOrderIDs, nil
|
||||
}
|
||||
}
|
||||
return discovered, updated, newOrderIDs, fmt.Errorf("订单列表超过 %d 页,已停止继续同步", maxSoldOrderPages)
|
||||
return discovered, updated, newOrderIDs, remoteOrderIDs, fmt.Errorf("订单列表超过 %d 页,已停止继续同步", maxSoldOrderPages)
|
||||
}
|
||||
|
||||
func soldOrderChanged(existing *db.Order, remote mtop.SoldOrder) bool {
|
||||
@@ -559,13 +565,13 @@ func (s *Server) refreshSingleOrder(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, map[string]any{"success": true, "message": "订单刷新完成", "order": detail})
|
||||
}
|
||||
|
||||
// deleteOrder 删除订单。
|
||||
// deleteOrder 逻辑删除订单,保留订单历史,避免破坏自动化审计数据。
|
||||
func (s *Server) deleteOrder(w http.ResponseWriter, r *http.Request) {
|
||||
orderID := chi.URLParam(r, "order_id")
|
||||
if _, ok := s.requireOrderOwner(w, r, orderID); !ok {
|
||||
return
|
||||
}
|
||||
_, err := s.Store.DB.ExecContext(r.Context(), `DELETE FROM orders WHERE order_id=?`, orderID)
|
||||
_, err := s.Store.Orders.SoftDelete(r.Context(), orderID)
|
||||
if err != nil {
|
||||
writeErr(w, http.StatusInternalServerError, "删除失败")
|
||||
return
|
||||
|
||||
@@ -61,6 +61,39 @@ func TestRefreshOrdersDiscoversNewOrdersWithoutBrowser(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRefreshOrdersSoftDeletesOrdersMissingFromSellerList(t *testing.T) {
|
||||
srv, store, cleanup := newTestServer(t)
|
||||
defer cleanup()
|
||||
ctx := context.Background()
|
||||
_, _ = store.DB.ExecContext(ctx, `INSERT INTO orders (order_id,item_id,buyer_id,cookie_id,order_status) VALUES ('buyer-order','buy-item','seller-account','acc1','pending_ship')`)
|
||||
srv.MTop = withMTopTransport(roundTripFunc(func(req *http.Request) (*http.Response, error) {
|
||||
if strings.Contains(req.URL.Query().Get("api"), "order.detail") {
|
||||
body := `{"ret":["SUCCESS::调用成功"],"data":{"utArgs":{"orderStatus":"待发货"},"components":[{"render":"orderInfoVO","data":{"itemInfo":{"buyAmount":"1"},"priceInfo":{"amount":{"value":"10.00"}}}}]}}`
|
||||
return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: req}, nil
|
||||
}
|
||||
body := `{"ret":["SUCCESS::调用成功"],"data":{"module":{"nextPage":"false","totalCount":"1","items":[{` +
|
||||
`"commonData":{"orderId":"seller-order","itemId":"seller-item","orderStatus":"待发货"},` +
|
||||
`"buyerInfoVO":{"buyerId":"buyer-1"},"priceVO":{"totalPrice":"10.00","buyNum":"1"}}]}}}`
|
||||
return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: req}, nil
|
||||
}))
|
||||
h := srv.Router()
|
||||
cookie := loginHelper(t, h)
|
||||
req := httptest.NewRequest(http.MethodPost, "/api/orders/refresh", nil)
|
||||
req.AddCookie(cookie)
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusOK || !strings.Contains(rec.Body.String(), `"soft_deleted":1`) {
|
||||
t.Fatalf("status=%d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
var deletedAt string
|
||||
if err := store.DB.QueryRowContext(ctx, `SELECT COALESCE(deleted_at,'') FROM orders WHERE order_id=?`, "buyer-order").Scan(&deletedAt); err != nil || deletedAt == "" {
|
||||
t.Fatalf("缺失订单应逻辑删除,deleted_at=%q err=%v", deletedAt, err)
|
||||
}
|
||||
if _, err := store.Orders.Get(ctx, "buyer-order"); err == nil {
|
||||
t.Fatal("逻辑删除的购买订单不应再出现在活动订单查询中")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMissingRefreshResultsAreCounted(t *testing.T) {
|
||||
targets := []refreshTarget{{OrderID: "a"}, {OrderID: "b"}, {OrderID: "c"}}
|
||||
missing := missingRefreshTargetIDs(targets, map[string]struct{}{"b": {}})
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(147 197 253 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--color-neutral-200) / 1)}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}input::placeholder,textarea::placeholder{opacity:1;color:rgb(var(--color-neutral-400) / 1)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:6Line truncated
|
||||
@@ -1,19 +0,0 @@
|
||||
import{j as e,r,b as Fe,c as ra,d as Pa}from"./react-vendor-C_od1ZSF.js";import{L as Da,U as na,M as ts,C as ss,B as ia,S as oa,Z as as,a as ft,b as us,c as hs,d as gs,e as Ea,f as rt,A as ks,D as Ta,g as Cs,P as ca,h as At,E as da,T as Fa,i as Ma,j as $e,X as De,k as qa,l as Ba,m as bs,n as xa,o as Ze,Q as Qt,p as xt,q as He,r as bt,s as It,t as Ss,R as ze,u as ma,v as za,w as Qe,K as Ua,x as dt,y as lt,z as st,F as Ls,G as jt,H as yt,I as Ot,J as pa,N as Wa,O as Os,V as Is,W as Va,Y as Ja,_ as Qa,$ as Ga,a0 as Gt,a1 as Dt,a2 as ls,a3 as Ka,a4 as Ha,a5 as rs,a6 as Za,a7 as Ya,a8 as ns,a9 as As,aa as zt,ab as ua,ac as Xa,ad as el,ae as Wt,af as ha,ag as tl,ah as sl,ai as al,aj as ll,ak as rl,al as nl,am as il}from"./icons-vendor-DjsKcZkz.js";import{R as Et,B as ol,X as Rs,Y as $s,T as Tt,a as cl,C as Kt,A as dl,b as xl,c as ml,P as Ps,d as Ds,L as pl}from"./charts-vendor-BxxJOyEX.js";import"./vendor-D-Edl3pr.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))i(m);new MutationObserver(m=>{for(const N of m)if(N.type==="childList")for(const C of N.addedNodes)C.tagName==="LINK"&&C.rel==="modulepreload"&&i(C)}).observe(document,{childList:!0,subtree:!0});function l(m){const N={};return m.integrity&&(N.integrity=m.integrity),m.referrerPolicy&&(N.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?N.credentials="include":m.crossOrigin==="anonymous"?N.credentials="omit":N.credentials="same-origin",N}function i(m){if(m.ep)return;m.ep=!0;const N=l(m);fetch(m.href,N)}})();const ul=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,94.967678 C78.0600632,72.5405324 98.33054,57.0003 121.73,57.0003 Z M86.6602,103.417 C62.9972,103.417 43.7462,122.667 43.7462,146.33 C43.7462,169.992 62.9972,189.244 86.6602,189.244 L105.7645,189.244 L129.869462,148.004782 C129.678439,147.482425 129.5742,146.918336 129.5742,146.33 C129.5742,122.667 110.3232,103.417 86.6602,103.417 Z",fill:"currentColor"})})}),is=({sizeClass:t="w-12 h-12",logoClassName:s="w-full h-full text-white"})=>e.jsxs("div",{className:"relative z-10 flex items-center justify-center",children:[e.jsx("div",{className:"absolute -inset-1 bg-blue-500/20 rounded-xl blur opacity-25"}),e.jsxs("div",{className:`relative ${t} rounded-xl flex items-center justify-center group-hover:scale-105 transition-transform duration-300`,children:[e.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 120 120","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"login-squircle-gradient",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0094f7"}),e.jsx("stop",{offset:"100%",stopColor:"#287efe"})]})}),e.jsx("path",{d:"M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23.51 12.25 L 27.29 10.34 L 31.54 8.78 L 36.33 7.56 L 41.8Line truncated
|
||||
|
||||
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(us,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:Pt,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:L,children:"取消"}),e.jsxs("button",{onClick:Je,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:L,children:[L?e.jsx($e,{className:"w-4 h-4 animate-spin"}):e.jsx(Ze,{className:"w-4 h-4"}),L?"保存中...":"保存"]})]})})]})}),document.body)]})},Kr=t=>({total:Number((t==null?void 0:t.total)||0),success_count:Number((t==null?void 0:t.success_count)||0),failed_count:Number((t==null?void 0:t.failed_count)||0),results:Array.isArray(t==null?void 0:t.results)?t.results.map(s=>({order_id:String((s==null?void 0:s.order_id)||"unknown"),success:(s==null?void 0:s.success)===!0,message:String((s==null?void 0:s.message)||"")})):[]}),Hr=t=>(t==null?void 0:t.results.filter(s=>!s.success))||[],Qs=({status:t})=>{const s={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-[#0094f7] text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600",unknown:"bg-gray-100 text-gray-500"},l={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中",unknown:"未知"};return e.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${s[t]||s.cancelled}`,children:l[t]||t})},Zr=()=>{const[t,s]=r.useState([]),[l,i]=r.useState([]),[m,N]=r.useState([]),[C,$]=r.useState({}),[f,A]=r.useState("all"),[y,G]=r.useState(""),[Y,xe]=r.useState(""),[ne,_]=r.useState(""),M=r.useRef(0),[ie,H]=r.useState(1),[X,W]=r.useState(1),[be,he]=r.useState(!1),[I,K]=r.useState(!1),[oe,q]=r.useState(!1),[Q,R]=r.useState(!1),[P,se]=r.useState(null),[D,ae]=r.useState(null),[Oe,je]=r.useState({}),[me,h]=r.useState(!1),[g,V]=r.useState(""),[w,ee]=r.useState(!1),[le,_e]=r.useState(null),[Re,fe]=r.useState(null),[c,v]=r.useState(null),[E,x]=r.useState(!1),[d,L]=r.useState(null),[U,Z]=r.useState(null),J=async()=>{const p=++M.current;he(!0);try{const B=await Wl(y||void 0,f,ie,20,ne);if(p!==M.current)return;s(B.data),W(B.total_pages)}catch(B){console.error("加载订单失败:",B)}finally{p===M.current&&he(!1)}},Ce=(p,B,ve)=>{if(ve&&ve.trim())return ve;if(C[`${p}:${B}`])return C[`${p}:${B}`];const Ae=l.find(Ge=>{if(ve&&Ge.item_title){const Xe=ve.toLowerCase(),et=Ge.item_title.toLowerCase();return et.includes(Xe)||Xe.includes(et)}return!1});return Ae!=null&&Ae.item_title?Ae.item_title:"未知商品"},u=p=>{const B={};p.forEach(ve=>{ve.item_id&&(B[`${ve.cookie_id}:${ve.item_id}`]=ve.item_title||ve.item_id)}),$(B)};r.useEffect(()=>{const p=window.setTimeout(()=>{H(1),_(Y.trim())},300);return()=>window.clearTimeout(p)},[Y]),r.useEffect(()=>{J()},[y,f,ie,ne]),r.useEffect(()=>{Promise.all([Rt(),_t()]).then(([p,B])=>{N(p),i(B),u(B)}).catch(p=>{console.error("加载商品列表失败:",p)})},[]);const k=r.useMemo(()=>new Map(m.map(p=>[p.id,p])),[m]),T=p=>{const B=k.get(p),ve=(B==null?void 0:B.remark)||(B==null?void 0:B.nickname);return ve?`${ve} · ${p.slice(0,6)}`:`账号 ${p.slice(0,8)}`},F=p=>{const B=k.get(p);return(B==null?void 0:B.remark)||(B==null?void 0:B.nickname)||"未命名账号"},Ie=async()=>{he(!0);try{const p=await Ql(y||void 0,f);await J(),p!=null&&p.message&&alert(p.message)}catch(p){console.error("同步订单失败:",p),alert((p==null?void 0:p.message)||"同步失败,请重试")}finally{he(!1)}},Te=p=>{V(p),_e(null),h(!0)},ye=async p=>{var B;ee(!0),_e(null);try{const ve=await Kl([g],p),Ae=(B=ve==null?void 0:ve.results)==null?void 0:B[0];Ae!=null&&Ae.success?(_e({success:!0,message:Ae.message}),J()):_e({success:!1,message:(Ae==null?void 0:Ae.message)||"发货失败"})}catch(ve){_e({success:!1,message:(ve==null?void 0:ve.message)||"请求失败"})}finally{ee(!1)}},Pe=p=>{se(p),K(!0)},ge=p=>{ae({...p}),q(!0)},Ee=async()=>{if(!(!D||!D.order_id))try{const p={};D.status!==void 0&&(p.order_status=D.status),D.buyer_id!==void 0&&(p.buyer_id=D.buyer_id),D.amount!==void 0&&(p.amount=D.amount),D.receiver_name!==void 0&&(p.receiver_name=D.receiver_name),D.receiver_phone
Line truncated
|
||||
VIP-MONTH-002
|
||||
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(U=>U.map(Z=>`"${String(Z).replace(/"/g,'""')}"`).join(",")).join(`
|
||||
`),x=new Blob(["\uFEFF"+E],{type:"text/csv;charset=utf-8"}),d=URL.createObjectURL(x),L=document.createElement("a");L.href=d,L.download="卡密组批量导入模板.csv",document.body.appendChild(L),L.click(),L.remove(),URL.revokeObjectURL(d)},_e=async()=>{if(M){be(!0),X(null);try{const c=await sr(M);if(X(c),c.created>0){const v=await tt();s(v)}}catch(c){X({error:(c==null?void 0:c.message)||"上传失败"})}finally{be(!1)}}},Re=async()=>{if(!(!he||!K.trim())){be(!0),Q(null);try{const c=await ar(he,K);Q({added:c.added}),oe("");const v=await tt();s(v)}catch(c){alert("追加失败:"+((c==null?void 0:c.message)||"未知错误"))}finally{be(!1)}}},fe=()=>{var c;_("create"),ie(null),X(null),I((c=w[0])!=null&&c.id?String(w[0].id):""),oe(""),Q(null),xe(!0)};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"卡密库存"}),e.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理自动发货的卡密、链接或图片资源。"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:fe,className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-2xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[e.jsx(Ot,{className:"w-5 h-5"}),"批量导入"]}),e.jsxs("button",{onClick:()=>N(!0),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[e.jsx(st,{className:"w-5 h-5"}),"添加新卡密"]})]})]}),e.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-gray-50 bg-[#FAFAFA] p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative sm:w-48",children:[e.jsx(pa,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsxs("select",{"aria-label":"按卡密类型筛选",value:R,onChange:c=>P(c.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-9 text-sm shadow-sm",children:[e.jsx("option",{value:"",children:"全部类型"}),e.jsx("option",{value:"data",children:"批量卡密"}),e.jsx("option",{value:"text",children:"文本"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"image",children:"图片"})]})]}),e.jsxs("div",{className:"relative w-full sm:max-w-sm",children:[e.jsx(jt,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search","aria-label":"按卡密名称搜索",placeholder:"搜索卡密名称...",value:se,onChange:c=>D(c.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-4 text-sm shadow-sm"})]})]}),e.jsxs("div",{className:"whitespace-nowrap px-1 text-xs font-bold text-gray-400",children:["显示 ",ee.length," / ",t.length," 组"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full table-fixed text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[e.jsx("th",{className:"w-[23%] px-5 py-5",children:"卡密名称"}),e.jsx("th",{className:"w-[8%] px-3 py-5",children:"卡密组ID"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"类型"}),e.jsx("th",{className:"w-[27%] px-5 py-5",children:"内容/库存"}),e.jsx("th",{className:"w-[19%] px-5 py-5",children:"描述"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"状态"}),e.jsx("th",{className:"w-[9%] px-3 py-5 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:ee.map(c=>{let v="";return c.type==="data"&&c.data_content?v=`库存: ${c.data_content.split(`
|
||||
`).filter(x=>x.trim()).length} 条`:c.type==="text"&&c.text_content?v=c.text_content:c.type==="api"&&c.api_config?v=c.api_config.url:c.type==="image"&&c.image_url&&(v="图片链接"),e.jsxs("tr",{className:"hover:bg-[#FFFDE7]/50 transition-colors group",children:[e.jsx("td",{className:"px-5 py-5 align-middle",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white",children:e.jsx(ae,{type:c.type})}),e.jsx("span",{className:"line-clamp-3 min-w-0 text-[13px] font-bold leading-5 text-gray-900",title:c.name,children:c.name})]})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("button",{onClick:()=>V(c.id),className:"inline-flex max-w-full items-center gap-1 rounded-lg bg-gray-100 px-2 py-1.5 font-mono text-[11px] font-extrabold text-gray-700 transition-colors hover:bg-gray-200",title:"复制卡密组ID,用于批量铺货表格",children:[e.jsx("span",{className:"truncate",children:c.id}),e.jsx(Wa,{className:"h-3 w-3 shrink-0"})]})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("span",{className:`inline-flex rounded-md px-2 py-1 text-[11px] font-bold ${c.type==="text"?"bg-blue-50 text-blue-600":c.type==="data"?"bg-purple-50 text-purple-600":c.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:c.type==="text"?"文本":c.type==="data"?"批量":c.type==="api"?"API":"图片"})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"line-clamp-3 break-all font-mono text-sm leading-5 text-gray-600",title:v,children:v})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"block truncate text-sm text-gray-500",title:c.description||"-",children:c.description||"-"})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("button",{onClick:()=>g(c),className:`w-12 h-8 rounded-full relative transition-colors ${c.enabled?"bg-green-500":"bg-gray-300"}`,children:e.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${c.enabled?"left-5":"left-1"}`})})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx("button",{onClick:()=>Oe(c),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-black",title:"编辑",children:e.jsx(yt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>me(c.id),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-500",children:e.jsx(Qe,{className:"h-4 w-4"})})]})})]},c.id)})})]})}),ee.length===0&&e.jsxs("div",{className:"py-20 text-center text-gray-400",children:[e.jsx(ca,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:t.length===0?"暂无卡密配置,请点击右上角添加。":"没有符合当前筛选条件的卡密组。"})]})]}),l&&C&&Fe.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),e.jsx("button",{onClick:()=>i(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:e.jsx(De,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:f.name||"",onChange:c=>A({...f,name:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),e.jsxs("select",{value:f.type||"text",onChange:c=>A({...f,type:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"请选择类型"}),e.jsx("option",{value:"text",children:"固定文字"}),e.jsx("option",{value:"data",children:"批量数据"}),(C==null?void 0:C.type)==="api"&&e.jsx("option",{value:"api",children:"API接口(仅保留现有配置)"}),e.jsx("option",{value:"image",children:"图片"})]})]})]}),f.type==="api"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),e.jsx("input",{type:"url",value:f.api_url||"",onChange:c=>A({...f,api_url:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://api.example.com/get-card"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsLine truncated
|
||||
卡号1:密码1
|
||||
卡号2:密码2
|
||||
或者
|
||||
兑换码1
|
||||
兑换码2`}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-blue-600",children:f.data_content?f.data_content.split(`
|
||||
`).filter(c=>c.trim()).length:0})," 条"]})]})]}),f.type==="image"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{type:"url",value:f.image_url||"",onChange:c=>A({...f,image_url:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"输入图片卡密的 URL 地址"})]}),f.image_url&&e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),e.jsx("img",{src:f.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:c=>{c.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"}})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",value:f.delay_seconds||0,onChange:c=>A({...f,delay_seconds:parseInt(c.target.value)||0}),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),e.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),e.jsx("textarea",{value:f.description||"",onChange:c=>A({...f,description:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),e.jsx("button",{type:"button",onClick:()=>A({...f,enabled:!f.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${f.enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${f.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>i(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:je,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(Ze,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),m&&Fe.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[e.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),e.jsx("button",{onClick:()=>N(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:e.jsx(De,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),e.jsx("input",{type:"text",value:y.name,onChange:c=>G({...y,name:c.target.value}),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>G({...y,type:"data",content:""}),className:`p-3 rounded-xl font-bold transition-all ${y.type==="data"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(ss,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),e.jsxs("button",{type:"button",onClick:()=>G({...y,type:"text",content:""}),className:`p-3 rounded-xl font-bold transition-all ${y.type==="text"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:[e.jsx(Os,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),e.jsxs("button",{type:"button",onClick:()=>G({...y,type:"image",content:""}),className:`p-3 rounded-xl font-bold transition-all ${y.type==="image"?"bg-[#0094f7] text-white":"bg-gray-100 text-grayLine truncated
|
||||
CODE-789012
|
||||
...`:"请输入每次发货时发送的固定文字"}),y.type==="data"&&e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-[#0094f7]",children:y.content.split(`
|
||||
`).filter(c=>c.trim()).length})," 条"]})]}),y.type==="api"&&e.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),e.jsxs("select",{value:y.api_method,onChange:c=>G({...y,api_method:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"GET",children:"GET"}),e.jsx("option",{value:"POST",children:"POST"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),e.jsx("input",{type:"number",min:"1",max:"60",value:y.api_timeout,onChange:c=>G({...y,api_timeout:parseInt(c.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),e.jsx("textarea",{value:y.api_headers,onChange:c=>G({...y,api_headers:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),e.jsx("textarea",{value:y.api_params,onChange:c=>G({...y,api_params:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),e.jsx("input",{value:y.description,onChange:c=>G({...y,description:c.target.value}),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),e.jsx("input",{type:"number",value:y.delay_seconds,onChange:c=>G({...y,delay_seconds:parseInt(c.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>N(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:h,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(st,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),Y&&Fe.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:()=>xe(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(De,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:()=>_("create"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${ne==="create"?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Va,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:()=>_("append"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${ne==="append"?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Ot,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),ne==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),'。 类型填 text/data/image;data 类型的"内容"按行存卡密(CSV 单元格内换行需用引号包裹)。']}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:le,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text
Line truncated
|
||||
VIP-002
|
||||
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsx("p",{className:"text-xs text-gray-500",children:"一行一个卡密号,空行自动忽略。会追加到该组现有库存末尾。"})]}),q&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",q.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>xe(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),ne==="create"?e.jsxs("button",{onClick:_e,disabled:!M||W,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[W?e.jsx($e,{className:"w-4 h-4 animate-spin"}):e.jsx(Ot,{className:"w-4 h-4"}),W?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:Re,disabled:!he||!K.trim()||W||w.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[W?e.jsx($e,{className:"w-4 h-4 animate-spin"}):e.jsx(st,{className:"w-4 h-4"}),W?"处理中...":"追加卡密"]})]})]})}),document.body)]})},en=t=>t.find(s=>s.status==="running"||s.status==="canceling"),tn=t=>{const s=String(t||"").trim();return s?/^[¥¥]/.test(s)?s:`¥${s}`:"-"},sn=({onConfigureDelivery:t})=>{const[s,l]=r.useState([]),[i,m]=r.useState([]),[N,C]=r.useState([]),[$,f]=r.useState(""),[A,y]=r.useState(""),[G,Y]=r.useState(!1),[xe,ne]=r.useState(!1),[_,M]=r.useState(!1),[ie,H]=r.useState(!1),[X,W]=r.useState(!1),[be,he]=r.useState(!1),[I,K]=r.useState(!1),[oe,q]=r.useState("upload"),[Q,R]=r.useState(null),[P,se]=r.useState(null),[D,ae]=r.useState(""),[Oe,je]=r.useState(!1),[me,h]=r.useState({catId:"",catName:"",channelCatId:"",tbCatId:""}),[g,V]=r.useState(null),[w,ee]=r.useState(null),[le,_e]=r.useState(null),Re=r.useRef(!1),[fe,c]=r.useState(null),[v,E]=r.useState({}),[x,d]=r.useState({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""}),[L,U]=r.useState({cookie_id:"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),[Z,J]=r.useState([]);r.useEffect(()=>{if(!be||L.images.length===0){J([]);return}const n=L.images.map((O,te)=>({key:O.name+te,url:URL.createObjectURL(O)}));return J(n),()=>{n.forEach(O=>URL.revokeObjectURL(O.url))}},[be,L.images]);const Ce=async()=>{const n=await _t();l(n)},u=async()=>{m(await xs())};r.useEffect(()=>{Promise.all([Rt(),_t(),xs(),Bs(20)]).then(([n,O,te,We])=>{C(n),l(O),m(te);const Je=We.find(Be=>["running","canceling"].includes(Be.status))||We.find(Be=>Be.status!=="preview");_e(Je||null)}).catch(n=>console.error("加载商品配置失败:",n))},[]),r.useEffect(()=>{if(!I||!(w!=null&&w.id)||!["running","canceling"].includes(w.status))return;const n=window.setInterval(async()=>{if(!Re.current){Re.current=!0;try{const O=await ht(w.id);ee(O),_e(O),["running","canceling"].includes(O.status)||(q("done"),await Ce(),await u())}catch(O){console.error("刷新批量铺货进度失败:",O)}finally{Re.current=!1}}},3e3);return()=>{window.clearInterval(n)}},[I,w==null?void 0:w.id,w==null?void 0:w.status]);const k=async()=>{if(!$)return alert("请先选择账号");Y(!0);try{const n=await lr($);await Ce(),alert((n==null?void 0:n.message)||"商品同步完成")}catch(n){console.error("同步商品失败:",n),alert((n==null?void 0:n.message)||"同步失败,请重试")}finally{Y(!1)}},T=n=>{c(n),E({...n}),H(!0)},F=async()=>{if(fe)try{await ur(fe.cookie_id,fe.item_id,{item_title:v.item_title||"",item_description:v.item_description||"",item_category:v.item_category||"",item_price:v.item_price||"",item_detail:v.item_detail||fe.item_detail||""}),await Ce(),await u(),H(!1),c(null)}catch(n){console.error("更新商品失败:",n),alert("更新失败,请重试")}},Ie=async n=>{if(confirm(`确认删除商品"${n.item_title}"吗?`))try{await rr(n.cookie_id,n.item_id),l(O=>O.filter(te=>!(te.cookie_id===n.cookie_id&&te.item_id===n.item_id)))}catch(O){console.error("删除商品失败:",O),alert("删除失败,请重试")}},Te=async()=>{try{if(!x.cookie_id||!x.item_id){alert("请选择账号并填写商品ID");return}await nr(x.cookie_id,{item_id:x.item_id,item_title:x.item_title,item_price:x.item_price,item_detail:x.item_image?JSON.stringify({item_image:x.item_image}):""}),await Ce(),W(!1),d({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""})}catch(n){console.error("添加商品失败:",n),alert("添加失败,请重试")}},ye=async()=>{if(!L.cookie_id)return alert("请选择发布账号");if(!L.title.trim())return alert("请填写商品标题");if(!L.price.trim())return alert("请填写商品价格");if(!L.quantity||Number(L.quantity)<=0)return alert("库存数量必须大于 0");if(L.images.length===0)return alert("至少上传 1 张商品图片");if(L.postage_mode==="fixed
Line truncated
|
||||
`),We=new Blob(["\uFEFF"+te],{type:"text/csv;charset=utf-8"}),Je=URL.createObjectURL(We),Be=document.createElement("a");Be.href=Je,Be.download="批量铺货模板.csv",document.body.appendChild(Be),Be.click(),Be.remove(),URL.revokeObjectURL(Je)},Ae=()=>{d(n=>({...n,cookie_id:$||n.cookie_id})),W(!0)},Ge=()=>{U(n=>({...n,cookie_id:$||n.cookie_id})),he(!0)},Xe=n=>i.filter(O=>O.cookie_id===n.cookie_id&&O.item_id===n.item_id).length>0?i.filter(O=>O.cookie_id===n.cookie_id&&O.item_id===n.item_id):i.filter(O=>O.cookie_id===n.cookie_id&&!O.item_id),et=n=>{switch(n){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"canceling":return"正在安全取消";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"partially_failed":return"部分失败";case"canceled":return"已取消";default:return n||"-"}},nt=n=>{switch(n){case"success":case"completed":return"bg-emerald-50 text-emerald-700 border-emerald-100";case"partially_failed":case"failed":return"bg-red-50 text-red-700 border-red-100";case"running":return"bg-blue-50 text-blue-700 border-blue-100";case"canceled":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-100"}},Ue=r.useMemo(()=>new Map(N.map(n=>[n.id,n])),[N]),Ve=r.useMemo(()=>A?s.filter(n=>n.cookie_id===A):s,[A,s]),Ke=n=>{const O=Ue.get(n),te=(O==null?void 0:O.remark)||(O==null?void 0:O.nickname);return te?`${te} · ${n.slice(0,6)}`:`账号 ${n.slice(0,8)}`},mt=n=>{const O=Ue.get(n);return(O==null?void 0:O.remark)||(O==null?void 0:O.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:justify-between xl:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"商品管理"}),e.jsx("p",{className:"text-gray-500 mt-2 text-sm",children:"监控并管理所有账号下的闲鱼商品。"})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-account-filter",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"商品列表筛选"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ga,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-account-filter","aria-label":"按账号筛选商品列表",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:A,onChange:n=>y(n.target.value),children:[e.jsx("option",{value:"",children:"全部账号"}),N.map(n=>e.jsx("option",{value:n.id,children:Ke(n.id)},n.id))]})]})]}),e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-sync-account",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"同步商品账号"}),e.jsxs("div",{className:"relative",children:[e.jsx(xt,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-sync-account","aria-label":"选择要同步商品的账号",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:$,onChange:n=>f(n.target.value),children:[e.jsx("option",{value:"",children:"请选择账号"}),N.map(n=>e.jsx("option",{value:n.id,children:Ke(n.id)},n.id))]})]})]}),e.jsxs("button",{onClick:k,disabled:G||!$,className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:[e.jsx(ze,{className:`w-4 h-4 ${G?"animate-spin":""}`}),"同步商品"]}),e.jsxs("button",{onClick:Ae,className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors flex items-center gap-2 shadow-lg",children:[e.jsx(st,{className:"w-4 h-4"}),"添加商品"]}),e.jsxs("button",{onClick:Ge,className:"px-5 py-3 rounded-2xl font-bold bg-emerald-600 text-white hover:bg-emerald-700 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100",children:[e.jsx(Gt,{className:"w-4 h-4"}),"发布商品"]}),e.jsxs("button",{onClick:()=>void Pe(),className:"px-5 py-3 rounded-2xl font-bold bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-2 shadow-lg shadow-blue-100",children:[e.jsx(Dt,{className:"w-4 h-4"}),le&&["running","canceling"].includes(le.status)?"继续批量任务":"批量铺货"]}),le&&!["running","canceling"].includes(le.status)&&e.jsx("button",{onClick:()=>void Ee(),className:"px-4 py-3 rounded-2xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"最近批次结果"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:[Ve.map(n=>{const O=Xe(n),te=O.length>0;return e.jsxs("div",{className:"ios-card p-3 rounded-2xl hover:shadow-lg transition-all group r
Line truncated
|
||||
@@ -0,0 +1,19 @@
|
||||
import{j as e,r,b as qe,c as na,d as Da}from"./react-vendor-C_od1ZSF.js";import{L as Ta,U as ia,M as ss,C as as,B as oa,S as ca,Z as ls,a as ft,b as hs,c as gs,d as bs,e as Ea,f as nt,A as Cs,D as Ma,g as Ss,P as da,h as Rt,E as xa,T as qa,i as Fa,j as Pe,X as De,k as Ba,l as za,m as ys,n as ma,o as Ye,Q as Gt,p as mt,q as Ze,r as yt,s as At,t as Ls,R as Ue,u as pa,v as Ua,w as Ke,K as Wa,x as xt,y as rt,z as at,F as Os,G as _t,H as jt,I as It,J as ua,N as Va,O as Is,V as As,W as Ja,Y as Qa,_ as Ga,$ as Ka,a0 as Kt,a1 as Tt,a2 as rs,a3 as Ha,a4 as Za,a5 as ns,a6 as Ya,a7 as Xa,a8 as is,a9 as Rs,aa as Ut,ab as ha,ac as el,ad as tl,ae as Vt,af as ga,ag as sl,ah as al,ai as ll,aj as rl,ak as nl,al as il,am as ol}from"./icons-vendor-DjsKcZkz.js";import{R as Et,B as cl,X as $s,Y as Ps,T as Mt,a as dl,C as Ht,A as xl,b as ml,c as pl,P as Ds,d as Ts,L as ul}from"./charts-vendor-BxxJOyEX.js";import"./vendor-D-Edl3pr.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))i(m);new MutationObserver(m=>{for(const v of m)if(v.type==="childList")for(const k of v.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&i(k)}).observe(document,{childList:!0,subtree:!0});function l(m){const v={};return m.integrity&&(v.integrity=m.integrity),m.referrerPolicy&&(v.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?v.credentials="include":m.crossOrigin==="anonymous"?v.credentials="omit":v.credentials="same-origin",v}function i(m){if(m.ep)return;m.ep=!0;const v=l(m);fetch(m.href,v)}})();const hl=({className:t="w-full h-full text-white"})=>e.jsx("svg",{className:t,viewBox:"0 0 256 256","aria-hidden":"true",children:e.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:e.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,94.967678 C78.0600632,72.5405324 98.33054,57.0003 121.73,57.0003 Z M86.6602,103.417 C62.9972,103.417 43.7462,122.667 43.7462,146.33 C43.7462,169.992 62.9972,189.244 86.6602,189.244 L105.7645,189.244 L129.869462,148.004782 C129.678439,147.482425 129.5742,146.918336 129.5742,146.33 C129.5742,122.667 110.3232,103.417 86.6602,103.417 Z",fill:"currentColor"})})}),os=({sizeClass:t="w-12 h-12",logoClassName:s="w-full h-full text-white"})=>e.jsxs("div",{className:"relative z-10 flex items-center justify-center",children:[e.jsx("div",{className:"absolute -inset-1 bg-blue-500/20 rounded-xl blur opacity-25"}),e.jsxs("div",{className:`relative ${t} rounded-xl flex items-center justify-center group-hover:scale-105 transition-transform duration-300`,children:[e.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 120 120","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"login-squircle-gradient",x1:"0",y1:"0",x2:"1",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-brand))"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-brand-light))"})]})}),e.jsx("path",{d:"M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23.51 12.25 L 27.29
Line truncated
|
||||
|
||||
例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[e.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[e.jsx(hs,{className:"w-4 h-4"}),"AI如何工作"]}),e.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[e.jsx("li",{children:"• 自动识别买家的砍价请求"}),e.jsx("li",{children:"• 根据设定的策略智能回复"}),e.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),e.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:Dt,className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:I,children:"取消"}),e.jsxs("button",{onClick:Ge,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:I,children:[I?e.jsx(Pe,{className:"w-4 h-4 animate-spin"}):e.jsx(Ye,{className:"w-4 h-4"}),I?"保存中...":"保存"]})]})})]})}),document.body)]})},Hr=t=>({total:Number((t==null?void 0:t.total)||0),success_count:Number((t==null?void 0:t.success_count)||0),failed_count:Number((t==null?void 0:t.failed_count)||0),results:Array.isArray(t==null?void 0:t.results)?t.results.map(s=>({order_id:String((s==null?void 0:s.order_id)||"unknown"),success:(s==null?void 0:s.success)===!0,message:String((s==null?void 0:s.message)||"")})):[]}),Zr=t=>(t==null?void 0:t.results.filter(s=>!s.success))||[],Gs=({status:t})=>{const s={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-brand text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600",unknown:"bg-gray-100 text-gray-500"},l={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中",unknown:"未知"};return e.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${s[t]||s.cancelled}`,children:l[t]||t})},Yr=()=>{const[t,s]=r.useState([]),[l,i]=r.useState([]),[m,v]=r.useState([]),[k,D]=r.useState({}),[g,R]=r.useState("all"),[f,Q]=r.useState(""),[Z,me]=r.useState(""),[ce,_]=r.useState(""),q=r.useRef(0),[de,G]=r.useState(1),[Y,U]=r.useState(1),[fe,ge]=r.useState(!1),[O,K]=r.useState(!1),[xe,F]=r.useState(!1),[J,$]=r.useState(!1),[E,se]=r.useState(null),[M,ae]=r.useState(null),[Le,Ne]=r.useState({}),[pe,u]=r.useState(!1),[h,W]=r.useState(""),[w,X]=r.useState(!1),[ne,_e]=r.useState(null),[Re,be]=r.useState(null),[c,N]=r.useState(null),[le,d]=r.useState(!1),[p,I]=r.useState(null),[A,H]=r.useState(null),P=async()=>{const x=++q.current;ge(!0);try{const T=await Vl(f||void 0,g,de,20,ce);if(x!==q.current)return;s(T.data),U(T.total_pages)}catch(T){console.error("加载订单失败:",T)}finally{x===q.current&&ge(!1)}},we=(x,T,ie)=>{if(ie&&ie.trim())return ie;if(k[`${x}:${T}`])return k[`${x}:${T}`];const re=l.find(We=>{if(ie&&We.item_title){const et=ie.toLowerCase(),tt=We.item_title.toLowerCase();return tt.includes(et)||et.includes(tt)}return!1});return re!=null&&re.item_title?re.item_title:"未知商品"},Oe=x=>{const T={};x.forEach(ie=>{ie.item_id&&(T[`${ie.cookie_id}:${ie.item_id}`]=ie.item_title||ie.item_id)}),D(T)};r.useEffect(()=>{const x=window.setTimeout(()=>{G(1),_(Z.trim())},300);return()=>window.clearTimeout(x)},[Z]),r.useEffect(()=>{P()},[f,g,de,ce]),r.useEffect(()=>{Promise.all([$t(),Nt()]).then(([x,T])=>{v(x),i(T),Oe(T)}).catch(x=>{console.error("加载商品列表失败:",x)})},[]);const $e=r.useMemo(()=>new Map(m.map(x=>[x.id,x])),[m]),Te=x=>{const T=$e.get(x),ie=(T==null?void 0:T.remark)||(T==null?void 0:T.nickname);return ie?`${ie} · ${x.slice(0,6)}`:`账号 ${x.slice(0,8)}`},Ee=x=>{const T=$e.get(x);return(T==null?void 0:T.remark)||(T==null?void 0:T.nickname)||"未命名账号"},y=async()=>{ge(!0);try{const x=await Gl(f||void 0,g);await P(),x!=null&&x.message&&alert(x.message)}catch(x){console.error("同步订单失败:",x),alert((x==null?void 0:x.message)||"同步失败,请重试")}finally{ge(!1)}},C=x=>{W(x),_e(null),u(!0)},B=async x=>{var T;X(!0),_e(null);try{const ie=await Hl([h],x),re=(T=ie==null?void 0:ie.results)==null?void 0:T[0];re!=null&&re.success?(_e({success:!0,message:re.message}),P()):_e({success:!1,message:(re==null?void 0:re.message)||"发货失败"})}catch(ie){_e({success:!1,message:(ie==null?void 0:ie.message)||"请求失败"})}finally{X(!1)}},V=x=>{se(x),K(!0)},ke=x=>{ae({...x}),F(!0)},Me=async()=>{if(!(!M||!M.order_id))try{const x={};M.status!==void 0&&(x.order_status=M.status),M.buyer_id!==void 0&&(x.buyer_id=M.buyer_id),M.amount!==void 0&&(x.amount=M.amount),M.receiver_name!==void 0&&(x.receiver_name=M.receiver_name),M.receiver_phone!==
Line truncated
|
||||
VIP-MONTH-002
|
||||
VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(A=>A.map(H=>`"${String(H).replace(/"/g,'""')}"`).join(",")).join(`
|
||||
`),d=new Blob(["\uFEFF"+le],{type:"text/csv;charset=utf-8"}),p=URL.createObjectURL(d),I=document.createElement("a");I.href=p,I.download="卡密组批量导入模板.csv",document.body.appendChild(I),I.click(),I.remove(),URL.revokeObjectURL(p)},_e=async()=>{if(q){fe(!0),Y(null);try{const c=await ar(q);if(Y(c),c.created>0){const N=await st();s(N)}}catch(c){Y({error:(c==null?void 0:c.message)||"上传失败"})}finally{fe(!1)}}},Re=async()=>{if(!(!ge||!K.trim())){fe(!0),J(null);try{const c=await lr(ge,K);J({added:c.added}),xe("");const N=await st();s(N)}catch(c){alert("追加失败:"+((c==null?void 0:c.message)||"未知错误"))}finally{fe(!1)}}},be=()=>{var c;_("create"),de(null),Y(null),O((c=w[0])!=null&&c.id?String(w[0].id):""),xe(""),J(null),me(!0)};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"卡密库存"}),e.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理自动发货的卡密、链接或图片资源。"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:be,className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-2xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[e.jsx(It,{className:"w-5 h-5"}),"批量导入"]}),e.jsxs("button",{onClick:()=>v(!0),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[e.jsx(at,{className:"w-5 h-5"}),"添加新卡密"]})]})]}),e.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[e.jsxs("div",{className:"flex flex-col gap-3 border-b border-gray-50 bg-surface-muted p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-3 sm:flex-row",children:[e.jsxs("div",{className:"relative sm:w-48",children:[e.jsx(ua,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsxs("select",{"aria-label":"按卡密类型筛选",value:$,onChange:c=>E(c.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-9 text-sm shadow-sm",children:[e.jsx("option",{value:"",children:"全部类型"}),e.jsx("option",{value:"data",children:"批量卡密"}),e.jsx("option",{value:"text",children:"文本"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"image",children:"图片"})]})]}),e.jsxs("div",{className:"relative w-full sm:max-w-sm",children:[e.jsx(_t,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search","aria-label":"按卡密名称搜索",placeholder:"搜索卡密名称...",value:se,onChange:c=>M(c.target.value),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-4 text-sm shadow-sm"})]})]}),e.jsxs("div",{className:"whitespace-nowrap px-1 text-xs font-bold text-gray-400",children:["显示 ",X.length," / ",t.length," 组"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full table-fixed text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[e.jsx("th",{className:"w-[23%] px-5 py-5",children:"卡密名称"}),e.jsx("th",{className:"w-[8%] px-3 py-5",children:"卡密组ID"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"类型"}),e.jsx("th",{className:"w-[27%] px-5 py-5",children:"内容/库存"}),e.jsx("th",{className:"w-[19%] px-5 py-5",children:"描述"}),e.jsx("th",{className:"w-[7%] px-2 py-5",children:"状态"}),e.jsx("th",{className:"w-[9%] px-3 py-5 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:X.map(c=>{let N="";return c.type==="data"&&c.data_content?N=`库存: ${c.data_content.split(`
|
||||
`).filter(d=>d.trim()).length} 条`:c.type==="text"&&c.text_content?N=c.text_content:c.type==="api"&&c.api_config?N=c.api_config.url:c.type==="image"&&c.image_url&&(N="图片链接"),e.jsxs("tr",{className:"hover:bg-warning-50/50 transition-colors group",children:[e.jsx("td",{className:"px-5 py-5 align-middle",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white",children:e.jsx(ae,{type:c.type})}),e.jsx("span",{className:"line-clamp-3 min-w-0 text-[13px] font-bold leading-5 text-gray-900",title:c.name,children:c.name})]})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("button",{onClick:()=>W(c.id),className:"inline-flex max-w-full items-center gap-1 rounded-lg bg-gray-100 px-2 py-1.5 font-mono text-[11px] font-extrabold text-gray-700 transition-colors hover:bg-gray-200",title:"复制卡密组ID,用于批量铺货表格",children:[e.jsx("span",{className:"truncate",children:c.id}),e.jsx(Va,{className:"h-3 w-3 shrink-0"})]})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("span",{className:`inline-flex rounded-md px-2 py-1 text-[11px] font-bold ${c.type==="text"?"bg-blue-50 text-blue-600":c.type==="data"?"bg-purple-50 text-purple-600":c.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:c.type==="text"?"文本":c.type==="data"?"批量":c.type==="api"?"API":"图片"})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"line-clamp-3 break-all font-mono text-sm leading-5 text-gray-600",title:N,children:N})}),e.jsx("td",{className:"px-5 py-5",children:e.jsx("span",{className:"block truncate text-sm text-gray-500",title:c.description||"-",children:c.description||"-"})}),e.jsx("td",{className:"px-2 py-5",children:e.jsx("button",{onClick:()=>h(c),className:`w-12 h-8 rounded-full relative transition-colors ${c.enabled?"bg-green-500":"bg-gray-300"}`,children:e.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${c.enabled?"left-5":"left-1"}`})})}),e.jsx("td",{className:"px-3 py-5",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx("button",{onClick:()=>Le(c),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-black",title:"编辑",children:e.jsx(jt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>pe(c.id),className:"rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-500",children:e.jsx(Ke,{className:"h-4 w-4"})})]})})]},c.id)})})]})}),X.length===0&&e.jsxs("div",{className:"py-20 text-center text-gray-400",children:[e.jsx(da,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:t.length===0?"暂无卡密配置,请点击右上角添加。":"没有符合当前筛选条件的卡密组。"})]})]}),l&&k&&qe.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),e.jsx("button",{onClick:()=>i(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:e.jsx(De,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:g.name||"",onChange:c=>R({...g,name:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),e.jsxs("select",{value:g.type||"text",onChange:c=>R({...g,type:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"请选择类型"}),e.jsx("option",{value:"text",children:"固定文字"}),e.jsx("option",{value:"data",children:"批量数据"}),(k==null?void 0:k.type)==="api"&&e.jsx("option",{value:"api",children:"API接口(仅保留现有配置)"}),e.jsx("option",{value:"image",children:"图片"})]})]})]}),g.type==="api"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),e.jsx("input",{type:"url",value:g.api_url||"",onChange:c=>R({...g,api_url:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://api.example.com/get-card"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsLine truncated
|
||||
卡号1:密码1
|
||||
卡号2:密码2
|
||||
或者
|
||||
兑换码1
|
||||
兑换码2`}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-blue-600",children:g.data_content?g.data_content.split(`
|
||||
`).filter(c=>c.trim()).length:0})," 条"]})]})]}),g.type==="image"&&e.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{type:"url",value:g.image_url||"",onChange:c=>R({...g,image_url:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"输入图片卡密的 URL 地址"})]}),g.image_url&&e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),e.jsx("img",{src:g.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:c=>{c.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"}})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",value:g.delay_seconds||0,onChange:c=>R({...g,delay_seconds:parseInt(c.target.value)||0}),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),e.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),e.jsx("textarea",{value:g.description||"",onChange:c=>R({...g,description:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),e.jsx("button",{type:"button",onClick:()=>R({...g,enabled:!g.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${g.enabled?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${g.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>i(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:Ne,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(Ye,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),m&&qe.createPortal(e.jsx("div",{className:"modal-overlay-centered",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[e.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),e.jsx("button",{onClick:()=>v(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:e.jsx(De,{className:"w-5 h-5 text-gray-500"})})]}),e.jsx("div",{className:"modal-body",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),e.jsx("input",{type:"text",value:f.name,onChange:c=>Q({...f,name:c.target.value}),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>Q({...f,type:"data",content:""}),className:`p-3 rounded-xl font-bold transition-all ${f.type==="data"?"bg-brand text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(as,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),e.jsxs("button",{type:"button",onClick:()=>Q({...f,type:"text",content:""}),className:`p-3 rounded-xl font-bold transition-all ${f.type==="text"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children:[e.jsx(Is,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),e.jsxs("button",{type:"button",onClick:()=>Q({...f,type:"image",content:""}),className:`p-3 rounded-xl font-bold transition-all ${f.type==="image"?"bg-brand text-white":"bg-gray-100 text-gray-600"}`,children
Line truncated
|
||||
CODE-789012
|
||||
...`:"请输入每次发货时发送的固定文字"}),f.type==="data"&&e.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",e.jsx("span",{className:"font-bold text-brand",children:f.content.split(`
|
||||
`).filter(c=>c.trim()).length})," 条"]})]}),f.type==="api"&&e.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),e.jsxs("select",{value:f.api_method,onChange:c=>Q({...f,api_method:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"GET",children:"GET"}),e.jsx("option",{value:"POST",children:"POST"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),e.jsx("input",{type:"number",min:"1",max:"60",value:f.api_timeout,onChange:c=>Q({...f,api_timeout:parseInt(c.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),e.jsx("textarea",{value:f.api_headers,onChange:c=>Q({...f,api_headers:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),e.jsx("textarea",{value:f.api_params,onChange:c=>Q({...f,api_params:c.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),e.jsx("input",{value:f.description,onChange:c=>Q({...f,description:c.target.value}),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),e.jsx("input",{type:"number",value:f.delay_seconds,onChange:c=>Q({...f,delay_seconds:parseInt(c.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),e.jsx("div",{className:"modal-footer",children:e.jsxs("div",{className:"flex gap-3 w-full",children:[e.jsx("button",{onClick:()=>v(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:u,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(at,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),Z&&qe.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),e.jsx("button",{onClick:()=>me(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:e.jsx(De,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[e.jsxs("button",{onClick:()=>_("create"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${ce==="create"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(Ja,{className:"w-4 h-4"}),"批量创建卡密组"]}),e.jsxs("button",{onClick:()=>_("append"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${ce==="append"?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[e.jsx(It,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),ce==="create"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",e.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),'。 类型填 text/data/image;data 类型的"内容"按行存卡密(CSV 单元格内换行需用引号包裹)。']}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:ne,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm tran
Line truncated
|
||||
VIP-002
|
||||
VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),e.jsx("p",{className:"text-xs text-gray-500",children:"一行一个卡密号,空行自动忽略。会追加到该组现有库存末尾。"})]}),F&&e.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",F.added," 个卡密"]})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>me(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),ce==="create"?e.jsxs("button",{onClick:_e,disabled:!q||U,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[U?e.jsx(Pe,{className:"w-4 h-4 animate-spin"}):e.jsx(It,{className:"w-4 h-4"}),U?"处理中...":"上传创建"]}):e.jsxs("button",{onClick:Re,disabled:!ge||!K.trim()||U||w.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[U?e.jsx(Pe,{className:"w-4 h-4 animate-spin"}):e.jsx(at,{className:"w-4 h-4"}),U?"处理中...":"追加卡密"]})]})]})}),document.body)]})},tn=t=>t.find(s=>s.status==="running"||s.status==="canceling"),sn=t=>{const s=String(t||"").trim();return s?/^[¥¥]/.test(s)?s:`¥${s}`:"-"},an=({onConfigureDelivery:t})=>{const[s,l]=r.useState([]),[i,m]=r.useState([]),[v,k]=r.useState([]),[D,g]=r.useState(""),[R,f]=r.useState(""),[Q,Z]=r.useState(!1),[me,ce]=r.useState(!1),[_,q]=r.useState(!1),[de,G]=r.useState(!1),[Y,U]=r.useState(!1),[fe,ge]=r.useState(!1),[O,K]=r.useState(!1),[xe,F]=r.useState("upload"),[J,$]=r.useState(null),[E,se]=r.useState(null),[M,ae]=r.useState(""),[Le,Ne]=r.useState(!1),[pe,u]=r.useState({catId:"",catName:"",channelCatId:"",tbCatId:""}),[h,W]=r.useState(null),[w,X]=r.useState(null),[ne,_e]=r.useState(null),Re=r.useRef(!1),[be,c]=r.useState(null),[N,le]=r.useState({}),[d,p]=r.useState({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""}),[I,A]=r.useState({cookie_id:"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),[H,P]=r.useState([]);r.useEffect(()=>{if(!fe||I.images.length===0){P([]);return}const n=I.images.map((L,te)=>({key:L.name+te,url:URL.createObjectURL(L)}));return P(n),()=>{n.forEach(L=>URL.revokeObjectURL(L.url))}},[fe,I.images]);const we=async()=>{const n=await Nt();l(n)},Oe=async()=>{m(await ms())};r.useEffect(()=>{Promise.all([$t(),Nt(),ms(),zs(20)]).then(([n,L,te,Je])=>{k(n),l(L),m(te);const Ge=Je.find(ze=>["running","canceling"].includes(ze.status))||Je.find(ze=>ze.status!=="preview");_e(Ge||null)}).catch(n=>console.error("加载商品配置失败:",n))},[]),r.useEffect(()=>{if(!O||!(w!=null&&w.id)||!["running","canceling"].includes(w.status))return;const n=window.setInterval(async()=>{if(!Re.current){Re.current=!0;try{const L=await gt(w.id);X(L),_e(L),["running","canceling"].includes(L.status)||(F("done"),await we(),await Oe())}catch(L){console.error("刷新批量铺货进度失败:",L)}finally{Re.current=!1}}},3e3);return()=>{window.clearInterval(n)}},[O,w==null?void 0:w.id,w==null?void 0:w.status]);const $e=async()=>{if(!D)return alert("请先选择账号");Z(!0);try{const n=await rr(D);await we(),alert((n==null?void 0:n.message)||"商品同步完成")}catch(n){console.error("同步商品失败:",n),alert((n==null?void 0:n.message)||"同步失败,请重试")}finally{Z(!1)}},Te=n=>{c(n),le({...n}),G(!0)},Ee=async()=>{if(be)try{await hr(be.cookie_id,be.item_id,{item_title:N.item_title||"",item_description:N.item_description||"",item_category:N.item_category||"",item_price:N.item_price||"",item_detail:N.item_detail||be.item_detail||""}),await we(),await Oe(),G(!1),c(null)}catch(n){console.error("更新商品失败:",n),alert("更新失败,请重试")}},y=async n=>{if(confirm(`确认删除商品"${n.item_title}"吗?`))try{await nr(n.cookie_id,n.item_id),l(L=>L.filter(te=>!(te.cookie_id===n.cookie_id&&te.item_id===n.item_id)))}catch(L){console.error("删除商品失败:",L),alert("删除失败,请重试")}},C=async()=>{try{if(!d.cookie_id||!d.item_id){alert("请选择账号并填写商品ID");return}await ir(d.cookie_id,{item_id:d.item_id,item_title:d.item_title,item_price:d.item_price,item_detail:d.item_image?JSON.stringify({item_image:d.item_image}):""}),await we(),U(!1),p({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""})}catch(n){console.error("添加商品失败:",n),alert("添加失败,请重试")}},B=async()=>{if(!I.cookie_id)return alert("请选择发布账号");if(!I.title.trim())return alert("请填写商品标题");if(!I.price.trim())return alert("请填写商品价格");if(!I.quantity||Number(I.quantity)<=0)return alert("库存数量必须大于 0");if(I.images.length===0)return alert("至少上传 1 张商品图片");if(I.postage_mode==="fi
Line truncated
|
||||
`),Je=new Blob(["\uFEFF"+te],{type:"text/csv;charset=utf-8"}),Ge=URL.createObjectURL(Je),ze=document.createElement("a");ze.href=Ge,ze.download="批量铺货模板.csv",document.body.appendChild(ze),ze.click(),ze.remove(),URL.revokeObjectURL(Ge)},re=()=>{p(n=>({...n,cookie_id:D||n.cookie_id})),U(!0)},We=()=>{A(n=>({...n,cookie_id:D||n.cookie_id})),ge(!0)},et=n=>i.filter(L=>L.cookie_id===n.cookie_id&&L.item_id===n.item_id).length>0?i.filter(L=>L.cookie_id===n.cookie_id&&L.item_id===n.item_id):i.filter(L=>L.cookie_id===n.cookie_id&&!L.item_id),tt=n=>{switch(n){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"canceling":return"正在安全取消";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"partially_failed":return"部分失败";case"canceled":return"已取消";default:return n||"-"}},it=n=>{switch(n){case"success":case"completed":return"bg-emerald-50 text-emerald-700 border-emerald-100";case"partially_failed":case"failed":return"bg-red-50 text-red-700 border-red-100";case"running":return"bg-blue-50 text-blue-700 border-blue-100";case"canceled":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-100"}},Ve=r.useMemo(()=>new Map(v.map(n=>[n.id,n])),[v]),Qe=r.useMemo(()=>R?s.filter(n=>n.cookie_id===R):s,[R,s]),He=n=>{const L=Ve.get(n),te=(L==null?void 0:L.remark)||(L==null?void 0:L.nickname);return te?`${te} · ${n.slice(0,6)}`:`账号 ${n.slice(0,8)}`},pt=n=>{const L=Ve.get(n);return(L==null?void 0:L.remark)||(L==null?void 0:L.nickname)||"未命名账号"};return e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row xl:justify-between xl:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"商品管理"}),e.jsx("p",{className:"text-gray-500 mt-2 text-sm",children:"监控并管理所有账号下的闲鱼商品。"})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-account-filter",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"商品列表筛选"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ka,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-account-filter","aria-label":"按账号筛选商品列表",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:R,onChange:n=>f(n.target.value),children:[e.jsx("option",{value:"",children:"全部账号"}),v.map(n=>e.jsx("option",{value:n.id,children:He(n.id)},n.id))]})]})]}),e.jsxs("div",{className:"flex min-w-[200px] flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"item-sync-account",className:"px-1 text-[11px] font-extrabold tracking-wide text-gray-500",children:"同步商品账号"}),e.jsxs("div",{className:"relative",children:[e.jsx(mt,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none"}),e.jsxs("select",{id:"item-sync-account","aria-label":"选择要同步商品的账号",className:"ios-input w-full pl-10 pr-9 py-3 rounded-xl text-sm",value:D,onChange:n=>g(n.target.value),children:[e.jsx("option",{value:"",children:"请选择账号"}),v.map(n=>e.jsx("option",{value:n.id,children:He(n.id)},n.id))]})]})]}),e.jsxs("button",{onClick:$e,disabled:Q||!D,className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:[e.jsx(Ue,{className:`w-4 h-4 ${Q?"animate-spin":""}`}),"同步商品"]}),e.jsxs("button",{onClick:re,className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors flex items-center gap-2 shadow-lg",children:[e.jsx(at,{className:"w-4 h-4"}),"添加商品"]}),e.jsxs("button",{onClick:We,className:"px-5 py-3 rounded-2xl font-bold bg-emerald-500 text-white hover:bg-emerald-600 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100",children:[e.jsx(Kt,{className:"w-4 h-4"}),"发布商品"]}),e.jsxs("button",{onClick:()=>void V(),className:"px-5 py-3 rounded-2xl font-bold bg-brand text-white hover:bg-brand-highlight transition-colors flex items-center gap-2 shadow-lg shadow-blue-100",children:[e.jsx(Tt,{className:"w-4 h-4"}),ne&&["running","canceling"].includes(ne.status)?"继续批量任务":"批量铺货"]}),ne&&!["running","canceling"].includes(ne.status)&&e.jsx("button",{onClick:()=>void Me(),className:"px-4 py-3 rounded-2xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"最近批次结果"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:[Qe.map(n=>{const L=et(n),te=L.length>0;return e.jsxs("div",{className:"ios-card p-3 rounded-2xl hover:shadow-lg transition-all gro
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-wLine truncated
|
||||
@@ -6,12 +6,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Ydisks闲鱼助手 - 自动发货与管家系统</title>
|
||||
<meta name="description" content="Ydisks闲鱼助手 - 自动回复、自动发货、订单管理、AI智能议价一体化解决方案" />
|
||||
<script type="module" crossorigin src="/static/assets/index-BXzKW9e8.js"></script>
|
||||
<script type="module" crossorigin src="/static/assets/index-DLBJvCyf.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/react-vendor-C_od1ZSF.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/icons-vendor-DjsKcZkz.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/vendor-D-Edl3pr.js">
|
||||
<link rel="modulepreload" crossorigin href="/static/assets/charts-vendor-BxxJOyEX.js">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-DPhnB9W9.css">
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-B8qM55ET.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
Reference in new issue
Block a user