query($userInfoQuery); if ($userResult && $userRow = $userResult->fetch_assoc()) { // 只有 em_permission_role_id=2 表示该用户是组长 $isLeader = ($userRow['em_permission_role_id'] == 2); } // 如果不是组长,直接跳转到客户列表页面 if (!$isLeader) { header('Location: customers.php'); exit; } $act = $_GET['act'] ?? ''; if ($act == 'postchk') { $keys = urlencode($_GET['Keys'] ?? ''); $page = $_GET['Page'] ?? ''; $chkact = $_POST['chkact'] ?? ''; if (isset($_POST['chkbox'])) { $sqlStr = "(" . implode(',', array_map('intval', (array)$_POST['chkbox'])) . ")"; $count = count($_POST['chkbox']); // 检查是否为员工转让操作 if (substr($chkact, 0, 1) === 't') { // 从chkact值中提取员工ID $employeeId = (int)substr($chkact, 1); // 获取员工代码和名称 $stmt = $conn->prepare("SELECT em_code, em_user FROM employee WHERE id = ?"); $stmt->bind_param("i", $employeeId); $stmt->execute(); $result = $stmt->get_result(); $employeeCode = ''; $employeeName = '未知业务员'; if ($row = $result->fetch_assoc()) { $employeeCode = $row['em_code']; $employeeName = $row['em_user']; } $stmt->close(); // 更新客户记录 $sql = "UPDATE customer SET cs_updatetime = NOW(), cs_code = REPLACE(cs_code, '-', '/{$employeeCode}-'), cs_belong = {$employeeId}, cs_chain = CONCAT(cs_chain, ',{$employeeId}') WHERE id IN {$sqlStr}"; $conn->query($sql); // 记录操作日志 $ids = implode(',', array_map('intval', (array)$_POST['chkbox'])); $action = "{$_SESSION['employee_name']} 批量转移{$count}个客户({$ids})给组员【{$employeeName}】"; logAction($action); } else { $chkact = (int)$chkact; $sql = "UPDATE customer SET cs_deal = {$chkact} WHERE id IN {$sqlStr}"; $conn->query($sql); // 记录跟进阶段变更日志 $dealStatus = ""; switch($chkact) { case 0: $dealStatus = "无响应"; break; case 1: $dealStatus = "背景调查"; break; case 2: $dealStatus = "明确需求"; break; case 3: $dealStatus = "已成交"; break; default: $dealStatus = "未知状态"; } $ids = implode(',', array_map('intval', (array)$_POST['chkbox'])); $action = "{$_SESSION['employee_name']} 批量将{$count}个客户({$ids})的跟进阶段更改为【{$dealStatus}】"; logAction($action); } $deleteTag = "DELETE FROM tagtable WHERE customerId IN " . $sqlStr; $conn->query($deleteTag); } header("Location: ?Keys=" . $keys . "&Page=" . $page); exit; } // 处理搜索和过滤参数 $keys = $_GET['Keys'] ?? ''; $keys = str_replace([" ", "+"], "", $keys); $keyscode = textEncode($keys); $page = $_GET['Page'] ?? ''; $filters = [ 'Country' => $_GET['fliterCountry'] ?? '', 'Qudao' => $_GET['fliterQudao'] ?? '', 'Deal' => $_GET['fliterDeal'] ?? '', 'Business' => $_GET['fliterBusiness'] ?? '', 'Contact' => $_GET['fliterContact'] ?? '' ]; $filterStr = ""; $urlStr = ""; // 构建过滤条件 if (!empty($filters['Country'])) { $filterStr .= " AND c.cs_country=" . (int)$filters['Country']; $urlStr .= "&fliterCountry=" . $filters['Country']; } if (!empty($filters['Qudao'])) { $filterStr .= " AND c.cs_from=" . (int)$filters['Qudao']; $urlStr .= "&fliterQudao=" . $filters['Qudao']; } if (!empty($filters['Deal'])) { $filterStr .= " AND c.cs_deal=" . (int)$filters['Deal']; $urlStr .= "&fliterDeal=" . $filters['Deal']; } if (!empty($filters['Business'])) { $filterStr .= " AND c.cs_type=" . (int)$filters['Business']; $urlStr .= "&fliterBusiness=" . $filters['Business']; } // 改进联系方式过滤查询 if (!empty($filters['Contact'])) { switch ($filters['Contact']) { case "1": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE tel_1 != '' OR tel_2 != '' OR tel_3 != '')"; break; case "2": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE wechat_1 != '' OR wechat_2 != '' OR wechat_3 != '')"; break; case "3": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE whatsapp_1 != '' OR whatsapp_2 != '' OR whatsapp_3 != '')"; break; case "4": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE email_1 != '' OR email_2 != '' OR email_3 != '')"; break; case "5": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE linkedin_1 != '' OR linkedin_2 != '' OR linkedin_3 != '')"; break; case "6": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE facebook_1 != '' OR facebook_2 != '' OR facebook_3 != '')"; break; case "7": $filterStr .= " AND c.id IN (SELECT customer_id FROM customer_contact WHERE alibaba_1 != '' OR alibaba_2 != '' OR alibaba_3 != '')"; break; } $urlStr .= "&fliterContact=" . $filters['Contact']; } $keys = urlencode($keys); $hrefstr = "?keys=" . $keys; ?> 管理区域

搜索条件

序号
客户编号
渠道来源
区域
客户类型
跟进阶段
录入时间
组员
query($sql); if ($result && $result->num_rows > 0) { // 优化分页逻辑 $pageSize = 15; $totalRecords = $result->num_rows; $totalPages = ceil($totalRecords / $pageSize); $page = empty($page) ? 1 : $page; $page = ($page === 'end') ? $totalPages : $page; $page = (!is_numeric($page) || $page < 1) ? 1 : (int)$page; $page = ($page > $totalPages) ? $totalPages : $page; $offset = $pageSize * ($page - 1); // 获取记录 $rows = []; while ($row = $result->fetch_assoc()) { $rows[] = $row; } $paginatedRows = array_slice($rows, $offset, $pageSize); $tempNum = $offset; foreach ($paginatedRows as $row) { $tempNum++; // 获取联系人信息 $contactSql = "SELECT * FROM customer_contact WHERE customer_id = " . $row['id']; $contactResult = $conn->query($contactSql); $contactData = $contactResult->num_rows > 0 ? $contactResult->fetch_assoc() : null; ?>
0): ?>
query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']); echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写'; ?>
query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']); echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写'; ?>
query(" SELECT ct.businessType FROM customer_business_type cbt JOIN clienttype ct ON cbt.business_type_id = ct.id WHERE cbt.customer_id = " . (int)$row['id']); if ($businessTypes->num_rows > 0) { $types = []; while ($type = $businessTypes->fetch_assoc()) { $types[] = $type['businessType']; } // 显示所有业务类型,用顿号分隔 echo implode('、', $types); } else { echo '未填写'; } ?>
成交"; } elseif ($row['cs_deal'] == 2) { echo "明确需求"; } elseif ($row['cs_deal'] == 1) { echo "背景调查"; } else { echo "未成交"; } ?>
query("SELECT em_user FROM employee WHERE id=" . (int)$row['cs_belong']); echo ($employeeRow = $employeeResult->fetch_assoc()) ? htmlspecialcharsFix($employeeRow['em_user']) : '未填写'; ?>
联系方式
['电话', false], 'email' => ['邮箱', true], 'whatsapp' => ['WhatsApp', false], 'wechat' => ['微信', false], 'linkedin' => ['领英', false], 'facebook' => ['Facebook', false], 'alibaba' => ['阿里巴巴', false] ]; foreach ($contactFields as $fieldBase => $config) { $fieldName = $config[0]; $isEmail = $config[1]; echo "
"; for ($i = 1; $i <= 3; $i++) { $field = $fieldBase . '_' . $i; if (!empty($contactData[$field])) { if ($isEmail) { echo ""; } else { echo "
" . htmlspecialcharsFix($contactData[$field]) . "
"; } } } echo "
"; } } ?>
备注
Sorry,当前暂无信息
Sorry,没有找到""相关的信息,点击返回
1) { $pageName = "?Keys=" . $keys . $urlStr . "&"; $pagelen = 3; if ($page > 1) { echo "首页"; echo "上一页"; } if ($pagelen * 2 + 1 >= $totalPages) { $startPage = 1; $endPage = $totalPages; } else { if ($page <= $pagelen + 1) { $startPage = 1; $endPage = $pagelen * 2 + 1; } else { $startPage = $page - $pagelen; $endPage = $page + $pagelen; } if ($page + $pagelen > $totalPages) { $startPage = $totalPages - $pagelen * 2; $endPage = $totalPages; } } for ($i = $startPage; $i <= $endPage; $i++) { if ($i == $page) { echo "{$i}"; } else { echo "{$i}"; } } if ($page < $totalPages) { if ($totalPages - $page > $pagelen) { echo "...{$totalPages}"; } echo "下一页"; echo "尾页"; } } ?>