智慧水务管理系统 - 精河县供水工程综合管理平台

sales-target.html 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>销售目标 - 轻量 CRM</title>
  7. <script src="https://cdn.tailwindcss.com"></script>
  8. <style>
  9. @media (max-width: 640px) {
  10. .mobile-stack { flex-direction: column !important; }
  11. .mobile-full { width: 100% !important; }
  12. }
  13. </style>
  14. </head>
  15. <body class="bg-gray-50 min-h-screen">
  16. <!-- 顶部导航 -->
  17. <nav class="bg-indigo-600 text-white shadow-lg">
  18. <div class="container mx-auto px-4 py-4">
  19. <div class="flex justify-between items-center">
  20. <div class="flex items-center space-x-3">
  21. <span class="text-2xl">📊</span>
  22. <h1 class="text-xl font-bold">轻量 CRM</h1>
  23. </div>
  24. <div class="flex space-x-4">
  25. <a href="/" class="hover:bg-indigo-500 px-3 py-2 rounded">首页</a>
  26. <a href="/customers" class="hover:bg-indigo-500 px-3 py-2 rounded">客户</a>
  27. <a href="/leads" class="hover:bg-indigo-500 px-3 py-2 rounded">线索</a>
  28. <a href="/public-pool" class="hover:bg-indigo-500 px-3 py-2 rounded">公海池</a>
  29. <a href="/sales-target" class="bg-indigo-500 px-3 py-2 rounded">销售目标</a>
  30. </div>
  31. </div>
  32. </div>
  33. </nav>
  34. <!-- 主内容区 -->
  35. <main class="container mx-auto px-4 py-8">
  36. <!-- 页面标题 -->
  37. <div class="mb-8">
  38. <h2 class="text-3xl font-bold text-gray-800">🎯 销售目标</h2>
  39. <p class="text-gray-600 mt-2">跟踪销售业绩,达成目标</p>
  40. </div>
  41. <!-- 今日目标 -->
  42. <div class="bg-white rounded-lg shadow p-6 mb-6">
  43. <h3 class="text-xl font-semibold mb-4">📅 今日目标</h3>
  44. <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
  45. <div class="text-center p-4 bg-blue-50 rounded-lg">
  46. <p class="text-gray-500 text-sm">新增客户</p>
  47. <p id="todayNew" class="text-3xl font-bold text-blue-600 mt-2">-</p>
  48. <p class="text-xs text-gray-400 mt-1">目标:5</p>
  49. <div class="w-full bg-gray-200 rounded-full h-2 mt-2">
  50. <div id="todayNewProgress" class="bg-blue-600 h-2 rounded-full" style="width: 0%"></div>
  51. </div>
  52. </div>
  53. <div class="text-center p-4 bg-green-50 rounded-lg">
  54. <p class="text-gray-500 text-sm">客户跟进</p>
  55. <p id="todayFollowups" class="text-3xl font-bold text-green-600 mt-2">-</p>
  56. <p class="text-xs text-gray-400 mt-1">目标:10</p>
  57. <div class="w-full bg-gray-200 rounded-full h-2 mt-2">
  58. <div id="todayFollowupsProgress" class="bg-green-600 h-2 rounded-full" style="width: 0%"></div>
  59. </div>
  60. </div>
  61. <div class="text-center p-4 bg-purple-50 rounded-lg">
  62. <p class="text-gray-500 text-sm">线索转化</p>
  63. <p id="todayConverted" class="text-3xl font-bold text-purple-600 mt-2">-</p>
  64. <p class="text-xs text-gray-400 mt-1">目标:3</p>
  65. <div class="w-full bg-gray-200 rounded-full h-2 mt-2">
  66. <div id="todayConvertedProgress" class="bg-purple-600 h-2 rounded-full" style="width: 0%"></div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <!-- 本周目标 -->
  72. <div class="bg-white rounded-lg shadow p-6 mb-6">
  73. <h3 class="text-xl font-semibold mb-4">📊 本周目标</h3>
  74. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  75. <div class="text-center p-4 bg-indigo-50 rounded-lg">
  76. <p class="text-gray-500 text-sm">新增客户</p>
  77. <p id="weekNew" class="text-3xl font-bold text-indigo-600 mt-2">-</p>
  78. <p class="text-xs text-gray-400 mt-1">目标:20</p>
  79. <div class="w-full bg-gray-200 rounded-full h-2 mt-2">
  80. <div id="weekNewProgress" class="bg-indigo-600 h-2 rounded-full" style="width: 0%"></div>
  81. </div>
  82. </div>
  83. <div class="text-center p-4 bg-teal-50 rounded-lg">
  84. <p class="text-gray-500 text-sm">客户跟进</p>
  85. <p id="weekFollowups" class="text-3xl font-bold text-teal-600 mt-2">-</p>
  86. <p class="text-xs text-gray-400 mt-1">目标:50</p>
  87. <div class="w-full bg-gray-200 rounded-full h-2 mt-2">
  88. <div id="weekFollowupsProgress" class="bg-teal-600 h-2 rounded-full" style="width: 0%"></div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- 本月目标 -->
  94. <div class="bg-white rounded-lg shadow p-6 mb-6">
  95. <h3 class="text-xl font-semibold mb-4">📈 本月目标</h3>
  96. <div class="text-center p-4 bg-orange-50 rounded-lg">
  97. <p class="text-gray-500 text-sm">新增客户</p>
  98. <p id="monthNew" class="text-3xl font-bold text-orange-600 mt-2">-</p>
  99. <p class="text-xs text-gray-400 mt-1">目标:80</p>
  100. <div class="w-full bg-gray-200 rounded-full h-3 mt-2">
  101. <div id="monthNewProgress" class="bg-orange-600 h-3 rounded-full" style="width: 0%"></div>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- 累计转化 -->
  106. <div class="bg-white rounded-lg shadow p-6">
  107. <h3 class="text-xl font-semibold mb-4">🏆 累计成就</h3>
  108. <div class="text-center">
  109. <p class="text-gray-500 text-sm">线索转化总数</p>
  110. <p id="totalConverted" class="text-4xl font-bold text-yellow-600 mt-2">-</p>
  111. </div>
  112. </div>
  113. </main>
  114. <script>
  115. const API_BASE = '';
  116. const TARGETS = {
  117. todayNew: 5,
  118. todayFollowups: 10,
  119. todayConverted: 3,
  120. weekNew: 20,
  121. weekFollowups: 50,
  122. monthNew: 80
  123. };
  124. // 加载销售目标数据
  125. async function loadSalesTarget() {
  126. try {
  127. const res = await fetch(`${API_BASE}/api/stats/sales`);
  128. const data = await res.json();
  129. if (data.success) {
  130. const d = data.data;
  131. // 今日
  132. document.getElementById('todayNew').textContent = d.todayNew;
  133. document.getElementById('todayFollowups').textContent = d.todayFollowups;
  134. document.getElementById('todayConverted').textContent = d.convertedLeads;
  135. // 本周
  136. document.getElementById('weekNew').textContent = d.weekNew;
  137. document.getElementById('weekFollowups').textContent = d.weekFollowups;
  138. // 本月
  139. document.getElementById('monthNew').textContent = d.monthNew;
  140. // 累计
  141. document.getElementById('totalConverted').textContent = d.convertedLeads;
  142. // 进度条
  143. updateProgress('todayNewProgress', d.todayNew, TARGETS.todayNew);
  144. updateProgress('todayFollowupsProgress', d.todayFollowups, TARGETS.todayFollowups);
  145. updateProgress('todayConvertedProgress', d.convertedLeads, TARGETS.todayConverted);
  146. updateProgress('weekNewProgress', d.weekNew, TARGETS.weekNew);
  147. updateProgress('weekFollowupsProgress', d.weekFollowups, TARGETS.weekFollowups);
  148. updateProgress('monthNewProgress', d.monthNew, TARGETS.monthNew);
  149. }
  150. } catch (error) {
  151. console.error('加载失败:', error);
  152. }
  153. }
  154. // 更新进度条
  155. function updateProgress(elementId, current, target) {
  156. const percentage = Math.min(100, Math.round((current / target) * 100));
  157. document.getElementById(elementId).style.width = percentage + '%';
  158. }
  159. // 页面加载
  160. document.addEventListener('DOMContentLoaded', loadSalesTarget);
  161. </script>
  162. </body>
  163. </html>