customers.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. // 辅助函数
  5. function textEncode($str) {
  6. return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
  7. }
  8. function textDecode($str) {
  9. return htmlspecialchars_decode($str, ENT_QUOTES);
  10. }
  11. function htmlEncode($str) {
  12. return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
  13. }
  14. function htmlDecode($str) {
  15. return htmlspecialchars_decode($str, ENT_QUOTES);
  16. }
  17. $act = $_GET['act'] ?? '';
  18. $urlStr = '';
  19. // 处理保存操作
  20. if ($act == "save") {
  21. $isedit = false;
  22. $id = $_POST['id'] ?? '';
  23. if (!empty($id) && is_numeric($id)) {
  24. $isedit = true;
  25. }
  26. // 获取表单数据
  27. $cs_code = textEncode($_POST['cs_code']);
  28. $cs_company = textEncode($_POST['cs_company']);
  29. $cs_name = textEncode($_POST['cs_name']);
  30. $cs_belong = $_POST['cs_belong'];
  31. $cs_country = $_POST['cs_country'];
  32. $cs_from = $_POST['cs_from'];
  33. $cs_tel = textEncode($_POST['cs_tel']);
  34. $cs_email = textEncode($_POST['cs_email']);
  35. $cs_whatsapp = textEncode($_POST['cs_whatsapp']);
  36. $cs_wechat = textEncode($_POST['cs_wechat']);
  37. $cs_linkedin = textEncode($_POST['cs_linkedin']);
  38. $cs_facebook = textEncode($_POST['cs_facebook']);
  39. $cs_alibaba = textEncode($_POST['cs_alibaba']);
  40. $cs_state = $_POST['cs_state'];
  41. $cs_deal = $_POST['cs_deal'];
  42. $no_content = htmlEncode($_POST['no_content']);
  43. $allowedit = isset($_POST['allowedit']) ? 1 : 0;
  44. if ($isedit) {
  45. // 更新现有记录
  46. $sql = "SELECT cs_chain FROM customer WHERE id = $id";
  47. $result = mysqli_query($conn, $sql);
  48. if ($row = mysqli_fetch_assoc($result)) {
  49. $cs_chain = $row['cs_chain'];
  50. $chain_array = explode(',', $cs_chain);
  51. $last_item = end($chain_array);
  52. if ($last_item != $cs_belong) {
  53. $cs_chain .= ",$cs_belong";
  54. }
  55. $sql = "UPDATE customer SET
  56. cs_code = '$cs_code',
  57. cs_company = '$cs_company',
  58. cs_name = '$cs_name',
  59. cs_belong = '$cs_belong',
  60. cs_country = '$cs_country',
  61. cs_from = '$cs_from',
  62. cs_tel = '$cs_tel',
  63. cs_email = '$cs_email',
  64. cs_whatsapp = '$cs_whatsapp',
  65. cs_wechat = '$cs_wechat',
  66. cs_linkedin = '$cs_linkedin',
  67. cs_facebook = '$cs_facebook',
  68. cs_alibaba = '$cs_alibaba',
  69. cs_state = '$cs_state',
  70. cs_deal = '$cs_deal',
  71. cs_note = '$no_content',
  72. allowedit = $allowedit,
  73. cs_chain = '$cs_chain',
  74. cs_updatetime = NOW()
  75. WHERE id = $id";
  76. mysqli_query($conn, $sql);
  77. $page = $_GET['Page'] ?? '';
  78. $keys = urlencode($_GET['Keys'] ?? '');
  79. header("Location: ?keys=$keys&Page=$page$urlStr");
  80. exit;
  81. }
  82. }
  83. }
  84. // 处理编辑操作
  85. if ($act == "edit") {
  86. $id = $_GET['id'] ?? '';
  87. $isedit = false;
  88. if (!empty($id) && is_numeric($id)) {
  89. $isedit = true;
  90. }
  91. if ($isedit) {
  92. $sql = "SELECT c.*, n.c_code FROM customer c
  93. LEFT JOIN myNote n ON c.cs_code = n.c_code
  94. WHERE c.id = $id";
  95. $result = mysqli_query($conn, $sql);
  96. if ($row = mysqli_fetch_assoc($result)) {
  97. $cs_code = textDecode($row['cs_code']);
  98. $cs_company = textDecode($row['cs_company']);
  99. $cs_name = textDecode($row['cs_name']);
  100. $cs_country = $row['cs_country'];
  101. $cs_from = $row['cs_from'];
  102. $cs_tel = textDecode($row['cs_tel']);
  103. $cs_telBu = textDecode($row['cs_telBu']);
  104. $cs_email = textDecode($row['cs_email']);
  105. $cs_emailBu = textDecode($row['cs_emailBu']);
  106. $cs_whatsapp = textDecode($row['cs_whatsapp']);
  107. $cs_whatsappBu = textDecode($row['cs_whatsappBu']);
  108. $cs_wechat = textDecode($row['cs_wechat']);
  109. $cs_wechatBu = textDecode($row['cs_wechatBu']);
  110. $cs_linkedin = textDecode($row['cs_linkedin']);
  111. $cs_linkedinBu = textDecode($row['cs_linkedinBu']);
  112. $cs_facebook = textDecode($row['cs_facebook']);
  113. $cs_facebookBu = textDecode($row['cs_facebookBu']);
  114. $cs_alibaba = textDecode($row['cs_alibaba']);
  115. $cs_alibabaBu = textDecode($row['cs_alibabaBu']);
  116. $cs_address = textDecode($row['cs_address']);
  117. $cs_addtime = $row['cs_addtime'];
  118. $cs_updatetime = $row['cs_updatetime'];
  119. $cs_belong = $row['cs_belong'];
  120. $cs_state = $row['cs_state'];
  121. $cs_deal = $row['cs_deal'];
  122. $cs_note = htmlDecode($row['cs_note']);
  123. $allowedit = $row['allowedit'];
  124. }
  125. }
  126. }
  127. // 处理批量操作
  128. if ($act == "postchk") {
  129. if (isset($_POST['chkbox']) && isset($_POST['chkact'])) {
  130. $chkact = $_POST['chkact'];
  131. $ids = implode(',', array_map('intval', $_POST['chkbox']));
  132. switch($chkact) {
  133. case "0":
  134. case "1":
  135. $sql = "UPDATE customer SET cs_state = $chkact WHERE id IN ($ids)";
  136. break;
  137. case "-1":
  138. $sql = "DELETE FROM customer WHERE id IN ($ids)";
  139. break;
  140. }
  141. if (isset($sql)) {
  142. mysqli_query($conn, $sql);
  143. }
  144. $keys = urlencode($_GET['Keys'] ?? '');
  145. $page = $_GET['Page'] ?? '';
  146. header("Location: ?keys=$keys&Page=$page$urlStr");
  147. exit;
  148. }
  149. }
  150. // 处理筛选条件
  151. $fliterQudao = $_GET['fliterQudao'] ?? '';
  152. $fliterDeal = $_GET['fliterDeal'] ?? '';
  153. $fliterTeam = $_GET['fliterTeam'] ?? '';
  154. $fliterContact = $_GET['fliterContact'] ?? '';
  155. $fliterEmployee = $_GET['fliterEmployee'] ?? '';
  156. $fliterStr = "";
  157. if (!empty($fliterQudao)) {
  158. $fliterStr .= " AND cs_from = " . intval($fliterQudao);
  159. $urlStr .= "&fliterQudao=" . $fliterQudao;
  160. }
  161. if (!empty($fliterDeal)) {
  162. $fliterStr .= " AND cs_deal = " . intval($fliterDeal);
  163. $urlStr .= "&fliterDeal=" . $fliterDeal;
  164. }
  165. if (!empty($fliterTeam)) {
  166. $fliterStr .= " AND (cs_belong = " . intval($fliterTeam) .
  167. " OR cs_belong IN (SELECT id FROM employee WHERE em_role = " . intval($fliterTeam) . "))";
  168. $urlStr .= "&fliterTeam=" . $fliterTeam;
  169. }
  170. if (!empty($fliterEmployee)) {
  171. $fliterStr .= " AND cs_belong = " . intval($fliterEmployee);
  172. $urlStr .= "&fliterEmployee=" . $fliterEmployee;
  173. }
  174. if (!empty($fliterContact)) {
  175. switch($fliterContact) {
  176. case "1": $fliterStr .= " AND cs_tel != ''"; break;
  177. case "2": $fliterStr .= " AND cs_wechat != ''"; break;
  178. case "3": $fliterStr .= " AND cs_whatsapp != ''"; break;
  179. case "4": $fliterStr .= " AND cs_email != ''"; break;
  180. case "5": $fliterStr .= " AND cs_linkedin != ''"; break;
  181. case "6": $fliterStr .= " AND cs_facebook != ''"; break;
  182. case "7": $fliterStr .= " AND cs_alibaba != ''"; break;
  183. }
  184. $urlStr .= "&fliterContact=" . $fliterContact;
  185. }
  186. // 搜索和排序
  187. $keys = $_GET['Keys'] ?? '';
  188. $keyscode = textEncode($keys);
  189. $page = $_GET['Page'] ?? 1;
  190. $ord = $_GET['Ord'] ?? '';
  191. $ordStr = !empty($ord) ? "$ord," : "";
  192. // 构建查询SQL
  193. $sqlStr = "SELECT id, cs_code, cs_name, cs_country, cs_address, cs_tel, cs_email,
  194. cs_whatsapp, cs_wechat, cs_linkedin, cs_facebook, cs_addtime, cs_alibaba,
  195. cs_from, cs_deal, cs_updatetime, cs_belong, cs_note, cs_claimFrom, cs_chain,
  196. cs_dealdate
  197. FROM customer
  198. WHERE (cs_code LIKE '%$keyscode%'
  199. OR cs_name LIKE '%$keyscode%'
  200. OR cs_wechat LIKE '%$keyscode%'
  201. OR cs_alibaba LIKE '%$keyscode%'
  202. OR cs_telformat LIKE '%$keyscode%'
  203. OR cs_whatsappformat LIKE '%$keyscode%'
  204. OR cs_email LIKE '%$keyscode%')
  205. $fliterStr
  206. ORDER BY ${ordStr}cs_updatetime DESC";
  207. ?>
  208. <!DOCTYPE html>
  209. <html xmlns="http://www.w3.org/1999/xhtml">
  210. <head>
  211. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  212. <title>管理区域</title>
  213. <link rel="stylesheet" href="css/common.css" type="text/css" />
  214. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  215. <script src="system/js/jquery-1.7.2.min.js"></script>
  216. <script src="js/js.js"></script>
  217. <script language="javascript" src="js/jquery-1.7.2.min.js"></script>
  218. <script type="text/javascript" src="js/js.js"></script>
  219. <script type="text/javascript" src="xheditor-1.1.9/xheditor-1.1.9-zh-cn.min.js"></script>
  220. <script>
  221. $(document).ready(function(){
  222. $('.txt2').xheditor({
  223. tools:'full',
  224. hoverExecDelay:-1,
  225. urlBase:'system/',
  226. upLinkUrl:"upload.php",
  227. upLinkExt:"zip,rar,txt,pdf",
  228. upImgUrl:"upload.php",
  229. upImgExt:"jpg,jpeg,gif,png",
  230. upFlashUrl:"upload.php",
  231. upFlashExt:"swf",
  232. upMediaUrl:"upload.php",
  233. upMediaExt:"wmv,avi,wma,mp3,mid"
  234. });
  235. });
  236. </script>
  237. </head>
  238. <body class="clear">
  239. <?php require_once 'panel.php'; ?>
  240. <div id="man_zone">
  241. <?php
  242. $keys = $_GET['Keys'] ?? '';
  243. $keys = str_replace([" ", "+"], "", $keys);
  244. $keyscode = textEncode($keys);
  245. $page = $_GET['Page'] ?? 1;
  246. $filters = [
  247. 'Country' => $_GET['fliterCountry'] ?? '',
  248. 'Qudao' => $_GET['fliterQudao'] ?? '',
  249. 'Deal' => $_GET['fliterDeal'] ?? '',
  250. 'Business' => $_GET['fliterBusiness'] ?? '',
  251. 'Contact' => $_GET['fliterContact'] ?? ''
  252. ];
  253. $filterStr = "";
  254. $urlStr = "";
  255. // Build filter conditions
  256. if (!empty($filters['Country'])) {
  257. $filterStr .= " AND cs_country=" . (int)$filters['Country'];
  258. $urlStr .= "&fliterCountry=" . $filters['Country'];
  259. }
  260. if (!empty($filters['Qudao'])) {
  261. $filterStr .= " AND cs_from=" . (int)$filters['Qudao'];
  262. $urlStr .= "&fliterQudao=" . $filters['Qudao'];
  263. }
  264. if (!empty($filters['Deal'])) {
  265. $filterStr .= " AND cs_deal=" . (int)$filters['Deal'];
  266. $urlStr .= "&fliterDeal=" . $filters['Deal'];
  267. }
  268. if (!empty($filters['Business'])) {
  269. $filterStr .= " AND cs_type=" . (int)$filters['Business'];
  270. $urlStr .= "&fliterBusiness=" . $filters['Business'];
  271. }
  272. if (!empty($filters['Contact'])) {
  273. switch ($filters['Contact']) {
  274. case "1": $filterStr .= " AND cs_tel<>''"; break;
  275. case "2": $filterStr .= " AND cs_wechat<>''"; break;
  276. case "3": $filterStr .= " AND cs_whatsapp<>''"; break;
  277. case "4": $filterStr .= " AND cs_email<>''"; break;
  278. case "5": $filterStr .= " AND cs_linkedin<>''"; break;
  279. case "6": $filterStr .= " AND cs_facebook<>''"; break;
  280. default: $filterStr .= " AND cs_alibaba<>''";
  281. }
  282. $urlStr .= "&fliterContact=" . $filters['Contact'];
  283. }
  284. $keys = urlencode($keys);
  285. $hrefstr = "?keys=" . $keys;
  286. ?>
  287. <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
  288. <div class="fastSelect clear">
  289. <H1>搜索条件</H1>
  290. <div class="selectItem">
  291. <label>区域</label>
  292. <select name="fliterCountry" class="filterSearch">
  293. <option value="">请选择国家地区</option>
  294. <?php
  295. $result = $conn->query("SELECT id, countryName FROM country");
  296. while ($row = $result->fetch_assoc()) {
  297. $selected = ($filters['Country'] == $row['id']) ? ' selected' : '';
  298. echo "<option value=\"{$row['id']}\"$selected>{$row['countryName']}</option>";
  299. }
  300. ?>
  301. </select>
  302. </div>
  303. <div class="selectItem">
  304. <label>来源渠道</label>
  305. <select name="fliterQudao" class="filterSearch">
  306. <option value="">请选择渠道</option>
  307. <?php
  308. $result = $conn->query("SELECT id, ch_name FROM qudao");
  309. while ($row = $result->fetch_assoc()) {
  310. $selected = ($filters['Qudao'] == $row['id']) ? ' selected' : '';
  311. echo "<option value=\"{$row['id']}\"$selected>{$row['ch_name']}</option>";
  312. }
  313. ?>
  314. </select>
  315. </div>
  316. <div class="selectItem">
  317. <label>跟进阶段</label>
  318. <select name="fliterDeal" class="filterSearch">
  319. <option value="">请选择</option>
  320. <option value="1"<?= ($filters['Deal'] == "1") ? ' selected' : '' ?>>背景调查</option>
  321. <option value="2"<?= ($filters['Deal'] == "2") ? ' selected' : '' ?>>明确需求</option>
  322. <option value="3"<?= ($filters['Deal'] == "3") ? ' selected' : '' ?>>已成交</option>
  323. </select>
  324. </div>
  325. <div class="selectItem">
  326. <label>客户类型</label>
  327. <select name="fliterBusiness" class="filterSearch">
  328. <option value="">请选择</option>
  329. <?php
  330. $result = $conn->query("SELECT id, businessType FROM clientType");
  331. while ($row = $result->fetch_assoc()) {
  332. $selected = ($filters['Business'] == $row['id']) ? ' selected' : '';
  333. echo "<option value=\"{$row['id']}\"$selected>{$row['businessType']}</option>";
  334. }
  335. ?>
  336. </select>
  337. </div>
  338. <div class="selectItem">
  339. <label>联系方式</label>
  340. <select name="fliterContact" class="filterSearch">
  341. <option value="">请选择</option>
  342. <option value="1"<?= ($filters['Contact'] == "1") ? ' selected' : '' ?>>电话</option>
  343. <option value="2"<?= ($filters['Contact'] == "2") ? ' selected' : '' ?>>微信</option>
  344. <option value="3"<?= ($filters['Contact'] == "3") ? ' selected' : '' ?>>WhatsApp</option>
  345. <option value="4"<?= ($filters['Contact'] == "4") ? ' selected' : '' ?>>邮箱</option>
  346. <option value="5"<?= ($filters['Contact'] == "5") ? ' selected' : '' ?>>领英</option>
  347. <option value="6"<?= ($filters['Contact'] == "6") ? ' selected' : '' ?>>Facebook</option>
  348. <option value="7"<?= ($filters['Contact'] == "7") ? ' selected' : '' ?>>阿里巴巴</option>
  349. </select>
  350. </div>
  351. <div class="inputSearch">
  352. <input type="text" id="keys" class="inputTxt"
  353. value="<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>"
  354. onFocus="if(this.value == '<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>'){this.value='';}"
  355. onBlur="if(this.value == ''){this.value='<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>';}"
  356. onKeyDown="if(event.keyCode==13){location.href='?Keys='+escape(document.getElementById('keys').value)}" />
  357. <input type="button" id="searchgo" class="searchgo" value="go"
  358. onClick="location.href='?Keys='+escape(document.getElementById('keys').value)" />
  359. </div>
  360. </div>
  361. <div class="table2 em<?= $_SESSION['employee_id'] ?>">
  362. <div class="theader">
  363. <div class="col1"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></div>
  364. <div class="col2">序号</div>
  365. <div class="col3">客户编号</div>
  366. <div class="col4">渠道来源</div>
  367. <div class="col5">区域</div>
  368. <div class="col6">客户类型</div>
  369. <div class="col6">跟进阶段</div>
  370. <div class="colmark">颜色标记</div>
  371. <div class="col6">录入时间</div>
  372. <div class="col9">操作</div>
  373. </div>
  374. <?php
  375. $sql = "SELECT id, cs_code, cs_from, cs_country, cs_type, cs_deal, cs_addtime,
  376. cs_tel, cs_email, cs_whatsapp, cs_wechat, cs_linkedin, cs_facebook,
  377. cs_alibaba, colortag, cs_note, cs_claimFrom
  378. FROM customer
  379. WHERE is_silent=0 AND cs_deal>0 AND cs_belong=?
  380. AND (cs_code LIKE ? OR cs_name LIKE ? OR cs_email LIKE ?
  381. OR cs_wechat LIKE ? OR cs_telformat LIKE ?
  382. OR cs_whatsappformat LIKE ? OR cs_code LIKE ?)
  383. $filterStr
  384. ORDER BY colortag DESC, id DESC";
  385. $stmt = $conn->prepare($sql);
  386. $searchPattern = "%$keyscode%";
  387. $stmt->bind_param("isssssss",
  388. $_SESSION['employee_id'],
  389. $searchPattern, $searchPattern, $searchPattern,
  390. $searchPattern, $searchPattern, $searchPattern,
  391. $searchPattern
  392. );
  393. $stmt->execute();
  394. $result = $stmt->get_result();
  395. // Pagination logic
  396. $perPage = 20;
  397. $totalRecords = $result->num_rows;
  398. $totalPages = ceil($totalRecords / $perPage);
  399. $page = min(max(1, $page), $totalPages);
  400. $offset = ($page - 1) * $perPage;
  401. $sql .= " LIMIT $offset, $perPage";
  402. $stmt = $conn->prepare($sql);
  403. $stmt->bind_param("isssssss",
  404. $_SESSION['employee_id'],
  405. $searchPattern, $searchPattern, $searchPattern,
  406. $searchPattern, $searchPattern, $searchPattern,
  407. $searchPattern
  408. );
  409. $stmt->execute();
  410. $result = $stmt->get_result();
  411. if ($result->num_rows > 0) {
  412. $tempNum = $offset;
  413. while ($row = $result->fetch_assoc()) {
  414. $tempNum++;
  415. ?>
  416. <div class="tline color<?= $row['colortag'] ?>">
  417. <div class="col1" align="center"><input type="checkbox" name="chkbox[]" value="<?= $row['id'] ?>" /></div>
  418. <div class="col2"><?= $tempNum ?></div>
  419. <div class="col3 slidepanel"><?= $row['cs_code'] ?>
  420. <?php if ($row['cs_claimFrom'] > 0): ?>
  421. <img src="../images/yijiao.png" class="handover" title="来自认领">
  422. <?php endif; ?>
  423. </div>
  424. <div class="col4">
  425. <?php
  426. $qudao = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
  427. echo $qudao->num_rows > 0 ? $qudao->fetch_assoc()['ch_name'] : '未填写';
  428. ?>
  429. </div>
  430. <div class="col5">
  431. <?php
  432. $country = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
  433. echo $country->num_rows > 0 ? $country->fetch_assoc()['countryName'] : '未填写';
  434. ?>
  435. </div>
  436. <div class="col6">
  437. <?php
  438. $clientType = $conn->query("SELECT businessType FROM clientType WHERE id=" . (int)$row['cs_type']);
  439. echo $clientType->num_rows > 0 ? $clientType->fetch_assoc()['businessType'] : '未填写';
  440. ?>
  441. </div>
  442. <div class="col6">
  443. <?php
  444. switch ($row['cs_deal']) {
  445. case 3: echo '<span style="color:red;">成交</span>'; break;
  446. case 2: echo '明确需求'; break;
  447. case 1: echo '背景调查'; break;
  448. default: echo '无响应';
  449. }
  450. ?>
  451. </div>
  452. <div class="colmark colormark">
  453. <ul class="colorlist" data-id="<?= $row['id'] ?>">
  454. <li value="1" class="color1"></li>
  455. <li value="2" class="color2"></li>
  456. <li value="3" class="color3"></li>
  457. <li value="4" class="color4"></li>
  458. <li value="0" class="color0"></li>
  459. </ul>
  460. </div>
  461. <div class="col6"><?= $row['cs_addtime'] ?></div>
  462. <div class="col9">
  463. <a href="customerEdit.php?Keys=<?= $keys ?>&fliterDeal=<?= $filters['Deal'] ?>&fliterBusiness=<?= $filters['Business'] ?>&Page=<?= $page ?>&act=edit&id=<?= $row['id'] ?>" class="ico_edit ico">修改</a>
  464. </div>
  465. </div>
  466. <div class="notepanel clear">
  467. <div class="noteItem">联系方式</div>
  468. <div class="lx">
  469. <div class="tel"><?= $row['cs_tel'] ?></div>
  470. <div class="mail"><a href="mailto:<?= $row['cs_email'] ?>"><?= $row['cs_email'] ?></a></div>
  471. <div class="whatsapp"><?= $row['cs_whatsapp'] ?></div>
  472. <div class="wechat"><?= $row['cs_wechat'] ?></div>
  473. <div class="linkedin"><?= $row['cs_linkedin'] ?></div>
  474. <div class="facebook"><?= $row['cs_facebook'] ?></div>
  475. <div class="alibaba"><?= $row['cs_alibaba'] ?></div>
  476. </div>
  477. <div class="noteItem2">备注</div>
  478. <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
  479. </div>
  480. <?php
  481. }
  482. } else {
  483. if (empty($keys)) {
  484. echo '<tr><div align="center" colspan="9">Sorry,当前暂无信息</div></tr>';
  485. } else {
  486. echo '<tr><div align="center" colspan="9"><a href="?">Sorry,没有找到"' .
  487. htmlspecialchars($keyscode) . '"相关的信息,点击返回</a></div></tr>';
  488. }
  489. }
  490. ?>
  491. <div colspan="9">
  492. <div class="showpagebox">
  493. <?php
  494. if ($totalPages > 1) {
  495. $pageName = "?Keys=$keys$urlStr&";
  496. $pageLen = 3;
  497. if ($page > 1) {
  498. echo "<a href=\"{$pageName}Page=1\">首页</a>";
  499. echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
  500. }
  501. if ($pageLen * 2 + 1 >= $totalPages) {
  502. $startPage = 1;
  503. $endPage = $totalPages;
  504. } else {
  505. if ($page <= $pageLen + 1) {
  506. $startPage = 1;
  507. $endPage = $pageLen * 2 + 1;
  508. } else {
  509. $startPage = $page - $pageLen;
  510. $endPage = $page + $pageLen;
  511. }
  512. if ($page + $pageLen > $totalPages) {
  513. $startPage = $totalPages - $pageLen * 2;
  514. $endPage = $totalPages;
  515. }
  516. }
  517. for ($i = $startPage; $i <= $endPage; $i++) {
  518. if ($i == $page) {
  519. echo "<a class=\"current\">$i</a>";
  520. } else {
  521. echo "<a href=\"{$pageName}Page=$i\">$i</a>";
  522. }
  523. }
  524. if ($page < $totalPages) {
  525. if ($totalPages - $page > $pageLen) {
  526. echo "<a href=\"{$pageName}Page=$totalPages\">...$totalPages</a>";
  527. }
  528. echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
  529. echo "<a href=\"{$pageName}Page=$totalPages\">尾页</a>";
  530. }
  531. }
  532. ?>
  533. </div>
  534. <?php require_once 'postchkbox.php'; ?>
  535. </div>
  536. </div>
  537. </form>
  538. </div>
  539. </body>
  540. </html>