abnormal.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. ?>
  5. <!DOCTYPE html>
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>管理区域</title>
  10. <link rel="stylesheet" href="css/common.css" type="text/css" />
  11. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  12. <script src="system/js/jquery-1.7.2.min.js"></script>
  13. <script src="js/js.js"></script>
  14. </head>
  15. <body class="clear">
  16. <?php require_once 'panel.php'; ?>
  17. <div id="man_zone">
  18. <?php
  19. $act = $_GET['act'] ?? '';
  20. $page = $_GET['Page'] ?? '';
  21. $keys = urlencode($_GET['Keys'] ?? '');
  22. $hrefstr = "?keys=" . $keys;
  23. ?>
  24. <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
  25. <div class="fastSelect clear">
  26. <H1>异常客户</H1>
  27. </div>
  28. <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2 em<?= $_SESSION['employee_id'] ?>">
  29. <div class="theader">
  30. <div class="col1"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></div>
  31. <div class="col2">序号</div>
  32. <div class="col3">客户编号</div>
  33. <div class="col4">渠道来源</div>
  34. <div class="col5">区域</div>
  35. <div class="col6">客户类型</div>
  36. <div class="col6">跟进阶段</div>
  37. <div class="colmark">颜色标记</div>
  38. <div class="col6">录入时间</div>
  39. <div class="col9">操作</div>
  40. </div>
  41. <?php
  42. $sqlStr = "SELECT id, cs_code, cs_from, cs_country, cs_type, cs_deal, cs_addtime, cs_tel, cs_email,
  43. cs_whatsapp, cs_wechat, cs_linkedin, cs_facebook, cs_alibaba, colortag, cs_note, cs_claimFrom
  44. FROM customer
  45. WHERE (cs_alibaba = '' AND (cs_code LIKE '%阿里%' OR cs_code LIKE '%1688%') AND cs_belong = " . $_SESSION['employee_id'] . ")
  46. OR (cs_from = 8 AND cs_wechat = '' AND cs_belong = " . $_SESSION['employee_id'] . ")
  47. ORDER BY colortag DESC, id DESC";
  48. $result = $conn->query($sqlStr);
  49. if ($result && $result->num_rows > 0) {
  50. $pageSize = 20;
  51. $page = empty($page) ? 1 : $page;
  52. $page = $page === 'end' ? ceil($result->num_rows / $pageSize) : $page;
  53. $page = !is_numeric($page) || $page < 1 ? 1 : (int)$page;
  54. $totalPages = ceil($result->num_rows / $pageSize);
  55. $page = $page > $totalPages ? $totalPages : $page;
  56. $offset = $pageSize * ($page - 1);
  57. // Store all results in array
  58. $rows = [];
  59. while ($row = $result->fetch_assoc()) {
  60. $rows[] = $row;
  61. }
  62. // Get paginated results
  63. $paginatedRows = array_slice($rows, $offset, $pageSize);
  64. $tempNum = $offset;
  65. foreach ($paginatedRows as $row) {
  66. $tempNum++;
  67. ?>
  68. <div class="tline color<?= $row['colorTag'] ?>">
  69. <div class="col1" align="center"><input type="checkbox" name="chkbox" value="<?= $row['id'] ?>" /></div>
  70. <div class="col2"><?= $tempNum ?></div>
  71. <div class="col3 slidepanel"><?= $row['cs_code'] ?><?php if ($row['cs_claimFrom'] > 0): ?><img src="../images/yijiao.png" class="handover" title="来自认领"><?php endif; ?></div>
  72. <div class="col4">
  73. <?php
  74. $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id = " . $row['cs_from']);
  75. if ($qudaoRow = $qudaoResult->fetch_assoc()) {
  76. echo $qudaoRow['ch_name'];
  77. } else {
  78. echo "未填写";
  79. }
  80. ?>
  81. </div>
  82. <div class="col5">
  83. <?php
  84. $countryResult = $conn->query("SELECT countryName FROM country WHERE id = " . $row['cs_country']);
  85. if ($countryRow = $countryResult->fetch_assoc()) {
  86. echo $countryRow['countryName'];
  87. } else {
  88. echo "未填写";
  89. }
  90. ?>
  91. </div>
  92. <div class="col6">
  93. <?php
  94. $typeResult = $conn->query("SELECT businessType FROM clientType WHERE id = " . $row['cs_type']);
  95. if ($typeRow = $typeResult->fetch_assoc()) {
  96. echo $typeRow['businessType'];
  97. } else {
  98. echo "未填写";
  99. }
  100. ?>
  101. </div>
  102. <div class="col6">
  103. <?php
  104. switch ($row['cs_deal']) {
  105. case 3:
  106. echo '<span style="color:red;">成交</span>';
  107. break;
  108. case 2:
  109. echo '明确需求';
  110. break;
  111. case 1:
  112. echo '背景调查';
  113. break;
  114. default:
  115. echo '无响应';
  116. }
  117. ?>
  118. </div>
  119. <div class="colmark colormark">
  120. <ul class="colorlist" data-id="<?= $row['id'] ?>">
  121. <li value="1" class="color1"></li>
  122. <li value="2" class="color2"></li>
  123. <li value="3" class="color3"></li>
  124. <li value="4" class="color4"></li>
  125. <li value="0" class="color0"></li>
  126. </ul>
  127. </div>
  128. <div class="col6"><?= $row['cs_addtime'] ?></div>
  129. <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>
  130. </div>
  131. <div class="notepanel clear">
  132. <div class="noteItem">联系方式</div>
  133. <div class="lx">
  134. <div class="tel"><?= $row['cs_tel'] ?></div>
  135. <div class="mail"><a href="mailto:<?= $row['cs_email'] ?>"><?= $row['cs_email'] ?></a></div>
  136. <div class="whatsapp"><?= $row['cs_whatsapp'] ?></div>
  137. <div class="wechat"><?= $row['cs_wechat'] ?></div>
  138. <div class="linkedin"><?= $row['cs_linkedin'] ?></div>
  139. <div class="facebook"><?= $row['cs_facebook'] ?></div>
  140. <div class="alibaba"><?= $row['cs_alibaba'] ?></div>
  141. </div>
  142. <div class="noteItem2">备注</div>
  143. <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
  144. </div>
  145. <?php
  146. }
  147. } else {
  148. if (empty($keys)) {
  149. ?>
  150. <tr>
  151. <div align="center" colspan="9">Sorry,当前暂无信息</div>
  152. </tr>
  153. <?php
  154. } else {
  155. ?>
  156. <tr>
  157. <div align="center" colspan="9"><a href="?">Sorry,没有找到"<?= $keyscode ?? '' ?>"相关的信息,点击返回</a></div>
  158. </tr>
  159. <?php
  160. }
  161. }
  162. ?>
  163. <div colspan="9">
  164. <div class="showpagebox">
  165. <?php
  166. if (isset($totalPages) && $totalPages > 1) {
  167. $pageName = "?Keys=" . $keys . ($urlStr ?? '') . "&";
  168. $pagelen = 3;
  169. // First page and Previous page
  170. if ($page > 1) {
  171. echo "<a href=\"{$pageName}Page=1\">首页</a>";
  172. echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
  173. }
  174. // Calculate page range
  175. if ($pagelen * 2 + 1 >= $totalPages) {
  176. $startPage = 1;
  177. $endPage = $totalPages;
  178. } else {
  179. if ($page <= $pagelen + 1) {
  180. $startPage = 1;
  181. $endPage = $pagelen * 2 + 1;
  182. } else {
  183. $startPage = $page - $pagelen;
  184. $endPage = $page + $pagelen;
  185. }
  186. if ($page + $pagelen > $totalPages) {
  187. $startPage = $totalPages - $pagelen * 2;
  188. $endPage = $totalPages;
  189. }
  190. }
  191. // Page numbers
  192. for ($i = $startPage; $i <= $endPage; $i++) {
  193. if ($i == $page) {
  194. echo "<a class=\"current\">{$i}</a>";
  195. } else {
  196. echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>";
  197. }
  198. }
  199. // Next page and Last page
  200. if ($page < $totalPages) {
  201. if ($totalPages - $page > $pagelen) {
  202. echo "<a href=\"{$pageName}Page={$totalPages}\">...{$totalPages}</a>";
  203. }
  204. echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
  205. echo "<a href=\"{$pageName}Page={$totalPages}\">尾页</a>";
  206. }
  207. }
  208. ?>
  209. </div>
  210. </div>
  211. </div>
  212. </form>
  213. </div>
  214. </body>
  215. </html>