2026-04-16 13:30:38 +08:00

83 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 商机管理模块 (Opportunity Management)
## 模块概述
商机管理模块提供完整的销售跟进和商机全生命周期管理功能,支持商机创建、阶段管理、漏斗分析和销售预测。
## 功能特性
### 2.1 商机管理(销售跟进模块)
#### 2.1.1 商机全生命周期管理
- **商机创建**:支持手动录入和线索转化,必填字段包括客户名称、预估金额、销售阶段、预计成交时间
- **阶段管理**:自定义销售漏斗(初步接洽→需求确认→方案报价→合同谈判→成交),阶段变更需记录原因
#### 2.1.2 商机分析
- **漏斗可视化**:展示各阶段商机数量/金额占比,支持按区域、销售维度筛选
- **预测功能**基于历史转化率自动计算预计成交金额偏差率≤15%
## 数据库表结构
### opportunities (商机表)
- `id`: 商机ID (主键)
- `customer_name`: 客户名称 (必填)
- `estimated_amount`: 预估金额 (必填)
- `current_stage`: 当前销售阶段 (必填)
- `expected_close_date`: 预计成交时间 (必填)
- `source_type`: 来源类型 (manual=手动录入, lead=线索转化)
- `owner_id`: 负责人ID
- `region`: 区域
- `created_at`: 创建时间
- `updated_at`: 更新时间
- `status`: 状态 (active=活跃, won=成交, lost=丢单)
### sales_stages (销售阶段表)
- `id`: 阶段ID (主键)
- `stage_name`: 阶段名称
- `stage_order`: 阶段顺序
- `description`: 阶段描述
- `conversion_rate`: 历史转化率
- `is_active`: 是否启用
### opportunity_stage_history (商机阶段变更历史表)
- `id`: 历史记录ID (主键)
- `opportunity_id`: 商机ID
- `from_stage`: 原阶段
- `to_stage`: 目标阶段
- `change_reason`: 变更原因 (必填)
- `changed_by`: 变更人ID
- `changed_at`: 变更时间
### opportunity_predictions (商机预测表)
- `id`: 预测记录ID (主键)
- `opportunity_id`: 商机ID
- `predicted_amount`: 预测金额
- `confidence_level`: 置信度
- `prediction_date`: 预测日期
- `actual_amount`: 实际金额 (成交后更新)
- `deviation_rate`: 偏差率
## API接口
### 商机管理
- `create_opportunity()`: 创建商机
- `update_opportunity_stage()`: 更新商机阶段
### 数据分析
- `get_funnel_analysis()`: 获取销售漏斗分析数据
- `get_sales_prediction()`: 获取销售预测汇总
## 前端界面
- 商机列表CRUD界面
- 销售阶段管理界面
- 销售漏斗可视化图表
- 销售预测汇总卡片
## 安装部署
1. 将模块目录复制到 `~/repos/` 目录下
2. 运行主应用的 `build.sh` 脚本,自动处理数据库表创建和前端资源链接
3. 模块将自动集成到系统中
## 依赖要求
- ahserver >= 1.0.0
- sqlor-database-module >= 1.0.0
- bricks-framework >= 1.0.0