silentCustomer.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. $act = $_GET['act'] ?? '';
  5. if ($act == 'postchk') {
  6. $keys = urlencode($_GET['Keys'] ?? '');
  7. $page = $_GET['Page'] ?? '';
  8. $chkact = $_POST['chkact'] ?? '';
  9. $sqlStr = "";
  10. if (isset($_POST['chkbox'])) {
  11. foreach ($_POST['chkbox'] as $id) {
  12. $sqlStr .= ($sqlStr ? " OR id=" : " WHERE id=") . intval($id);
  13. }
  14. }
  15. switch ($chkact) {
  16. case "0":
  17. case "1":
  18. case "2":
  19. $sqlStr = "UPDATE customer SET cs_deal=" . intval($chkact) . $sqlStr;
  20. break;
  21. default:
  22. $chkact = str_replace('t', '', $chkact);
  23. $sqlStr = "UPDATE customer SET cs_belong=" . intval($chkact) . $sqlStr;
  24. }
  25. $conn->query($sqlStr);
  26. header("Location: ?Keys=" . $keys . "&Page=" . $page);
  27. exit;
  28. }
  29. $keys = $_GET['Keys'] ?? '';
  30. $keys = str_replace([' ', '+'], '', $keys);
  31. $keyscode = textEncode($keys);
  32. $page = $_GET['Page'] ?? '';
  33. $filterCountry = $_GET['fliterCountry'] ?? '';
  34. $filterQudao = $_GET['fliterQudao'] ?? '';
  35. $filterDeal = $_GET['fliterDeal'] ?? '';
  36. $filterBusiness = $_GET['fliterBusiness'] ?? '';
  37. $filterContact = $_GET['fliterContact'] ?? '';
  38. $filterStr = "";
  39. $urlStr = "";
  40. if (!empty($filterCountry)) {
  41. $filterStr .= " AND c.cs_country=" . intval($filterCountry);
  42. $urlStr .= "&fliterCountry=" . $filterCountry;
  43. }
  44. if (!empty($filterQudao)) {
  45. $filterStr .= " AND c.cs_from=" . intval($filterQudao);
  46. $urlStr .= "&fliterQudao=" . $filterQudao;
  47. }
  48. if (!empty($filterDeal)) {
  49. $filterStr .= " AND c.cs_deal=" . intval($filterDeal);
  50. $urlStr .= "&fliterDeal=" . $filterDeal;
  51. }
  52. if (!empty($filterBusiness)) {
  53. $filterStr .= " AND c.cs_type=" . intval($filterBusiness);
  54. $urlStr .= "&fliterBusiness=" . $filterBusiness;
  55. }
  56. if (!empty($filterContact)) {
  57. switch ($filterContact) {
  58. case "1":
  59. $filterStr .= " AND (cc.tel_1<>'' OR cc.tel_2<>'' OR cc.tel_3<>'')";
  60. break;
  61. case "2":
  62. $filterStr .= " AND (cc.wechat_1<>'' OR cc.wechat_2<>'' OR cc.wechat_3<>'')";
  63. break;
  64. case "3":
  65. $filterStr .= " AND (cc.whatsapp_1<>'' OR cc.whatsapp_2<>'' OR cc.whatsapp_3<>'')";
  66. break;
  67. case "4":
  68. $filterStr .= " AND (cc.email_1<>'' OR cc.email_2<>'' OR cc.email_3<>'')";
  69. break;
  70. case "5":
  71. $filterStr .= " AND (cc.linkedin_1<>'' OR cc.linkedin_2<>'' OR cc.linkedin_3<>'')";
  72. break;
  73. case "6":
  74. $filterStr .= " AND (cc.facebook_1<>'' OR cc.facebook_2<>'' OR cc.facebook_3<>'')";
  75. break;
  76. default:
  77. $filterStr .= " AND (cc.alibaba_1<>'' OR cc.alibaba_2<>'' OR cc.alibaba_3<>'')";
  78. }
  79. $urlStr .= "&fliterContact=" . $filterContact;
  80. }
  81. $keys = urlencode($keys);
  82. $hrefstr = "?keys=" . $keys;
  83. ?>
  84. <!DOCTYPE html>
  85. <html xmlns="http://www.w3.org/1999/xhtml">
  86. <head>
  87. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  88. <title>管理区域</title>
  89. <link rel="stylesheet" href="css/common.css" type="text/css" />
  90. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  91. <script src="system/js/jquery-1.7.2.min.js"></script>
  92. <script src="js/js.js"></script>
  93. <style>
  94. body {
  95. margin: 0;
  96. padding: 20px;
  97. background: #fff;
  98. }
  99. #man_zone {
  100. margin-left: 0;
  101. }
  102. </style>
  103. </head>
  104. <body class="clear">
  105. <?php // require_once 'panel.php'; ?>
  106. <div id="man_zone">
  107. <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
  108. <div class="fastSelect clear">
  109. <H1>静默客户</H1>
  110. <div class="selectItem">
  111. <label>区域</label>
  112. <select name="fliterCountry" class="filterSearch">
  113. <option value="">请选择国家地区</option>
  114. <?php
  115. $result = $conn->query("SELECT id, countryName FROM country");
  116. while ($row = $result->fetch_assoc()) {
  117. $selected = ($filterCountry == $row['id']) ? ' selected="selected"' : '';
  118. echo "<option value=\"{$row['id']}\"{$selected}>{$row['countryName']}</option>";
  119. }
  120. ?>
  121. </select>
  122. </div>
  123. <div class="selectItem">
  124. <label>来源渠道</label>
  125. <select name="fliterQudao" class="filterSearch">
  126. <option value="">请选择渠道</option>
  127. <?php
  128. $result = $conn->query("SELECT id, ch_name FROM qudao");
  129. while ($row = $result->fetch_assoc()) {
  130. $selected = ($filterQudao == $row['id']) ? ' selected="selected"' : '';
  131. echo "<option value=\"{$row['id']}\"{$selected}>{$row['ch_name']}</option>";
  132. }
  133. ?>
  134. </select>
  135. </div>
  136. <div class="selectItem">
  137. <label>跟进阶段</label>
  138. <select name="fliterDeal" class="filterSearch">
  139. <option value="">请选择</option>
  140. <option value="0"<?= ($filterDeal == "0") ? ' selected="selected"' : '' ?>>无响应</option>
  141. <option value="1"<?= ($filterDeal == "1") ? ' selected="selected"' : '' ?>>背景调查</option>
  142. <option value="2"<?= ($filterDeal == "2") ? ' selected="selected"' : '' ?>>明确需求</option>
  143. <option value="3"<?= ($filterDeal == "3") ? ' selected="selected"' : '' ?>>已成交</option>
  144. </select>
  145. </div>
  146. <div class="selectItem">
  147. <label>客户类型</label>
  148. <select name="fliterBusiness" class="filterSearch">
  149. <option value="">请选择</option>
  150. <?php
  151. $result = $conn->query("SELECT id, businessType FROM clienttype");
  152. while ($row = $result->fetch_assoc()) {
  153. $selected = ($filterBusiness == $row['id']) ? ' selected="selected"' : '';
  154. echo "<option value=\"{$row['id']}\"{$selected}>{$row['businessType']}</option>";
  155. }
  156. ?>
  157. </select>
  158. </div>
  159. <div class="selectItem">
  160. <label>联系方式</label>
  161. <select name="fliterContact" class="filterSearch">
  162. <option value="">请选择</option>
  163. <option value="1"<?= ($filterContact == "1") ? ' selected="selected"' : '' ?>>电话</option>
  164. <option value="2"<?= ($filterContact == "2") ? ' selected="selected"' : '' ?>>微信</option>
  165. <option value="3"<?= ($filterContact == "3") ? ' selected="selected"' : '' ?>>WhatsApp</option>
  166. <option value="4"<?= ($filterContact == "4") ? ' selected="selected"' : '' ?>>邮箱</option>
  167. <option value="5"<?= ($filterContact == "5") ? ' selected="selected"' : '' ?>>领英</option>
  168. <option value="6"<?= ($filterContact == "6") ? ' selected="selected"' : '' ?>>Facebook</option>
  169. <option value="7"<?= ($filterContact == "7") ? ' selected="selected"' : '' ?>>阿里巴巴</option>
  170. </select>
  171. </div>
  172. <div class="inputSearch">
  173. <input type="text" id="keys" class="inputTxt"
  174. value="<?= empty($keyscode) ? '请输入搜索关键词' : htmlspecialcharsFix($keyscode) ?>"
  175. onFocus="if(this.value == '<?= empty($keyscode) ? '请输入搜索关键词' : htmlspecialcharsFix($keyscode) ?>'){this.value='';}"
  176. onBlur="if(this.value == ''){this.value='<?= empty($keyscode) ? '请输入搜索关键词' : htmlspecialcharsFix($keyscode) ?>';}"
  177. onKeyDown="if(event.keyCode==13){location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)}" />
  178. <input type="button" id="searchgo" class="searchgo" value="go"
  179. onClick="location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)" />
  180. </div>
  181. </div>
  182. <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2 em<?= $_SESSION['employee_id'] ?>">
  183. <div class="theader">
  184. <div class="col2">序号</div>
  185. <div class="col3">客户编号</div>
  186. <div class="col10">渠道来源</div>
  187. <div class="col10">区域</div>
  188. <div class="col10">客户类型</div>
  189. <div class="col10">跟进阶段</div>
  190. <div class="col6">录入时间</div>
  191. <div class="col6">操作</div>
  192. </div>
  193. <?php
  194. // 使用GROUP BY和GROUP_CONCAT来聚合多个联系人的信息
  195. $sqlStr = "SELECT c.id, MAX(c.cs_code) as cs_code, MAX(c.cs_from) as cs_from,
  196. MAX(c.cs_country) as cs_country, MAX(c.cs_type) as cs_type, MAX(c.cs_deal) as cs_deal,
  197. MAX(c.cs_addtime) as cs_addtime, MAX(c.colortag) as colortag,
  198. MAX(c.cs_note) as cs_note, MAX(c.cs_claimFrom) as cs_claimFrom,
  199. MAX(c.cs_belong) as cs_belong, MAX(c.cs_chain) as cs_chain,
  200. GROUP_CONCAT(cc.contact_name SEPARATOR '<br>') as contact_names,
  201. GROUP_CONCAT(DISTINCT NULLIF(cc.tel_1, '') SEPARATOR '<br>') as tel_1,
  202. GROUP_CONCAT(DISTINCT NULLIF(cc.tel_2, '') SEPARATOR '<br>') as tel_2,
  203. GROUP_CONCAT(DISTINCT NULLIF(cc.tel_3, '') SEPARATOR '<br>') as tel_3,
  204. GROUP_CONCAT(DISTINCT NULLIF(cc.tel_1_format, '') SEPARATOR '<br>') as tel_1_format,
  205. GROUP_CONCAT(DISTINCT NULLIF(cc.tel_2_format, '') SEPARATOR '<br>') as tel_2_format,
  206. GROUP_CONCAT(DISTINCT NULLIF(cc.tel_3_format, '') SEPARATOR '<br>') as tel_3_format,
  207. GROUP_CONCAT(DISTINCT NULLIF(cc.email_1, '') SEPARATOR '<br>') as email_1,
  208. GROUP_CONCAT(DISTINCT NULLIF(cc.email_2, '') SEPARATOR '<br>') as email_2,
  209. GROUP_CONCAT(DISTINCT NULLIF(cc.email_3, '') SEPARATOR '<br>') as email_3,
  210. GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_1, '') SEPARATOR '<br>') as whatsapp_1,
  211. GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_2, '') SEPARATOR '<br>') as whatsapp_2,
  212. GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_3, '') SEPARATOR '<br>') as whatsapp_3,
  213. GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_1_format, '') SEPARATOR '<br>') as whatsapp_1_format,
  214. GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_2_format, '') SEPARATOR '<br>') as whatsapp_2_format,
  215. GROUP_CONCAT(DISTINCT NULLIF(cc.whatsapp_3_format, '') SEPARATOR '<br>') as whatsapp_3_format,
  216. GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_1, '') SEPARATOR '<br>') as wechat_1,
  217. GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_2, '') SEPARATOR '<br>') as wechat_2,
  218. GROUP_CONCAT(DISTINCT NULLIF(cc.wechat_3, '') SEPARATOR '<br>') as wechat_3,
  219. GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_1, '') SEPARATOR '<br>') as linkedin_1,
  220. GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_2, '') SEPARATOR '<br>') as linkedin_2,
  221. GROUP_CONCAT(DISTINCT NULLIF(cc.linkedin_3, '') SEPARATOR '<br>') as linkedin_3,
  222. GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_1, '') SEPARATOR '<br>') as facebook_1,
  223. GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_2, '') SEPARATOR '<br>') as facebook_2,
  224. GROUP_CONCAT(DISTINCT NULLIF(cc.facebook_3, '') SEPARATOR '<br>') as facebook_3,
  225. GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_1, '') SEPARATOR '<br>') as alibaba_1,
  226. GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_2, '') SEPARATOR '<br>') as alibaba_2,
  227. GROUP_CONCAT(DISTINCT NULLIF(cc.alibaba_3, '') SEPARATOR '<br>') as alibaba_3
  228. FROM customer c
  229. LEFT JOIN customer_contact cc ON c.id = cc.customer_id
  230. WHERE (c.is_silent=1 OR (c.cs_deal=0 AND c.cs_belong=" . intval($_SESSION['employee_id']) . "))";
  231. // 添加搜索条件
  232. if (!empty($keyscode)) {
  233. $sqlStr .= " AND (c.cs_code LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  234. OR cc.contact_name LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  235. OR cc.email_1 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  236. OR cc.email_2 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  237. OR cc.email_3 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  238. OR cc.wechat_1 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  239. OR cc.wechat_2 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  240. OR cc.wechat_3 LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  241. OR cc.tel_1_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  242. OR cc.tel_2_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  243. OR cc.tel_3_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  244. OR cc.whatsapp_1_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  245. OR cc.whatsapp_2_format LIKE '%" . $conn->real_escape_string($keyscode) . "%'
  246. OR cc.whatsapp_3_format LIKE '%" . $conn->real_escape_string($keyscode) . "%')";
  247. }
  248. // 添加其他筛选条件
  249. $sqlStr .= $filterStr;
  250. // 分组和排序
  251. $sqlStr .= " GROUP BY c.id ORDER BY MAX(c.colortag) DESC, c.id DESC";
  252. $result = $conn->query($sqlStr);
  253. if ($result && $result->num_rows > 0) {
  254. $pageSize = 20;
  255. $page = empty($page) ? 1 : $page;
  256. $page = ($page === 'end') ? ceil($result->num_rows / $pageSize) : $page;
  257. $page = (!is_numeric($page) || $page < 1) ? 1 : (int)$page;
  258. $totalPages = ceil($result->num_rows / $pageSize);
  259. $page = ($page > $totalPages) ? $totalPages : $page;
  260. $offset = $pageSize * ($page - 1);
  261. $rows = [];
  262. while ($row = $result->fetch_assoc()) {
  263. $rows[] = $row;
  264. }
  265. $paginatedRows = array_slice($rows, $offset, $pageSize);
  266. $tempNum = $offset;
  267. foreach ($paginatedRows as $row) {
  268. $tempNum++;
  269. ?>
  270. <div class="tline color<?= $row['colortag'] ?>">
  271. <div class="col2"><?= $tempNum ?></div>
  272. <div class="col3 slidepanel">
  273. <?= htmlspecialcharsFix($row['cs_code']) ?>
  274. <?php if ($row['cs_claimFrom'] > 0): ?>
  275. <img src="../images/yijiao.png" class="handover" title="来自认领">
  276. <?php endif; ?>
  277. </div>
  278. <div class="col10">
  279. <?php
  280. $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . intval($row['cs_from']));
  281. echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写';
  282. ?>
  283. </div>
  284. <div class="col10">
  285. <?php
  286. $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . intval($row['cs_country']));
  287. echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写';
  288. ?>
  289. </div>
  290. <div class="col10">
  291. <?php
  292. $typeResult = $conn->query("SELECT businessType FROM clienttype WHERE id=" . intval($row['cs_type']));
  293. echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialcharsFix($typeRow['businessType']) : '未填写';
  294. ?>
  295. </div>
  296. <div class="col10">
  297. <?php
  298. if ($row['cs_deal'] == 3) {
  299. echo "<span style='color:red;'>成交</span>";
  300. } elseif ($row['cs_deal'] == 2) {
  301. echo "明确需求";
  302. } elseif ($row['cs_deal'] == 1) {
  303. echo "背景调查";
  304. } else {
  305. echo "无响应";
  306. }
  307. ?>
  308. </div>
  309. <div class="col6"><?= $row['cs_addtime'] ?></div>
  310. <div class="col6">
  311. <?php if ($row['cs_belong'] == $_SESSION['employee_id']): ?>
  312. <a href="customerEdit.php?id=<?= $row['id'] ?>" class="ico_edit ico">修改</a>
  313. <?php endif; ?>
  314. </div>
  315. </div>
  316. <div class="notepanel clear">
  317. <div class="noteItem">联系方式</div>
  318. <div class="lx">
  319. <div class="tel">
  320. <?php
  321. $tels = [];
  322. if (!empty($row['tel_1'])) $tels[] = htmlspecialcharsFix($row['tel_1']);
  323. if (!empty($row['tel_2'])) $tels[] = htmlspecialcharsFix($row['tel_2']);
  324. if (!empty($row['tel_3'])) $tels[] = htmlspecialcharsFix($row['tel_3']);
  325. echo implode('<br>', $tels);
  326. ?>
  327. </div>
  328. <div class="mail">
  329. <?php
  330. $emails = [];
  331. if (!empty($row['email_1'])) $emails[] = '<a href="mailto:' . htmlspecialcharsFix($row['email_1']) . '">' . htmlspecialcharsFix($row['email_1']) . '</a>';
  332. if (!empty($row['email_2'])) $emails[] = '<a href="mailto:' . htmlspecialcharsFix($row['email_2']) . '">' . htmlspecialcharsFix($row['email_2']) . '</a>';
  333. if (!empty($row['email_3'])) $emails[] = '<a href="mailto:' . htmlspecialcharsFix($row['email_3']) . '">' . htmlspecialcharsFix($row['email_3']) . '</a>';
  334. echo implode('<br>', $emails);
  335. ?>
  336. </div>
  337. <div class="whatsapp">
  338. <?php
  339. $whatsapps = [];
  340. if (!empty($row['whatsapp_1'])) $whatsapps[] = htmlspecialcharsFix($row['whatsapp_1']);
  341. if (!empty($row['whatsapp_2'])) $whatsapps[] = htmlspecialcharsFix($row['whatsapp_2']);
  342. if (!empty($row['whatsapp_3'])) $whatsapps[] = htmlspecialcharsFix($row['whatsapp_3']);
  343. echo implode('<br>', $whatsapps);
  344. ?>
  345. </div>
  346. <div class="wechat">
  347. <?php
  348. $wechats = [];
  349. if (!empty($row['wechat_1'])) $wechats[] = htmlspecialcharsFix($row['wechat_1']);
  350. if (!empty($row['wechat_2'])) $wechats[] = htmlspecialcharsFix($row['wechat_2']);
  351. if (!empty($row['wechat_3'])) $wechats[] = htmlspecialcharsFix($row['wechat_3']);
  352. echo implode('<br>', $wechats);
  353. ?>
  354. </div>
  355. <div class="linkedin">
  356. <?php
  357. $linkedins = [];
  358. if (!empty($row['linkedin_1'])) $linkedins[] = htmlspecialcharsFix($row['linkedin_1']);
  359. if (!empty($row['linkedin_2'])) $linkedins[] = htmlspecialcharsFix($row['linkedin_2']);
  360. if (!empty($row['linkedin_3'])) $linkedins[] = htmlspecialcharsFix($row['linkedin_3']);
  361. echo implode('<br>', $linkedins);
  362. ?>
  363. </div>
  364. <div class="facebook">
  365. <?php
  366. $facebooks = [];
  367. if (!empty($row['facebook_1'])) $facebooks[] = htmlspecialcharsFix($row['facebook_1']);
  368. if (!empty($row['facebook_2'])) $facebooks[] = htmlspecialcharsFix($row['facebook_2']);
  369. if (!empty($row['facebook_3'])) $facebooks[] = htmlspecialcharsFix($row['facebook_3']);
  370. echo implode('<br>', $facebooks);
  371. ?>
  372. </div>
  373. <div class="alibaba">
  374. <?php
  375. $alibabas = [];
  376. if (!empty($row['alibaba_1'])) $alibabas[] = htmlspecialcharsFix($row['alibaba_1']);
  377. if (!empty($row['alibaba_2'])) $alibabas[] = htmlspecialcharsFix($row['alibaba_2']);
  378. if (!empty($row['alibaba_3'])) $alibabas[] = htmlspecialcharsFix($row['alibaba_3']);
  379. echo implode('<br>', $alibabas);
  380. ?>
  381. </div>
  382. </div>
  383. <div class="noteItem2">备注</div>
  384. <div class="notecontent">
  385. <div class="chain">
  386. 流转记录:
  387. <?php
  388. if (!empty($row['cs_chain'])) {
  389. $myArray = explode(',', $row['cs_chain']);
  390. $chainEmployees = [];
  391. foreach ($myArray as $employeeId) {
  392. $sqlStr = "SELECT em_user FROM employee WHERE id=" . intval($employeeId);
  393. $chainResult = $conn->query($sqlStr);
  394. if ($chainRow = $chainResult->fetch_assoc()) {
  395. $chainEmployees[] = htmlspecialcharsFix($chainRow['em_user']);
  396. }
  397. }
  398. echo implode(" > ", $chainEmployees);
  399. }
  400. ?>
  401. </div>
  402. <?= htmlUnCode($row['cs_note']) ?>
  403. </div>
  404. </div>
  405. <?php
  406. }
  407. } else {
  408. if (empty($keys)) {
  409. ?>
  410. <tr>
  411. <div align="center">当前暂无沉默客户</div>
  412. </tr>
  413. <?php
  414. } else {
  415. ?>
  416. <tr>
  417. <div align="center"><a href="?">Sorry,没有找到"<?= htmlspecialcharsFix($keyscode) ?>"相关的信息,点击返回</a></div>
  418. </tr>
  419. <?php
  420. }
  421. }
  422. ?>
  423. <div colspan="9">
  424. <div class="showpagebox">
  425. <?php
  426. if (isset($totalPages) && $totalPages > 1) {
  427. $pageName = "?Keys=" . $keys . $urlStr . "&";
  428. $pagelen = 3;
  429. if ($page > 1) {
  430. echo "<a href=\"{$pageName}Page=1\">首页</a>";
  431. echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
  432. }
  433. if ($pagelen * 2 + 1 >= $totalPages) {
  434. $startPage = 1;
  435. $endPage = $totalPages;
  436. } else {
  437. if ($page <= $pagelen + 1) {
  438. $startPage = 1;
  439. $endPage = $pagelen * 2 + 1;
  440. } else {
  441. $startPage = $page - $pagelen;
  442. $endPage = $page + $pagelen;
  443. }
  444. if ($page + $pagelen > $totalPages) {
  445. $startPage = $totalPages - $pagelen * 2;
  446. $endPage = $totalPages;
  447. }
  448. }
  449. for ($i = $startPage; $i <= $endPage; $i++) {
  450. if ($i == $page) {
  451. echo "<a class=\"current\">{$i}</a>";
  452. } else {
  453. echo "<a href=\"{$pageName}Page={$i}\">{$i}</a>";
  454. }
  455. }
  456. if ($page < $totalPages) {
  457. if ($totalPages - $page > $pagelen) {
  458. echo "<a href=\"{$pageName}Page={$totalPages}\">...{$totalPages}</a>";
  459. }
  460. echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
  461. echo "<a href=\"{$pageName}Page={$totalPages}\">尾页</a>";
  462. }
  463. echo "<input type=\"text\" id=\"Pagego\" value=\"{$page}\"
  464. onFocus=\"if(this.value == '{$page}'){this.value='';}\"
  465. onBlur=\"if(this.value == ''){this.value='{$page}';}\"
  466. onKeyUp=\"this.value=this.value.replace(/\D/g,'')\"
  467. onKeyDown=\"if(event.keyCode==13){location.href='{$pageName}Page='+document.getElementById('Pagego').value}\" />";
  468. }
  469. ?>
  470. </div>
  471. </div>
  472. </div>
  473. </form>
  474. </div>
  475. </body>
  476. </html>