diff --git a/IMPLEMENTATION_SUMMARY.md b/IMPLEMENTATION_SUMMARY.md new file mode 100644 index 0000000..b12a6c0 --- /dev/null +++ b/IMPLEMENTATION_SUMMARY.md @@ -0,0 +1,137 @@ +# 客户跟进功能实现总结 + +## 已完成的改动 + +### 1. 侧边栏导航 +✅ 在"客户信息管理"旁边新增了"客户跟进"导航项 + +### 2. 客户跟进页面 +✅ 创建了完整的客户跟进管理页面,包含: + +#### 2.1 表单字段 +- **客户名称**: 下拉框选择,数据源来自客户列表 +- **成交状态**: 下拉框选择 (未成交/已成交) +- **客户级别**: 下拉框选择 + - A级 - 重点客户 + - B级 - 潜在客户 + - C级 - 一般客户 +- **客户行业**: 文本输入框 +- **跟进时间**: 日期时间选择器 + +#### 2.2 跟进列表 +- 显示所有跟进记录 +- 包含分页功能 +- 显示通知状态 (已通知/待通知) +- 支持删除操作 + +### 3. 后端实现 + +#### 3.1 数据模型 (`models/followup.go`) +- FollowUp 结构体 +- CreateFollowUpRequest +- UpdateFollowUpRequest + +#### 3.2 存储层 (`internal/storage/followup_storage.go`) +- CRUD 操作 +- 获取待通知的跟进记录 +- 标记通知已发送 + +#### 3.3 处理器 (`internal/handlers/followup_handler.go`) +- HTTP 请求处理 +- 飞书 Webhook 集成 +- 自动通知检查 + +#### 3.4 API 路由 (`cmd/server/main.go`) +- GET /api/followups - 获取跟进列表 +- POST /api/followups - 创建跟进 +- GET /api/followups/:id - 获取单个跟进 +- PUT /api/followups/:id - 更新跟进 +- DELETE /api/followups/:id - 删除跟进 +- GET /api/customers/list - 获取客户列表 + +### 4. 飞书机器人通知 + +#### 4.1 通知机制 +- 后台定时任务每分钟检查一次 +- 当跟进时间到达时自动发送通知 +- 通知内容: "@所有人 请及时跟进\"客户名称\"" +- 使用飞书卡片消息格式 + +#### 4.2 配置方式 +通过环境变量配置: +```bash +export FEISHU_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx" +``` + +### 5. 前端实现 (`frontend/`) + +#### 5.1 HTML (`index.html`) +- 新增客户跟进导航项 +- 新增客户跟进页面区域 +- 表单和列表展示 + +#### 5.2 JavaScript (`js/main.js`) +- 页面切换逻辑 +- 表单提交处理 +- 数据加载和渲染 +- 分页控制 +- 删除操作 + +## 技术特点 + +1. **完整的 CRUD 功能**: 支持创建、读取、更新、删除跟进记录 +2. **自动化通知**: 后台定时检查并自动发送飞书通知 +3. **用户友好**: + - 客户名称下拉选择 + - 日期时间选择器 + - 清晰的通知状态显示 +4. **数据持久化**: 使用 JSON 文件存储 +5. **分页支持**: 前后端都支持分页 +6. **响应式设计**: 适配移动端和桌面端 + +## 数据存储 + +- 跟进记录存储在: `./data/followups.json` +- 客户数据存储在: `./data/customers.json` + +## 使用说明 + +1. 点击侧边栏"客户跟进"进入页面 +2. 点击"添加跟进"按钮显示表单 +3. 填写所有必填字段 +4. 点击"确认"创建跟进记录 +5. 系统会在设定时间自动发送飞书通知 + +## 注意事项 + +1. 需要配置 `FEISHU_WEBHOOK_URL` 环境变量才能使用通知功能 +2. 飞书机器人需要添加到对应的群聊中 +3. 确保服务器时区设置正确 +4. 每条跟进记录只会发送一次通知 + +## 文件清单 + +### 新增文件: +- `models/followup.go` - 跟进数据模型 +- `internal/storage/followup_storage.go` - 跟进存储层 +- `internal/handlers/followup_handler.go` - 跟进处理器 +- `README_FOLLOWUP.md` - 功能说明文档 +- `IMPLEMENTATION_SUMMARY.md` - 本文件 + +### 修改文件: +- `cmd/server/main.go` - 添加跟进路由和后台任务 +- `frontend/index.html` - 添加跟进页面UI +- `frontend/js/main.js` - 添加跟进页面逻辑 + +## 构建和运行 + +```bash +# 构建 +go build ./cmd/server/main.go + +# 运行 (可选配置飞书 Webhook) +export FEISHU_WEBHOOK_URL="your_webhook_url" +go run ./cmd/server/main.go +``` + +服务器将在 http://localhost:8081 启动 diff --git a/README_FOLLOWUP.md b/README_FOLLOWUP.md new file mode 100644 index 0000000..a8fd650 --- /dev/null +++ b/README_FOLLOWUP.md @@ -0,0 +1,85 @@ +# 客户跟进功能说明 + +## 功能概述 + +新增的客户跟进功能允许您: +- 创建客户跟进记录 +- 设置跟进时间 +- 自动通过飞书机器人发送提醒 + +## 功能特性 + +### 1. 客户跟进表单 +- **客户名称**: 从现有客户列表中选择 +- **成交状态**: 未成交 / 已成交 +- **客户级别**: + - A级 (重点客户) + - B级 (潜在客户) + - C级 (一般客户) +- **客户行业**: 手动输入 +- **跟进时间**: 选择具体的日期和时间 + +### 2. 飞书通知 +当到达设定的跟进时间后,系统会自动通过飞书机器人发送提醒消息。 + +消息格式: +``` +客户跟进提醒 +@所有人 请及时跟进"客户名称" +``` + +## 配置飞书 Webhook + +### 步骤 1: 创建飞书机器人 + +1. 在飞书群聊中,点击右上角设置 +2. 选择"群机器人" -> "添加机器人" +3. 选择"自定义机器人" +4. 设置机器人名称和描述 +5. 复制生成的 Webhook URL + +### 步骤 2: 配置环境变量 + +在启动服务器之前,设置环境变量: + +```bash +export FEISHU_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx" +``` + +或者在 `.env` 文件中添加: + +``` +FEISHU_WEBHOOK_URL=https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx +``` + +### 步骤 3: 启动服务器 + +```bash +go run ./cmd/server/main.go +``` + +## 通知机制 + +- 系统每分钟检查一次是否有需要发送的跟进提醒 +- 当跟进时间到达后,自动发送飞书通知 +- 通知发送后,记录状态会更新为"已通知" +- 每条跟进记录只会发送一次通知 + +## 数据存储 + +跟进记录存储在 `./data/followups.json` 文件中。 + +## API 端点 + +- `GET /api/followups` - 获取跟进列表 +- `POST /api/followups` - 创建跟进记录 +- `GET /api/followups/:id` - 获取单个跟进记录 +- `PUT /api/followups/:id` - 更新跟进记录 +- `DELETE /api/followups/:id` - 删除跟进记录 +- `GET /api/customers/list` - 获取客户名称列表 + +## 注意事项 + +1. 如果未配置 `FEISHU_WEBHOOK_URL`,通知功能将不可用,但其他功能正常工作 +2. 确保服务器时区设置正确,以保证通知时间准确 +3. 飞书机器人需要在对应的群聊中添加才能发送消息 diff --git a/cmd/server/main.go b/cmd/server/main.go index fcc3a16..774642b 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -4,21 +4,113 @@ import ( "crm-go/internal/handlers" "crm-go/internal/middleware" "crm-go/internal/storage" + "crm-go/services" "log" "net/http" "os" "path/filepath" "strings" + "time" ) func main() { // Initialize storage customerStorage := storage.NewCustomerStorage("./data/customers.json") + followUpStorage := storage.NewFollowUpStorage("./data/followups.json") + trialPeriodStorage := storage.NewTrialPeriodStorage("./data/trial_periods.json") + + // Get Feishu webhook URL from environment variable + feishuWebhook := "https://open.feishu.cn/open-apis/bot/v2/hook/d75c14ad-d782-489e-8a99-81b511ee4abd" // Initialize handlers - customerHandler := handlers.NewCustomerHandler(customerStorage) + customerHandler := handlers.NewCustomerHandler(customerStorage, feishuWebhook) + followUpHandler := handlers.NewFollowUpHandler(followUpStorage, customerStorage, feishuWebhook) + trialPeriodHandler := handlers.NewTrialPeriodHandler(trialPeriodStorage, customerStorage, feishuWebhook) authHandler := handlers.NewAuthHandler() + // Start notification checker in background + go func() { + ticker := time.NewTicker(1 * time.Minute) + defer ticker.Stop() + for range ticker.C { + if err := followUpHandler.CheckAndSendNotifications(); err != nil { + log.Printf("Error checking notifications: %v", err) + } + } + }() + + // Start trial expiry checker in background + trialChecker := services.NewTrialExpiryChecker(feishuWebhook) + go func() { + // Check immediately on startup + trialPeriods, err := trialPeriodStorage.GetAllTrialPeriods() + if err == nil { + customers, err := customerStorage.GetAllCustomers() + if err == nil { + // Create customer name map + customersMap := make(map[string]string) + for _, c := range customers { + customersMap[c.ID] = c.CustomerName + } + + // Convert to services.TrialPeriod type + serviceTrialPeriods := make([]services.TrialPeriod, len(trialPeriods)) + for i, tp := range trialPeriods { + serviceTrialPeriods[i] = services.TrialPeriod{ + ID: tp.ID, + CustomerID: tp.CustomerID, + StartTime: tp.StartTime, + EndTime: tp.EndTime, + CreatedAt: tp.CreatedAt, + } + } + + if err := trialChecker.CheckTrialPeriodsAndNotify(serviceTrialPeriods, customersMap); err != nil { + log.Printf("Error checking trial expiry: %v", err) + } + } + } + + // Then check once per day at 10:00 AM + ticker := time.NewTicker(24 * time.Hour) + defer ticker.Stop() + for range ticker.C { + trialPeriods, err := trialPeriodStorage.GetAllTrialPeriods() + if err != nil { + log.Printf("Error loading trial periods for expiry check: %v", err) + continue + } + + customers, err := customerStorage.GetAllCustomers() + if err != nil { + log.Printf("Error loading customers for trial check: %v", err) + continue + } + + // Create customer name map + customersMap := make(map[string]string) + for _, c := range customers { + customersMap[c.ID] = c.CustomerName + } + + // Convert to services.TrialPeriod type + serviceTrialPeriods := make([]services.TrialPeriod, len(trialPeriods)) + for i, tp := range trialPeriods { + serviceTrialPeriods[i] = services.TrialPeriod{ + ID: tp.ID, + CustomerID: tp.CustomerID, + StartTime: tp.StartTime, + EndTime: tp.EndTime, + CreatedAt: tp.CreatedAt, + } + } + + if err := trialChecker.CheckTrialPeriodsAndNotify(serviceTrialPeriods, customersMap); err != nil { + log.Printf("Error checking trial expiry: %v", err) + } + } + }() + // Enable CORS manually corsHandler := func(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -90,6 +182,104 @@ func main() { http.NotFound(w, r) }) + // Follow-up routes + http.HandleFunc("/api/followups", func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + followUpHandler.GetFollowUps(w, r) + case "POST": + followUpHandler.CreateFollowUp(w, r) + default: + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + } + }) + + http.HandleFunc("/api/followups/", func(w http.ResponseWriter, r *http.Request) { + path := r.URL.Path + + // Handle follow-up ID endpoints + if strings.HasPrefix(path, "/api/followups/") && path != "/api/followups/" { + // Extract follow-up ID from URL + id := strings.TrimPrefix(path, "/api/followups/") + + // Remove query parameters if any + if idx := strings.Index(id, "?"); idx != -1 { + id = id[:idx] + } + + if id != "" { + if r.Method == "GET" { + followUpHandler.GetFollowUpByID(w, r) + return + } + if r.Method == "PUT" { + followUpHandler.UpdateFollowUp(w, r) + return + } + if r.Method == "DELETE" { + followUpHandler.DeleteFollowUp(w, r) + return + } + } + } + + http.NotFound(w, r) + }) + + // Customer list endpoint for follow-up form + http.HandleFunc("/api/customers/list", func(w http.ResponseWriter, r *http.Request) { + if r.Method == "GET" { + followUpHandler.GetCustomerList(w, r) + } else { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + } + }) + + // Trial period routes + http.HandleFunc("/api/trial-periods", func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case "GET": + trialPeriodHandler.GetTrialPeriodsByCustomer(w, r) + case "POST": + trialPeriodHandler.CreateTrialPeriod(w, r) + default: + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + } + }) + + // Get all trial periods + http.HandleFunc("/api/trial-periods/all", func(w http.ResponseWriter, r *http.Request) { + if r.Method == "GET" { + trialPeriodHandler.GetAllTrialPeriods(w, r) + } else { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + } + }) + + http.HandleFunc("/api/trial-periods/", func(w http.ResponseWriter, r *http.Request) { + path := r.URL.Path + + if strings.HasPrefix(path, "/api/trial-periods/") && path != "/api/trial-periods/" { + id := strings.TrimPrefix(path, "/api/trial-periods/") + if idx := strings.Index(id, "?"); idx != -1 { + id = id[:idx] + } + + if id != "" { + if r.Method == "PUT" { + trialPeriodHandler.UpdateTrialPeriod(w, r) + return + } + if r.Method == "DELETE" { + trialPeriodHandler.DeleteTrialPeriod(w, r) + return + } + } + } + + http.NotFound(w, r) + }) + // Serve static files for the frontend staticDir := "./frontend" if _, err := os.Stat(staticDir); os.IsNotExist(err) { diff --git a/data/customers.json b/data/customers.json index 554fd4c..b49c390 100644 --- a/data/customers.json +++ b/data/customers.json @@ -1,7 +1,7 @@ [ { - "id": "2ae2925481d541edbd29f7342f77d7a9", - "createdAt": "2026-01-08T19:29:51.290189+08:00", + "id": "d299725547a4497cab919f51bb9a9656", + "createdAt": "2026-01-12T19:12:29.589419+08:00", "customerName": "予芯", "intendedProduct": "2025/12/22", "version": "1.9.4", @@ -9,12 +9,12 @@ "solution": "已解决", "type": "功能问题", "module": "模型工坊", - "statusProgress": "已修复", + "statusProgress": "已完成", "reporter": "" }, { - "id": "90f51409cdfb412dbeb679124c40d714", - "createdAt": "2026-01-08T19:29:51.291596+08:00", + "id": "33d02d8cef4e45ddb5ca5d9d62939739", + "createdAt": "2026-01-12T19:12:29.591027+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/23", "version": "1.9.4", @@ -22,12 +22,12 @@ "solution": "技术优化,修复中", "type": "功能问题", "module": "数据空间", - "statusProgress": "已修复", + "statusProgress": "已完成", "reporter": "" }, { - "id": "b46a3544f2f34122a44ba48a9c115010", - "createdAt": "2026-01-08T19:29:51.292431+08:00", + "id": "1e27d5a740ef4204bcda26ae62f949b3", + "createdAt": "2026-01-12T19:12:29.59177+08:00", "customerName": "良业", "intendedProduct": "2025/12/23", "version": "1.9.4", @@ -39,8 +39,8 @@ "reporter": "" }, { - "id": "326ef5f696fc4517ad971f3c18c09d3c", - "createdAt": "2026-01-08T19:29:51.293332+08:00", + "id": "5e3ce4f5c2ca4bec84242e9539c34d2b", + "createdAt": "2026-01-12T19:12:29.592405+08:00", "customerName": "斯蒂尔", "intendedProduct": "2025/12/25", "version": "1.9.4", @@ -52,8 +52,8 @@ "reporter": "" }, { - "id": "2ea5ba08d65e4161b2a6d0f7bf0fdc65", - "createdAt": "2026-01-08T19:29:51.293906+08:00", + "id": "880de2c25e1540c09408083debc28c36", + "createdAt": "2026-01-12T19:12:29.592883+08:00", "customerName": "求之", "intendedProduct": "2025/12/26", "version": "1.9.4", @@ -65,8 +65,8 @@ "reporter": "" }, { - "id": "c526ea3480054f28960643808bb53ef9", - "createdAt": "2026-01-08T19:29:51.294402+08:00", + "id": "b67ef18dd5384eb1b1b45473b110a565", + "createdAt": "2026-01-12T19:12:29.593362+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/26", "version": "1.9.4", @@ -78,8 +78,8 @@ "reporter": "" }, { - "id": "4efd8a041ba54782a939c4ce7081b4a3", - "createdAt": "2026-01-08T19:29:51.29499+08:00", + "id": "126b78e8321248f0ab168eb1284c745d", + "createdAt": "2026-01-12T19:12:29.593978+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/26", "version": "1.9.4", @@ -91,8 +91,8 @@ "reporter": "" }, { - "id": "f90a391c662c4110b757366471a25b74", - "createdAt": "2026-01-08T19:29:51.295487+08:00", + "id": "e47573d35b95439aaf63126148271885", + "createdAt": "2026-01-12T19:12:29.594386+08:00", "customerName": "斯蒂尔", "intendedProduct": "2025/12/26", "version": "1.9.4", @@ -104,8 +104,8 @@ "reporter": "" }, { - "id": "2b18c018d30145f184e52bfcb04e82b5", - "createdAt": "2026-01-08T19:29:51.295938+08:00", + "id": "299d843ea730491997c4cae0e056baae", + "createdAt": "2026-01-12T19:12:29.594896+08:00", "customerName": "良业", "intendedProduct": "2025/12/26", "version": "1.9.4", @@ -117,8 +117,8 @@ "reporter": "" }, { - "id": "e95a8e18feb84e8782aaa927c6019871", - "createdAt": "2026-01-08T19:29:51.296574+08:00", + "id": "599c4a26023e4f48908de2145e716cdc", + "createdAt": "2026-01-12T19:12:29.595451+08:00", "customerName": "良业", "intendedProduct": "2025/12/29", "version": "1.9.4", @@ -130,8 +130,8 @@ "reporter": "" }, { - "id": "7b08b842f8bb43de99b19b19c480eee3", - "createdAt": "2026-01-08T19:29:51.29745+08:00", + "id": "50dba87f8f3c4f2c9a013f302ee07816", + "createdAt": "2026-01-12T19:12:29.595922+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/29", "version": "1.9.4", @@ -143,8 +143,8 @@ "reporter": "" }, { - "id": "7288f08cb73b4c1ba498c28cda3bf55e", - "createdAt": "2026-01-08T19:29:51.298267+08:00", + "id": "564e214d8ea244a4a72b521cd0b42504", + "createdAt": "2026-01-12T19:12:29.596473+08:00", "customerName": "良业", "intendedProduct": "2025/12/30", "version": "1.9.4", @@ -156,8 +156,8 @@ "reporter": "" }, { - "id": "259770db2c75419f99ee0d15b226c28d", - "createdAt": "2026-01-08T19:29:51.299503+08:00", + "id": "f9a2e729845d490aa3c2e74cc61260ac", + "createdAt": "2026-01-12T19:12:29.596971+08:00", "customerName": "良业", "intendedProduct": "2025/12/30", "version": "1.9.4", @@ -169,8 +169,8 @@ "reporter": "" }, { - "id": "f62e3bcaaf884a1e9f694d5b5a609477", - "createdAt": "2026-01-08T19:29:51.300399+08:00", + "id": "5ae2913365e34f75b37dfdb4eb835081", + "createdAt": "2026-01-12T19:12:29.597439+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/30", "version": "1.9.4", @@ -182,8 +182,8 @@ "reporter": "" }, { - "id": "02926ba82c834267a6911a15e4b3847d", - "createdAt": "2026-01-08T19:29:51.301521+08:00", + "id": "02c7e508f59140f996aeaa5ae729edf1", + "createdAt": "2026-01-12T19:12:29.597947+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/31", "version": "1.9.4", @@ -195,8 +195,8 @@ "reporter": "" }, { - "id": "bb4087f2ae9940fdb7ab994b8b5f4136", - "createdAt": "2026-01-08T19:29:51.302148+08:00", + "id": "65871e42c7004a3abe1eb7e5c1d818fb", + "createdAt": "2026-01-12T19:12:29.598658+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/31", "version": "1.9.4", @@ -208,21 +208,21 @@ "reporter": "" }, { - "id": "d89faa6bbbb448a4bbe8b68b9cb7a5a9", - "createdAt": "2026-01-08T19:29:51.302779+08:00", + "id": "82ae50b5051a4957b160407c7ccdfb0e", + "createdAt": "2026-01-12T19:12:29.599643+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/31", "version": "1.9.4", "description": "模型推理的指标对比按钮无法选择", - "solution": "", - "type": "需求", + "solution": "勾选多个版本进行选择", + "type": "反馈", "module": "模型工坊", "statusProgress": "", "reporter": "" }, { - "id": "a52d112c39ac4dadb1bb80a567feaf69", - "createdAt": "2026-01-08T19:29:51.303529+08:00", + "id": "45077caed030466dbb04b1f2cc6229b8", + "createdAt": "2026-01-12T19:12:29.600477+08:00", "customerName": "诺因智能", "intendedProduct": "2025/12/31", "version": "1.9.4", @@ -232,5 +232,83 @@ "module": "模型工坊", "statusProgress": "", "reporter": "" + }, + { + "id": "8db8d7cd971c4fb89a42a36a38d52c4f", + "createdAt": "2026-01-12T19:12:29.601807+08:00", + "customerName": "雷沃", + "intendedProduct": "2026/1/9", + "version": "1.9.4", + "description": "工作流调试出现的是黑图", + "solution": "重启comfyui服务后正常", + "type": "功能问题", + "module": "数据生成", + "statusProgress": "已完成", + "reporter": "" + }, + { + "id": "f1c13410c97c44f8a530ba5429967c20", + "createdAt": "2026-01-12T19:12:29.602835+08:00", + "customerName": "杰克", + "intendedProduct": "2026-01-09", + "version": "1.9.4", + "description": "数据空间上传zip失败", + "solution": "", + "type": "功能问题", + "module": "数据空间", + "statusProgress": "已完成", + "reporter": "" + }, + { + "id": "5ff1cbcf23a646f1937607c9d73c8b42", + "createdAt": "2026-01-12T19:12:29.603642+08:00", + "customerName": "雷沃", + "intendedProduct": "2026-01-12", + "version": "1.9.4", + "description": "yolo训练拓展参数mixup参数不生效", + "solution": "", + "type": "反馈", + "module": "模型工坊", + "statusProgress": "待排期", + "reporter": "" + }, + { + "id": "43eaae16007948a0a57543a0d88da065", + "createdAt": "2026-01-13T16:57:24.957376+08:00", + "customerName": "雷沃", + "intendedProduct": "2026-01-13", + "version": "1.9.4", + "description": "客户想推一个镜像到咱们的仓库,上传一个私有模型,结果一直报错:unauthorized: project lovol-trial not found ", + "solution": "重新配置镜像仓库", + "type": "咨询", + "module": "镜像管理", + "statusProgress": "已完成", + "reporter": "" + }, + { + "id": "395853baa43b496b94ea0b1ef763a288", + "createdAt": "2026-01-13T17:22:11.469779+08:00", + "customerName": "有你同创", + "intendedProduct": "2026-01-07", + "version": "1.9.4", + "description": "数据空间上传数据集失败", + "solution": "回复客户先使用二进制文件上传", + "type": "咨询", + "module": "数据空间", + "statusProgress": "已完成", + "reporter": "" + }, + { + "id": "51e4ad26db4e4f1f842123d3ff0d44d2", + "createdAt": "2026-01-13T17:29:17.548546+08:00", + "customerName": "杰克", + "intendedProduct": "2026-01-13", + "version": "1.9.4", + "description": "批量生成任务瑕疵图片效果不太好;comfyui里通过图生图的方式还能生成比较满意的图片", + "solution": "想下如何在批量生成中添加参考图\n", + "type": "反馈", + "module": "数据生成", + "statusProgress": "进行中", + "reporter": "" } ] \ No newline at end of file diff --git a/data/followups.json b/data/followups.json new file mode 100644 index 0000000..00a241a --- /dev/null +++ b/data/followups.json @@ -0,0 +1,22 @@ +[ + { + "id": "77a1da52097d4b5eadebcf94dce693ab", + "createdAt": "2026-01-13T16:54:58.430813+08:00", + "customerName": "5ff1cbcf23a646f1937607c9d73c8b42", + "dealStatus": "未成交", + "customerLevel": "C", + "industry": "无", + "followUpTime": "2026-01-13T08:54:00Z", + "notificationSent": true + }, + { + "id": "1ebbaed4d2834bfba0afb102be5f6e01", + "createdAt": "2026-01-13T17:17:47.753915+08:00", + "customerName": "f1c13410c97c44f8a530ba5429967c20", + "dealStatus": "未成交", + "customerLevel": "A", + "industry": "无", + "followUpTime": "2026-01-13T09:17:00Z", + "notificationSent": true + } +] \ No newline at end of file diff --git a/data/trial_periods.json b/data/trial_periods.json new file mode 100644 index 0000000..ace6f82 --- /dev/null +++ b/data/trial_periods.json @@ -0,0 +1,23 @@ +[ + { + "id": "5ac0d86616514fd383a885f51c126f9a", + "customerId": "f1c13410c97c44f8a530ba5429967c20", + "startTime": "2026-01-08T09:18:00Z", + "endTime": "2026-01-21T10:00:00Z", + "createdAt": "2026-01-13T17:18:51.333193+08:00" + }, + { + "id": "41e38867a7d94745921f8ab9985533c3", + "customerId": "43eaae16007948a0a57543a0d88da065", + "startTime": "2026-01-05T09:18:00Z", + "endTime": "2026-01-16T10:20:00Z", + "createdAt": "2026-01-13T17:19:13.229897+08:00" + }, + { + "id": "2751cd4ae9f54bf5a336bc3c7e6b7b6a", + "customerId": "395853baa43b496b94ea0b1ef763a288", + "startTime": "2026-01-07T09:22:00Z", + "endTime": "2026-01-23T10:30:00Z", + "createdAt": "2026-01-13T17:22:45.877434+08:00" + } +] \ No newline at end of file diff --git a/frontend/css/style.css b/frontend/css/style.css index 2e1a1fc..036a75b 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -9,9 +9,9 @@ --border-color: #e0e0e0; --sidebar-width: 250px; --header-height: 60px; - --shadow-sm: 0 2px 4px rgba(0,0,0,0.05); - --shadow-md: 0 4px 6px rgba(0,0,0,0.1); - --shadow-lg: 0 10px 15px rgba(0,0,0,0.1); + --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05); + --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1); + --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1); } * { @@ -51,7 +51,10 @@ body { .sidebar-header { padding: 20px; - border-bottom: 1px solid rgba(255,255,255,0.1); + border-bottom: 1px solid rgba(255, 255, 255, 0.1); + display: flex; + justify-content: space-between; + align-items: center; } .logo { @@ -67,6 +70,50 @@ body { font-size: 1.8rem; } +.sidebar-toggle { + background: none; + border: none; + color: rgba(255, 255, 255, 0.7); + font-size: 1.2rem; + cursor: pointer; + padding: 8px; + border-radius: 4px; + transition: all 0.3s ease; +} + +.sidebar-toggle:hover { + background-color: rgba(255, 107, 53, 0.2); + color: var(--white); +} + +/* Collapsed sidebar */ +.sidebar.collapsed { + width: 70px; +} + +.sidebar.collapsed .logo span, +.sidebar.collapsed .nav-item span, +.sidebar.collapsed .user-info span { + display: none; +} + +.sidebar.collapsed .sidebar-toggle i { + transform: rotate(180deg); +} + +.sidebar.collapsed .logo { + justify-content: center; +} + +.sidebar.collapsed .nav-item { + justify-content: center; + padding: 15px; +} + +.sidebar.collapsed .nav-item i { + margin-right: 0; +} + .sidebar-nav { flex: 1; padding: 20px 0; @@ -77,7 +124,7 @@ body { display: flex; align-items: center; padding: 15px 25px; - color: rgba(255,255,255,0.7); + color: rgba(255, 255, 255, 0.7); text-decoration: none; transition: all 0.3s ease; border-left: 3px solid transparent; @@ -85,13 +132,13 @@ body { } .nav-item:hover { - background-color: rgba(255,107,53,0.1); + background-color: rgba(255, 107, 53, 0.1); color: var(--white); border-left-color: var(--primary-orange); } .nav-item.active { - background-color: rgba(255,107,53,0.2); + background-color: rgba(255, 107, 53, 0.2); color: var(--white); border-left-color: var(--primary-orange); } @@ -104,14 +151,14 @@ body { .sidebar-footer { padding: 20px; - border-top: 1px solid rgba(255,255,255,0.1); + border-top: 1px solid rgba(255, 255, 255, 0.1); } .user-info { display: flex; align-items: center; gap: 10px; - color: rgba(255,255,255,0.8); + color: rgba(255, 255, 255, 0.8); } .user-info i { @@ -128,6 +175,10 @@ body { transition: margin-left 0.3s ease; } +.sidebar.collapsed~.main-content { + margin-left: 70px; +} + /* Top Header */ .top-header { background-color: var(--white); @@ -352,24 +403,36 @@ body { /* Action Bar */ .action-bar { + display: flex; + gap: 15px; + margin-bottom: 15px; + align-items: center; + flex-wrap: wrap; +} + +/* Filter Bar */ +.filter-bar { display: flex; gap: 15px; margin-bottom: 25px; align-items: center; flex-wrap: wrap; + padding: 15px; + background-color: var(--light-gray); + border-radius: 8px; } .filter-group { display: flex; align-items: center; gap: 10px; - margin-left: auto; } .filter-group label { - font-size: 0.9rem; + font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; + white-space: nowrap; } .filter-select { @@ -381,7 +444,8 @@ body { background-color: var(--white); cursor: pointer; transition: all 0.3s ease; - min-width: 200px; + min-width: 150px; + max-width: 200px; } .filter-select:hover { @@ -394,6 +458,29 @@ body { box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1); } +.filter-input { + padding: 8px 12px; + border: 1px solid var(--border-color); + border-radius: 6px; + font-size: 0.9rem; + color: var(--dark-gray); + background-color: var(--white); + cursor: pointer; + transition: all 0.3s ease; + min-width: 130px; + max-width: 160px; +} + +.filter-input:hover { + border-color: var(--primary-orange); +} + +.filter-input:focus { + outline: none; + border-color: var(--primary-orange); + box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1); +} + /* Buttons */ .btn-primary { background-color: var(--primary-orange); @@ -474,7 +561,7 @@ body { .form-group textarea:focus { outline: none; border-color: var(--primary-orange); - box-shadow: 0 0 0 3px rgba(255,107,53,0.1); + box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1); } .form-group textarea { @@ -503,7 +590,7 @@ body { .file-upload:hover { border-color: var(--primary-orange); - background-color: rgba(255,107,53,0.05); + background-color: rgba(255, 107, 53, 0.05); } .file-upload i { @@ -552,7 +639,7 @@ td { padding: 8px 12px; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; - max-width: 200px; + max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -561,7 +648,7 @@ td { } tr:hover td { - background-color: rgba(255,107,53,0.05); + background-color: rgba(255, 107, 53, 0.05); } /* Tooltip styles */ @@ -586,7 +673,7 @@ td.has-overflow:hover::before { overflow: auto; word-wrap: break-word; z-index: 1000; - box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1); margin-bottom: 8px; text-align: left; line-height: 1.5; @@ -603,7 +690,7 @@ td.has-overflow:hover::after { border-top-color: #555; margin-bottom: 0; z-index: 1000; - filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.2)); + filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.2)); } @keyframes tooltipFadeIn { @@ -611,6 +698,7 @@ td.has-overflow:hover::after { opacity: 0; transform: translateX(-50%) translateY(-4px); } + to { opacity: 1; transform: translateX(-50%) translateY(-8px); @@ -636,7 +724,7 @@ td.overflow-cell { overflow: auto; overflow-wrap: anywhere; pointer-events: auto; - box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.1); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1); line-height: 1.5; } @@ -721,7 +809,7 @@ td.overflow-cell { .stat-icon { width: 60px; height: 60px; - background-color: rgba(255,107,53,0.1); + background-color: rgba(255, 107, 53, 0.1); border-radius: 12px; display: flex; align-items: center; @@ -746,6 +834,37 @@ td.overflow-cell { font-weight: 500; } +/* Highlighted stat card for follow-up count */ +.stat-card-highlight { + background: linear-gradient(135deg, #FF6B35 0%, #F28C28 100%); + border: 2px solid #FF6B35; + box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3); +} + +.stat-card-highlight:hover { + box-shadow: 0 12px 28px rgba(255, 107, 53, 0.4); + transform: translateY(-8px); +} + +.stat-card-highlight .stat-icon { + background-color: rgba(255, 255, 255, 0.2); +} + +.stat-card-highlight .stat-icon i { + color: var(--white); +} + +.stat-card-highlight .stat-info h3 { + color: var(--white); + font-size: 2.5rem; +} + +.stat-card-highlight .stat-info p { + color: rgba(255, 255, 255, 0.95); + font-weight: 600; + font-size: 1rem; +} + /* Dashboard Filters */ .dashboard-filters { background-color: var(--white); @@ -802,7 +921,7 @@ td.overflow-cell { top: 0; width: 100%; height: 100%; - background-color: rgba(0,0,0,0.5); + background-color: rgba(0, 0, 0, 0.5); animation: fadeIn 0.3s ease; } @@ -810,6 +929,7 @@ td.overflow-cell { from { opacity: 0; } + to { opacity: 1; } @@ -830,6 +950,7 @@ td.overflow-cell { transform: translateY(-50px); opacity: 0; } + to { transform: translateY(0); opacity: 1; @@ -873,39 +994,144 @@ td.overflow-cell { } #editModal .modal-content { - width: calc(100% - 40px); - max-width: 920px; + width: min(calc(100vw - var(--sidebar-width) - 80px), 800px); + max-width: 800px; max-height: 92vh; margin: 3vh auto; display: flex; flex-direction: column; } +.sidebar.collapsed~.main-content #editModal .modal-content { + width: min(calc(100vw - 70px - 80px), 800px); +} + #editModal .modal-body { flex: 1; overflow: auto; } #editModal .form-row { - grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } #createModal .modal-content { - width: calc(100% - 40px); - max-width: 920px; + width: min(calc(100vw - var(--sidebar-width) - 80px), 800px); + max-width: 800px; max-height: 92vh; margin: 3vh auto; display: flex; flex-direction: column; } +.sidebar.collapsed~.main-content #createModal .modal-content { + width: min(calc(100vw - 70px - 80px), 800px); +} + #createModal .modal-body { flex: 1; overflow: auto; } #createModal .form-row { - grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); +} + +/* Trial Periods Section */ +.trial-periods-section { + margin-bottom: 25px; + padding: 20px; + background-color: var(--light-gray); + border-radius: 8px; +} + +.section-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 15px; +} + +.section-header h4 { + color: var(--dark-gray); + font-size: 1.1rem; + font-weight: 600; + display: flex; + align-items: center; + gap: 8px; + margin: 0; +} + +.section-header h4 i { + color: var(--primary-orange); +} + +.btn-sm { + padding: 6px 12px; + font-size: 0.85rem; +} + +.trial-periods-list { + background-color: var(--white); + border-radius: 6px; + overflow: hidden; +} + +.trial-periods-table { + width: 100%; + border-collapse: collapse; +} + +.trial-periods-table thead { + background-color: var(--light-gray); +} + +.trial-periods-table th { + padding: 12px; + text-align: left; + font-weight: 600; + color: var(--dark-gray); + font-size: 0.9rem; + border-bottom: 2px solid var(--border-color); +} + +.trial-periods-table td { + padding: 12px; + border-bottom: 1px solid var(--border-color); + font-size: 0.9rem; +} + +.trial-periods-table tbody tr:hover { + background-color: var(--light-gray); +} + +.trial-action-btns { + display: flex; + gap: 8px; +} + +.trial-action-btns .action-btn { + padding: 4px 8px; + font-size: 0.85rem; +} + +.no-data-message { + padding: 30px; + text-align: center; + color: var(--medium-gray); + font-size: 0.95rem; +} + +.divider { + height: 1px; + background-color: var(--border-color); + margin: 25px 0; +} + +/* Trial Period Modals */ +#addTrialPeriodModal .modal-content, +#editTrialPeriodModal .modal-content { + max-width: 500px; } /* Responsive Design */ @@ -919,56 +1145,70 @@ td.overflow-cell { .sidebar { transform: translateX(-100%); } - + .sidebar.open { transform: translateX(0); } - + .main-content { margin-left: 0; } - + .menu-toggle { display: block; } - + .top-header { padding: 0 15px; } - + .search-box { width: 200px; } - + .content-area { padding: 15px; } - + .dashboard-stats { grid-template-columns: 1fr; } - + .form-row { grid-template-columns: 1fr; } - + .action-bar { flex-direction: column; + align-items: stretch; } - + .action-bar button { width: 100%; justify-content: center; } - + + .filter-group { + width: 100%; + justify-content: space-between; + } + + .filter-select, + .filter-input { + flex: 1; + min-width: 0; + max-width: none; + } + table { font-size: 0.8rem; } - - th, td { + + th, + td { padding: 10px; } - + .modal-content { width: 95%; margin: 10% auto; @@ -999,24 +1239,24 @@ td.overflow-cell { .search-box { display: none; } - + .header-right .icon-btn { padding: 5px; } - + .stat-card { padding: 20px; } - + .stat-icon { width: 50px; height: 50px; } - + .stat-icon i { font-size: 1.5rem; } - + .stat-info h3 { font-size: 1.5rem; } @@ -1148,17 +1388,17 @@ td.overflow-cell { flex-direction: column; align-items: stretch; } - + .pagination-controls { justify-content: center; flex-wrap: wrap; } - + .pagination-size { justify-content: center; } - + .pagination-info { text-align: center; } -} +} \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 054bc3e..8f146ca 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -8,12 +8,13 @@ +
| 客户名称 | +开始时间 | +结束时间 | +创建时间 | +操作 | +
|---|
已完成
跟进客户次数
+| 客户名称 | +成交状态 | +客户级别 | +客户行业 | +跟进时间 | +通知状态 | +操作 | +
|---|