highSeas.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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 c.cs_country=" . (int)$filterCountry;
  42. $urlStr .= "&fliterCountry=" . $filterCountry;
  43. }
  44. if (!empty($filterQudao)) {
  45. $filterStr .= " AND c.cs_from=" . (int)$filterQudao;
  46. $urlStr .= "&fliterQudao=" . $filterQudao;
  47. }
  48. if (!empty($filterDeal)) {
  49. $filterStr .= " AND c.cs_deal=" . (int)$filterDeal;
  50. $urlStr .= "&fliterDeal=" . $filterDeal;
  51. }
  52. if (!empty($filterBusiness)) {
  53. $filterStr .= " AND c.cs_type=" . (int)$filterBusiness;
  54. $urlStr .= "&fliterBusiness=" . $filterBusiness;
  55. }
  56. if (!empty($filterBelong)) {
  57. $filterStr .= " AND c.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 c.id, c.cs_code, c.cs_from, c.cs_country, c.cs_type, c.cs_deal, c.cs_addtime,
  141. c.cs_updatetime, c.cs_note, c.cs_claimFrom
  142. FROM customer c
  143. LEFT JOIN customer_contact cc ON c.id = cc.customer_id
  144. WHERE c.cs_deal<>3 AND c.cs_deal<>0 AND c.cs_type<>2 AND c.cs_belong<>13
  145. AND c.cs_belong<>" . $_SESSION['employee_id'] . "
  146. AND DATEDIFF(NOW(), c.cs_updatetime) > 120
  147. AND c.cs_country NOT IN (2, 229, 13, 153)
  148. AND c.cs_belongclient=0
  149. AND cc.wechat NOT LIKE 'wxid%'
  150. AND (c.cs_code LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  151. OR cc.contact_name LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  152. OR cc.email LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  153. OR cc.wechat LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  154. OR cc.tel LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  155. OR cc.whatsapp LIKE '%" . $conn->real_escape_string($keyscode) . "%')" .
  156. $filterStr . " ORDER BY c.cs_state DESC, c.id DESC";
  157. $result = $conn->query($sql);
  158. if ($result && $result->num_rows > 0) {
  159. $pageSize = 20;
  160. $page = empty($page) ? 1 : $page;
  161. $page = ($page === 'end') ? ceil($result->num_rows / $pageSize) : $page;
  162. $page = (!is_numeric($page) || $page < 1) ? 1 : (int)$page;
  163. $totalPages = ceil($result->num_rows / $pageSize);
  164. $page = ($page > $totalPages) ? $totalPages : $page;
  165. $offset = $pageSize * ($page - 1);
  166. // Store results in array for pagination
  167. $rows = [];
  168. while ($row = $result->fetch_assoc()) {
  169. $rows[] = $row;
  170. }
  171. // Get paginated results
  172. $paginatedRows = array_slice($rows, $offset, $pageSize);
  173. $tempNum = $offset;
  174. foreach ($paginatedRows as $row) {
  175. $tempNum++;
  176. ?>
  177. <div class="tline">
  178. <div class="col9"><?= $tempNum ?></div>
  179. <div class="col3 slidepanel"><?= htmlspecialcharsFix($row['cs_code']) ?></div>
  180. <div class="col4">
  181. <?php
  182. $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
  183. echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写';
  184. ?>
  185. </div>
  186. <div class="col5">
  187. <?php
  188. $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
  189. echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写';
  190. ?>
  191. </div>
  192. <div class="col6">
  193. <?php
  194. $typeResult = $conn->query("SELECT businessType FROM clienttype WHERE id=" . (int)$row['cs_type']);
  195. echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialcharsFix($typeRow['businessType']) : '未填写';
  196. ?>
  197. </div>
  198. <div class="col6">
  199. <?php
  200. if ($row['cs_deal'] == 2) {
  201. echo "明确需求";
  202. } elseif ($row['cs_deal'] == 1) {
  203. echo "背景调查";
  204. }
  205. ?>
  206. </div>
  207. <div class="col20"><?= $row['cs_updatetime'] ?></div>
  208. <div class="col4"><span id="claim1" class="claim" data-id="<?= $row['id'] ?>">认领</span></div>
  209. </div>
  210. <div class="notepanel clear">
  211. <div class="noteItem2">备注</div>
  212. <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
  213. </div>
  214. <?php
  215. }
  216. } else {
  217. if (empty($keys)) {
  218. ?>
  219. <tr>
  220. <div align="center" colspan="8">Sorry,当前暂无信息</div>
  221. </tr>
  222. <?php
  223. } else {
  224. ?>
  225. <tr>
  226. <div align="center" colspan="8">
  227. <a href="?">Sorry,没有找到"<?= htmlspecialcharsFix($keyscode) ?>"相关的信息,点击返回</a>
  228. </div>
  229. </tr>
  230. <?php
  231. }
  232. }
  233. ?>
  234. <div colspan="8">
  235. <div class="showpagebox">
  236. <?php
  237. if (isset($totalPages) && $totalPages > 1) {
  238. $pageName = "?Keys=" . $keys . $urlStr . "&";
  239. $pagelen = 3;
  240. if ($page > 1) {
  241. echo "<a href=\"{$pageName}Page=1\">首页</a>";
  242. echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
  243. }
  244. if ($pagelen * 2 + 1 >= $totalPages) {
  245. $startPage = 1;
  246. $endPage = $totalPages;
  247. } else {
  248. if ($page <= $pagelen + 1) {
  249. $startPage = 1;
  250. $endPage = $pagelen * 2 + 1;
  251. } else {
  252. $startPage = $page - $pagelen;
  253. $endPage = $page + $pagelen;
  254. }
  255. if ($page + $pagelen > $totalPages) {
  256. $startPage = $totalPages - $pagelen * 2;
  257. $endPage = $totalPages;
  258. }
  259. }
  260. for ($i = $startPage; $i <= $endPage; $i++) {
  261. if ($i == $page) {
  262. echo "<a class=\"current\">{$i}</a>";
  263. } else {
  264. echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>";
  265. }
  266. }
  267. if ($page < $totalPages) {
  268. if ($totalPages - $page > $pagelen) {
  269. echo "<a href=\"{$pageName}Page={$totalPages}\">...{$totalPages}</a>";
  270. }
  271. echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
  272. echo "<a href=\"{$pageName}Page={$totalPages}\">尾页</a>";
  273. }
  274. echo "<input type=\"text\" id=\"Pagego\" value=\"{$page}\"
  275. onFocus=\"if(this.value == '{$page}'){this.value='';}\"
  276. onBlur=\"if(this.value == ''){this.value='{$page}';}\"
  277. onKeyUp=\"this.value=this.value.replace(/\D/g,'')\"
  278. onKeyDown=\"if(event.keyCode==13){location.href='{$pageName}Page='+document.getElementById('Pagego').value}\" />";
  279. }
  280. ?>
  281. </div>
  282. </div>
  283. </div>
  284. </form>
  285. </div>
  286. </body>
  287. </html>