abnormal.php 8.5 KB

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