123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <?php
- require_once 'conn.php';
- checkLogin();
- ?>
- <!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"></script>
- </head>
- <body class="clear">
- <?php require_once 'panel.php'; ?>
- <div id="man_zone">
- <?php
- $act = $_GET['act'] ?? '';
- $page = $_GET['Page'] ?? '';
- $keys = urlencode($_GET['Keys'] ?? '');
- $hrefstr = "?keys=" . $keys;
- ?>
- <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
- <div class="fastSelect clear">
- <H1>异常客户</H1>
- </div>
- <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2 em<?= $_SESSION['employee_id'] ?>">
- <div class="theader">
- <div class="col1"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></div>
- <div class="col2">序号</div>
- <div class="col3">客户编号</div>
- <div class="col4">渠道来源</div>
- <div class="col5">区域</div>
- <div class="col6">客户类型</div>
- <div class="col6">跟进阶段</div>
- <div class="colmark">颜色标记</div>
- <div class="col6">录入时间</div>
- <div class="col9">操作</div>
- </div>
- <?php
- $sqlStr = "SELECT id, cs_code, cs_from, cs_country, cs_type, cs_deal, cs_addtime, cs_tel, cs_email,
- cs_whatsapp, cs_wechat, cs_linkedin, cs_facebook, cs_alibaba, colortag, cs_note, cs_claimFrom
- FROM customer
- WHERE (cs_alibaba = '' AND (cs_code LIKE '%阿里%' OR cs_code LIKE '%1688%') AND cs_belong = " . $_SESSION['employee_id'] . ")
- OR (cs_from = 8 AND cs_wechat = '' AND cs_belong = " . $_SESSION['employee_id'] . ")
- ORDER BY colortag 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);
-
- // Store all results in array
- $rows = [];
- while ($row = $result->fetch_assoc()) {
- $rows[] = $row;
- }
-
- // Get paginated results
- $paginatedRows = array_slice($rows, $offset, $pageSize);
- $tempNum = $offset;
-
- foreach ($paginatedRows as $row) {
- $tempNum++;
- ?>
- <div class="tline color<?= $row['colorTag'] ?>">
- <div class="col1" align="center"><input type="checkbox" name="chkbox" value="<?= $row['id'] ?>" /></div>
- <div class="col2"><?= $tempNum ?></div>
- <div class="col3 slidepanel"><?= $row['cs_code'] ?><?php if ($row['cs_claimFrom'] > 0): ?><img src="../images/yijiao.png" class="handover" title="来自认领"><?php endif; ?></div>
- <div class="col4">
- <?php
- $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id = " . $row['cs_from']);
- if ($qudaoRow = $qudaoResult->fetch_assoc()) {
- echo $qudaoRow['ch_name'];
- } else {
- echo "未填写";
- }
- ?>
- </div>
- <div class="col5">
- <?php
- $countryResult = $conn->query("SELECT countryName FROM country WHERE id = " . $row['cs_country']);
- if ($countryRow = $countryResult->fetch_assoc()) {
- echo $countryRow['countryName'];
- } else {
- echo "未填写";
- }
- ?>
- </div>
- <div class="col6">
- <?php
- $typeResult = $conn->query("SELECT businessType FROM clientType WHERE id = " . $row['cs_type']);
- if ($typeRow = $typeResult->fetch_assoc()) {
- echo $typeRow['businessType'];
- } else {
- echo "未填写";
- }
- ?>
- </div>
- <div class="col6">
- <?php
- switch ($row['cs_deal']) {
- case 3:
- echo '<span style="color:red;">成交</span>';
- break;
- case 2:
- echo '明确需求';
- break;
- case 1:
- echo '背景调查';
- break;
- default:
- echo '无响应';
- }
- ?>
- </div>
- <div class="colmark colormark">
- <ul class="colorlist" data-id="<?= $row['id'] ?>">
- <li value="1" class="color1"></li>
- <li value="2" class="color2"></li>
- <li value="3" class="color3"></li>
- <li value="4" class="color4"></li>
- <li value="0" class="color0"></li>
- </ul>
- </div>
- <div class="col6"><?= $row['cs_addtime'] ?></div>
- <div class="col9"><a href="customerEdit.php?Keys=<?= $keys ?>&fliterDeal=<?= $_GET['fliterDeal'] ?? '' ?>&fliterBusiness=<?= $_GET['fliterBusiness'] ?? '' ?>&Page=<?= $page ?>&act=edit&id=<?= $row['id'] ?>" class="ico_edit ico">修改</a></div>
- </div>
- <div class="notepanel clear">
- <div class="noteItem">联系方式</div>
- <div class="lx">
- <div class="tel"><?= $row['cs_tel'] ?></div>
- <div class="mail"><a href="mailto:<?= $row['cs_email'] ?>"><?= $row['cs_email'] ?></a></div>
- <div class="whatsapp"><?= $row['cs_whatsapp'] ?></div>
- <div class="wechat"><?= $row['cs_wechat'] ?></div>
- <div class="linkedin"><?= $row['cs_linkedin'] ?></div>
- <div class="facebook"><?= $row['cs_facebook'] ?></div>
- <div class="alibaba"><?= $row['cs_alibaba'] ?></div>
- </div>
- <div class="noteItem2">备注</div>
- <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
- </div>
- <?php
- }
- } else {
- if (empty($keys)) {
- ?>
- <tr>
- <div align="center" colspan="9">Sorry,当前暂无信息</div>
- </tr>
- <?php
- } else {
- ?>
- <tr>
- <div align="center" colspan="9"><a href="?">Sorry,没有找到"<?= $keyscode ?? '' ?>"相关的信息,点击返回</a></div>
- </tr>
- <?php
- }
- }
- ?>
- <div colspan="9">
- <div class="showpagebox">
- <?php
- if (isset($totalPages) && $totalPages > 1) {
- $pageName = "?Keys=" . $keys . ($urlStr ?? '') . "&";
- $pagelen = 3;
- // First page and Previous page
- if ($page > 1) {
- echo "<a href=\"{$pageName}Page=1\">首页</a>";
- echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
- }
- // Calculate page range
- 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;
- }
- }
- // Page numbers
- for ($i = $startPage; $i <= $endPage; $i++) {
- if ($i == $page) {
- echo "<a class=\"current\">{$i}</a>";
- } else {
- echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>";
- }
- }
- // Next page and Last page
- 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>
|