123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
- require_once 'conn.php';
- checkLogin();
- $keywordsNative = $_POST['keywords'] ?? '';
- $keywords = str_replace(['+', ' ', '-', ')', '('], '', $keywordsNative);
- $keywords = textEncode($keywords);
- if (empty($keywords) || strlen($keywords) < 4) {
- echo "<script>alert('请至少输入4位数字或文字进行查找');window.location.href='/home.php';</script>";
- exit;
- }
- $searchStr = "SELECT c.cs_code, cc.contact_name as cs_name, c.cs_country, cc.tel as cs_tel,
- cc.email as cs_email, cc.whatsapp as cs_whatsapp, cc.wechat as cs_wechat,
- cc.linkedin as cs_linkedin, cc.facebook as cs_facebook, c.cs_addtime,
- c.cs_from, c.cs_belong, c.cs_deal, cc.alibaba as cs_alibaba
- FROM customer c
- LEFT JOIN customer_contact cc ON c.id = cc.customer_id
- WHERE (cc.tel_format LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.email LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.whatsapp_format LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.wechat LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.alibaba LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.linkedin LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.facebook LIKE '%" . $conn->real_escape_string($keywords) . "%'
- OR cc.email LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
- OR cc.wechat LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
- OR cc.alibaba LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
- OR cc.linkedin LIKE '%" . $conn->real_escape_string($keywordsNative) . "%'
- OR cc.facebook LIKE '%" . $conn->real_escape_string($keywordsNative) . "%')";
- ?>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>管理区域</title>
- <link rel="stylesheet" href="css/common.css" type="text/css" />
- <link rel="stylesheet" href="css/alert.css" type="text/css" />
- <script src="system/js/jquery-1.7.2.min.js"></script>
- <script src="js/js.js"></script>
- <style>
- body {
- margin: 0;
- padding: 20px;
- background: #fff;
- }
- #man_zone {
- margin-left: 0;
- }
- </style>
- </head>
- <body class="clear">
- <?php // require_once 'panel.php'; ?>
- <div id="man_zone">
- <div class="searchForm resultSearch">
- <form method="post" action="searchResult.php" accept-charset="UTF-8">
- <input class="keywords" name="keywords" id="keyword" placeholder="请输入电话/邮箱/微信/WhatsApp.." value="<?= htmlspecialcharsFix($keywordsNative) ?>">
- <input class="searchSubmit" type="submit" value="客户检索">
- </form>
- </div>
- <table width="100%" class="resultForm">
- <tr class="tableHead">
- <td align="center">序号</td>
- <td align="center">客户编号</td>
- <td align="center">联系人</td>
- <td align="center">国家</td>
- <td align="center">来源</td>
- <td align="center">跟进阶段</td>
- <td align="center">录入日期</td>
- <td align="center">所属业务员</td>
- </tr>
- <?php
- $result = $conn->query($searchStr);
- if ($result && $result->num_rows > 0) {
- $i = 1;
- while ($row = $result->fetch_assoc()) {
- ?>
- <tr>
- <td align="center" rowspan="2"><?= $i ?></td>
- <td align="center"><?= htmlspecialcharsFix($row['cs_code']) ?></td>
- <td align="center"><?= htmlspecialcharsFix($row['cs_name']) ?></td>
- <td align="center">
- <?php
- $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
- echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未选择';
- ?>
- </td>
- <td align="center">
- <?php
- $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
- echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未选择';
- ?>
- </td>
- <td align="center">
- <?= ($row['cs_deal'] == 3) ? '<span class="highline">成交</span>' : '未成交' ?>
- </td>
- <td align="center"><?= $row['cs_addtime'] ?></td>
- <td align="center" rowspan="2">
- <?php
- $employeeResult = $conn->query("SELECT em_user FROM employee WHERE id=" . (int)$row['cs_belong']);
- echo ($employeeRow = $employeeResult->fetch_assoc()) ? htmlspecialcharsFix($employeeRow['em_user']) : '系统出错';
- ?>
- </td>
- </tr>
- <tr>
- <td colspan="6" class="contacts">
- <div class="tel"><?= htmlspecialcharsFix($row['cs_tel']) ?></div>
- <div class="mail"><?= htmlspecialcharsFix($row['cs_email']) ?></div>
- <div class="whatsapp"><?= htmlspecialcharsFix($row['cs_whatsapp']) ?></div>
- <div class="wechat"><?= htmlspecialcharsFix($row['cs_wechat']) ?></div>
- <div class="linkedin"><?= htmlspecialcharsFix($row['cs_linkedin']) ?></div>
- <div class="facebook"><?= htmlspecialcharsFix($row['cs_facebook']) ?></div>
- <div class="alibaba"><?= htmlspecialcharsFix($row['cs_alibaba']) ?></div>
- </td>
- </tr>
- <?php
- $i++;
- }
- } else {
- if (empty($keywords)) {
- ?>
- <tr>
- <td colspan="8" align="center">暂无相关记录,可录入该客户,<a href="/customerAdd.php" class="highline">点击录入客户数据</a></td>
- </tr>
- <?php
- } else {
- ?>
- <tr>
- <td colspan="8" align="center">
- <a href="?">Sorry,没有找到"<?= htmlspecialcharsFix($keywords) ?>"相关的信息,点击返回</a>
- </td>
- </tr>
- <?php
- }
- }
- ?>
- </table>
- </div>
- </body>
- </html>
|