流量分发筛选状态功能
This commit is contained in:
@@ -38,6 +38,7 @@ export function fetchTransferFriends(params: {
|
|||||||
limit?: number;
|
limit?: number;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
workbenchId: number;
|
workbenchId: number;
|
||||||
|
isRecycle?: number; // 0=未回收, 1=已回收, undefined=全部
|
||||||
}) {
|
}) {
|
||||||
return request("/v1/workbench/transfer-friends", params, "GET");
|
return request("/v1/workbench/transfer-friends", params, "GET");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ const SendRcrodModal: React.FC<SendRcrodModalProps> = ({
|
|||||||
const [searchKeyword, setSearchKeyword] = useState("");
|
const [searchKeyword, setSearchKeyword] = useState("");
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
|
const [recycleFilter, setRecycleFilter] = useState<number | undefined>(undefined); // undefined=全部, 0=未回收, 1=已回收
|
||||||
const pageSize = 20;
|
const pageSize = 20;
|
||||||
|
|
||||||
// 获取分发记录数据
|
// 获取分发记录数据
|
||||||
const fetchSendRecords = async (page = 1, keyword = "") => {
|
const fetchSendRecords = async (page = 1, keyword = "", isRecycle?: number) => {
|
||||||
if (!ruleId) return;
|
if (!ruleId) return;
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -48,6 +49,7 @@ const SendRcrodModal: React.FC<SendRcrodModalProps> = ({
|
|||||||
page,
|
page,
|
||||||
limit: pageSize,
|
limit: pageSize,
|
||||||
keyword,
|
keyword,
|
||||||
|
isRecycle,
|
||||||
});
|
});
|
||||||
console.log(detailRes);
|
console.log(detailRes);
|
||||||
|
|
||||||
@@ -68,21 +70,29 @@ const SendRcrodModal: React.FC<SendRcrodModalProps> = ({
|
|||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
setSearchQuery("");
|
setSearchQuery("");
|
||||||
setSearchKeyword("");
|
setSearchKeyword("");
|
||||||
fetchSendRecords(1, "");
|
setRecycleFilter(undefined);
|
||||||
|
fetchSendRecords(1, "", undefined);
|
||||||
}
|
}
|
||||||
}, [visible, ruleId]);
|
}, [visible, ruleId]);
|
||||||
|
|
||||||
// 搜索关键词变化时触发搜索
|
// 搜索关键词变化时触发搜索
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible || !ruleId || searchKeyword === "") return;
|
if (!visible || !ruleId) return;
|
||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
fetchSendRecords(1, searchKeyword);
|
fetchSendRecords(1, searchKeyword, recycleFilter);
|
||||||
}, [searchKeyword]);
|
}, [searchKeyword]);
|
||||||
|
|
||||||
|
// 筛选条件变化时触发搜索
|
||||||
|
useEffect(() => {
|
||||||
|
if (!visible || !ruleId) return;
|
||||||
|
setCurrentPage(1);
|
||||||
|
fetchSendRecords(1, searchKeyword, recycleFilter);
|
||||||
|
}, [recycleFilter]);
|
||||||
|
|
||||||
// 页码变化
|
// 页码变化
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible || !ruleId) return;
|
if (!visible || !ruleId) return;
|
||||||
fetchSendRecords(currentPage, searchKeyword);
|
fetchSendRecords(currentPage, searchKeyword, recycleFilter);
|
||||||
}, [currentPage]);
|
}, [currentPage]);
|
||||||
|
|
||||||
// 处理页码变化
|
// 处理页码变化
|
||||||
@@ -160,6 +170,37 @@ const SendRcrodModal: React.FC<SendRcrodModalProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 回收状态筛选 */}
|
||||||
|
<div className={style.filterBar}>
|
||||||
|
<div className={style.filterLabel}>回收状态:</div>
|
||||||
|
<div className={style.filterOptions}>
|
||||||
|
<div
|
||||||
|
className={`${style.filterOption} ${
|
||||||
|
recycleFilter === undefined ? style.active : ""
|
||||||
|
}`}
|
||||||
|
onClick={() => setRecycleFilter(undefined)}
|
||||||
|
>
|
||||||
|
全部
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={`${style.filterOption} ${
|
||||||
|
recycleFilter === 0 ? style.active : ""
|
||||||
|
}`}
|
||||||
|
onClick={() => setRecycleFilter(0)}
|
||||||
|
>
|
||||||
|
未回收
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={`${style.filterOption} ${
|
||||||
|
recycleFilter === 1 ? style.active : ""
|
||||||
|
}`}
|
||||||
|
onClick={() => setRecycleFilter(1)}
|
||||||
|
>
|
||||||
|
已回收
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 分发记录列表 */}
|
{/* 分发记录列表 */}
|
||||||
<div className={style.accountList}>
|
<div className={style.accountList}>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
|
|||||||
@@ -251,6 +251,52 @@
|
|||||||
font-weight: 500;
|
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 {
|
.accountModalFooter {
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
border-top: 1px solid #f0f0f0;
|
border-top: 1px solid #f0f0f0;
|
||||||
|
|||||||
@@ -174,7 +174,8 @@ class AutomaticAssign extends BaseController
|
|||||||
public function allotWechatFriend($data = [],$isInner = false,$errorNum = 0)
|
public function allotWechatFriend($data = [],$isInner = false,$errorNum = 0)
|
||||||
{
|
{
|
||||||
// 获取授权token
|
// 获取授权token
|
||||||
$authorization = trim($this->request->header('authorization', $this->authorization));
|
$authorization = $this->authorization;
|
||||||
|
|
||||||
if (empty($authorization)) {
|
if (empty($authorization)) {
|
||||||
if($isInner){
|
if($isInner){
|
||||||
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
|
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;
|
$url = $this->baseUrl . 'api/WechatFriend/allot?wechatFriendId='.$wechatFriendId.'¬ifyReceiver='.$notifyReceiver.'&comment='.$comment.'&toAccountId='.$toAccountId.'&optFrom='.$optFrom;
|
||||||
$result = requestCurl($url, [], 'PUT', $header, 'json');
|
$result = requestCurl($url, [], 'PUT', $header, 'json');
|
||||||
|
$response = handleApiResponse($result);
|
||||||
if (empty($result)) {
|
if (empty($response)) {
|
||||||
if($isInner){
|
if($isInner){
|
||||||
return json_encode(['code'=>200,'msg'=>'微信好友分配成功']);
|
return json_encode(['code'=>200,'msg'=>'微信好友分配成功']);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user