subTag.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. // 获取URL参数
  5. $tagName = $_GET['tagName'] ?? '';
  6. $employeeId = $_GET['employeeId'] ?? 0;
  7. if (empty($employeeId) || !is_numeric($employeeId)) {
  8. $employeeId = 0;
  9. }
  10. if (empty($tagName)) {
  11. header('Location: customers.php');
  12. exit;
  13. }
  14. ?>
  15. <!DOCTYPE html>
  16. <html xmlns="http://www.w3.org/1999/xhtml">
  17. <head>
  18. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  19. <title>管理区域</title>
  20. <link rel="stylesheet" href="css/common.css" type="text/css" />
  21. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  22. <script src="system/js/jquery-1.7.2.min.js"></script>
  23. <script src="js/js.js"></script>
  24. <style>
  25. body {
  26. margin: 0;
  27. padding: 20px;
  28. background: #fff;
  29. }
  30. #man_zone {
  31. margin-left: 0;
  32. }
  33. </style>
  34. </head>
  35. <body class="clear">
  36. <?php // require_once 'panel.php'; ?>
  37. <div id="man_zone">
  38. <div class="fastSelect clear">
  39. <h1>标签:<?= htmlspecialcharsFix($tagName) ?></h1>
  40. </div>
  41. <div width="100%" border="0" cellpadding="3" cellspacing="1" class="table2">
  42. <div class="theader">
  43. <div class="col2">序号</div>
  44. <div class="col3">客户编号</div>
  45. <div class="col4">渠道来源</div>
  46. <div class="col5">区域</div>
  47. <div class="col6">客户类型</div>
  48. <div class="col7">跟进阶段</div>
  49. <div class="col8">录入时间</div>
  50. <div class="col10">操作</div>
  51. </div>
  52. <?php
  53. // 组合查询SQL,使用LEFT JOIN获取联系人信息
  54. $sqlStr = "SELECT c.id, c.cs_code, c.cs_from, c.cs_country, c.cs_type, c.cs_deal, c.cs_addtime, c.cs_note,
  55. cc.id as contact_id, cc.contact_name,
  56. cc.tel_1, cc.tel_1_format, cc.tel_1_bu,
  57. cc.tel_2, cc.tel_2_format, cc.tel_2_bu,
  58. cc.tel_3, cc.tel_3_format, cc.tel_3_bu,
  59. cc.email_1, cc.email_1_bu,
  60. cc.email_2, cc.email_2_bu,
  61. cc.email_3, cc.email_3_bu,
  62. cc.whatsapp_1, cc.whatsapp_1_format, cc.whatsapp_1_bu,
  63. cc.whatsapp_2, cc.whatsapp_2_format, cc.whatsapp_2_bu,
  64. cc.whatsapp_3, cc.whatsapp_3_format, cc.whatsapp_3_bu,
  65. cc.wechat_1, cc.wechat_1_bu,
  66. cc.wechat_2, cc.wechat_2_bu,
  67. cc.wechat_3, cc.wechat_3_bu,
  68. cc.linkedin_1, cc.linkedin_1_bu,
  69. cc.linkedin_2, cc.linkedin_2_bu,
  70. cc.linkedin_3, cc.linkedin_3_bu,
  71. cc.facebook_1, cc.facebook_1_bu,
  72. cc.facebook_2, cc.facebook_2_bu,
  73. cc.facebook_3, cc.facebook_3_bu,
  74. cc.alibaba_1, cc.alibaba_1_bu,
  75. cc.alibaba_2, cc.alibaba_2_bu,
  76. cc.alibaba_3, cc.alibaba_3_bu
  77. FROM customer c
  78. LEFT JOIN customer_contact cc ON c.id = cc.customer_id
  79. WHERE c.cs_belong=" . (int)$employeeId . "
  80. AND c.id IN (SELECT customerId FROM tagtable WHERE tagName='" . $conn->real_escape_string($tagName) . "')";
  81. $result = $conn->query($sqlStr);
  82. $tempNum = 0;
  83. if ($result && $result->num_rows > 0) {
  84. while ($row = $result->fetch_assoc()) {
  85. $tempNum++;
  86. ?>
  87. <div class="tline">
  88. <div class="col2"><?= $tempNum ?></div>
  89. <div class="col3 slidepanel"><?= htmlspecialcharsFix($row['cs_code']) ?></div>
  90. <div class="col4">
  91. <?php
  92. $qudaoResult = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
  93. echo ($qudaoRow = $qudaoResult->fetch_assoc()) ? htmlspecialcharsFix($qudaoRow['ch_name']) : '未填写';
  94. ?>
  95. </div>
  96. <div class="col5">
  97. <?php
  98. $countryResult = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
  99. echo ($countryRow = $countryResult->fetch_assoc()) ? htmlspecialcharsFix($countryRow['countryName']) : '未填写';
  100. ?>
  101. </div>
  102. <div class="col6">
  103. <?php
  104. $typeResult = $conn->query("SELECT businessType FROM clienttype WHERE id=" . (int)$row['cs_type']);
  105. echo ($typeRow = $typeResult->fetch_assoc()) ? htmlspecialcharsFix($typeRow['businessType']) : '未填写';
  106. ?>
  107. </div>
  108. <div class="col7">
  109. <?php
  110. if ($row['cs_deal'] == 3) {
  111. echo "<span style='color:red;'>成交</span>";
  112. } elseif ($row['cs_deal'] == 2) {
  113. echo "明确需求";
  114. } elseif ($row['cs_deal'] == 1) {
  115. echo "背景调查";
  116. } else {
  117. echo "无响应";
  118. }
  119. ?>
  120. </div>
  121. <div class="col8"><?= $row['cs_addtime'] ?></div>
  122. <div class="col10"><a href="customerEdit.php?id=<?= $row['id'] ?>" class="ico_edit ico">修改</a></div>
  123. </div>
  124. <div class="notepanel clear">
  125. <div class="noteItem">联系方式</div>
  126. <div class="lx">
  127. <div class="tel">
  128. <?php if(!empty($row['tel_1'])): ?>
  129. <div><?= htmlspecialcharsFix($row['tel_1']) ?></div>
  130. <?php endif; ?>
  131. <?php if(!empty($row['tel_2'])): ?>
  132. <div><?= htmlspecialcharsFix($row['tel_2']) ?></div>
  133. <?php endif; ?>
  134. <?php if(!empty($row['tel_3'])): ?>
  135. <div><?= htmlspecialcharsFix($row['tel_3']) ?></div>
  136. <?php endif; ?>
  137. </div>
  138. <div class="mail">
  139. <?php if(!empty($row['email_1'])): ?>
  140. <div><a href="mailto:<?= htmlspecialcharsFix($row['email_1']) ?>"><?= htmlspecialcharsFix($row['email_1']) ?></a></div>
  141. <?php endif; ?>
  142. <?php if(!empty($row['email_2'])): ?>
  143. <div><a href="mailto:<?= htmlspecialcharsFix($row['email_2']) ?>"><?= htmlspecialcharsFix($row['email_2']) ?></a></div>
  144. <?php endif; ?>
  145. <?php if(!empty($row['email_3'])): ?>
  146. <div><a href="mailto:<?= htmlspecialcharsFix($row['email_3']) ?>"><?= htmlspecialcharsFix($row['email_3']) ?></a></div>
  147. <?php endif; ?>
  148. </div>
  149. <div class="whatsapp">
  150. <?php if(!empty($row['whatsapp_1'])): ?>
  151. <div><?= htmlspecialcharsFix($row['whatsapp_1']) ?></div>
  152. <?php endif; ?>
  153. <?php if(!empty($row['whatsapp_2'])): ?>
  154. <div><?= htmlspecialcharsFix($row['whatsapp_2']) ?></div>
  155. <?php endif; ?>
  156. <?php if(!empty($row['whatsapp_3'])): ?>
  157. <div><?= htmlspecialcharsFix($row['whatsapp_3']) ?></div>
  158. <?php endif; ?>
  159. </div>
  160. <div class="wechat">
  161. <?php if(!empty($row['wechat_1'])): ?>
  162. <div><?= htmlspecialcharsFix($row['wechat_1']) ?></div>
  163. <?php endif; ?>
  164. <?php if(!empty($row['wechat_2'])): ?>
  165. <div><?= htmlspecialcharsFix($row['wechat_2']) ?></div>
  166. <?php endif; ?>
  167. <?php if(!empty($row['wechat_3'])): ?>
  168. <div><?= htmlspecialcharsFix($row['wechat_3']) ?></div>
  169. <?php endif; ?>
  170. </div>
  171. <div class="linkedin">
  172. <?php if(!empty($row['linkedin_1'])): ?>
  173. <div><?= htmlspecialcharsFix($row['linkedin_1']) ?></div>
  174. <?php endif; ?>
  175. <?php if(!empty($row['linkedin_2'])): ?>
  176. <div><?= htmlspecialcharsFix($row['linkedin_2']) ?></div>
  177. <?php endif; ?>
  178. <?php if(!empty($row['linkedin_3'])): ?>
  179. <div><?= htmlspecialcharsFix($row['linkedin_3']) ?></div>
  180. <?php endif; ?>
  181. </div>
  182. <div class="facebook">
  183. <?php if(!empty($row['facebook_1'])): ?>
  184. <div><?= htmlspecialcharsFix($row['facebook_1']) ?></div>
  185. <?php endif; ?>
  186. <?php if(!empty($row['facebook_2'])): ?>
  187. <div><?= htmlspecialcharsFix($row['facebook_2']) ?></div>
  188. <?php endif; ?>
  189. <?php if(!empty($row['facebook_3'])): ?>
  190. <div><?= htmlspecialcharsFix($row['facebook_3']) ?></div>
  191. <?php endif; ?>
  192. </div>
  193. <div class="alibaba">
  194. <?php if(!empty($row['alibaba_1'])): ?>
  195. <div><?= htmlspecialcharsFix($row['alibaba_1']) ?></div>
  196. <?php endif; ?>
  197. <?php if(!empty($row['alibaba_2'])): ?>
  198. <div><?= htmlspecialcharsFix($row['alibaba_2']) ?></div>
  199. <?php endif; ?>
  200. <?php if(!empty($row['alibaba_3'])): ?>
  201. <div><?= htmlspecialcharsFix($row['alibaba_3']) ?></div>
  202. <?php endif; ?>
  203. </div>
  204. </div>
  205. <div class="noteItem2">备注</div>
  206. <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
  207. </div>
  208. <?php
  209. }
  210. }
  211. ?>
  212. </div>
  213. </div>
  214. </body>
  215. </html>