diff --git a/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/api.ts b/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/api.ts index fddb19bc..c8042414 100644 --- a/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/api.ts +++ b/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/api.ts @@ -38,6 +38,7 @@ export function fetchTransferFriends(params: { limit?: number; keyword?: string; workbenchId: number; + isRecycle?: number; // 0=未回收, 1=已回收, undefined=全部 }) { return request("/v1/workbench/transfer-friends", params, "GET"); } diff --git a/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/components/SendRcrodModal.tsx b/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/components/SendRcrodModal.tsx index e9d82452..e0d5548b 100644 --- a/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/components/SendRcrodModal.tsx +++ b/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/components/SendRcrodModal.tsx @@ -35,10 +35,11 @@ const SendRcrodModal: React.FC = ({ const [searchKeyword, setSearchKeyword] = useState(""); const [currentPage, setCurrentPage] = useState(1); const [total, setTotal] = useState(0); + const [recycleFilter, setRecycleFilter] = useState(undefined); // undefined=全部, 0=未回收, 1=已回收 const pageSize = 20; // 获取分发记录数据 - const fetchSendRecords = async (page = 1, keyword = "") => { + const fetchSendRecords = async (page = 1, keyword = "", isRecycle?: number) => { if (!ruleId) return; setLoading(true); @@ -48,6 +49,7 @@ const SendRcrodModal: React.FC = ({ page, limit: pageSize, keyword, + isRecycle, }); console.log(detailRes); @@ -68,21 +70,29 @@ const SendRcrodModal: React.FC = ({ setCurrentPage(1); setSearchQuery(""); setSearchKeyword(""); - fetchSendRecords(1, ""); + setRecycleFilter(undefined); + fetchSendRecords(1, "", undefined); } }, [visible, ruleId]); // 搜索关键词变化时触发搜索 useEffect(() => { - if (!visible || !ruleId || searchKeyword === "") return; + if (!visible || !ruleId) return; setCurrentPage(1); - fetchSendRecords(1, searchKeyword); + fetchSendRecords(1, searchKeyword, recycleFilter); }, [searchKeyword]); + // 筛选条件变化时触发搜索 + useEffect(() => { + if (!visible || !ruleId) return; + setCurrentPage(1); + fetchSendRecords(1, searchKeyword, recycleFilter); + }, [recycleFilter]); + // 页码变化 useEffect(() => { if (!visible || !ruleId) return; - fetchSendRecords(currentPage, searchKeyword); + fetchSendRecords(currentPage, searchKeyword, recycleFilter); }, [currentPage]); // 处理页码变化 @@ -160,6 +170,37 @@ const SendRcrodModal: React.FC = ({ + {/* 回收状态筛选 */} +
+
回收状态:
+
+
setRecycleFilter(undefined)} + > + 全部 +
+
setRecycleFilter(0)} + > + 未回收 +
+
setRecycleFilter(1)} + > + 已回收 +
+
+
+ {/* 分发记录列表 */}
{loading ? ( diff --git a/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/index.module.scss b/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/index.module.scss index 1415242c..91923e5d 100644 --- a/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/index.module.scss +++ b/Cunkebao/src/pages/mobile/workspace/traffic-distribution/list/index.module.scss @@ -251,6 +251,52 @@ font-weight: 500; } +.filterBar { + display: flex; + align-items: center; + padding: 12px 16px; + background: white; + border-bottom: 1px solid #f0f0f0; + + .filterLabel { + font-size: 14px; + font-weight: 500; + color: #333; + margin-right: 12px; + white-space: nowrap; + } + + .filterOptions { + display: flex; + gap: 8px; + flex: 1; + + .filterOption { + flex: 1; + padding: 8px 16px; + border: 1px solid #e0e0e0; + border-radius: 8px; + font-size: 14px; + color: #666; + cursor: pointer; + transition: all 0.2s; + background: white; + text-align: center; + + &:hover { + border-color: #1677ff; + color: #1677ff; + } + + &.active { + background: #1677ff; + border-color: #1677ff; + color: white; + } + } + } +} + .accountModalFooter { padding: 16px 20px; border-top: 1px solid #f0f0f0; diff --git a/Server/application/api/controller/AutomaticAssign.php b/Server/application/api/controller/AutomaticAssign.php index a9e24102..6a0953cf 100644 --- a/Server/application/api/controller/AutomaticAssign.php +++ b/Server/application/api/controller/AutomaticAssign.php @@ -174,7 +174,8 @@ class AutomaticAssign extends BaseController public function allotWechatFriend($data = [],$isInner = false,$errorNum = 0) { // 获取授权token - $authorization = trim($this->request->header('authorization', $this->authorization)); + $authorization = $this->authorization; + if (empty($authorization)) { if($isInner){ return json_encode(['code'=>500,'msg'=>'缺少授权信息']); @@ -209,8 +210,8 @@ class AutomaticAssign extends BaseController // 发送请求 $url = $this->baseUrl . 'api/WechatFriend/allot?wechatFriendId='.$wechatFriendId.'¬ifyReceiver='.$notifyReceiver.'&comment='.$comment.'&toAccountId='.$toAccountId.'&optFrom='.$optFrom; $result = requestCurl($url, [], 'PUT', $header, 'json'); - - if (empty($result)) { + $response = handleApiResponse($result); + if (empty($response)) { if($isInner){ return json_encode(['code'=>200,'msg'=>'微信好友分配成功']); }else{