searchResult.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. $keywordsNative = $_POST['keywords'] ?? '';
  5. $keywords = str_replace(['+', ' ', '-', ')', '('], '', $keywordsNative);
  6. $keywords = textEncode($keywords);
  7. if (empty($keywords) || strlen($keywords) < 4) {
  8. echo "<script>alert('请至少输入4位数字或文字进行查找');window.location.href='/home.php';</script>";
  9. exit;
  10. }
  11. $searchStr = "SELECT cs_code, cs_name, cs_country, cs_tel, cs_email, cs_whatsapp, cs_wechat, cs_linkedin,
  12. cs_facebook, cs_addtime, cs_from, cs_belong, cs_deal, cs_alibaba
  13. FROM customer
  14. WHERE (cs_telformat LIKE '%" . $conn->real_escape_string($keywords) . "%'
  15. OR cs_email LIKE '%" . $conn->real_escape_string($keywords) . "%'
  16. OR cs_whatsappformat LIKE '%" . $conn->real_escape_string($keywords) . "%'
  17. OR cs_wechat LIKE '%" . $conn->real_escape_string($keywords) . "%'
  18. OR cs_alibaba LIKE '%" . $conn->real_escape_string($keywords) . "%'
  19. OR cs_linkedin LIKE '%" . $conn->real_escape_string($keywords) . "%'
  20. OR cs_facebook LIKE '%" . $conn->real_escape_string($keywords) . "%'
  21. OR cs_email LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
  22. OR cs_wechat LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
  23. OR cs_alibaba LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
  24. OR cs_linkedin LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
  25. OR cs_facebook LIKE '%" . $conn->real_escape_string($keywordsNative) . "%')";
  26. ?>
  27. <!DOCTYPE html>
  28. <html xmlns="http://www.w3.org/1999/xhtml">
  29. <head>
  30. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  31. <title>管理区域</title>
  32. <link rel="stylesheet" href="css/common.css" type="text/css" />
  33. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  34. <script src="system/js/jquery-1.7.2.min.js"></script>
  35. <script src="js/js.js"></script>
  36. <style>
  37. body {
  38. margin: 0;
  39. padding: 20px;
  40. background: #fff;
  41. }
  42. #man_zone {
  43. margin-left: 0;
  44. }
  45. </style>
  46. </head>
  47. <body class="clear">
  48. <?php // require_once 'panel.php'; ?>
  49. <div id="man_zone">
  50. <div class="searchForm resultSearch">
  51. <form method="post" action="searchResult.php" accept-charset="UTF-8">
  52. <input class="keywords" name="keywords" id="keyword" placeholder="请输入电话/邮箱/微信/WhatsApp.." value="<?= htmlspecialcharsFix($keywordsNative) ?>">
  53. <input class="searchSubmit" type="submit" value="客户检索">
  54. </form>
  55. </div>
  56. <table width="100%" class="resultForm">
  57. <tr class="tableHead">
  58. <td align="center">序号</td>
  59. <td align="center">客户编号</td>
  60. <td align="center">联系人</td>
  61. <td align="center">国家</td>
  62. <td align="center">来源</td>
  63. <td align="center">跟进阶段</td>
  64. <td align="center">录入日期</td>
  65. <td align="center">所属业务员</td>
  66. </tr>
  67. <?php
  68. $result = $conn->query($searchStr);
  69. if ($result && $result->num_rows > 0) {
  70. $i = 1;
  71. while ($row = $result->fetch_assoc()) {
  72. ?>
  73. <tr>
  74. <td align="center" rowspan="2"><?= $i ?></td>
  75. <td align="center"><?= htmlspecialcharsFix($row['cs_code']) ?></td>
  76. <td align="center"><?= htmlspecialcharsFix($row['cs_name']) ?></td>
  77. <td align="center">
  78. <?php
  79. $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
  80. echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未选择';
  81. ?>
  82. </td>
  83. <td align="center">
  84. <?php
  85. $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
  86. echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未选择';
  87. ?>
  88. </td>
  89. <td align="center">
  90. <?= ($row['cs_deal'] == 3) ? '<span class="highline">成交</span>' : '未成交' ?>
  91. </td>
  92. <td align="center"><?= $row['cs_addtime'] ?></td>
  93. <td align="center" rowspan="2">
  94. <?php
  95. $employeeResult = $conn->query("SELECT em_user FROM employee WHERE id=" . (int)$row['cs_belong']);
  96. echo ($employeeRow = $employeeResult->fetch_assoc()) ? htmlspecialcharsFix($employeeRow['em_user']) : '系统出错';
  97. ?>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td colspan="6" class="contacts">
  102. <div class="tel"><?= htmlspecialcharsFix($row['cs_tel']) ?></div>
  103. <div class="mail"><?= htmlspecialcharsFix($row['cs_email']) ?></div>
  104. <div class="whatsapp"><?= htmlspecialcharsFix($row['cs_whatsapp']) ?></div>
  105. <div class="wechat"><?= htmlspecialcharsFix($row['cs_wechat']) ?></div>
  106. <div class="linkedin"><?= htmlspecialcharsFix($row['cs_linkedin']) ?></div>
  107. <div class="facebook"><?= htmlspecialcharsFix($row['cs_facebook']) ?></div>
  108. <div class="alibaba"><?= htmlspecialcharsFix($row['cs_alibaba']) ?></div>
  109. </td>
  110. </tr>
  111. <?php
  112. $i++;
  113. }
  114. } else {
  115. if (empty($keywords)) {
  116. ?>
  117. <tr>
  118. <td colspan="8" align="center">暂无相关记录,可录入该客户,<a href="/customerAdd.php" class="highline">点击录入客户数据</a></td>
  119. </tr>
  120. <?php
  121. } else {
  122. ?>
  123. <tr>
  124. <td colspan="8" align="center">
  125. <a href="?">Sorry,没有找到"<?= htmlspecialcharsFix($keywords) ?>"相关的信息,点击返回</a>
  126. </td>
  127. </tr>
  128. <?php
  129. }
  130. }
  131. ?>
  132. </table>
  133. </div>
  134. </body>
  135. </html>