highSeas.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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?ver=0620"></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. $keys = $_GET['Keys'] ?? '';
  21. $keyscode = textEncode($keys);
  22. $page = $_GET['Page'] ?? '';
  23. $filterCountry = $_GET['fliterCountry'] ?? '';
  24. $filterQudao = $_GET['fliterQudao'] ?? '';
  25. $filterDeal = $_GET['fliterDeal'] ?? '';
  26. $filterBusiness = $_GET['fliterBusiness'] ?? '';
  27. $filterBelong = $_GET['fliterBelong'] ?? '';
  28. $filterStr = "";
  29. $urlStr = "";
  30. if (!empty($filterCountry)) {
  31. $filterStr .= " AND cs_country=" . (int)$filterCountry;
  32. $urlStr .= "&fliterCountry=" . $filterCountry;
  33. }
  34. if (!empty($filterQudao)) {
  35. $filterStr .= " AND cs_from=" . (int)$filterQudao;
  36. $urlStr .= "&fliterQudao=" . $filterQudao;
  37. }
  38. if (!empty($filterDeal)) {
  39. $filterStr .= " AND cs_deal=" . (int)$filterDeal;
  40. $urlStr .= "&fliterDeal=" . $filterDeal;
  41. }
  42. if (!empty($filterBusiness)) {
  43. $filterStr .= " AND cs_type=" . (int)$filterBusiness;
  44. $urlStr .= "&fliterBusiness=" . $filterBusiness;
  45. }
  46. if (!empty($filterBelong)) {
  47. $filterStr .= " AND cs_belong=" . (int)$filterBelong;
  48. $urlStr .= "&fliterBelong=" . $filterBelong;
  49. }
  50. $keys = urlencode($keys);
  51. $hrefstr = "?keys=" . $keys;
  52. ?>
  53. <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
  54. <div class="fastSelect clear">
  55. <H1>搜索条件</H1>
  56. <div class="selectItem">
  57. <label>区域</label>
  58. <select name="fliterCountry" class="filterSearch">
  59. <option value="">请选择国家地区</option>
  60. <?php
  61. $result = $conn->query("SELECT id, countryName FROM country");
  62. while ($row = $result->fetch_assoc()) {
  63. $selected = ($filterCountry == $row['id']) ? ' selected="selected"' : '';
  64. echo "<option value=\"{$row['id']}\"{$selected}>{$row['countryName']}</option>";
  65. }
  66. ?>
  67. </select>
  68. </div>
  69. <div class="selectItem">
  70. <label>来源渠道</label>
  71. <select name="fliterQudao" class="filterSearch">
  72. <option value="">请选择渠道</option>
  73. <?php
  74. $result = $conn->query("SELECT id, ch_name FROM qudao");
  75. while ($row = $result->fetch_assoc()) {
  76. $selected = ($filterQudao == $row['id']) ? ' selected="selected"' : '';
  77. echo "<option value=\"{$row['id']}\"{$selected}>{$row['ch_name']}</option>";
  78. }
  79. ?>
  80. </select>
  81. </div>
  82. <div class="selectItem">
  83. <label>跟进阶段</label>
  84. <select name="fliterDeal" class="filterSearch">
  85. <option value="">请选择</option>
  86. <option value="0"<?= ($filterDeal == "0") ? ' selected="selected"' : '' ?>>无响应</option>
  87. <option value="1"<?= ($filterDeal == "1") ? ' selected="selected"' : '' ?>>背景调查</option>
  88. <option value="2"<?= ($filterDeal == "2") ? ' selected="selected"' : '' ?>>明确需求</option>
  89. </select>
  90. </div>
  91. <div class="selectItem">
  92. <label>客户类型</label>
  93. <select name="fliterBusiness" class="filterSearch">
  94. <option value="">请选择</option>
  95. <?php
  96. $result = $conn->query("SELECT id, businessType FROM clientType");
  97. while ($row = $result->fetch_assoc()) {
  98. $selected = ($filterBusiness == $row['id']) ? ' selected="selected"' : '';
  99. echo "<option value=\"{$row['id']}\"{$selected}>{$row['businessType']}</option>";
  100. }
  101. ?>
  102. </select>
  103. </div>
  104. <div class="selectItem">
  105. <label>业务员</label>
  106. <select name="fliterBelong" class="filterSearch">
  107. <option value="">请选择</option>
  108. <?php
  109. $result = $conn->query("SELECT id, em_user FROM employee");
  110. while ($row = $result->fetch_assoc()) {
  111. $selected = ($filterBelong == $row['id']) ? ' selected="selected"' : '';
  112. echo "<option value=\"{$row['id']}\"{$selected}>{$row['em_user']}</option>";
  113. }
  114. ?>
  115. </select>
  116. </div>
  117. </div>
  118. <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2">
  119. <div class="theader">
  120. <div class="col9">序号</div>
  121. <div class="col3">客户编号</div>
  122. <div class="col4">渠道来源</div>
  123. <div class="col5">区域</div>
  124. <div class="col6">客户类型</div>
  125. <div class="col6">是否成交</div>
  126. <div class="col20">更新日期</div>
  127. <div class="col4">操作</div>
  128. </div>
  129. <?php
  130. $sql = "SELECT id, cs_code, cs_from, cs_country, cs_type, cs_deal, cs_addtime, cs_updatetime, cs_note, cs_claimFrom
  131. FROM customer
  132. WHERE cs_deal<>3 AND cs_deal<>0 AND cs_type<>2 AND cs_belong<>13
  133. AND cs_belong<>" . $_SESSION['employee_id'] . "
  134. AND DATEDIFF(NOW(), cs_updatetime) > 120
  135. AND cs_country NOT IN (2, 229, 13, 153)
  136. AND cs_belongclient=0
  137. AND cs_wechat NOT LIKE 'wxid%'
  138. AND (cs_code LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  139. OR cs_name LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  140. OR cs_email LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  141. OR cs_wechat LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  142. OR cs_tel LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  143. OR cs_whatsapp LIKE '%" . $conn->real_escape_string($keyscode) . "%')" .
  144. $filterStr . " ORDER BY cs_state DESC, id DESC";
  145. $result = $conn->query($sql);
  146. if ($result && $result->num_rows > 0) {
  147. $pageSize = 20;
  148. $page = empty($page) ? 1 : $page;
  149. $page = ($page === 'end') ? ceil($result->num_rows / $pageSize) : $page;
  150. $page = (!is_numeric($page) || $page < 1) ? 1 : (int)$page;
  151. $totalPages = ceil($result->num_rows / $pageSize);
  152. $page = ($page > $totalPages) ? $totalPages : $page;
  153. $offset = $pageSize * ($page - 1);
  154. // Store results in array for pagination
  155. $rows = [];
  156. while ($row = $result->fetch_assoc()) {
  157. $rows[] = $row;
  158. }
  159. // Get paginated results
  160. $paginatedRows = array_slice($rows, $offset, $pageSize);
  161. $tempNum = $offset;
  162. foreach ($paginatedRows as $row) {
  163. $tempNum++;
  164. ?>
  165. <div class="tline">
  166. <div class="col9"><?= $tempNum ?></div>
  167. <div class="col3 slidepanel"><?= htmlspecialchars($row['cs_code']) ?></div>
  168. <div class="col4">
  169. <?php
  170. $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
  171. echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialchars($qudaoRow['ch_name']) : '未填写';
  172. ?>
  173. </div>
  174. <div class="col5">
  175. <?php
  176. $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
  177. echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialchars($countryRow['countryName']) : '未填写';
  178. ?>
  179. </div>
  180. <div class="col6">
  181. <?php
  182. $typeResult = $conn->query("SELECT businessType FROM clientType WHERE id=" . (int)$row['cs_type']);
  183. echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialchars($typeRow['businessType']) : '未填写';
  184. ?>
  185. </div>
  186. <div class="col6">
  187. <?php
  188. if ($row['cs_deal'] == 2) {
  189. echo "明确需求";
  190. } elseif ($row['cs_deal'] == 1) {
  191. echo "背景调查";
  192. }
  193. ?>
  194. </div>
  195. <div class="col20"><?= $row['cs_updatetime'] ?></div>
  196. <div class="col4"><span id="claim1" class="claim" data-id="<?= $row['id'] ?>">认领</span></div>
  197. </div>
  198. <div class="notepanel clear">
  199. <div class="noteItem2">备注</div>
  200. <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
  201. </div>
  202. <?php
  203. }
  204. } else {
  205. if (empty($keys)) {
  206. ?>
  207. <tr>
  208. <div align="center" colspan="8">Sorry,当前暂无信息</div>
  209. </tr>
  210. <?php
  211. } else {
  212. ?>
  213. <tr>
  214. <div align="center" colspan="8">
  215. <a href="?">Sorry,没有找到"<?= htmlspecialchars($keyscode) ?>"相关的信息,点击返回</a>
  216. </div>
  217. </tr>
  218. <?php
  219. }
  220. }
  221. ?>
  222. <div colspan="8">
  223. <div class="showpagebox">
  224. <?php
  225. if (isset($totalPages) && $totalPages > 1) {
  226. $pageName = "?Keys=" . $keys . $urlStr . "&";
  227. $pagelen = 3;
  228. if ($page > 1) {
  229. echo "<a href=\"{$pageName}Page=1\">首页</a>";
  230. echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
  231. }
  232. if ($pagelen * 2 + 1 >= $totalPages) {
  233. $startPage = 1;
  234. $endPage = $totalPages;
  235. } else {
  236. if ($page <= $pagelen + 1) {
  237. $startPage = 1;
  238. $endPage = $pagelen * 2 + 1;
  239. } else {
  240. $startPage = $page - $pagelen;
  241. $endPage = $page + $pagelen;
  242. }
  243. if ($page + $pagelen > $totalPages) {
  244. $startPage = $totalPages - $pagelen * 2;
  245. $endPage = $totalPages;
  246. }
  247. }
  248. for ($i = $startPage; $i <= $endPage; $i++) {
  249. if ($i == $page) {
  250. echo "<a class=\"current\">{$i}</a>";
  251. } else {
  252. echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>";
  253. }
  254. }
  255. if ($page < $totalPages) {
  256. if ($totalPages - $page > $pagelen) {
  257. echo "<a href=\"{$pageName}Page={$totalPages}\">...{$totalPages}</a>";
  258. }
  259. echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
  260. echo "<a href=\"{$pageName}Page={$totalPages}\">尾页</a>";
  261. }
  262. echo "<input type=\"text\" id=\"Pagego\" value=\"{$page}\"
  263. onFocus=\"if(this.value == '{$page}'){this.value='';}\"
  264. onBlur=\"if(this.value == ''){this.value='{$page}';}\"
  265. onKeyUp=\"this.value=this.value.replace(/\D/g,'')\"
  266. onKeyDown=\"if(event.keyCode==13){location.href='{$pageName}Page='+document.getElementById('Pagego').value}\" />";
  267. }
  268. ?>
  269. </div>
  270. </div>
  271. </div>
  272. </form>
  273. </div>
  274. </body>
  275. </html>