highSeas.php 11 KB

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