diff --git a/Cunkebao/api/wechat-accounts.ts b/Cunkebao/api/wechat-accounts.ts index 1cc6cf9e..3097b1eb 100644 --- a/Cunkebao/api/wechat-accounts.ts +++ b/Cunkebao/api/wechat-accounts.ts @@ -88,4 +88,120 @@ export const transformWechatAccount = (serverAccount: any): import("@/types/wech status: serverAccount.wechatAlive === 1 ? "normal" : "abnormal" as "normal" | "abnormal", lastActive: new Date().toLocaleString() // 服务端未提供,使用当前时间 }; +}; + +/** + * 将服务端的微信账号详情转换为前端详情页面所需的格式 + * @param detailResponse 服务端微信账号详情响应 + * @returns 前端页面所需的微信账号详情格式 + */ +export const transformWechatAccountDetail = (detailResponse: WechatAccountDetailResponse): any => { + if (!detailResponse || !detailResponse.data) { + return null; + } + + const { basicInfo, statistics, accountInfo, restrictions, friends } = detailResponse.data; + + // 设备信息处理 + let deviceId = ''; + let deviceName = ''; + + if (basicInfo.deviceInfo) { + const deviceInfoParts = basicInfo.deviceInfo.split(' '); + deviceId = deviceInfoParts[0] || ''; + deviceName = deviceInfoParts[1] ? deviceInfoParts[1].replace(/[()]/g, '') : ''; + } + + // 账号年龄计算 + let accountAgeYears = 0; + let accountAgeMonths = 0; + + if (accountInfo.createTime) { + const createDate = new Date(accountInfo.createTime); + const currentDate = new Date(); + const diffInMonths = (currentDate.getFullYear() - createDate.getFullYear()) * 12 + + (currentDate.getMonth() - createDate.getMonth()); + + accountAgeYears = Math.floor(diffInMonths / 12); + accountAgeMonths = diffInMonths % 12; + } + + // 转换限制记录 + const restrictionRecords = restrictions?.map((restriction, index) => ({ + id: `${index}`, + date: restriction.startTime, + reason: restriction.reason, + recoveryTime: restriction.endTime, + type: mapRestrictionType(restriction.type) + })) || []; + + // 转换好友数据 + const transformedFriends = friends?.map(friend => ({ + id: friend.id.toString(), + avatar: friend.avatar || `/placeholder.svg?height=40&width=40&text=${friend.nickname?.[0] || ''}`, + nickname: friend.nickname, + wechatId: friend.wechatId, + remark: '', // 服务端未提供 + addTime: friend.createTime, + lastInteraction: '', // 服务端未提供 + tags: [], // 服务端未提供 + region: friend.region || '', + source: '', // 服务端未提供 + notes: '', // 服务端未提供 + })) || []; + + // 创建每周统计数据(模拟数据,服务端未提供) + const weeklyStats = Array.from({ length: 7 }, (_, i) => ({ + date: `Day ${i + 1}`, + friends: Math.floor(Math.random() * 50) + 50, + messages: Math.floor(Math.random() * 100) + 100, + })); + + return { + id: basicInfo.id.toString(), + avatar: basicInfo.avatar || '', + nickname: basicInfo.nickname || '', + wechatId: basicInfo.wechatId || '', + deviceId, + deviceName, + friendCount: statistics.totalFriend || 0, + todayAdded: 0, // 服务端未提供,默认为0 + status: basicInfo.status === '在线' ? 'normal' : 'abnormal', + lastActive: accountInfo.lastUpdateTime || new Date().toLocaleString(), + messageCount: statistics.thirtyDayMsgCount || 0, + activeRate: 0, // 服务端未提供,默认为0 + accountAge: { + years: accountAgeYears, + months: accountAgeMonths, + }, + totalChats: statistics.sevenDayMsgCount + statistics.yesterdayMsgCount || 0, + chatFrequency: Math.floor((statistics.sevenDayMsgCount || 0) / 7), // 每日平均聊天次数 + restrictionRecords, + isVerified: true, // 服务端未提供,默认为true + firstMomentDate: accountInfo.createTime || '', + accountWeight: accountInfo.weight || 50, + weightFactors: { + restrictionFactor: restrictionRecords.length > 0 ? 0.8 : 1.0, + verificationFactor: 1.0, + ageFactor: Math.min(1.0, accountAgeYears * 0.1 + 0.5), + activityFactor: statistics.totalFriend > 0 ? 0.9 : 0.7, + }, + weeklyStats, + friends: transformedFriends, + }; +}; + +/** + * 将服务端的限制类型映射为前端类型 + * @param type 服务端限制类型 + * @returns 前端限制类型 + */ +const mapRestrictionType = (type: string): "friend_limit" | "marketing" | "spam" | "other" => { + const typeMap: Record = { + 'friend': 'friend_limit', + 'marketing': 'marketing', + 'spam': 'spam' + }; + + return typeMap[type] || 'other'; }; \ No newline at end of file diff --git a/Cunkebao/app/wechat-accounts/[id]/page.tsx b/Cunkebao/app/wechat-accounts/[id]/page.tsx index e238b2e0..c113e604 100644 --- a/Cunkebao/app/wechat-accounts/[id]/page.tsx +++ b/Cunkebao/app/wechat-accounts/[id]/page.tsx @@ -18,6 +18,7 @@ import { Filter, Tag, ChevronRight, + Loader2, } from "lucide-react" import { Badge } from "@/components/ui/badge" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" @@ -42,6 +43,8 @@ import { PaginationNext, PaginationPrevious, } from "@/components/ui/pagination" +import { toast } from "@/components/ui/use-toast" +import { fetchWechatAccountDetail, transformWechatAccountDetail } from "@/api/wechat-accounts" interface RestrictionRecord { id: string @@ -120,137 +123,42 @@ export default function WechatAccountDetailPage({ params }: { params: { id: stri const [currentPage, setCurrentPage] = useState(1) const [activeTab, setActiveTab] = useState("overview") const friendsPerPage = 10 + const [isLoading, setIsLoading] = useState(false) useEffect(() => { // 模拟API调用获取账号详情 const fetchAccount = async () => { - // 生成随机标签 - const generateRandomTags = (count: number) => { - const tagPool = [ - { name: "潜在客户", color: "bg-blue-100 text-blue-800" }, - { name: "高意向", color: "bg-green-100 text-green-800" }, - { name: "已成交", color: "bg-purple-100 text-purple-800" }, - { name: "需跟进", color: "bg-yellow-100 text-yellow-800" }, - { name: "活跃用户", color: "bg-indigo-100 text-indigo-800" }, - { name: "沉默用户", color: "bg-gray-100 text-gray-800" }, - { name: "企业客户", color: "bg-red-100 text-red-800" }, - { name: "个人用户", color: "bg-pink-100 text-pink-800" }, - { name: "新增好友", color: "bg-emerald-100 text-emerald-800" }, - { name: "老客户", color: "bg-amber-100 text-amber-800" }, - ] - - return Array.from({ length: Math.floor(Math.random() * count) + 1 }, () => { - const randomTag = tagPool[Math.floor(Math.random() * tagPool.length)] - return { - id: `tag-${Math.random().toString(36).substring(2, 9)}`, - name: randomTag.name, - color: randomTag.color, - } + try { + setIsLoading(true) + + // 调用API获取微信账号详情 + const response = await fetchWechatAccountDetail(params.id) + + if (response && response.code === 200) { + // 转换数据格式 + const transformedAccount = transformWechatAccountDetail(response) + setAccount(transformedAccount) + } else { + toast({ + title: "获取微信账号详情失败", + description: response?.msg || "请稍后再试", + variant: "destructive" + }) + // 获取失败时使用模拟数据 + setAccount(generateMockAccountData()) + } + } catch (error) { + console.error("获取微信账号详情失败:", error) + toast({ + title: "获取微信账号详情失败", + description: "请检查网络连接或稍后再试", + variant: "destructive" }) + // 请求出错时使用模拟数据 + setAccount(generateMockAccountData()) + } finally { + setIsLoading(false) } - - // 生成随机好友 - const friendCount = Math.floor(Math.random() * (300 - 150)) + 150 - const generateFriends = (count: number) => { - return Array.from({ length: count }, (_, i) => { - const firstName = ["张", "王", "李", "赵", "陈", "刘", "杨", "黄", "周", "吴"][Math.floor(Math.random() * 10)] - const secondName = ["小", "大", "明", "华", "强", "伟", "芳", "娜", "秀", "英"][ - Math.floor(Math.random() * 10) - ] - const lastName = ["明", "华", "强", "伟", "芳", "娜", "秀", "英", "军", "杰"][Math.floor(Math.random() * 10)] - const nickname = firstName + secondName + lastName - - // 生成随机的添加时间(过去1年内) - const addDate = new Date() - addDate.setDate(addDate.getDate() - Math.floor(Math.random() * 365)) - - // 生成随机的最后互动时间(过去30天内) - const lastDate = new Date() - lastDate.setDate(lastDate.getDate() - Math.floor(Math.random() * 30)) - - return { - id: `friend-${i}`, - avatar: `/placeholder.svg?height=40&width=40&text=${nickname[0]}`, - nickname, - wechatId: `wxid_${Math.random().toString(36).substring(2, 9)}`, - remark: - Math.random() > 0.5 - ? `${nickname}(${["同事", "客户", "朋友", "同学"][Math.floor(Math.random() * 4)]})` - : "", - addTime: addDate.toISOString().split("T")[0], - lastInteraction: lastDate.toISOString().split("T")[0], - tags: generateRandomTags(3), - region: ["广东", "北京", "上海", "浙江", "江苏", "四川", "湖北", "福建", "山东", "河南"][ - Math.floor(Math.random() * 10) - ], - source: ["抖音", "小红书", "朋友介绍", "搜索添加", "群聊", "附近的人", "名片分享"][ - Math.floor(Math.random() * 7) - ], - notes: - Math.random() > 0.7 - ? ["对产品很感兴趣", "需要进一步跟进", "已购买过产品", "价格敏感", "需要更多信息"][ - Math.floor(Math.random() * 5) - ] - : "", - } - }) - } - - const friends = generateFriends(friendCount) - - const mockAccount: WechatAccountDetail = { - id: params.id, - avatar: - "https://hebbkx1anhila5yf.public.blob.vercel-storage.com/img_v3_02jn_e7fcc2a4-3560-478d-911a-4ccd69c6392g.jpg-a8zVtwxMuSrPWN9dfWH93EBY0yM3Dh.jpeg", - nickname: "卡若-25vig", - wechatId: `wxid_${Math.random().toString(36).substr(2, 8)}`, - deviceId: "device-1", - deviceName: "设备1", - friendCount: friends.length, - todayAdded: 12, - status: "normal", - lastActive: new Date().toLocaleString(), - messageCount: 1234, - activeRate: 87, - accountAge: { - years: 2, - months: 8, - }, - totalChats: 15234, - chatFrequency: 42, - restrictionRecords: [ - { - id: "1", - date: "2024-02-25", - reason: "添加好友过于频繁", - recoveryTime: "2024-02-26", - type: "friend_limit", - }, - { - id: "2", - date: "2024-01-15", - reason: "营销内容违规", - recoveryTime: "2024-01-16", - type: "marketing", - }, - ], - isVerified: true, - firstMomentDate: "2021-06-15", - accountWeight: 85, - weightFactors: { - restrictionFactor: 0.8, - verificationFactor: 1.0, - ageFactor: 0.9, - activityFactor: 0.85, - }, - weeklyStats: Array.from({ length: 7 }, (_, i) => ({ - date: `Day ${i + 1}`, - friends: Math.floor(Math.random() * 50) + 50, - messages: Math.floor(Math.random() * 100) + 100, - })), - friends: friends, - } - setAccount(mockAccount) } fetchAccount() @@ -328,439 +236,580 @@ export default function WechatAccountDetailPage({ params }: { params: { id: stri const totalPages = Math.ceil(filteredFriends.length / friendsPerPage) const paginatedFriends = filteredFriends.slice((currentPage - 1) * friendsPerPage, currentPage * friendsPerPage) + // 生成模拟账号数据(作为备用,服务器请求失败时使用) + const generateMockAccountData = () => { + // 生成随机标签 + const generateRandomTags = (count: number) => { + const tagPool = [ + { name: "潜在客户", color: "bg-blue-100 text-blue-800" }, + { name: "高意向", color: "bg-green-100 text-green-800" }, + { name: "已成交", color: "bg-purple-100 text-purple-800" }, + { name: "需跟进", color: "bg-yellow-100 text-yellow-800" }, + { name: "活跃用户", color: "bg-indigo-100 text-indigo-800" }, + { name: "沉默用户", color: "bg-gray-100 text-gray-800" }, + { name: "企业客户", color: "bg-red-100 text-red-800" }, + { name: "个人用户", color: "bg-pink-100 text-pink-800" }, + { name: "新增好友", color: "bg-emerald-100 text-emerald-800" }, + { name: "老客户", color: "bg-amber-100 text-amber-800" }, + ] + + return Array.from({ length: Math.floor(Math.random() * count) + 1 }, () => { + const randomTag = tagPool[Math.floor(Math.random() * tagPool.length)] + return { + id: `tag-${Math.random().toString(36).substring(2, 9)}`, + name: randomTag.name, + color: randomTag.color, + } + }) + } + + // 生成随机好友 + const friendCount = Math.floor(Math.random() * (300 - 150)) + 150 + const generateFriends = (count: number) => { + return Array.from({ length: count }, (_, i) => { + const firstName = ["张", "王", "李", "赵", "陈", "刘", "杨", "黄", "周", "吴"][Math.floor(Math.random() * 10)] + const secondName = ["小", "大", "明", "华", "强", "伟", "芳", "娜", "秀", "英"][ + Math.floor(Math.random() * 10) + ] + const lastName = ["明", "华", "强", "伟", "芳", "娜", "秀", "英", "军", "杰"][Math.floor(Math.random() * 10)] + const nickname = firstName + secondName + lastName + + // 生成随机的添加时间(过去1年内) + const addDate = new Date() + addDate.setDate(addDate.getDate() - Math.floor(Math.random() * 365)) + + // 生成随机的最后互动时间(过去30天内) + const lastDate = new Date() + lastDate.setDate(lastDate.getDate() - Math.floor(Math.random() * 30)) + + return { + id: `friend-${i}`, + avatar: `/placeholder.svg?height=40&width=40&text=${nickname[0]}`, + nickname, + wechatId: `wxid_${Math.random().toString(36).substring(2, 9)}`, + remark: + Math.random() > 0.5 + ? `${nickname}(${["同事", "客户", "朋友", "同学"][Math.floor(Math.random() * 4)]})` + : "", + addTime: addDate.toISOString().split("T")[0], + lastInteraction: lastDate.toISOString().split("T")[0], + tags: generateRandomTags(3), + region: ["广东", "北京", "上海", "浙江", "江苏", "四川", "湖北", "福建", "山东", "河南"][ + Math.floor(Math.random() * 10) + ], + source: ["抖音", "小红书", "朋友介绍", "搜索添加", "群聊", "附近的人", "名片分享"][ + Math.floor(Math.random() * 7) + ], + notes: + Math.random() > 0.7 + ? ["对产品很感兴趣", "需要进一步跟进", "已购买过产品", "价格敏感", "需要更多信息"][ + Math.floor(Math.random() * 5) + ] + : "", + } + }) + } + + const friends = generateFriends(friendCount) + + const mockAccount: WechatAccountDetail = { + id: params.id, + avatar: + "https://hebbkx1anhila5yf.public.blob.vercel-storage.com/img_v3_02jn_e7fcc2a4-3560-478d-911a-4ccd69c6392g.jpg-a8zVtwxMuSrPWN9dfWH93EBY0yM3Dh.jpeg", + nickname: "卡若-25vig", + wechatId: `wxid_${Math.random().toString(36).substr(2, 8)}`, + deviceId: "device-1", + deviceName: "设备1", + friendCount: friends.length, + todayAdded: 12, + status: "normal", + lastActive: new Date().toLocaleString(), + messageCount: 1234, + activeRate: 87, + accountAge: { + years: 2, + months: 8, + }, + totalChats: 15234, + chatFrequency: 42, + restrictionRecords: [ + { + id: "1", + date: "2024-02-25", + reason: "添加好友过于频繁", + recoveryTime: "2024-02-26", + type: "friend_limit", + }, + { + id: "2", + date: "2024-01-15", + reason: "营销内容违规", + recoveryTime: "2024-01-16", + type: "marketing", + }, + ], + isVerified: true, + firstMomentDate: "2021-06-15", + accountWeight: 85, + weightFactors: { + restrictionFactor: 0.8, + verificationFactor: 1.0, + ageFactor: 0.9, + activityFactor: 0.85, + }, + weeklyStats: Array.from({ length: 7 }, (_, i) => ({ + date: `Day ${i + 1}`, + friends: Math.floor(Math.random() * 50) + 50, + messages: Math.floor(Math.random() * 100) + 100, + })), + friends: friends, + } + return mockAccount + } + return ( -
-
-
- -

账号详情

-
-
- -
- -
-
- - - {account.nickname[0]} - - {account.isVerified && ( - - 已认证 - - )} -
-
-
-

{account.nickname}

- - {account.status === "normal" ? "正常" : "异常"} - -
-

微信号:{account.wechatId}

-
- - -
-
+ {isLoading ? ( +
+ +
+ ) : account ? ( +
+
+
+ +

账号详情

- +
- - - 账号概览 - 好友列表 ({account.friendCount}) - - - - {/* 账号基础信息 */} -
- -
- - 账号年龄 -
-
{formatAccountAge(account.accountAge)}
-
注册时间:{account.firstMomentDate}
-
- - -
- - 活跃程度 -
-
{account.chatFrequency}次/天
-
总聊天数:{account.totalChats.toLocaleString()}
-
-
- - {/* 账号权重评估 */} - -
-
- - 账号权重评估 -
-
- {account.accountWeight} - -
-
-

{getWeightDescription(account.accountWeight)}

-
-
- 账号年龄 - - {(account.weightFactors.ageFactor * 100).toFixed(0)}% -
-
- 活跃度 - - {(account.weightFactors.activityFactor * 100).toFixed(0)}% -
-
- 限制影响 - - {(account.weightFactors.restrictionFactor * 100).toFixed(0)}% -
-
- 实名认证 - - {(account.weightFactors.verificationFactor * 100).toFixed(0)}% -
-
-
- - {/* 添加好友统计 */} - -
-
- - 添加好友统计 -
- - - - - -

根据账号权重计算每日可添加好友数量

-
-
-
-
-
- 今日已添加 - {account.todayAdded} -
-
-
- 添加进度 - - {account.todayAdded}/{calculateMaxDailyAdds(account.accountWeight)} - -
- -
-
- 根据当前账号权重({account.accountWeight}分),每日最多可添加{" "} - {calculateMaxDailyAdds(account.accountWeight)}{" "} - 个好友 -
-
-
- - {/* 限制记录 */} - -
-
- - 限制记录 -
- setShowRestrictions(true)}> - 共 {account.restrictionRecords.length} 次 - -
-
- {account.restrictionRecords.slice(0, 2).map((record) => ( -
-
- {record.reason} - {record.date} -
-
- ))} -
-
-
- - - -
- {/* 搜索栏 */} -
-
- - setSearchQuery(e.target.value)} - className="pl-9" - /> -
- -
- - {/* 好友列表 */} -
- {paginatedFriends.length === 0 ? ( -
未找到匹配的好友
- ) : ( - paginatedFriends.map((friend) => ( -
handleFriendClick(friend)} - > - - - {friend.nickname[0]} - -
-
-
- {friend.nickname} - {friend.remark && ({friend.remark})} -
- -
-
{friend.wechatId}
-
- {friend.tags.slice(0, 3).map((tag) => ( - - {tag.name} - - ))} - {friend.tags.length > 3 && ( - - +{friend.tags.length - 3} - - )} -
-
-
- )) - )} -
- - {/* 分页 */} - {totalPages > 1 && ( - - - - { - e.preventDefault() - setCurrentPage((prev) => Math.max(1, prev - 1)) - }} - /> - - {Array.from({ length: Math.min(5, totalPages) }, (_, i) => { - let pageNumber - if (totalPages <= 5) { - pageNumber = i + 1 - } else if (currentPage <= 3) { - pageNumber = i + 1 - } else if (currentPage >= totalPages - 2) { - pageNumber = totalPages - 4 + i - } else { - pageNumber = currentPage - 2 + i - } - return ( - - { - e.preventDefault() - setCurrentPage(pageNumber) - }} - > - {pageNumber} - - - ) - })} - - { - e.preventDefault() - setCurrentPage((prev) => Math.min(totalPages, prev + 1)) - }} - /> - - - - )} -
-
-
-
- - {/* 限制记录详情弹窗 */} - - - - 限制记录详情 - 每次限制恢复时间为24小时 - - -
- {account.restrictionRecords.map((record) => ( -
-
-
{record.reason}
- {record.date} -
-
恢复时间:{record.recoveryTime}
-
- ))} -
-
-
-
- - {/* 好友转移确认弹窗 */} - - - - 好友转移确认 - 即将导出该微信号的好友列表,用于创建新的获客计划 - -
-
- +
+ +
+
+ {account.nickname[0]} -
-
{account.nickname}
-
{account.wechatId}
-
+ {account.isVerified && ( + + 已认证 + + )}
-
-

• 将导出该账号下的所有好友信息

-

• 好友信息将用于创建新的订单获客计划

-

• 导出过程中请勿关闭页面

+
+
+

{account.nickname}

+ + {account.status === "normal" ? "正常" : "异常"} + +
+

微信号:{account.wechatId}

+
+ + +
- - - - - -
+ - {/* 好友详情弹窗 */} - - - - 好友详情 - - {selectedFriend && ( -
-
- - - {selectedFriend.nickname[0]} - + + + 账号概览 + 好友列表 ({account.friendCount}) + + + + {/* 账号基础信息 */} +
+ +
+ + 账号年龄 +
+
{formatAccountAge(account.accountAge)}
+
注册时间:{account.firstMomentDate}
+
+ + +
+ + 活跃程度 +
+
{account.chatFrequency}次/天
+
总聊天数:{account.totalChats.toLocaleString()}
+
+
+ + {/* 账号权重评估 */} + +
+
+ + 账号权重评估 +
+
+ {account.accountWeight} + +
+
+

{getWeightDescription(account.accountWeight)}

+
+
+ 账号年龄 + + {(account.weightFactors.ageFactor * 100).toFixed(0)}% +
+
+ 活跃度 + + {(account.weightFactors.activityFactor * 100).toFixed(0)}% +
+
+ 限制影响 + + {(account.weightFactors.restrictionFactor * 100).toFixed(0)}% +
+
+ 实名认证 + + {(account.weightFactors.verificationFactor * 100).toFixed(0)}% +
+
+
+ + {/* 添加好友统计 */} + +
+
+ + 添加好友统计 +
+ + + + + +

根据账号权重计算每日可添加好友数量

+
+
+
+
+
+ 今日已添加 + {account.todayAdded} +
-
{selectedFriend.nickname}
-
{selectedFriend.wechatId}
- {selectedFriend.remark && ( -
备注: {selectedFriend.remark}
+
+ 添加进度 + + {account.todayAdded}/{calculateMaxDailyAdds(account.accountWeight)} + +
+ +
+
+ 根据当前账号权重({account.accountWeight}分),每日最多可添加{" "} + {calculateMaxDailyAdds(account.accountWeight)}{" "} + 个好友 +
+
+
+ + {/* 限制记录 */} + +
+
+ + 限制记录 +
+ setShowRestrictions(true)}> + 共 {account.restrictionRecords.length} 次 + +
+
+ {account.restrictionRecords.slice(0, 2).map((record) => ( +
+
+ {record.reason} + {record.date} +
+
+ ))} +
+
+
+ + + +
+ {/* 搜索栏 */} +
+
+ + setSearchQuery(e.target.value)} + className="pl-9" + /> +
+ +
+ + {/* 好友列表 */} +
+ {paginatedFriends.length === 0 ? ( +
未找到匹配的好友
+ ) : ( + paginatedFriends.map((friend) => ( +
handleFriendClick(friend)} + > + + + {friend.nickname[0]} + +
+
+
+ {friend.nickname} + {friend.remark && ({friend.remark})} +
+ +
+
{friend.wechatId}
+
+ {friend.tags.slice(0, 3).map((tag) => ( + + {tag.name} + + ))} + {friend.tags.length > 3 && ( + + +{friend.tags.length - 3} + + )} +
+
+
+ )) )}
-
-
-
-
添加时间
-
{selectedFriend.addTime}
-
-
-
最近互动
-
{selectedFriend.lastInteraction}
-
-
-
地区
-
{selectedFriend.region}
-
-
-
来源
-
{selectedFriend.source}
+ {/* 分页 */} + {totalPages > 1 && ( + + + + { + e.preventDefault() + setCurrentPage((prev) => Math.max(1, prev - 1)) + }} + /> + + {Array.from({ length: Math.min(5, totalPages) }, (_, i) => { + let pageNumber + if (totalPages <= 5) { + pageNumber = i + 1 + } else if (currentPage <= 3) { + pageNumber = i + 1 + } else if (currentPage >= totalPages - 2) { + pageNumber = totalPages - 4 + i + } else { + pageNumber = currentPage - 2 + i + } + return ( + + { + e.preventDefault() + setCurrentPage(pageNumber) + }} + > + {pageNumber} + + + ) + })} + + { + e.preventDefault() + setCurrentPage((prev) => Math.min(totalPages, prev + 1)) + }} + /> + + + + )} +
+ + + + + {/* 限制记录详情弹窗 */} + + + + 限制记录详情 + 每次限制恢复时间为24小时 + + +
+ {account.restrictionRecords.map((record) => ( +
+
+
{record.reason}
+ {record.date} +
+
恢复时间:{record.recoveryTime}
+
+ ))} +
+
+
+
+ + {/* 好友转移确认弹窗 */} + + + + 好友转移确认 + 即将导出该微信号的好友列表,用于创建新的获客计划 + +
+
+ + + {account.nickname[0]} + +
+
{account.nickname}
+
{account.wechatId}
- -
-
- - 标签 -
-
- {selectedFriend.tags.map((tag) => ( - - {tag.name} - - ))} - {selectedFriend.tags.length === 0 && 暂无标签} -
-
- - {selectedFriend.notes && ( -
-
备注信息
-
{selectedFriend.notes}
-
- )} - -
- - +
+

• 将导出该账号下的所有好友信息

+

• 好友信息将用于创建新的订单获客计划

+

• 导出过程中请勿关闭页面

- )} - -
+ + + + + +
+ + {/* 好友详情弹窗 */} + + + + 好友详情 + + {selectedFriend && ( +
+
+ + + {selectedFriend.nickname[0]} + +
+
{selectedFriend.nickname}
+
{selectedFriend.wechatId}
+ {selectedFriend.remark && ( +
备注: {selectedFriend.remark}
+ )} +
+
+ +
+
+
添加时间
+
{selectedFriend.addTime}
+
+
+
最近互动
+
{selectedFriend.lastInteraction}
+
+
+
地区
+
{selectedFriend.region}
+
+
+
来源
+
{selectedFriend.source}
+
+
+ +
+
+ + 标签 +
+
+ {selectedFriend.tags.map((tag) => ( + + {tag.name} + + ))} + {selectedFriend.tags.length === 0 && 暂无标签} +
+
+ + {selectedFriend.notes && ( +
+
备注信息
+
{selectedFriend.notes}
+
+ )} + +
+ + +
+
+ )} +
+
+
-
+ ) : ( +
+

未找到账号信息

+
+ )} ) }