From b3fd87e5dcd2f71389fed3f72e04bda390ba4309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Sun, 8 Mar 2026 10:25:38 +0800 Subject: [PATCH] =?UTF-8?q?sync:=20soul-admin=20=E9=A1=B5=E9=9D=A2=20|=20?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0:=20=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../find-partner/tabs/ResourceDockingTab.tsx | 94 ++++++++++++++----- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/soul-admin/src/pages/find-partner/tabs/ResourceDockingTab.tsx b/soul-admin/src/pages/find-partner/tabs/ResourceDockingTab.tsx index 8d557d7f..1a3df228 100644 --- a/soul-admin/src/pages/find-partner/tabs/ResourceDockingTab.tsx +++ b/soul-admin/src/pages/find-partner/tabs/ResourceDockingTab.tsx @@ -1,14 +1,20 @@ import { useState, useEffect } from 'react' -import { Card, CardContent } from '@/components/ui/card' +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table' -import { RefreshCw } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { Badge } from '@/components/ui/badge' +import { RefreshCw, Send } from 'lucide-react' import { Pagination } from '@/components/ui/Pagination' -import { get } from '@/api/client' +import { get, post } from '@/api/client' interface MatchRecord { id: string; userId: string; matchedUserId: string; matchType: string phone?: string; wechatId?: string; userNickname?: string; matchedNickname?: string - createdAt: string + createdAt: string; ckbStatus?: string +} + +const typeLabels: Record = { + investor: '资源对接', mentor: '导师顾问', team: '团队招募', } export function ResourceDockingTab() { @@ -17,32 +23,62 @@ export function ResourceDockingTab() { const [page, setPage] = useState(1) const [pageSize, setPageSize] = useState(10) const [isLoading, setIsLoading] = useState(true) + const [typeFilter, setTypeFilter] = useState('investor') + const [pushingId, setPushingId] = useState(null) async function load() { setIsLoading(true) try { - const params = new URLSearchParams({ page: String(page), pageSize: String(pageSize), matchType: 'investor' }) + const params = new URLSearchParams({ page: String(page), pageSize: String(pageSize), matchType: typeFilter }) const data = await get<{ success?: boolean; records?: MatchRecord[]; total?: number }>(`/api/db/match-records?${params}`) if (data?.success) { setRecords(data.records || []); setTotal(data.total ?? 0) } } catch (e) { console.error(e) } finally { setIsLoading(false) } } - useEffect(() => { load() }, [page]) + useEffect(() => { load() }, [page, typeFilter]) + + const pushToCKB = async (record: MatchRecord) => { + if (!record.phone && !record.wechatId) { + alert('该记录无联系方式,无法推送到存客宝') + return + } + setPushingId(record.id) + try { + const res = await post<{ success?: boolean; message?: string }>('/api/ckb/join', { + type: record.matchType || 'investor', + phone: record.phone || '', + wechat: record.wechatId || '', + userId: record.userId, + name: record.userNickname || '', + }) + alert(res?.message || (res?.success ? '推送成功' : '推送失败')) + } catch (e) { + alert('推送失败: ' + (e instanceof Error ? e.message : '网络错误')) + } finally { + setPushingId(null) + } + } const totalPages = Math.ceil(total / pageSize) || 1 + const hasContact = (r: MatchRecord) => !!(r.phone || r.wechatId) return (
-

资源对接匹配记录,共 {total} 条

-

用户填写「我能帮到你什么」和「我需要什么帮助」后提交到存客宝

+

点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝

+

共 {total} 条记录 — 有联系方式的可触发存客宝添加好友

+
+
+ +
-
@@ -56,24 +92,40 @@ export function ResourceDockingTab() { 发起人 匹配到 + 类型 联系方式 时间 + 操作 {records.map(r => ( - - {r.userNickname || r.userId} - {r.matchedNickname || r.matchedUserId} - - {r.phone &&
📱 {r.phone}
} - {r.wechatId &&
💬 {r.wechatId}
} - {!r.phone && !r.wechatId && '-'} + + {r.userNickname || r.userId?.slice(0, 12)} + {r.matchedNickname || r.matchedUserId?.slice(0, 12)} + + {typeLabels[r.matchType] || r.matchType} + + + {r.phone &&
📱 {r.phone}
} + {r.wechatId &&
💬 {r.wechatId}
} + {!r.phone && !r.wechatId && 无联系方式} +
+ {r.createdAt ? new Date(r.createdAt).toLocaleString() : '-'} + + {hasContact(r) ? ( + + ) : ( + + )} - {r.createdAt ? new Date(r.createdAt).toLocaleString() : '-'}
))} - {records.length === 0 && 暂无资源对接记录} + {records.length === 0 && 暂无记录}
{ setPageSize(n); setPage(1) }} />