') as contact_names,
GROUP_CONCAT(DISTINCT NULLIF(cc.tel_1, '') SEPARATOR '
') as tel_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.tel_2, '') SEPARATOR '
') as tel_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.tel_3, '') SEPARATOR '
') as tel_3,
GROUP_CONCAT(DISTINCT NULLIF(cc.tel_1_format, '') SEPARATOR '
') as tel_1_format,
GROUP_CONCAT(DISTINCT NULLIF(cc.tel_2_format, '') SEPARATOR '
') as tel_2_format,
GROUP_CONCAT(DISTINCT NULLIF(cc.tel_3_format, '') SEPARATOR '
') as tel_3_format,
GROUP_CONCAT(DISTINCT NULLIF(cc.email_1, '') SEPARATOR '
') as email_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.email_2, '') SEPARATOR '
') as email_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.email_3, '') SEPARATOR '
') as email_3,
GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_1, '') SEPARATOR '
') as whatsapp_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_2, '') SEPARATOR '
') as whatsapp_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_3, '') SEPARATOR '
') as whatsapp_3,
GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_1_format, '') SEPARATOR '
') as whatsapp_1_format,
GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_2_format, '') SEPARATOR '
') as whatsapp_2_format,
GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_3_format, '') SEPARATOR '
') as whatsapp_3_format,
GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_1, '') SEPARATOR '
') as wechat_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_2, '') SEPARATOR '
') as wechat_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_3, '') SEPARATOR '
') as wechat_3,
GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_1, '') SEPARATOR '
') as linkedin_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_2, '') SEPARATOR '
') as linkedin_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_3, '') SEPARATOR '
') as linkedin_3,
GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_1, '') SEPARATOR '
') as facebook_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_2, '') SEPARATOR '
') as facebook_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_3, '') SEPARATOR '
') as facebook_3,
GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_1, '') SEPARATOR '
') as alibaba_1,
GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_2, '') SEPARATOR '
') as alibaba_2,
GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_3, '') SEPARATOR '
') as alibaba_3
FROM customer c
LEFT JOIN customer_contact cc ON c.id = cc.customer_id
WHERE (c.is_silent=1 OR (c.cs_deal=0 AND c.cs_belong=" . intval($_SESSION['employee_id']) . "))";
// 添加搜索条件
if (!empty($keyscode)) {
$sqlStr .= " AND (c.cs_code LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.contact_name LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.email_1 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.email_2 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.email_3 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.wechat_1 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.wechat_2 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.wechat_3 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.tel_1_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.tel_2_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.tel_3_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.whatsapp_1_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.whatsapp_2_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
OR cc.whatsapp_3_format LIKE '%" . $conn->real_escape_string($keyscode) . "%')";
}
// 添加其他筛选条件
$sqlStr .= $filterStr;
// 分组和排序
$sqlStr .= " GROUP BY c.id ORDER BY MAX(c.colortag) DESC, c.id DESC";
$result = $conn->query($sqlStr);
if ($result && $result->num_rows > 0) {
$pageSize = 20;
$page = empty($page) ? 1 : $page;
$page = ($page === 'end') ? ceil($result->num_rows / $pageSize) : $page;
$page = (!is_numeric($page) || $page < 1) ? 1 : (int)$page;
$totalPages = ceil($result->num_rows / $pageSize);
$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++;
?>
= $tempNum ?>
= htmlspecialcharsFix($row['cs_code']) ?>
0): ?>
query("SELECT ch_name FROM qudao WHERE id=" . intval($row['cs_from']));
echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写';
?>
query("SELECT countryName FROM country WHERE id=" . intval($row['cs_country']));
echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写';
?>
query("SELECT businessType FROM clienttype WHERE id=" . intval($row['cs_type']));
echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialcharsFix($typeRow['businessType']) : '未填写';
?>
成交";
} elseif ($row['cs_deal'] == 2) {
echo "明确需求";
} elseif ($row['cs_deal'] == 1) {
echo "背景调查";
} else {
echo "无响应";
}
?>
= $row['cs_addtime'] ?>
联系方式
', $tels);
?>
', $whatsapps);
?>
', $wechats);
?>
', $linkedins);
?>
', $facebooks);
?>
', $alibabas);
?>
备注
流转记录:
query($sqlStr);
if ($chainRow = $chainResult->fetch_assoc()) {
$chainEmployees[] = htmlspecialcharsFix($chainRow['em_user']);
}
}
echo implode(" > ", $chainEmployees);
}
?>
= htmlUnCode($row['cs_note']) ?>
当前暂无沉默客户
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 "
尾页";
}
echo "
";
}
?>