diff --git a/nkebao/src/pages/wechat-accounts/WechatAccountDetail.tsx b/nkebao/src/pages/wechat-accounts/WechatAccountDetail.tsx index d6f769db..0cdf54f6 100644 --- a/nkebao/src/pages/wechat-accounts/WechatAccountDetail.tsx +++ b/nkebao/src/pages/wechat-accounts/WechatAccountDetail.tsx @@ -11,6 +11,7 @@ import { Info, UserPlus, Search, + Filter, Tag, ChevronRight, Loader2, @@ -102,6 +103,7 @@ export default function WechatAccountDetail() { const [isFetchingFriends, setIsFetchingFriends] = useState(false); const friendsObserver = useRef(null); const friendsLoadingRef = useRef(null); + const friendsContainerRef = useRef(null); // 如果没有账号数据,返回上一页 useEffect(() => { @@ -323,14 +325,35 @@ export default function WechatAccountDetail() { const getRestrictionLevelColor = (level: string) => { switch (level) { case "high": - return "bg-red-100 text-red-700"; + return "text-red-600"; case "medium": - return "bg-yellow-100 text-yellow-700"; + return "text-yellow-600"; default: - return "bg-gray-100 text-gray-700"; + return "text-gray-600"; } }; + const formatDateTime = (dateString: string) => { + const date = new Date(dateString); + return date.toLocaleString('zh-CN', { + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false + }).replace(/\//g, '-'); + }; + + const handleSearch = () => { + fetchFriends(1, true); + }; + + const handleTabChange = (value: string) => { + setActiveTab(value); + }; + if (!currentAccount) { return (
@@ -340,355 +363,400 @@ export default function WechatAccountDetail() { } return ( -
+
{/* 固定header */} -
-
+
+
-

账号详情

+

账号详情

{/* 内容区域 */} -
-
- {/* 账号基本信息卡片 */} -
-
-
- {currentAccount.nickname} -
+
+ {/* 账号基本信息卡片 */} +
+
+
+ {currentAccount.nickname} +
+
+
+
+

{currentAccount.nickname}

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

{currentAccount.nickname}

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

微信号:{currentAccount.wechatAccount}

-
- - -
+

微信号:{currentAccount.wechatAccount}

+
+ +
+
- {/* 标签页 */} -
-
- - -
+ {/* 标签页 */} +
+
+ + +
-
- {activeTab === "overview" ? ( -
- {/* 账号基础信息 */} -
-
-
- - 账号年龄 -
- {accountSummary && ( - <> -
- {formatAccountAge(calculateAccountAge(accountSummary.accountAge))} -
-
- 注册时间:{new Date(accountSummary.accountAge).toLocaleDateString()} -
- - )} -
- -
-
- - 活跃程度 -
- {accountSummary && ( - <> -
{accountSummary.activityLevel.dayTimes.toLocaleString()}次/天
-
总聊天数:{accountSummary.activityLevel.allTimes.toLocaleString()}
- - )} +
+ {activeTab === "overview" ? ( +
+ {/* 账号基础信息 */} +
+
+
+ + 账号年龄
+ {accountSummary && ( + <> +
+ {formatAccountAge(calculateAccountAge(accountSummary.accountAge))} +
+
+ 注册时间:{new Date(accountSummary.accountAge).toLocaleDateString()} +
+ + )}
- {/* 账号权重评估 */} - {accountSummary && ( -
-
-
- - 账号权重评估 -
-
- {accountSummary.accountWeight.scope} - -
+
+
+ + 活跃程度 +
+ {accountSummary && ( + <> +
{accountSummary.activityLevel.dayTimes.toLocaleString()}次/天
+
总聊天数:{accountSummary.activityLevel.allTimes.toLocaleString()}
+ + )} +
+
+ + {/* 账号权重评估 */} + {accountSummary && ( +
+
+
+ + 账号权重评估
-

{getWeightDescription(accountSummary.accountWeight.scope)}

-
-
- 账号年龄 -
-
-
- {accountSummary.accountWeight.ageWeight}% +
+ {accountSummary.accountWeight.scope} + +
+
+

{getWeightDescription(accountSummary.accountWeight.scope)}

+
+
+ 账号年龄 +
+
-
- 活跃度 -
-
-
- {accountSummary.accountWeight.activityWeigth}% + {accountSummary.accountWeight.ageWeight}% +
+
+ 活跃度 +
+
-
- 限制影响 -
-
-
- {accountSummary.accountWeight.restrictWeight}% + {accountSummary.accountWeight.activityWeigth}% +
+
+ 限制影响 +
+
-
- 实名认证 -
-
-
- {accountSummary.accountWeight.realNameWeight}% + {accountSummary.accountWeight.restrictWeight}% +
+
+ 实名认证 +
+
+
+ {accountSummary.accountWeight.realNameWeight}% +
+
+
+ )} + + {/* 添加好友统计 */} + {accountSummary && ( +
+
+
+ + 添加好友统计 +
+
+ +
+ 根据账号权重计算每日可添加好友数量
- )} - - {/* 添加好友统计 */} - {accountSummary && ( -
-
-
- - 添加好友统计 +
+
+ 今日已添加 + {accountSummary.statistics.todayAdded} +
+
+
+ 添加进度 + + {accountSummary.statistics.todayAdded}/{accountSummary.statistics.addLimit} +
-
- -
- 根据账号权重计算每日可添加好友数量 -
+
+
-
-
- 今日已添加 - {accountSummary.statistics.todayAdded} -
-
-
- 添加进度 - - {accountSummary.statistics.todayAdded}/{accountSummary.statistics.addLimit} - -
-
-
-
-
+
+ 根据当前账号权重({accountSummary.accountWeight.scope}分),每日最多可添加{" "} + {accountSummary.statistics.addLimit.toLocaleString()}{" "} + 个好友
- )} +
+ )} - {/* 限制记录 */} - {accountSummary && accountSummary.restrictions.length > 0 && ( -
-
+ {/* 限制记录 */} + {accountSummary && accountSummary.restrictions.length > 0 && ( +
+
+
限制记录
-
- {accountSummary.restrictions.map((restriction) => ( -
-
-
- {restriction.reason} - - {restriction.level === "high" ? "严重" : - restriction.level === "medium" ? "中等" : "轻微"} - -
-
{restriction.date}
-
-
- ))} -
-
- )} -
- ) : ( -
- {/* 搜索栏 */} -
-
- - setSearchQuery(e.target.value)} - onKeyPress={(e) => e.key === 'Enter' && fetchFriends(1, true)} - /> -
- -
- - {/* 好友列表 */} -
- {friends.map((friend) => ( -
handleFriendClick(friend)} + +
+
+ {accountSummary.restrictions.slice(0, 2).map((record) => ( +
+
+ + {record.reason} + + {formatDateTime(record.date)}
-
-
备注:{friend.remark || "无"}
-
- 地区:{friend.region} - 来源:{friend.source} +
+ ))} +
+
+ )} +
+ ) : ( +
+ {/* 搜索栏 */} +
+
+ + setSearchQuery(e.target.value)} + onKeyDown={(e) => e.key === 'Enter' && handleSearch()} + className="w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white" + /> +
+ +
+ + {/* 好友列表 */} +
+ {isFetchingFriends && friends.length === 0 ? ( +
+ +
+ ) : friends.length === 0 ? ( +
未找到匹配的好友
+ ) : ( + <> + {friends.map((friend) => ( +
handleFriendClick(friend)} + > + {friend.nickname} +
+
+
+ {friend.nickname} + {friend.remark && ({friend.remark})} +
+ +
+
{friend.wechatId}
+
+ {friend.tags?.map((tag, index) => ( + + {typeof tag === 'string' ? tag : tag.name} + + ))}
- -
- ))} + ))} + {hasMoreFriends && ( +
+ +
+ )} + + )} +
+
+ )} +
+
+
- {/* 加载更多 */} - {hasMoreFriends && ( -
- {isFetchingFriends && } + {/* 限制记录详情弹窗 */} + {showRestrictions && ( +
+
+
+

限制记录详情

+ +
+

每次限制恢复时间为24小时

+
+ {(accountSummary?.restrictions && accountSummary.restrictions.length > 0) ? ( + accountSummary.restrictions.map((record) => ( +
+
+
+ {record.reason}
- )} - - {!hasMoreFriends && friends.length > 0 && ( -
- 没有更多好友了 -
- )} - - {friends.length === 0 && !isFetchingFriends && ( -
- -

暂无好友数据

-
- )} + {formatDateTime(record.date)} +
+
恢复时间:{formatDateTime(record.date)}
+ )) + ) : ( +
+ 暂无风险记录,请继续保持
)}
-
+ )} {/* 好友转移确认对话框 */} {showTransferConfirm && (
-

好友转移确认

-

- 确认要将 {currentAccount.nickname} 的好友转移到场景获客吗?系统将自动创建一个获客计划。 -

+

好友转移确认

+

即将导出该微信号的好友列表,用于创建新的获客计划

+
+
+ {currentAccount.nickname} +
+
{currentAccount.nickname}
+
{currentAccount.wechatId}
+
+
+
+

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

+

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

+

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

+
+
) : friendDetail && selectedFriend ? (