|
@@ -0,0 +1,590 @@
|
|
|
+<?php
|
|
|
+require_once 'conn.php';
|
|
|
+checkLogin();
|
|
|
+
|
|
|
+// 辅助函数
|
|
|
+function textEncode($str) {
|
|
|
+ return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
|
|
+}
|
|
|
+
|
|
|
+function textDecode($str) {
|
|
|
+ return htmlspecialchars_decode($str, ENT_QUOTES);
|
|
|
+}
|
|
|
+
|
|
|
+function htmlEncode($str) {
|
|
|
+ return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
|
|
+}
|
|
|
+
|
|
|
+function htmlDecode($str) {
|
|
|
+ return htmlspecialchars_decode($str, ENT_QUOTES);
|
|
|
+}
|
|
|
+
|
|
|
+$act = $_GET['act'] ?? '';
|
|
|
+$urlStr = '';
|
|
|
+
|
|
|
+// 处理保存操作
|
|
|
+if ($act == "save") {
|
|
|
+ $isedit = false;
|
|
|
+ $id = $_POST['id'] ?? '';
|
|
|
+ if (!empty($id) && is_numeric($id)) {
|
|
|
+ $isedit = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取表单数据
|
|
|
+ $cs_code = textEncode($_POST['cs_code']);
|
|
|
+ $cs_company = textEncode($_POST['cs_company']);
|
|
|
+ $cs_name = textEncode($_POST['cs_name']);
|
|
|
+ $cs_belong = $_POST['cs_belong'];
|
|
|
+ $cs_country = $_POST['cs_country'];
|
|
|
+ $cs_from = $_POST['cs_from'];
|
|
|
+ $cs_tel = textEncode($_POST['cs_tel']);
|
|
|
+ $cs_email = textEncode($_POST['cs_email']);
|
|
|
+ $cs_whatsapp = textEncode($_POST['cs_whatsapp']);
|
|
|
+ $cs_wechat = textEncode($_POST['cs_wechat']);
|
|
|
+ $cs_linkedin = textEncode($_POST['cs_linkedin']);
|
|
|
+ $cs_facebook = textEncode($_POST['cs_facebook']);
|
|
|
+ $cs_alibaba = textEncode($_POST['cs_alibaba']);
|
|
|
+ $cs_state = $_POST['cs_state'];
|
|
|
+ $cs_deal = $_POST['cs_deal'];
|
|
|
+ $no_content = htmlEncode($_POST['no_content']);
|
|
|
+ $allowedit = isset($_POST['allowedit']) ? 1 : 0;
|
|
|
+
|
|
|
+ if ($isedit) {
|
|
|
+ // 更新现有记录
|
|
|
+ $sql = "SELECT cs_chain FROM customer WHERE id = $id";
|
|
|
+ $result = mysqli_query($conn, $sql);
|
|
|
+ if ($row = mysqli_fetch_assoc($result)) {
|
|
|
+ $cs_chain = $row['cs_chain'];
|
|
|
+ $chain_array = explode(',', $cs_chain);
|
|
|
+ $last_item = end($chain_array);
|
|
|
+
|
|
|
+ if ($last_item != $cs_belong) {
|
|
|
+ $cs_chain .= ",$cs_belong";
|
|
|
+ }
|
|
|
+
|
|
|
+ $sql = "UPDATE customer SET
|
|
|
+ cs_code = '$cs_code',
|
|
|
+ cs_company = '$cs_company',
|
|
|
+ cs_name = '$cs_name',
|
|
|
+ cs_belong = '$cs_belong',
|
|
|
+ cs_country = '$cs_country',
|
|
|
+ cs_from = '$cs_from',
|
|
|
+ cs_tel = '$cs_tel',
|
|
|
+ cs_email = '$cs_email',
|
|
|
+ cs_whatsapp = '$cs_whatsapp',
|
|
|
+ cs_wechat = '$cs_wechat',
|
|
|
+ cs_linkedin = '$cs_linkedin',
|
|
|
+ cs_facebook = '$cs_facebook',
|
|
|
+ cs_alibaba = '$cs_alibaba',
|
|
|
+ cs_state = '$cs_state',
|
|
|
+ cs_deal = '$cs_deal',
|
|
|
+ cs_note = '$no_content',
|
|
|
+ allowedit = $allowedit,
|
|
|
+ cs_chain = '$cs_chain',
|
|
|
+ cs_updatetime = NOW()
|
|
|
+ WHERE id = $id";
|
|
|
+
|
|
|
+ mysqli_query($conn, $sql);
|
|
|
+
|
|
|
+ $page = $_GET['Page'] ?? '';
|
|
|
+ $keys = urlencode($_GET['Keys'] ?? '');
|
|
|
+ header("Location: ?keys=$keys&Page=$page$urlStr");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 处理编辑操作
|
|
|
+if ($act == "edit") {
|
|
|
+ $id = $_GET['id'] ?? '';
|
|
|
+ $isedit = false;
|
|
|
+ if (!empty($id) && is_numeric($id)) {
|
|
|
+ $isedit = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($isedit) {
|
|
|
+ $sql = "SELECT c.*, n.c_code FROM customer c
|
|
|
+ LEFT JOIN myNote n ON c.cs_code = n.c_code
|
|
|
+ WHERE c.id = $id";
|
|
|
+ $result = mysqli_query($conn, $sql);
|
|
|
+ if ($row = mysqli_fetch_assoc($result)) {
|
|
|
+ $cs_code = textDecode($row['cs_code']);
|
|
|
+ $cs_company = textDecode($row['cs_company']);
|
|
|
+ $cs_name = textDecode($row['cs_name']);
|
|
|
+ $cs_country = $row['cs_country'];
|
|
|
+ $cs_from = $row['cs_from'];
|
|
|
+ $cs_tel = textDecode($row['cs_tel']);
|
|
|
+ $cs_telBu = textDecode($row['cs_telBu']);
|
|
|
+ $cs_email = textDecode($row['cs_email']);
|
|
|
+ $cs_emailBu = textDecode($row['cs_emailBu']);
|
|
|
+ $cs_whatsapp = textDecode($row['cs_whatsapp']);
|
|
|
+ $cs_whatsappBu = textDecode($row['cs_whatsappBu']);
|
|
|
+ $cs_wechat = textDecode($row['cs_wechat']);
|
|
|
+ $cs_wechatBu = textDecode($row['cs_wechatBu']);
|
|
|
+ $cs_linkedin = textDecode($row['cs_linkedin']);
|
|
|
+ $cs_linkedinBu = textDecode($row['cs_linkedinBu']);
|
|
|
+ $cs_facebook = textDecode($row['cs_facebook']);
|
|
|
+ $cs_facebookBu = textDecode($row['cs_facebookBu']);
|
|
|
+ $cs_alibaba = textDecode($row['cs_alibaba']);
|
|
|
+ $cs_alibabaBu = textDecode($row['cs_alibabaBu']);
|
|
|
+ $cs_address = textDecode($row['cs_address']);
|
|
|
+ $cs_addtime = $row['cs_addtime'];
|
|
|
+ $cs_updatetime = $row['cs_updatetime'];
|
|
|
+ $cs_belong = $row['cs_belong'];
|
|
|
+ $cs_state = $row['cs_state'];
|
|
|
+ $cs_deal = $row['cs_deal'];
|
|
|
+ $cs_note = htmlDecode($row['cs_note']);
|
|
|
+ $allowedit = $row['allowedit'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 处理批量操作
|
|
|
+if ($act == "postchk") {
|
|
|
+ if (isset($_POST['chkbox']) && isset($_POST['chkact'])) {
|
|
|
+ $chkact = $_POST['chkact'];
|
|
|
+ $ids = implode(',', array_map('intval', $_POST['chkbox']));
|
|
|
+
|
|
|
+ switch($chkact) {
|
|
|
+ case "0":
|
|
|
+ case "1":
|
|
|
+ $sql = "UPDATE customer SET cs_state = $chkact WHERE id IN ($ids)";
|
|
|
+ break;
|
|
|
+ case "-1":
|
|
|
+ $sql = "DELETE FROM customer WHERE id IN ($ids)";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isset($sql)) {
|
|
|
+ mysqli_query($conn, $sql);
|
|
|
+ }
|
|
|
+
|
|
|
+ $keys = urlencode($_GET['Keys'] ?? '');
|
|
|
+ $page = $_GET['Page'] ?? '';
|
|
|
+ header("Location: ?keys=$keys&Page=$page$urlStr");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 处理筛选条件
|
|
|
+$fliterQudao = $_GET['fliterQudao'] ?? '';
|
|
|
+$fliterDeal = $_GET['fliterDeal'] ?? '';
|
|
|
+$fliterTeam = $_GET['fliterTeam'] ?? '';
|
|
|
+$fliterContact = $_GET['fliterContact'] ?? '';
|
|
|
+$fliterEmployee = $_GET['fliterEmployee'] ?? '';
|
|
|
+
|
|
|
+$fliterStr = "";
|
|
|
+
|
|
|
+if (!empty($fliterQudao)) {
|
|
|
+ $fliterStr .= " AND cs_from = " . intval($fliterQudao);
|
|
|
+ $urlStr .= "&fliterQudao=" . $fliterQudao;
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($fliterDeal)) {
|
|
|
+ $fliterStr .= " AND cs_deal = " . intval($fliterDeal);
|
|
|
+ $urlStr .= "&fliterDeal=" . $fliterDeal;
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($fliterTeam)) {
|
|
|
+ $fliterStr .= " AND (cs_belong = " . intval($fliterTeam) .
|
|
|
+ " OR cs_belong IN (SELECT id FROM employee WHERE em_role = " . intval($fliterTeam) . "))";
|
|
|
+ $urlStr .= "&fliterTeam=" . $fliterTeam;
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($fliterEmployee)) {
|
|
|
+ $fliterStr .= " AND cs_belong = " . intval($fliterEmployee);
|
|
|
+ $urlStr .= "&fliterEmployee=" . $fliterEmployee;
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($fliterContact)) {
|
|
|
+ switch($fliterContact) {
|
|
|
+ case "1": $fliterStr .= " AND cs_tel != ''"; break;
|
|
|
+ case "2": $fliterStr .= " AND cs_wechat != ''"; break;
|
|
|
+ case "3": $fliterStr .= " AND cs_whatsapp != ''"; break;
|
|
|
+ case "4": $fliterStr .= " AND cs_email != ''"; break;
|
|
|
+ case "5": $fliterStr .= " AND cs_linkedin != ''"; break;
|
|
|
+ case "6": $fliterStr .= " AND cs_facebook != ''"; break;
|
|
|
+ case "7": $fliterStr .= " AND cs_alibaba != ''"; break;
|
|
|
+ }
|
|
|
+ $urlStr .= "&fliterContact=" . $fliterContact;
|
|
|
+}
|
|
|
+
|
|
|
+// 搜索和排序
|
|
|
+$keys = $_GET['Keys'] ?? '';
|
|
|
+$keyscode = textEncode($keys);
|
|
|
+$page = $_GET['Page'] ?? 1;
|
|
|
+$ord = $_GET['Ord'] ?? '';
|
|
|
+
|
|
|
+$ordStr = !empty($ord) ? "$ord," : "";
|
|
|
+
|
|
|
+// 构建查询SQL
|
|
|
+$sqlStr = "SELECT id, cs_code, cs_name, cs_country, cs_address, cs_tel, cs_email,
|
|
|
+ cs_whatsapp, cs_wechat, cs_linkedin, cs_facebook, cs_addtime, cs_alibaba,
|
|
|
+ cs_from, cs_deal, cs_updatetime, cs_belong, cs_note, cs_claimFrom, cs_chain,
|
|
|
+ cs_dealdate
|
|
|
+ FROM customer
|
|
|
+ WHERE (cs_code LIKE '%$keyscode%'
|
|
|
+ OR cs_name LIKE '%$keyscode%'
|
|
|
+ OR cs_wechat LIKE '%$keyscode%'
|
|
|
+ OR cs_alibaba LIKE '%$keyscode%'
|
|
|
+ OR cs_telformat LIKE '%$keyscode%'
|
|
|
+ OR cs_whatsappformat LIKE '%$keyscode%'
|
|
|
+ OR cs_email LIKE '%$keyscode%')
|
|
|
+ $fliterStr
|
|
|
+ ORDER BY ${ordStr}cs_updatetime DESC";
|
|
|
+
|
|
|
+?>
|
|
|
+<!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>
|
|
|
+ <script language="javascript" src="js/jquery-1.7.2.min.js"></script>
|
|
|
+ <script type="text/javascript" src="js/js.js"></script>
|
|
|
+ <script type="text/javascript" src="xheditor-1.1.9/xheditor-1.1.9-zh-cn.min.js"></script>
|
|
|
+ <script>
|
|
|
+ $(document).ready(function(){
|
|
|
+ $('.txt2').xheditor({
|
|
|
+ tools:'full',
|
|
|
+ hoverExecDelay:-1,
|
|
|
+ urlBase:'system/',
|
|
|
+ upLinkUrl:"upload.php",
|
|
|
+ upLinkExt:"zip,rar,txt,pdf",
|
|
|
+ upImgUrl:"upload.php",
|
|
|
+ upImgExt:"jpg,jpeg,gif,png",
|
|
|
+ upFlashUrl:"upload.php",
|
|
|
+ upFlashExt:"swf",
|
|
|
+ upMediaUrl:"upload.php",
|
|
|
+ upMediaExt:"wmv,avi,wma,mp3,mid"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+</head>
|
|
|
+<body class="clear">
|
|
|
+<?php require_once 'panel.php'; ?>
|
|
|
+<div id="man_zone">
|
|
|
+<?php
|
|
|
+$keys = $_GET['Keys'] ?? '';
|
|
|
+$keys = str_replace([" ", "+"], "", $keys);
|
|
|
+$keyscode = textEncode($keys);
|
|
|
+$page = $_GET['Page'] ?? 1;
|
|
|
+
|
|
|
+$filters = [
|
|
|
+ 'Country' => $_GET['fliterCountry'] ?? '',
|
|
|
+ 'Qudao' => $_GET['fliterQudao'] ?? '',
|
|
|
+ 'Deal' => $_GET['fliterDeal'] ?? '',
|
|
|
+ 'Business' => $_GET['fliterBusiness'] ?? '',
|
|
|
+ 'Contact' => $_GET['fliterContact'] ?? ''
|
|
|
+];
|
|
|
+
|
|
|
+$filterStr = "";
|
|
|
+$urlStr = "";
|
|
|
+
|
|
|
+// Build filter conditions
|
|
|
+if (!empty($filters['Country'])) {
|
|
|
+ $filterStr .= " AND cs_country=" . (int)$filters['Country'];
|
|
|
+ $urlStr .= "&fliterCountry=" . $filters['Country'];
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($filters['Qudao'])) {
|
|
|
+ $filterStr .= " AND cs_from=" . (int)$filters['Qudao'];
|
|
|
+ $urlStr .= "&fliterQudao=" . $filters['Qudao'];
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($filters['Deal'])) {
|
|
|
+ $filterStr .= " AND cs_deal=" . (int)$filters['Deal'];
|
|
|
+ $urlStr .= "&fliterDeal=" . $filters['Deal'];
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($filters['Business'])) {
|
|
|
+ $filterStr .= " AND cs_type=" . (int)$filters['Business'];
|
|
|
+ $urlStr .= "&fliterBusiness=" . $filters['Business'];
|
|
|
+}
|
|
|
+
|
|
|
+if (!empty($filters['Contact'])) {
|
|
|
+ switch ($filters['Contact']) {
|
|
|
+ case "1": $filterStr .= " AND cs_tel<>''"; break;
|
|
|
+ case "2": $filterStr .= " AND cs_wechat<>''"; break;
|
|
|
+ case "3": $filterStr .= " AND cs_whatsapp<>''"; break;
|
|
|
+ case "4": $filterStr .= " AND cs_email<>''"; break;
|
|
|
+ case "5": $filterStr .= " AND cs_linkedin<>''"; break;
|
|
|
+ case "6": $filterStr .= " AND cs_facebook<>''"; break;
|
|
|
+ default: $filterStr .= " AND cs_alibaba<>''";
|
|
|
+ }
|
|
|
+ $urlStr .= "&fliterContact=" . $filters['Contact'];
|
|
|
+}
|
|
|
+
|
|
|
+$keys = urlencode($keys);
|
|
|
+$hrefstr = "?keys=" . $keys;
|
|
|
+?>
|
|
|
+
|
|
|
+<form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
|
|
|
+ <div class="fastSelect clear">
|
|
|
+ <H1>搜索条件</H1>
|
|
|
+ <div class="selectItem">
|
|
|
+ <label>区域</label>
|
|
|
+ <select name="fliterCountry" class="filterSearch">
|
|
|
+ <option value="">请选择国家地区</option>
|
|
|
+ <?php
|
|
|
+ $result = $conn->query("SELECT id, countryName FROM country");
|
|
|
+ while ($row = $result->fetch_assoc()) {
|
|
|
+ $selected = ($filters['Country'] == $row['id']) ? ' selected' : '';
|
|
|
+ echo "<option value=\"{$row['id']}\"$selected>{$row['countryName']}</option>";
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="selectItem">
|
|
|
+ <label>来源渠道</label>
|
|
|
+ <select name="fliterQudao" class="filterSearch">
|
|
|
+ <option value="">请选择渠道</option>
|
|
|
+ <?php
|
|
|
+ $result = $conn->query("SELECT id, ch_name FROM qudao");
|
|
|
+ while ($row = $result->fetch_assoc()) {
|
|
|
+ $selected = ($filters['Qudao'] == $row['id']) ? ' selected' : '';
|
|
|
+ echo "<option value=\"{$row['id']}\"$selected>{$row['ch_name']}</option>";
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="selectItem">
|
|
|
+ <label>跟进阶段</label>
|
|
|
+ <select name="fliterDeal" class="filterSearch">
|
|
|
+ <option value="">请选择</option>
|
|
|
+ <option value="1"<?= ($filters['Deal'] == "1") ? ' selected' : '' ?>>背景调查</option>
|
|
|
+ <option value="2"<?= ($filters['Deal'] == "2") ? ' selected' : '' ?>>明确需求</option>
|
|
|
+ <option value="3"<?= ($filters['Deal'] == "3") ? ' selected' : '' ?>>已成交</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="selectItem">
|
|
|
+ <label>客户类型</label>
|
|
|
+ <select name="fliterBusiness" class="filterSearch">
|
|
|
+ <option value="">请选择</option>
|
|
|
+ <?php
|
|
|
+ $result = $conn->query("SELECT id, businessType FROM clientType");
|
|
|
+ while ($row = $result->fetch_assoc()) {
|
|
|
+ $selected = ($filters['Business'] == $row['id']) ? ' selected' : '';
|
|
|
+ echo "<option value=\"{$row['id']}\"$selected>{$row['businessType']}</option>";
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="selectItem">
|
|
|
+ <label>联系方式</label>
|
|
|
+ <select name="fliterContact" class="filterSearch">
|
|
|
+ <option value="">请选择</option>
|
|
|
+ <option value="1"<?= ($filters['Contact'] == "1") ? ' selected' : '' ?>>电话</option>
|
|
|
+ <option value="2"<?= ($filters['Contact'] == "2") ? ' selected' : '' ?>>微信</option>
|
|
|
+ <option value="3"<?= ($filters['Contact'] == "3") ? ' selected' : '' ?>>WhatsApp</option>
|
|
|
+ <option value="4"<?= ($filters['Contact'] == "4") ? ' selected' : '' ?>>邮箱</option>
|
|
|
+ <option value="5"<?= ($filters['Contact'] == "5") ? ' selected' : '' ?>>领英</option>
|
|
|
+ <option value="6"<?= ($filters['Contact'] == "6") ? ' selected' : '' ?>>Facebook</option>
|
|
|
+ <option value="7"<?= ($filters['Contact'] == "7") ? ' selected' : '' ?>>阿里巴巴</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="inputSearch">
|
|
|
+ <input type="text" id="keys" class="inputTxt"
|
|
|
+ value="<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>"
|
|
|
+ onFocus="if(this.value == '<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>'){this.value='';}"
|
|
|
+ onBlur="if(this.value == ''){this.value='<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>';}"
|
|
|
+ onKeyDown="if(event.keyCode==13){location.href='?Keys='+escape(document.getElementById('keys').value)}" />
|
|
|
+ <input type="button" id="searchgo" class="searchgo" value="go"
|
|
|
+ onClick="location.href='?Keys='+escape(document.getElementById('keys').value)" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="table2 em<?= $_SESSION['employee_id'] ?>">
|
|
|
+ <div class="theader">
|
|
|
+ <div class="col1"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></div>
|
|
|
+ <div class="col2">序号</div>
|
|
|
+ <div class="col3">客户编号</div>
|
|
|
+ <div class="col4">渠道来源</div>
|
|
|
+ <div class="col5">区域</div>
|
|
|
+ <div class="col6">客户类型</div>
|
|
|
+ <div class="col6">跟进阶段</div>
|
|
|
+ <div class="colmark">颜色标记</div>
|
|
|
+ <div class="col6">录入时间</div>
|
|
|
+ <div class="col9">操作</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <?php
|
|
|
+ $sql = "SELECT id, cs_code, cs_from, cs_country, cs_type, cs_deal, cs_addtime,
|
|
|
+ cs_tel, cs_email, cs_whatsapp, cs_wechat, cs_linkedin, cs_facebook,
|
|
|
+ cs_alibaba, colortag, cs_note, cs_claimFrom
|
|
|
+ FROM customer
|
|
|
+ WHERE is_silent=0 AND cs_deal>0 AND cs_belong=?
|
|
|
+ AND (cs_code LIKE ? OR cs_name LIKE ? OR cs_email LIKE ?
|
|
|
+ OR cs_wechat LIKE ? OR cs_telformat LIKE ?
|
|
|
+ OR cs_whatsappformat LIKE ? OR cs_code LIKE ?)
|
|
|
+ $filterStr
|
|
|
+ ORDER BY colortag DESC, id DESC";
|
|
|
+
|
|
|
+ $stmt = $conn->prepare($sql);
|
|
|
+ $searchPattern = "%$keyscode%";
|
|
|
+ $stmt->bind_param("isssssss",
|
|
|
+ $_SESSION['employee_id'],
|
|
|
+ $searchPattern, $searchPattern, $searchPattern,
|
|
|
+ $searchPattern, $searchPattern, $searchPattern,
|
|
|
+ $searchPattern
|
|
|
+ );
|
|
|
+
|
|
|
+ $stmt->execute();
|
|
|
+ $result = $stmt->get_result();
|
|
|
+
|
|
|
+ // Pagination logic
|
|
|
+ $perPage = 20;
|
|
|
+ $totalRecords = $result->num_rows;
|
|
|
+ $totalPages = ceil($totalRecords / $perPage);
|
|
|
+ $page = min(max(1, $page), $totalPages);
|
|
|
+ $offset = ($page - 1) * $perPage;
|
|
|
+
|
|
|
+ $sql .= " LIMIT $offset, $perPage";
|
|
|
+ $stmt = $conn->prepare($sql);
|
|
|
+ $stmt->bind_param("isssssss",
|
|
|
+ $_SESSION['employee_id'],
|
|
|
+ $searchPattern, $searchPattern, $searchPattern,
|
|
|
+ $searchPattern, $searchPattern, $searchPattern,
|
|
|
+ $searchPattern
|
|
|
+ );
|
|
|
+ $stmt->execute();
|
|
|
+ $result = $stmt->get_result();
|
|
|
+
|
|
|
+ if ($result->num_rows > 0) {
|
|
|
+ $tempNum = $offset;
|
|
|
+ while ($row = $result->fetch_assoc()) {
|
|
|
+ $tempNum++;
|
|
|
+ ?>
|
|
|
+ <div class="tline color<?= $row['colortag'] ?>">
|
|
|
+ <div class="col1" align="center"><input type="checkbox" name="chkbox[]" value="<?= $row['id'] ?>" /></div>
|
|
|
+ <div class="col2"><?= $tempNum ?></div>
|
|
|
+ <div class="col3 slidepanel"><?= $row['cs_code'] ?>
|
|
|
+ <?php if ($row['cs_claimFrom'] > 0): ?>
|
|
|
+ <img src="../images/yijiao.png" class="handover" title="来自认领">
|
|
|
+ <?php endif; ?>
|
|
|
+ </div>
|
|
|
+ <div class="col4">
|
|
|
+ <?php
|
|
|
+ $qudao = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
|
|
|
+ echo $qudao->num_rows > 0 ? $qudao->fetch_assoc()['ch_name'] : '未填写';
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="col5">
|
|
|
+ <?php
|
|
|
+ $country = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
|
|
|
+ echo $country->num_rows > 0 ? $country->fetch_assoc()['countryName'] : '未填写';
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="col6">
|
|
|
+ <?php
|
|
|
+ $clientType = $conn->query("SELECT businessType FROM clientType WHERE id=" . (int)$row['cs_type']);
|
|
|
+ echo $clientType->num_rows > 0 ? $clientType->fetch_assoc()['businessType'] : '未填写';
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="col6">
|
|
|
+ <?php
|
|
|
+ switch ($row['cs_deal']) {
|
|
|
+ case 3: echo '<span style="color:red;">成交</span>'; break;
|
|
|
+ case 2: echo '明确需求'; break;
|
|
|
+ case 1: echo '背景调查'; break;
|
|
|
+ default: echo '无响应';
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="colmark colormark">
|
|
|
+ <ul class="colorlist" data-id="<?= $row['id'] ?>">
|
|
|
+ <li value="1" class="color1"></li>
|
|
|
+ <li value="2" class="color2"></li>
|
|
|
+ <li value="3" class="color3"></li>
|
|
|
+ <li value="4" class="color4"></li>
|
|
|
+ <li value="0" class="color0"></li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="col6"><?= $row['cs_addtime'] ?></div>
|
|
|
+ <div class="col9">
|
|
|
+ <a href="customerEdit.php?Keys=<?= $keys ?>&fliterDeal=<?= $filters['Deal'] ?>&fliterBusiness=<?= $filters['Business'] ?>&Page=<?= $page ?>&act=edit&id=<?= $row['id'] ?>" class="ico_edit ico">修改</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="notepanel clear">
|
|
|
+ <div class="noteItem">联系方式</div>
|
|
|
+ <div class="lx">
|
|
|
+ <div class="tel"><?= $row['cs_tel'] ?></div>
|
|
|
+ <div class="mail"><a href="mailto:<?= $row['cs_email'] ?>"><?= $row['cs_email'] ?></a></div>
|
|
|
+ <div class="whatsapp"><?= $row['cs_whatsapp'] ?></div>
|
|
|
+ <div class="wechat"><?= $row['cs_wechat'] ?></div>
|
|
|
+ <div class="linkedin"><?= $row['cs_linkedin'] ?></div>
|
|
|
+ <div class="facebook"><?= $row['cs_facebook'] ?></div>
|
|
|
+ <div class="alibaba"><?= $row['cs_alibaba'] ?></div>
|
|
|
+ </div>
|
|
|
+ <div class="noteItem2">备注</div>
|
|
|
+ <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (empty($keys)) {
|
|
|
+ echo '<tr><div align="center" colspan="9">Sorry,当前暂无信息</div></tr>';
|
|
|
+ } else {
|
|
|
+ echo '<tr><div align="center" colspan="9"><a href="?">Sorry,没有找到"' .
|
|
|
+ htmlspecialchars($keyscode) . '"相关的信息,点击返回</a></div></tr>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+
|
|
|
+ <div colspan="9">
|
|
|
+ <div class="showpagebox">
|
|
|
+ <?php
|
|
|
+ if ($totalPages > 1) {
|
|
|
+ $pageName = "?Keys=$keys$urlStr&";
|
|
|
+ $pageLen = 3;
|
|
|
+
|
|
|
+ if ($page > 1) {
|
|
|
+ echo "<a href=\"{$pageName}Page=1\">首页</a>";
|
|
|
+ echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($pageLen * 2 + 1 >= $totalPages) {
|
|
|
+ $startPage = 1;
|
|
|
+ $endPage = $totalPages;
|
|
|
+ } else {
|
|
|
+ if ($page <= $pageLen + 1) {
|
|
|
+ $startPage = 1;
|
|
|
+ $endPage = $pageLen * 2 + 1;
|
|
|
+ } else {
|
|
|
+ $startPage = $page - $pageLen;
|
|
|
+ $endPage = $page + $pageLen;
|
|
|
+ }
|
|
|
+ if ($page + $pageLen > $totalPages) {
|
|
|
+ $startPage = $totalPages - $pageLen * 2;
|
|
|
+ $endPage = $totalPages;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for ($i = $startPage; $i <= $endPage; $i++) {
|
|
|
+ if ($i == $page) {
|
|
|
+ echo "<a class=\"current\">$i</a>";
|
|
|
+ } else {
|
|
|
+ echo "<a href=\"{$pageName}Page=$i\">$i</a>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($page < $totalPages) {
|
|
|
+ if ($totalPages - $page > $pageLen) {
|
|
|
+ echo "<a href=\"{$pageName}Page=$totalPages\">...$totalPages</a>";
|
|
|
+ }
|
|
|
+ echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
|
|
|
+ echo "<a href=\"{$pageName}Page=$totalPages\">尾页</a>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <?php require_once 'postchkbox.php'; ?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</form>
|
|
|
+</div>
|
|
|
+</body>
|
|
|
+</html>
|