123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <?php
- require_once 'conn.php';
- checkLogin();
- $act = $_GET['act'] ?? '';
- $tagName = $_GET['tagName'] ?? '';
- if (empty($tagName)) {
- header('Location: customers.php');
- exit;
- }
- if ($act == 'postchk') {
- $keys = urlencode($_GET['Keys'] ?? '');
- $chkact = str_replace('t', '', $_POST['chkact'] ?? '');
- if (isset($_POST['chkbox'])) {
- $sqlStr = "(" . implode(',', array_map('intval', (array)$_POST['chkbox'])) . ")";
- $updateStr = "UPDATE Customer SET
- cs_updatetime='" . date('Y-m-d H:i:s') . "',
- cs_code=REPLACE(cs_code, '-', '/' + (SELECT em_code FROM employee WHERE id=" . (int)$chkact . ") + '-'),
- cs_belong=" . (int)$chkact . ",
- cs_chain=CONCAT(cs_chain,'," . (int)$chkact . "')
- WHERE id IN " . $sqlStr;
- $deleteTag = "DELETE FROM tagTable WHERE customerId IN " . $sqlStr;
-
- $conn->query($updateStr);
- $conn->query($deleteTag);
- }
-
- header('Location: tag.php?tagName=' . urlencode($tagName));
- exit;
- }
- // Get all tags for the current employee
- $tagStr = '';
- $result = $conn->query("SELECT DISTINCT tagName FROM tagTable WHERE employeeId=" . $_SESSION['employee_id']);
- while ($row = $result->fetch_assoc()) {
- $tagStr .= "<span>" . htmlspecialchars($row['tagName']) . "</span>,";
- }
- ?>
- <!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="fastSelect clear">
- <H1 class="taghead" contenteditable="true" data-originaltag="<?= htmlspecialchars($tagName) ?>" data-em="<?= $_SESSION['employee_id'] ?>"><?= htmlspecialchars($tagName) ?></H1>
- </div>
- <form id="form1" method="post" action="?act=postchk&tagName=<?= urlencode($tagName) ?>" onsubmit="return false">
- <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2">
- <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="col7">跟进阶段</div>
- <div class="col8">录入时间</div>
- <div class="col10">操作</div>
- </div>
- <?php
- $sqlStr = "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, cs_note
- FROM customer
- WHERE cs_belong=" . $_SESSION['employee_id'] . "
- AND id IN (SELECT customerId FROM tagTable WHERE tagName='" . $conn->real_escape_string($tagName) . "')";
- $result = $conn->query($sqlStr);
- $tempNum = 0;
- while ($row = $result->fetch_assoc()) {
- $tempNum++;
- ?>
- <div class="tline">
- <div class="col1" align="center"><input type="checkbox" name="chkbox[]" value="<?= $row['id'] ?>"></div>
- <div class="col2"><?= $tempNum ?></div>
- <div class="col3 slidepanel"><?= htmlspecialchars($row['cs_code']) ?></div>
- <div class="col4">
- <?php
- $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
- echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialchars($qudaoRow['ch_name']) : '未填写';
- ?>
- </div>
- <div class="col5">
- <?php
- $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
- echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialchars($countryRow['countryName']) : '未填写';
- ?>
- </div>
- <div class="col7">
- <?php
- if ($row['cs_deal'] == 3) {
- echo "<span style='color:red;'>成交</span>";
- } elseif ($row['cs_deal'] == 2) {
- echo "明确需求";
- } elseif ($row['cs_deal'] == 1) {
- echo "背景调查";
- } else {
- echo "无响应";
- }
- ?>
- </div>
- <div class="col8"><?= $row['cs_addtime'] ?></div>
- <div class="col10"><a href="customerEdit.php?id=<?= $row['id'] ?>" class="ico_edit ico">修改</a></div>
- </div>
- <div class="notepanel clear">
- <div class="noteItem">联系方式</div>
- <div class="lx">
- <div class="tel"><?= htmlspecialchars($row['cs_tel']) ?></div>
- <div class="mail"><a href="mailto:<?= htmlspecialchars($row['cs_email']) ?>"><?= htmlspecialchars($row['cs_email']) ?></a></div>
- <div class="whatsapp"><?= htmlspecialchars($row['cs_whatsapp']) ?></div>
- <div class="wechat"><?= htmlspecialchars($row['cs_wechat']) ?></div>
- <div class="linkedin"><?= htmlspecialchars($row['cs_linkedin']) ?></div>
- <div class="facebook"><?= htmlspecialchars($row['cs_facebook']) ?></div>
- <div class="alibaba"><?= htmlspecialchars($row['cs_alibaba']) ?></div>
- </div>
- <div class="noteItem2">备注</div>
- <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
- <div class="coltag mytag" data-id="<?= $row['id'] ?>" data-em="<?= $_SESSION['employee_id'] ?>">
- <?php
- $tagStr1 = $tagStr;
- $tagResult = $conn->query("SELECT tagName FROM tagTable WHERE customerId=" . $row['id']);
- while ($tagRow = $tagResult->fetch_assoc()) {
- $tagStr1 = str_replace(
- "<span>" . htmlspecialchars($tagRow['tagName']) . "</span>",
- "<span class=\"active\">" . htmlspecialchars($tagRow['tagName']) . "</span>",
- $tagStr1
- );
- }
- echo $tagStr1;
- ?>
- </div>
- </div>
- <?php
- }
- ?>
- <div colspan="9">
- <div class="showpagebox">
- </div>
- <div class="postchkbox">
- <select id="chkact" name="chkact">
- <?php
- $result = $conn->query("SELECT id, em_code, em_user FROM employee ORDER BY em_code ASC");
- while ($row = $result->fetch_assoc()) {
- echo "<option value=\"t{$row['id']}\">转给" . htmlspecialchars($row['em_user']) . "(" . htmlspecialchars($row['em_code']) . ")</option>";
- }
- ?>
- </select>
- <input type="button" value="执行" onclick="postchk(1)" class="btn1">
- </div>
- </div>
- </div>
- </form>
- </div>
- </body>
- </html>
|