<?php require_once 'conn.php'; checkLogin(); $act = $_GET['act'] ?? ''; $keys = $_GET['Keys'] ?? ''; $keyscode = textEncode($keys); $page = $_GET['Page'] ?? ''; $filterCountry = $_GET['fliterCountry'] ?? ''; $filterQudao = $_GET['fliterQudao'] ?? ''; $filterDeal = $_GET['fliterDeal'] ?? ''; $filterBusiness = $_GET['fliterBusiness'] ?? ''; $filterBelong = $_GET['fliterBelong'] ?? ''; $filterStr = ""; $urlStr = ""; if (!empty($filterCountry)) { $filterStr .= " AND cs_country=" . (int)$filterCountry; $urlStr .= "&fliterCountry=" . $filterCountry; } if (!empty($filterQudao)) { $filterStr .= " AND cs_from=" . (int)$filterQudao; $urlStr .= "&fliterQudao=" . $filterQudao; } if (!empty($filterDeal)) { $filterStr .= " AND cs_deal=" . (int)$filterDeal; $urlStr .= "&fliterDeal=" . $filterDeal; } if (!empty($filterBusiness)) { $filterStr .= " AND cs_type=" . (int)$filterBusiness; $urlStr .= "&fliterBusiness=" . $filterBusiness; } if (!empty($filterBelong)) { $filterStr .= " AND cs_belong=" . (int)$filterBelong; $urlStr .= "&fliterBelong=" . $filterBelong; } $keys = urlencode($keys); $hrefstr = "?keys=" . $keys; if ($_SESSION['em_role'] == 0) { $memberStr = "SELECT id FROM employee WHERE em_role=" . $_SESSION['employee_id'] . " OR id=" . $_SESSION['employee_id']; } else { $memberStr = "SELECT id FROM employee WHERE em_role=" . $_SESSION['em_role'] . " OR id=" . $_SESSION['em_role']; } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>管理区域</title> <link rel="stylesheet" href="css/common.css" type="text/css" /> <link rel="stylesheet" href="css/alert.css" type="text/css" /> <script src="system/js/jquery-1.7.2.min.js"></script> <script src="js/js.js?ver=0620"></script> <style> body { margin: 0; padding: 20px; background: #fff; } #man_zone { margin-left: 0; } </style> </head> <body class="clear"> <?php // require_once 'panel.php'; ?> <div id="man_zone"> <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false"> <div class="fastSelect clear"> <H1>搜索条件</H1> <div class="selectItem"> <label>区域</label> <select name="fliterCountry" class="filterSearch"> <option value="">请选择国家地区</option> <?php $result = $conn->query("SELECT id, countryName FROM country"); while ($row = $result->fetch_assoc()) { $selected = ($filterCountry == $row['id']) ? ' selected="selected"' : ''; echo "<option value=\"{$row['id']}\"{$selected}>" . htmlspecialcharsFix($row['countryName']) . "</option>"; } ?> </select> </div> <div class="selectItem"> <label>来源渠道</label> <select name="fliterQudao" class="filterSearch"> <option value="">请选择渠道</option> <?php $result = $conn->query("SELECT id, ch_name FROM qudao"); while ($row = $result->fetch_assoc()) { $selected = ($filterQudao == $row['id']) ? ' selected="selected"' : ''; echo "<option value=\"{$row['id']}\"{$selected}>" . htmlspecialcharsFix($row['ch_name']) . "</option>"; } ?> </select> </div> <div class="selectItem"> <label>跟进阶段</label> <select name="fliterDeal" class="filterSearch"> <option value="">请选择</option> <option value="0"<?= ($filterDeal == "0") ? ' selected="selected"' : '' ?>>无响应</option> <option value="1"<?= ($filterDeal == "1") ? ' selected="selected"' : '' ?>>背景调查</option> <option value="2"<?= ($filterDeal == "2") ? ' selected="selected"' : '' ?>>明确需求</option> </select> </div> <div class="selectItem"> <label>客户类型</label> <select name="fliterBusiness" class="filterSearch"> <option value="">请选择</option> <?php $result = $conn->query("SELECT id, businessType FROM clientType"); while ($row = $result->fetch_assoc()) { $selected = ($filterBusiness == $row['id']) ? ' selected="selected"' : ''; echo "<option value=\"{$row['id']}\"{$selected}>" . htmlspecialcharsFix($row['businessType']) . "</option>"; } ?> </select> </div> <div class="selectItem"> <label>业务员</label> <select name="fliterBelong" class="filterSearch"> <option value="">请选择</option> <?php $result = $conn->query("SELECT id, em_user FROM employee WHERE id IN (" . $memberStr . ")"); while ($row = $result->fetch_assoc()) { $selected = ($filterBelong == $row['id']) ? ' selected="selected"' : ''; echo "<option value=\"{$row['id']}\"{$selected}>" . htmlspecialcharsFix($row['em_user']) . "</option>"; } ?> </select> </div> </div> <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2"> <div class="theader"> <div class="col9">序号</div> <div class="col3">客户编号</div> <div class="col4">渠道来源</div> <div class="col5">区域</div> <div class="col6">客户类型</div> <div class="col6">是否成交</div> <div class="col20">更新日期</div> <div class="col4">操作</div> </div> <?php $sqlStr = "SELECT * FROM customer WHERE cs_deal<>3 AND cs_type<>2 AND DATEDIFF(NOW(), cs_updatetime) > 60 AND cs_wechat NOT LIKE 'wxid%' AND cs_belongclient=0 AND cs_belong<>" . $_SESSION['employee_id'] . " AND cs_belong IN (" . $memberStr . ") AND (cs_code LIKE '%" . $conn->real_escape_string($keyscode) . "%' OR cs_name LIKE '%" . $conn->real_escape_string($keyscode) . "%' OR cs_email LIKE '%" . $conn->real_escape_string($keyscode) . "%' OR cs_wechat LIKE '%" . $conn->real_escape_string($keyscode) . "%' OR cs_tel LIKE '%" . $conn->real_escape_string($keyscode) . "%' OR cs_whatsapp LIKE '%" . $conn->real_escape_string($keyscode) . "%')" . $filterStr . " ORDER BY cs_state DESC, 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++; ?> <div class="tline"> <div class="col9"><?= $tempNum ?></div> <div class="col3 slidepanel"> <?= htmlspecialcharsFix($row['cs_code']) ?> <?php if ($row['cs_claimFrom'] > 0): ?> <img src="../images/yijiao.png" class="handover"> <?php endif; ?> </div> <div class="col4"> <?php $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']); echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写'; ?> </div> <div class="col5"> <?php $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']); echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写'; ?> </div> <div class="col6"> <?php $typeResult = $conn->query("SELECT businessType FROM clientType WHERE id=" . (int)$row['cs_type']); echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialcharsFix($typeRow['businessType']) : '未填写'; ?> </div> <div class="col6"> <?php if ($row['cs_deal'] == 2) { echo "明确需求"; } elseif ($row['cs_deal'] == 1) { echo "背景调查"; } else { echo "未成交"; } ?> </div> <div class="col20"><?= $row['cs_updatetime'] ?></div> <div class="col4"><span id="claim" class="claim" data-id="<?= $row['id'] ?>">认领</span></div> </div> <div class="notepanel clear"> <div class="noteItem2">备注</div> <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div> </div> <?php } } else { if (empty($keys)) { ?> <tr> <div align="center" colspan="8">Sorry,当前暂无信息</div> </tr> <?php } else { ?> <tr> <div align="center" colspan="8"><a href="?">Sorry,没有找到"<?= htmlspecialcharsFix($keyscode) ?>"相关的信息,点击返回</a></div> </tr> <?php } } ?> <div colspan="8"> <div class="showpagebox"> <?php if (isset($totalPages) && $totalPages > 1) { $pageName = "?Keys=" . $keys . $urlStr . "&"; $pagelen = 3; if ($page > 1) { echo "<a href=\"{$pageName}Page=1\">首页</a>"; echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>"; } 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 "<a class=\"current\">{$i}</a>"; } else { echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>"; } } if ($page < $totalPages) { if ($totalPages - $page > $pagelen) { echo "<a href=\"{$pageName}Page={$totalPages}\">...{$totalPages}</a>"; } echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>"; echo "<a href=\"{$pageName}Page={$totalPages}\">尾页</a>"; } } ?> </div> </div> </div> </form> </div> </body> </html>