123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796 |
- <?php
- require_once('conn.php');
- checkLogin("信息管理");
- // Initialize variables
- $urlStr = "";
- $act = $_GET['act'] ?? '';
- $output = '';
- // Process all actions that might need headers
- 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 = intval($_POST['cs_belong'] ?? 0);
- $cs_country = intval($_POST['cs_country'] ?? 0);
- $cs_from = intval($_POST['cs_from'] ?? 0);
- $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 = intval($_POST['cs_state'] ?? 0);
- $cs_deal = intval($_POST['cs_deal'] ?? 0);
- $no_content = htmlEncode($_POST['no_content'] ?? '');
- $allowedit = isset($_POST['allowedit']) ? 1 : 0;
- if ($isEdit) {
- $sql = "SELECT cs_chain FROM customer WHERE id=" . $id;
- $result = $conn->query($sql);
-
- if ($row = $result->fetch_assoc()) {
- $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";
- $conn->query($sql);
- $page = $_GET['Page'] ?? '';
- $keys = urlencode($_GET['Keys'] ?? '');
- header("Location: ?keys=$keys&Page=$page$urlStr");
- exit;
- } else {
- $output = "<script>alert('不存在该客户');history.back();</script>";
- }
- } else {
- $sql = "INSERT INTO customer (
- cs_code, cs_company, cs_name, cs_belong, cs_country, cs_from,
- cs_tel, cs_email, cs_whatsapp, cs_wechat, cs_linkedin,
- cs_facebook, cs_alibaba, cs_state, cs_deal, cs_note,
- allowedit, cs_chain, cs_addtime, cs_updatetime
- ) VALUES (
- '$cs_code', '$cs_company', '$cs_name', $cs_belong, $cs_country, $cs_from,
- '$cs_tel', '$cs_email', '$cs_whatsapp', '$cs_wechat', '$cs_linkedin',
- '$cs_facebook', '$cs_alibaba', $cs_state, $cs_deal, '$no_content',
- $allowedit, '$cs_belong', NOW(), NOW()
- )";
-
- $conn->query($sql);
- header("Location: ?");
- exit;
- }
- }
- // If we have output from processing, we'll show it instead of the normal page
- if (!empty($output)) {
- echo $output;
- exit;
- }
- ?>
- <!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" />
- <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>
- <div id="man_zone">
- <?php
- // 编辑操作
- if ($act == "edit" || $act == "add") {
- $id = $_GET['id'] ?? '';
- $isEdit = false;
-
- // 初始化变量
- $cs_code = $cs_company = $cs_name = $cs_tel = $cs_telBu = '';
- $cs_wechat = $cs_wechatBu = $cs_whatsapp = $cs_whatsappBu = '';
- $cs_email = $cs_emailBu = $cs_linkedin = $cs_linkedinBu = '';
- $cs_facebook = $cs_facebookBu = $cs_alibaba = $cs_alibabaBu = '';
- $cs_address = $cs_addtime = $cs_updatetime = $cs_note = '';
- $cs_belong = $cs_country = $cs_from = $cs_state = $cs_deal = $allowedit = 0;
- if (!empty($id) && is_numeric($id)) {
- $isEdit = true;
-
- $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 = $conn->query($sql);
-
- if ($row = $result->fetch_assoc()) {
- $cs_code = textUncode($row['cs_code']);
- $cs_company = textUncode($row['cs_company']);
- $cs_name = textUncode($row['cs_name']);
- $cs_country = $row['cs_country'];
- $cs_from = $row['cs_from'];
- $cs_tel = textUncode($row['cs_tel']);
- $cs_telBu = textUncode($row['cs_telBu']);
- $cs_wechat = textUncode($row['cs_wechat']);
- $cs_wechatBu = textUncode($row['cs_wechatBu']);
- $cs_whatsapp = textUncode($row['cs_whatsapp']);
- $cs_whatsappBu = textUncode($row['cs_whatsappBu']);
- $cs_email = textUncode($row['cs_email']);
- $cs_emailBu = textUncode($row['cs_emailBu']);
- $cs_linkedin = textUncode($row['cs_linkedin']);
- $cs_linkedinBu = textUncode($row['cs_linkedinBu']);
- $cs_facebook = textUncode($row['cs_facebook']);
- $cs_facebookBu = textUncode($row['cs_facebookBu']);
- $cs_alibaba = textUncode($row['cs_alibaba']);
- $cs_alibabaBu = textUncode($row['cs_alibabaBu']);
- $cs_address = textUncode($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 = htmlUncode($row['cs_note']);
- $allowedit = $row['allowedit'];
- }
- }
- $page = $_GET['Page'] ?? '';
- $keys = urlencode($_GET['Keys'] ?? '');
- $ord = urlencode($_GET['Ord'] ?? '');
- $hrefstr = "?keys=$keys&Page=$page&Ord=$ord";
- ?>
- <form name="form1" method="post" action="<?php echo $hrefstr; ?>&act=save">
- <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
- <tbody>
- <tr>
- <th width="8%">客户编号</th>
- <td><input type="text" id="cs_code" name="cs_code" value="<?php echo $cs_code; ?>" class="txt1" />
- <input type="hidden" name="id" value="<?php echo $id; ?>" /></td>
- </tr>
- <tr>
- <th width="8%">公司名称</th>
- <td><input type="text" id="cs_company" name="cs_company" value="<?php echo $cs_company; ?>" class="txt1" /></td>
- </tr>
- <tr>
- <th width="8%">联系人</th>
- <td><input type="text" id="cs_name" name="cs_name" value="<?php echo $cs_name; ?>" class="txt1" /></td>
- </tr>
- <tr>
- <th width="8%">所属业务</th>
- <td>
- <select name="cs_belong">
- <option value="0">请选择</option>
- <?php
- $sql = "SELECT id,em_user FROM employee";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc()) {
- $selected = ($row['id'] == $cs_belong) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"$selected>{$row['em_user']}</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <th width="8%">国家</th>
- <td>
- <select name="cs_country">
- <option value="0">请选择</option>
- <?php
- $sql = "SELECT id,countryCode,countryName FROM country";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc()) {
- $selected = ($row['id'] == $cs_country) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"$selected>{$row['countryName']}</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <th width="8%">来源</th>
- <td>
- <select name="cs_from">
- <option value="0">请选择</option>
- <?php
- $sql = "SELECT id,ch_name FROM qudao";
- $result = $conn->query($sql);
- while($row = $result->fetch_assoc()) {
- $selected = ($row['id'] == $cs_from) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"$selected>{$row['ch_name']}</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <th width="8%">录入时间</th>
- <td><?php echo $cs_addtime; ?></td>
- </tr>
- <tr>
- <th width="8%">更新时间</th>
- <td><?php echo $cs_updatetime; ?></td>
- </tr>
- <tr>
- <th width="8%" rowspan="7">联系方式</th>
- <td><input type="text" id="cs_tel" name="cs_tel" value="<?php echo $cs_tel ?? ''; ?>" class="txt5 tel" />备份:<?php echo $cs_telBu ?? ''; ?></td>
- </tr>
- <tr>
- <td><input type="text" id="cs_email" name="cs_email" value="<?php echo $cs_email ?? ''; ?>" class="txt5 mail" />备份:<?php echo $cs_emailBu ?? ''; ?></td>
- </tr>
- <tr>
- <td><input type="text" id="cs_whatsapp" name="cs_whatsapp" value="<?php echo $cs_whatsapp ?? ''; ?>" class="txt5 whatsapp" />备份:<?php echo $cs_whatsappBu ?? ''; ?></td>
- </tr>
- <tr>
- <td><input type="text" id="cs_wechat" name="cs_wechat" value="<?php echo $cs_wechat ?? ''; ?>" class="txt5 wechat" />备份:<?php echo $cs_wechatBu ?? ''; ?></td>
- </tr>
- <tr>
- <td><input type="text" id="cs_linkedin" name="cs_linkedin" value="<?php echo $cs_linkedin ?? ''; ?>" class="txt5 linkedin" />备份:<?php echo $cs_linkedinBu ?? ''; ?></td>
- </tr>
- <tr>
- <td><input type="text" id="cs_facebook" name="cs_facebook" value="<?php echo $cs_facebook ?? ''; ?>" class="txt5 facebook" />备份:<?php echo $cs_facebookBu ?? ''; ?></td>
- </tr>
- <tr>
- <td><input type="text" id="cs_alibaba" name="cs_alibaba" value="<?php echo $cs_alibaba ?? ''; ?>" class="txt5 alibaba" />备份:<?php echo $cs_alibabaBu ?? ''; ?></td>
- </tr>
- <tr>
- <th width="8%">地址</th>
- <td><input type="text" id="cs_address" name="cs_address" value="<?php echo $cs_address ?? ''; ?>" class="txt1" /></td>
- </tr>
- <tr>
- <th width="8%">标签</th>
- <td>
- <?php
- if($isEdit ?? false) {
- $sql = "SELECT id,tagName FROM tagtable WHERE customerId = ?";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param("i", $id);
- $stmt->execute();
- $result = $stmt->get_result();
- while($row = $result->fetch_assoc()) {
- echo htmlspecialchars($row['tagName'] ?? '') . ',';
- }
- $stmt->close();
- }
- ?>
- </td>
- </tr>
- <tr>
- <th width="8%">状态</th>
- <td>
- <label><input type="radio" name="cs_state" value="1" <?php if(($cs_state ?? 0)==1) echo 'checked="checked"'; ?> />有效</label>
- <label><input type="radio" name="cs_state" value="0" <?php if(($cs_state ?? 0)!=1) echo 'checked="checked"'; ?> />不再跟进</label>
- </td>
- </tr>
- <tr>
- <th width="8%">是否误报</th>
- <td>
- <label><input type="radio" name="allowedit" value="1" <?php if(($allowedit ?? 0)==1) echo 'checked="checked"'; ?> />审核通过</label>
- <label><input type="radio" name="allowedit" value="0" <?php if(($allowedit ?? 0)!=1) echo 'checked="checked"'; ?> />一般处理</label>
- </td>
- </tr>
- <tr>
- <th width="8%">是否成交</th>
- <td>
- <label><input type="radio" name="cs_deal" value="3" <?php if(($cs_deal ?? 0)==3) echo 'checked="checked"'; ?> />成交</label>
- <label><input type="radio" name="cs_deal" value="2" <?php if(($cs_deal ?? 0)==2) echo 'checked="checked"'; ?> />明确需求</label>
- <label><input type="radio" name="cs_deal" value="1" <?php if(($cs_deal ?? 0)==1) echo 'checked="checked"'; ?> />背景调查</label>
- <label><input type="radio" name="cs_deal" value="0" <?php if(($cs_deal ?? 0)==0) echo 'checked="checked"'; ?> />无响应</label>
- </td>
- </tr>
- <tr>
- <th>内容</th>
- <td><textarea id="no_content" name="no_content" class="txt2"><?php echo $cs_note ?? ''; ?></textarea></td>
- </tr>
- <tr>
- <th></th>
- <td>
- <input type="submit" name="save" id="save" value="确定" class="btn1" />
- <input type="reset" name="save" id="save" value="重置" class="btn1" />
- <input type="button" value="返回" class="btn1" onClick="location.href='<?php echo $hrefstr; ?>'" />
- </td>
- </tr>
- </tbody>
- </table>
- </form>
- <?php
- exit;
- }
- // 批量操作
- if ($act == "postchk") {
- $keys = urlencode($_GET['Keys'] ?? '');
- $page = $_GET['Page'] ?? '';
- $chkact = $_POST['chkact'] ?? '';
-
- if (isset($_POST['chkbox']) && is_array($_POST['chkbox'])) {
- $ids = array_map('intval', $_POST['chkbox']);
- $idList = implode(',', $ids);
-
- if (!empty($idList)) {
- switch($chkact) {
- case "0":
- case "1":
- $sql = "UPDATE customer SET cs_state=$chkact WHERE id IN ($idList)";
- break;
- default:
- $sql = "DELETE FROM customer WHERE id IN ($idList)";
- }
- $conn->query($sql);
- }
- }
-
- header("Location: ?Keys=$keys&Page=$page");
- exit;
- }
- // 主列表页面
- $fliterQudao = $_GET['fliterQudao'] ?? '';
- $fliterDeal = $_GET['fliterDeal'] ?? '';
- $fliterTeam = $_GET['fliterTeam'] ?? '';
- $fliterContact = $_GET['fliterContact'] ?? '';
- $fliterEmployee = $_GET['fliterEmployee'] ?? '';
- $filterStr = "";
- $urlStr = "";
- if (!empty($fliterQudao)) {
- $filterStr .= " AND cs_from=" . intval($fliterQudao);
- $urlStr .= "&fliterQudao=$fliterQudao";
- }
- if (!empty($fliterDeal)) {
- $filterStr .= " AND cs_deal=" . intval($fliterDeal);
- $urlStr .= "&fliterDeal=$fliterDeal";
- }
- if (!empty($fliterTeam)) {
- $filterStr .= " AND (cs_belong=" . intval($fliterTeam) .
- " OR cs_belong IN (SELECT id FROM employee WHERE em_role=" . intval($fliterTeam) . "))";
- $urlStr .= "&fliterTeam=$fliterTeam";
- }
- if (!empty($fliterEmployee)) {
- $filterStr .= " AND cs_belong=" . intval($fliterEmployee);
- $urlStr .= "&fliterEmployee=$fliterEmployee";
- }
- if (!empty($fliterContact)) {
- switch($fliterContact) {
- 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=$fliterContact";
- }
- $keys = $_GET['Keys'] ?? '';
- $keyscode = textEncode($keys);
- $page = $_GET['Page'] ?? '';
- $ord = $_GET['Ord'] ?? '';
- $sql = "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%')
- $filterStr
- ORDER BY cs_updatetime DESC";
- $result = $conn->query($sql);
- ?>
- <form id="form1" method="post" action="?act=postchk&Keys=<?php echo $keys; ?>&Page=<?php echo $page; ?>" onSubmit="return false">
- <div class="fastSelect clear">
- <H1>搜索条件</H1>
- <div class="selectItem">
- <label>来源渠道</label>
- <select name="fliterQudao" class="filterSearch">
- <option value="">请选择渠道</option>
- <?php
- $sql_temp = "SELECT id,ch_name FROM qudao";
- $qudaoResult = $conn->query($sql_temp);
- while($row = $qudaoResult->fetch_assoc()) {
- $selected = ($fliterQudao == $row['id']) ? ' selected="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="3" <?php if($fliterDeal=="3") echo 'selected="selected"'; ?>>已成交</option>
- <option value="2" <?php if($fliterDeal=="2") echo 'selected="selected"'; ?>>明确需求</option>
- <option value="1" <?php if($fliterDeal=="1") echo 'selected="selected"'; ?>>背景调查</option>
- <option value="0" <?php if($fliterDeal=="0") echo 'selected="selected"'; ?>>无响应</option>
- </select>
- </div>
- <div class="selectItem">
- <label>按组</label>
- <select name="fliterTeam" class="filterSearch">
- <option value="">请选择</option>
- <?php
- $sql_temp = "SELECT id,em_user FROM employee WHERE em_role=0";
- $teamResult = $conn->query($sql_temp);
- while($row = $teamResult->fetch_assoc()) {
- $selected = ($fliterTeam == $row['id']) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"$selected>{$row['em_user']}组</option>";
- }
- ?>
- </select>
- </div>
-
- <div class="selectItem">
- <label>业务</label>
- <select name="fliterEmployee" class="filterSearch">
- <option value="">请选择</option>
- <?php
- $sql_temp = "SELECT id,em_user FROM employee";
- $empResult = $conn->query($sql_temp);
- while($row = $empResult->fetch_assoc()) {
- $selected = ($fliterEmployee == $row['id']) ? ' selected="selected"' : '';
- echo "<option value=\"{$row['id']}\"$selected>{$row['em_user']}</option>";
- }
- ?>
- </select>
- </div>
-
- <div class="selectItem">
- <label>联系方式</label>
- <select name="fliterContact" class="filterSearch">
- <option value="">请选择</option>
- <option value="1" <?php if($fliterContact=="1") echo 'selected="selected"'; ?>>电话</option>
- <option value="2" <?php if($fliterContact=="2") echo 'selected="selected"'; ?>>微信</option>
- <option value="3" <?php if($fliterContact=="3") echo 'selected="selected"'; ?>>WhatsApp</option>
- <option value="4" <?php if($fliterContact=="4") echo 'selected="selected"'; ?>>邮箱</option>
- <option value="5" <?php if($fliterContact=="5") echo 'selected="selected"'; ?>>领英</option>
- <option value="6" <?php if($fliterContact=="6") echo 'selected="selected"'; ?>>Facebook</option>
- <option value="7" <?php if($fliterContact=="7") echo 'selected="selected"'; ?>>阿里巴巴</option>
- </select>
- </div>
- <div class="inputSearch">
- <input type="text" id="keys" class="inputTxt" value="<?php echo empty($keyscode) ? '请输入搜索关键词' : $keyscode; ?>"
- onFocus="if(this.value == '<?php echo empty($keyscode) ? '请输入搜索关键词' : $keyscode; ?>'){this.value='';}"
- onBlur="if(this.value == ''){this.value='<?php echo empty($keyscode) ? '请输入搜索关键词' : $keyscode; ?>';}"
- onKeyDown="if(event.keyCode==13){location.href='?Keys='+escape(document.getElementById('keys').value)+'<?php echo $urlStr; ?>'}" />
- <input type="button" id="searchgo" class="searchgo" value="go"
- onClick="location.href='?Keys='+escape(document.getElementById('keys').value)+'<?php echo $urlStr; ?>'" />
- </div>
- </div>
-
- <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
- <thead>
- <tr>
- <th width="4%"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></th>
- <th width="6%">序号</th>
- <th width="20%">客户编码</th>
- <th width="10%">联系人</th>
- <th width="10%">国家地区</th>
- <th width="7.5%">来源</th>
- <th width="7.5%">是否成交</th>
- <th width="10%">业务员</th>
- <th width="10%">操作</th>
- </tr>
- </thead>
- <tbody>
- <?php
- if ($result->num_rows > 0) {
- $pageSize = 18;
- $totalPages = ceil($result->num_rows / $pageSize);
-
- if (empty($page)) $page = 1;
- if ($page == 'end') $page = $totalPages;
- if (!is_numeric($page) || $page < 1) $page = 1;
- $page = (int)$page;
- if ($page > $totalPages) $page = $totalPages;
-
- $offset = ($page - 1) * $pageSize;
- $sql .= " LIMIT $offset, $pageSize";
- $result = $conn->query($sql);
-
- $tempNum = $pageSize * ($page - 1);
-
- while ($row = $result->fetch_assoc()) {
- $tempNum++;
- ?>
- <tr onMouseOver="this.style.background='#F7FCFF'" onMouseOut="this.style.background='#FFFFFF'">
- <td align="center"><input type="checkbox" name="chkbox" value="<?php echo $row['id'] ?? ''; ?>" /></td>
- <td align="center"><?php echo $tempNum; ?></td>
- <td align="center" class="code" data-id="<?php echo $row['id'] ?? ''; ?>">
- <?php
- echo $row['cs_code'] ?? ''; ?>
- <?php if(($row['cs_claimFrom'] ?? 0) > 0): ?>
- <img src="../images/yijiao.png" class="handover">
- <?php endif; ?>
- </td>
- <td align="center"><?php echo $row['cs_name'] ?? ''; ?></td>
- <td align="center">
- <?php
- $countryId = intval($row['cs_country'] ?? 0);
- $sql = "SELECT countryName FROM country WHERE id = ?";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param("i", $countryId);
- $stmt->execute();
- $countryResult = $stmt->get_result();
- if ($countryRow = $countryResult->fetch_assoc()) {
- echo htmlspecialchars($countryRow['countryName']);
- } else {
- echo "未选择";
- }
- $stmt->close();
- ?>
- </td>
- <td align="center">
- <?php
- $fromId = intval($row['cs_from'] ?? 0);
- $sql = "SELECT ch_name FROM qudao WHERE id = ?";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param("i", $fromId);
- $stmt->execute();
- $qudaoResult = $stmt->get_result();
- if ($qudaoRow = $qudaoResult->fetch_assoc()) {
- echo htmlspecialchars($qudaoRow['ch_name']);
- } else {
- echo "未选择";
- }
- $stmt->close();
- ?>
- </td>
- <td align="center">
- <?php
- $cs_deal = intval($row['cs_deal'] ?? 0);
- if ($cs_deal == 3) {
- echo "<span style='color:red;font-size:10px;'>" . htmlspecialchars($row['cs_dealdate'] ?? '') . "成交</span>";
- } elseif ($cs_deal == 2) {
- echo "明确需求";
- } elseif ($cs_deal == 1) {
- echo "背景调查";
- } else {
- echo "无响应";
- }
- ?>
- </td>
- <td align="center">
- <?php
- $belongId = intval($row['cs_belong'] ?? 0);
- $sql = "SELECT em_user FROM employee WHERE id = ?";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param("i", $belongId);
- $stmt->execute();
- $empResult = $stmt->get_result();
- if ($empRow = $empResult->fetch_assoc()) {
- echo htmlspecialchars($empRow['em_user']);
- } else {
- echo "未选择";
- }
- $stmt->close();
- ?>
- </td>
- <td align="center">
- <a href="?Keys=<?php echo urlencode($keys ?? ''); ?>&Page=<?php echo urlencode($page ?? '') . $urlStr; ?>&act=edit&id=<?php echo $row['id'] ?? ''; ?>" class="ico_edit ico">修改</a>
- </td>
- </tr>
- <tr class="detail_panel code<?php echo $row['id'] ?? ''; ?>__panel">
- <td colspan="2"></td>
- <td colspan="7" class="cs_detail">
- <ul>
- <li class="cs_detail_addtime">录入时间:<?php echo htmlspecialchars($row['cs_addtime'] ?? ''); ?></li>
- <li class="cs_detail_addtime">更新时间:<?php echo htmlspecialchars($row['cs_updatetime'] ?? ''); ?></li>
- <li class="cs_detail_addtime">
- 流转记录:
- <?php
- $chain = $row['cs_chain'] ?? '';
- if(!empty($chain)) {
- $chain_array = explode(',', $chain);
- $chain_ids = array_filter(array_map('intval', $chain_array));
-
- if(!empty($chain_ids)) {
- $placeholders = str_repeat('?,', count($chain_ids) - 1) . '?';
- $sql = "SELECT em_user FROM employee WHERE id IN ($placeholders)";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param(str_repeat('i', count($chain_ids)), ...$chain_ids);
- $stmt->execute();
- $chainResult = $stmt->get_result();
- $chain_users = [];
- while($chainRow = $chainResult->fetch_assoc()) {
- $chain_users[] = htmlspecialchars($chainRow['em_user']);
- }
- echo implode(' > ', $chain_users);
- $stmt->close();
- }
- }
- ?>
- </li>
- <?php if(!empty($row['cs_tel'] ?? '')): ?>
- <li class="tel"><?php echo htmlspecialchars($row['cs_tel']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_email'] ?? '')): ?>
- <li class="mail"><?php echo htmlspecialchars($row['cs_email']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_whatsapp'] ?? '')): ?>
- <li class="whatsapp"><?php echo htmlspecialchars($row['cs_whatsapp']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_wechat'] ?? '')): ?>
- <li class="wechat"><?php echo htmlspecialchars($row['cs_wechat']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_linkedin'] ?? '')): ?>
- <li class="linkedin"><?php echo htmlspecialchars($row['cs_linkedin']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_facebook'] ?? '')): ?>
- <li class="facebook"><?php echo htmlspecialchars($row['cs_facebook']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_alibaba'] ?? '')): ?>
- <li class="alibaba"><?php echo htmlspecialchars($row['cs_alibaba']); ?></li>
- <?php endif; ?>
- <?php if(!empty($row['cs_address'] ?? '')): ?>
- <li class="address"><?php echo htmlspecialchars($row['cs_address']); ?></li>
- <?php endif; ?>
- </ul>
- <div class="cs_detail_note"><?php echo htmlspecialchars($row['cs_note'] ?? ''); ?></div>
- </td>
- </tr>
- <?php
- }
- } else {
- if (empty($keys)) {
- ?>
- <tr>
- <td align="center" colspan="9">Sorry,当前暂无信息</td>
- </tr>
- <?php
- } else {
- ?>
- <tr>
- <td align="center" colspan="9"><a href="?">Sorry,没有找到"<?php echo $keyscode; ?>"相关的信息,点击返回</a></td>
- </tr>
- <?php
- }
- }
- ?>
- </tbody>
- <tfoot>
- <tr>
- <td colspan="9">
- <div class="showpagebox">
- <?php
- if ($totalPages > 1) {
- $pageName = "?Keys=$keys&Ord=$ord$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>";
- }
-
- echo "<input type=\"text\" id=\"Pagego\" value=\"$page\"
- onFocus=\"if(this.value == '$page'){this.value='';}\"
- onBlur=\"if(this.value == ''){this.value='$page';}\"
- onKeyUp=\"this.value=this.value.replace(/\D/g,'')\"
- onKeyDown=\"if(event.keyCode==13){location.href='{$pageName}Page='+document.getElementById('Pagego').value}\" />";
- }
- ?>
- </div>
- <div class="postchkbox">
- <select id="chkact" name="chkact">
- <option value="1">显示</option>
- <option value="0">隐藏</option>
- <option value="-1">删除</option>
- </select>
- <input type="button" value="执行" onClick="postchk(1)" class="btn1" />
- <input type="button" value="新增" onClick="location.href='?act=add'" class="btn1" />
- </div>
- </td>
- </tr>
- </tfoot>
- </table>
- </form>
- </div>
- </body>
- </html>
- <?php
- $conn->close();
- ?>
|