'use client' import { useState } from 'react' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card' import { Button } from '@/components/ui/Button' import { Modal } from '@/components/ui/Modal' import { SuccessTag, PendingTag, WarningTag } from '@/components/ui/Tag' import { Search, Plus, Users, TrendingUp, TrendingDown, Mail, Copy, CheckCircle, Clock, MoreVertical } from 'lucide-react' // 模拟代理商列表 const mockAgencies = [ { id: 'agency-001', name: '星耀传媒', email: 'contact@xingyao.com', status: 'active', creatorCount: 50, projectCount: 8, passRate: 92, trend: 'up', joinedAt: '2025-06-15', }, { id: 'agency-002', name: '创意无限', email: 'hello@chuangyi.com', status: 'active', creatorCount: 35, projectCount: 5, passRate: 88, trend: 'up', joinedAt: '2025-08-20', }, { id: 'agency-003', name: '美妆达人MCN', email: 'biz@meizhuang.com', status: 'active', creatorCount: 28, projectCount: 4, passRate: 75, trend: 'down', joinedAt: '2025-10-10', }, { id: 'agency-004', name: '时尚风向标', email: 'info@shishang.com', status: 'pending', creatorCount: 0, projectCount: 0, passRate: 0, trend: 'stable', joinedAt: '2026-02-01', }, ] function StatusTag({ status }: { status: string }) { if (status === 'active') return 已激活 if (status === 'pending') return 待接受 return 已暂停 } export default function AgenciesManagePage() { const [searchQuery, setSearchQuery] = useState('') const [showInviteModal, setShowInviteModal] = useState(false) const [inviteEmail, setInviteEmail] = useState('') const [inviteLink, setInviteLink] = useState('') const filteredAgencies = mockAgencies.filter(agency => agency.name.toLowerCase().includes(searchQuery.toLowerCase()) || agency.email.toLowerCase().includes(searchQuery.toLowerCase()) ) const handleInvite = () => { if (!inviteEmail.trim()) { alert('请输入代理商邮箱') return } // 模拟生成邀请链接 const link = `https://miaosi.app/invite/agency/${Date.now()}` setInviteLink(link) } const handleCopyLink = () => { navigator.clipboard.writeText(inviteLink) alert('链接已复制') } const handleSendInvite = () => { alert(`邀请已发送至 ${inviteEmail}`) setShowInviteModal(false) setInviteEmail('') setInviteLink('') } return (
{/* 页面标题 */}

代理商管理

管理合作代理商,查看代理商绩效数据

{/* 统计卡片 */}

总代理商

{mockAgencies.length}

已激活

{mockAgencies.filter(a => a.status === 'active').length}

待接受

{mockAgencies.filter(a => a.status === 'pending').length}

平均通过率

{Math.round(mockAgencies.filter(a => a.status === 'active').reduce((sum, a) => sum + a.passRate, 0) / mockAgencies.filter(a => a.status === 'active').length)}%

{/* 搜索 */}
setSearchQuery(e.target.value)} className="w-full pl-10 pr-4 py-2 border border-border-subtle rounded-lg bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
{/* 代理商列表 */} {filteredAgencies.map((agency) => ( ))}
代理商 状态 达人数 项目数 通过率 加入时间 操作
{agency.name}
{agency.email}
{agency.creatorCount} {agency.projectCount} {agency.status === 'active' ? (
= 90 ? 'text-accent-green' : agency.passRate >= 80 ? 'text-accent-indigo' : 'text-orange-400'}`}> {agency.passRate}% {agency.trend === 'up' && } {agency.trend === 'down' && }
) : ( - )}
{agency.joinedAt}
{/* 邀请代理商弹窗 */} { setShowInviteModal(false); setInviteEmail(''); setInviteLink(''); }} title="邀请代理商">

输入代理商邮箱,系统将发送邀请链接。

setInviteEmail(e.target.value)} placeholder="agency@example.com" className="flex-1 px-4 py-2 border border-border-subtle rounded-lg bg-bg-elevated text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-indigo" />
{inviteLink && (
邀请链接

{inviteLink}

)}
) }