Compare commits
3 Commits
5b4f5c393e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d95891ef3 | |||
| d466c9e9a8 | |||
| d079a28ffc |
61
docs/ai/README.md
Normal file
61
docs/ai/README.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# AI 模块(Ollama + RAG + 订单分析)
|
||||||
|
|
||||||
|
## 1. 配置
|
||||||
|
|
||||||
|
见 `src/main/resources/application.yml`:
|
||||||
|
|
||||||
|
- `ai.ollama.base-url`:主地址(例如 `https://ai-api.websoft.top`)
|
||||||
|
- `ai.ollama.fallback-url`:备用地址(例如 `http://47.119.165.234:11434`)
|
||||||
|
- `ai.ollama.chat-model`:对话模型(`qwen3.5:cloud`)
|
||||||
|
- `ai.ollama.embed-model`:向量模型(`qwen3-embedding:4b`)
|
||||||
|
|
||||||
|
## 2. 建表(知识库)
|
||||||
|
|
||||||
|
执行:`docs/ai/ai_kb_tables.sql`
|
||||||
|
|
||||||
|
## 3. API
|
||||||
|
|
||||||
|
说明:所有接口默认需要登录(`@PreAuthorize("isAuthenticated()")`),并且要求能够拿到 `tenantId`(header 或登录用户)。
|
||||||
|
|
||||||
|
### 3.1 对话
|
||||||
|
|
||||||
|
- `GET /api/ai/models`:获取 Ollama 模型列表
|
||||||
|
- `POST /api/ai/chat`:非流式对话
|
||||||
|
- `POST /api/ai/chat/stream`:流式对话(SSE)
|
||||||
|
- `GET /api/ai/chat/stream?prompt=...`:流式对话(SSE,适配 EventSource)
|
||||||
|
|
||||||
|
请求示例(非流式):
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"prompt": "帮我写一个退款流程说明"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.2 知识库(RAG)
|
||||||
|
|
||||||
|
- `POST /api/ai/kb/upload`:上传文档入库(建议 txt/md/html)
|
||||||
|
- `POST /api/ai/kb/sync/cms`:同步 CMS 已发布文章到知识库(当前租户)
|
||||||
|
- `POST /api/ai/kb/query`:仅检索 topK
|
||||||
|
- `POST /api/ai/kb/ask`:检索 + 生成答案(答案要求引用 chunk_id)
|
||||||
|
|
||||||
|
请求示例(ask):
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"question": "怎么开具发票?",
|
||||||
|
"topK": 5
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.3 商城订单分析(按租户/按天)
|
||||||
|
|
||||||
|
- `POST /api/ai/analytics/query`:返回按天指标数据
|
||||||
|
- `POST /api/ai/analytics/ask`:基于指标数据生成分析结论
|
||||||
|
|
||||||
|
请求示例(ask):
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"question": "最近30天支付率有没有明显下滑?请给出原因排查建议。",
|
||||||
|
"startDate": "2026-02-01",
|
||||||
|
"endDate": "2026-02-27"
|
||||||
|
}
|
||||||
|
```
|
||||||
200
src/api/ai/backend.ts
Normal file
200
src/api/ai/backend.ts
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult } from '@/api';
|
||||||
|
import { API_BASE_URL, TOKEN_HEADER_NAME } from '@/config/setting';
|
||||||
|
import { getToken } from '@/utils/token-util';
|
||||||
|
import { getHostname, getTenantId } from '@/utils/domain';
|
||||||
|
import { getMerchantId } from '@/utils/merchant';
|
||||||
|
|
||||||
|
export interface AiModel {
|
||||||
|
name?: string;
|
||||||
|
id?: string;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AiChatRequest {
|
||||||
|
prompt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeBaseURL(baseURL: string) {
|
||||||
|
return baseURL.replace(/\/+$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep consistent with `src/utils/request.ts` but usable from `fetch` for SSE.
|
||||||
|
function getRuntimeApiBaseURL(): string {
|
||||||
|
try {
|
||||||
|
const apiUrl = localStorage.getItem('ApiUrl');
|
||||||
|
if (apiUrl) return normalizeBaseURL(apiUrl);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return normalizeBaseURL(API_BASE_URL || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildAuthHeaders(): Record<string, string> {
|
||||||
|
const headers: Record<string, string> = {};
|
||||||
|
const token = getToken();
|
||||||
|
if (token) headers[TOKEN_HEADER_NAME] = token;
|
||||||
|
|
||||||
|
// Mirror axios interceptor behavior; add fallbacks to make localhost dev usable.
|
||||||
|
const tenantId =
|
||||||
|
getTenantId() ?? (localStorage.getItem('TenantId') || undefined);
|
||||||
|
if (tenantId) headers.TenantId = String(tenantId);
|
||||||
|
|
||||||
|
const companyId = localStorage.getItem('CompanyId');
|
||||||
|
if (companyId) headers.CompanyId = companyId;
|
||||||
|
|
||||||
|
const merchantId = getMerchantId?.();
|
||||||
|
if (merchantId) headers.MerchantId = String(merchantId);
|
||||||
|
|
||||||
|
const domain = getHostname?.();
|
||||||
|
if (domain) headers.Domain = domain;
|
||||||
|
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractText(payload: unknown): string {
|
||||||
|
if (payload == null) return '';
|
||||||
|
if (typeof payload === 'string') return payload;
|
||||||
|
if (typeof payload === 'number' || typeof payload === 'boolean') {
|
||||||
|
return String(payload);
|
||||||
|
}
|
||||||
|
if (Array.isArray(payload)) return payload.map(extractText).join('');
|
||||||
|
if (typeof payload === 'object') {
|
||||||
|
const obj: any = payload;
|
||||||
|
const candidates: unknown[] = [
|
||||||
|
obj.text,
|
||||||
|
obj.answer,
|
||||||
|
obj.content,
|
||||||
|
obj.data,
|
||||||
|
obj.message?.content,
|
||||||
|
obj.delta?.content,
|
||||||
|
obj.choices?.[0]?.delta?.content,
|
||||||
|
obj.choices?.[0]?.message?.content
|
||||||
|
];
|
||||||
|
for (const c of candidates) {
|
||||||
|
const t = extractText(c);
|
||||||
|
if (t) return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeModels(payload: unknown): AiModel[] {
|
||||||
|
if (!payload) return [];
|
||||||
|
if (Array.isArray(payload)) {
|
||||||
|
return payload.map((m) =>
|
||||||
|
typeof m === 'string' ? ({ name: m } as AiModel) : (m as AiModel)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (typeof payload === 'object') {
|
||||||
|
const obj: any = payload;
|
||||||
|
if (Array.isArray(obj.models)) {
|
||||||
|
return obj.models.map((m: any) =>
|
||||||
|
typeof m === 'string' ? ({ name: m } as AiModel) : (m as AiModel)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端 AI 模块:GET /api/ai/models
|
||||||
|
* 前端 baseURL 一般已包含 `/api`,因此这里用相对路径 `/ai/models`。
|
||||||
|
*/
|
||||||
|
export async function aiListModels(): Promise<unknown> {
|
||||||
|
const res = await request.get<ApiResult<unknown>>('/ai/models');
|
||||||
|
if (res.data.code === 0) return res.data.data;
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端 AI 模块:POST /api/ai/chat
|
||||||
|
*/
|
||||||
|
export async function aiChat(body: AiChatRequest): Promise<string> {
|
||||||
|
const res = await request.post<ApiResult<unknown>>('/ai/chat', body);
|
||||||
|
if (res.data.code === 0) return extractText(res.data.data);
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端 AI 模块:POST /api/ai/chat/stream(SSE)
|
||||||
|
* 用 fetch 以便读取 ReadableStream,并附带鉴权/租户头。
|
||||||
|
*/
|
||||||
|
export async function aiChatStream(
|
||||||
|
body: AiChatRequest,
|
||||||
|
opts: {
|
||||||
|
signal?: AbortSignal;
|
||||||
|
onDelta: (text: string) => void;
|
||||||
|
onDone?: () => void;
|
||||||
|
}
|
||||||
|
): Promise<void> {
|
||||||
|
const baseURL = getRuntimeApiBaseURL();
|
||||||
|
const url = `${baseURL}/ai/chat/stream`;
|
||||||
|
|
||||||
|
const res = await fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Accept: 'text/event-stream',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
...buildAuthHeaders()
|
||||||
|
},
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
signal: opts.signal
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok || !res.body) {
|
||||||
|
const text = await res.text().catch(() => '');
|
||||||
|
throw new Error(
|
||||||
|
`aiChatStream failed: ${res.status} ${res.statusText}${
|
||||||
|
text ? ` - ${text}` : ''
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const reader = res.body.getReader();
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
let buffer = '';
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
const { value, done } = await reader.read();
|
||||||
|
if (done) break;
|
||||||
|
buffer += decoder.decode(value, { stream: true });
|
||||||
|
// Some servers use CRLF; normalize to simplify parsing.
|
||||||
|
buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
||||||
|
|
||||||
|
// SSE events are separated by blank lines.
|
||||||
|
let idx = buffer.indexOf('\n\n');
|
||||||
|
while (idx !== -1) {
|
||||||
|
const rawEvent = buffer.slice(0, idx);
|
||||||
|
buffer = buffer.slice(idx + 2);
|
||||||
|
idx = buffer.indexOf('\n\n');
|
||||||
|
|
||||||
|
const dataParts: string[] = [];
|
||||||
|
for (const line of rawEvent.split('\n')) {
|
||||||
|
const trimmed = line.trimStart();
|
||||||
|
if (!trimmed.startsWith('data:')) continue;
|
||||||
|
dataParts.push(trimmed.slice(5).trimStart());
|
||||||
|
}
|
||||||
|
if (!dataParts.length) continue;
|
||||||
|
|
||||||
|
const data = dataParts.join('\n').trim();
|
||||||
|
if (!data) continue;
|
||||||
|
if (data === '[DONE]') {
|
||||||
|
opts.onDone?.();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let delta = '';
|
||||||
|
try {
|
||||||
|
delta = extractText(JSON.parse(data));
|
||||||
|
} catch {
|
||||||
|
// Some servers stream plain text without JSON.
|
||||||
|
delta = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delta) opts.onDelta(delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
opts.onDone?.();
|
||||||
|
}
|
||||||
208
src/api/cms/customerLead/index.ts
Normal file
208
src/api/cms/customerLead/index.ts
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import {
|
||||||
|
CustomerLead,
|
||||||
|
CustomerLeadParam,
|
||||||
|
LeadDispatchParam,
|
||||||
|
LeadFollowParam,
|
||||||
|
LeadDispatch,
|
||||||
|
LeadFollowLog,
|
||||||
|
LeadStatistics,
|
||||||
|
SalesmanStats
|
||||||
|
} from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询客资列表
|
||||||
|
*/
|
||||||
|
export async function pageCustomerLead(params: CustomerLeadParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<CustomerLead>>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/page',
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客资详情
|
||||||
|
*/
|
||||||
|
export async function getCustomerLeadDetail(leadId: number) {
|
||||||
|
const res = await request.get<ApiResult<CustomerLead>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/detail/' + leadId
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建客资(管理员录入)
|
||||||
|
*/
|
||||||
|
export async function createCustomerLead(data: CustomerLead) {
|
||||||
|
const res = await request.post<ApiResult<CustomerLead>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/create',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新客资信息
|
||||||
|
*/
|
||||||
|
export async function updateCustomerLead(data: CustomerLead) {
|
||||||
|
const res = await request.put<ApiResult<boolean>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/update',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新客资状态
|
||||||
|
*/
|
||||||
|
export async function updateCustomerLeadStatus(
|
||||||
|
leadId: number,
|
||||||
|
status: number,
|
||||||
|
remarks?: string
|
||||||
|
) {
|
||||||
|
const res = await request.put<ApiResult<boolean>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/status/' + leadId,
|
||||||
|
{ status, remarks }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 派单给业务员
|
||||||
|
*/
|
||||||
|
export async function dispatchLead(data: LeadDispatchParam) {
|
||||||
|
const res = await request.post<ApiResult<boolean>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/dispatch',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量派单
|
||||||
|
*/
|
||||||
|
export async function batchDispatchLeads(data: LeadDispatchParam) {
|
||||||
|
const res = await request.post<ApiResult<{ successCount: number; failCount: number; errors: string[] }>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/dispatch/batch',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加跟进记录
|
||||||
|
*/
|
||||||
|
export async function addLeadFollowLog(data: LeadFollowParam) {
|
||||||
|
const res = await request.post<ApiResult<boolean>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/follow',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取跟进历史
|
||||||
|
*/
|
||||||
|
export async function getLeadFollowHistory(leadId: number) {
|
||||||
|
const res = await request.get<ApiResult<LeadFollowLog[]>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/follow/history/' + leadId
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取统计数据
|
||||||
|
*/
|
||||||
|
export async function getLeadStatistics(params: CustomerLeadParam) {
|
||||||
|
const res = await request.get<ApiResult<LeadStatistics>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/statistics',
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出客资数据
|
||||||
|
*/
|
||||||
|
export async function exportCustomerLeads(params: CustomerLeadParam) {
|
||||||
|
const res = await request.get<ApiResult<Record<string, unknown>[]>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/export',
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取未分配客资列表
|
||||||
|
*/
|
||||||
|
export async function getUnassignedLeads() {
|
||||||
|
const res = await request.get<ApiResult<CustomerLead[]>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/unassigned'
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取业务员客资统计
|
||||||
|
*/
|
||||||
|
export async function getSalesmanLeadStats(salesmanId: number) {
|
||||||
|
const res = await request.get<ApiResult<SalesmanStats>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/salesman/stats/' + salesmanId
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取派单历史
|
||||||
|
*/
|
||||||
|
export async function getLeadDispatchHistory(leadId: number) {
|
||||||
|
const res = await request.get<ApiResult<LeadDispatch[]>>(
|
||||||
|
MODULES_API_URL + '/customer/lead/dispatch/history/' + leadId
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
174
src/api/cms/customerLead/model.ts
Normal file
174
src/api/cms/customerLead/model.ts
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
/**
|
||||||
|
* 客资管理模块 - 类型定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** 客资状态枚举 */
|
||||||
|
export const LeadStatusOptions = [
|
||||||
|
{ label: '待跟进', value: 0, color: 'warning' },
|
||||||
|
{ label: '跟进中', value: 1, color: 'primary' },
|
||||||
|
{ label: '已成交', value: 2, color: 'success' },
|
||||||
|
{ label: '无效', value: 3, color: 'info' }
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 客资来源类型 */
|
||||||
|
export const LeadSourceOptions = [
|
||||||
|
{ label: '表单', value: 'form' },
|
||||||
|
{ label: '网站', value: 'website' },
|
||||||
|
{ label: '小程序', value: 'miniapp' },
|
||||||
|
{ label: '推荐人', value: 'referral' },
|
||||||
|
{ label: '管理员录入', value: 'admin' }
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 跟进方式 */
|
||||||
|
export const FollowTypeOptions = [
|
||||||
|
{ label: '电话', value: 1 },
|
||||||
|
{ label: '微信', value: 2 },
|
||||||
|
{ label: '上门', value: 3 },
|
||||||
|
{ label: '短信', value: 4 },
|
||||||
|
{ label: '其他', value: 5 }
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 派单类型 */
|
||||||
|
export const DispatchTypeOptions = [
|
||||||
|
{ label: '新分配', value: 1 },
|
||||||
|
{ label: '重新分配', value: 2 },
|
||||||
|
{ label: '抢单', value: 3 }
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 客资实体 */
|
||||||
|
export interface CustomerLead {
|
||||||
|
leadId?: number;
|
||||||
|
name?: string;
|
||||||
|
phone?: string;
|
||||||
|
company?: string;
|
||||||
|
delivery?: string;
|
||||||
|
need?: string;
|
||||||
|
source?: string;
|
||||||
|
sourceType?: string;
|
||||||
|
ip?: string;
|
||||||
|
status?: number;
|
||||||
|
statusText?: string;
|
||||||
|
remarks?: string;
|
||||||
|
assignedUserId?: number;
|
||||||
|
assignedUserName?: string;
|
||||||
|
assignedRealName?: string;
|
||||||
|
assignedUserPhone?: string;
|
||||||
|
referrerUserId?: number;
|
||||||
|
referrerName?: string;
|
||||||
|
referrerPhone?: string;
|
||||||
|
referralFee?: number;
|
||||||
|
referralFeePaid?: number;
|
||||||
|
referralFeePaidText?: string;
|
||||||
|
referrerShare?: number;
|
||||||
|
dispatchTime?: string;
|
||||||
|
dispatchAdminId?: number;
|
||||||
|
dispatchAdminName?: string;
|
||||||
|
followCount?: number;
|
||||||
|
lastFollowTime?: string;
|
||||||
|
appointmentTime?: string;
|
||||||
|
dealAmount?: number;
|
||||||
|
dealTime?: string;
|
||||||
|
createTime?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 客资查询参数 */
|
||||||
|
export interface CustomerLeadParam {
|
||||||
|
leadId?: number;
|
||||||
|
name?: string;
|
||||||
|
phone?: string;
|
||||||
|
company?: string;
|
||||||
|
need?: string;
|
||||||
|
assignedUserId?: number;
|
||||||
|
dispatchRemarks?: string;
|
||||||
|
status?: number;
|
||||||
|
remarks?: string;
|
||||||
|
appointmentTime?: string;
|
||||||
|
dealAmount?: number;
|
||||||
|
sourceType?: string;
|
||||||
|
startDate?: string;
|
||||||
|
endDate?: string;
|
||||||
|
statusList?: string;
|
||||||
|
salesmanId?: number;
|
||||||
|
referrerId?: number;
|
||||||
|
keyword?: string;
|
||||||
|
pageNum?: number;
|
||||||
|
pageSize?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 派单请求参数 */
|
||||||
|
export interface LeadDispatchParam {
|
||||||
|
leadId?: number;
|
||||||
|
toUserId?: number;
|
||||||
|
remarks?: string;
|
||||||
|
dispatchType?: number;
|
||||||
|
leadIds?: number[];
|
||||||
|
batchMode?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跟进记录参数 */
|
||||||
|
export interface LeadFollowParam {
|
||||||
|
leadId?: number;
|
||||||
|
followType?: number;
|
||||||
|
followContent?: string;
|
||||||
|
nextFollowTime?: string;
|
||||||
|
nextFollowPlan?: string;
|
||||||
|
attachmentUrls?: string;
|
||||||
|
updateStatus?: boolean;
|
||||||
|
newStatus?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 派单记录 */
|
||||||
|
export interface LeadDispatch {
|
||||||
|
dispatchId?: number;
|
||||||
|
leadId?: number;
|
||||||
|
fromUserId?: number;
|
||||||
|
toUserId?: number;
|
||||||
|
toUserName?: string;
|
||||||
|
adminId?: number;
|
||||||
|
adminName?: string;
|
||||||
|
dispatchRemarks?: string;
|
||||||
|
dispatchType?: number;
|
||||||
|
dispatchTypeText?: string;
|
||||||
|
leadCustomerName?: string;
|
||||||
|
leadCustomerPhone?: string;
|
||||||
|
createTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跟进记录 */
|
||||||
|
export interface LeadFollowLog {
|
||||||
|
followId?: number;
|
||||||
|
leadId?: number;
|
||||||
|
userId?: number;
|
||||||
|
userName?: string;
|
||||||
|
followType?: number;
|
||||||
|
followTypeText?: string;
|
||||||
|
followContent?: string;
|
||||||
|
nextFollowTime?: string;
|
||||||
|
nextFollowPlan?: string;
|
||||||
|
attachmentUrls?: string;
|
||||||
|
customerName?: string;
|
||||||
|
customerPhone?: string;
|
||||||
|
createTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 统计数据 */
|
||||||
|
export interface LeadStatistics {
|
||||||
|
totalLeads?: number;
|
||||||
|
newLeads?: number;
|
||||||
|
assignedLeads?: number;
|
||||||
|
followedLeads?: number;
|
||||||
|
dealedLeads?: number;
|
||||||
|
dealAmount?: number;
|
||||||
|
referralCount?: number;
|
||||||
|
referralFee?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 业务员统计 */
|
||||||
|
export interface SalesmanStats {
|
||||||
|
total?: number;
|
||||||
|
pending?: number;
|
||||||
|
following?: number;
|
||||||
|
dealed?: number;
|
||||||
|
invalid?: number;
|
||||||
|
}
|
||||||
@@ -2,41 +2,26 @@
|
|||||||
import { computed, onBeforeUnmount, ref } from 'vue';
|
import { computed, onBeforeUnmount, ref } from 'vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
listOllamaModels,
|
aiChat,
|
||||||
ollamaChat,
|
aiChatStream,
|
||||||
ollamaChatStream,
|
aiListModels,
|
||||||
type OllamaChatMessage
|
normalizeModels
|
||||||
} from '@/api/ai/ollama';
|
} from '@/api/ai/backend';
|
||||||
|
|
||||||
type Msg = OllamaChatMessage;
|
|
||||||
|
|
||||||
// Hardcode endpoint to avoid going through mp.websoft.top `/proxy`.
|
|
||||||
// The API methods append `/api/*` paths.
|
|
||||||
//
|
|
||||||
// IMPORTANT: do not use `127.0.0.1` in browser production builds:
|
|
||||||
// it points to the visitor's machine, not your server.
|
|
||||||
// If you want to use server-local Ollama (`127.0.0.1:11434`), put it behind an HTTPS reverse proxy
|
|
||||||
// (e.g. `https://ai-api.websoft.top` or same-origin `/proxy`).
|
|
||||||
const BASE_URL = 'https://ai-api.websoft.top';
|
|
||||||
|
|
||||||
const modelLoading = ref(false);
|
const modelLoading = ref(false);
|
||||||
const models = ref<Array<{ id: string; name?: string }>>([]);
|
const models = ref<Array<{ id: string; name?: string }>>([]);
|
||||||
const modelId = ref<string>('');
|
const modelId = ref<string>('');
|
||||||
|
|
||||||
const systemPrompt = ref<string>('你是一个有帮助的助手。');
|
|
||||||
const userPrompt = ref<string>('你好,介绍一下你能做什么。');
|
const userPrompt = ref<string>('你好,介绍一下你能做什么。');
|
||||||
|
|
||||||
const temperature = ref<number>(0.7);
|
|
||||||
const stream = ref<boolean>(true);
|
const stream = ref<boolean>(true);
|
||||||
|
|
||||||
const sending = ref(false);
|
const sending = ref(false);
|
||||||
const assistantText = ref<string>('');
|
const assistantText = ref<string>('');
|
||||||
const errorText = ref<string>('');
|
const errorText = ref<string>('');
|
||||||
|
|
||||||
const history = ref<Msg[]>([]);
|
|
||||||
|
|
||||||
const canSend = computed(() => {
|
const canSend = computed(() => {
|
||||||
return !!modelId.value && !!userPrompt.value.trim() && !sending.value;
|
return !!userPrompt.value.trim() && !sending.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const abortController = ref<AbortController | null>(null);
|
const abortController = ref<AbortController | null>(null);
|
||||||
@@ -51,13 +36,14 @@
|
|||||||
modelLoading.value = true;
|
modelLoading.value = true;
|
||||||
errorText.value = '';
|
errorText.value = '';
|
||||||
try {
|
try {
|
||||||
const res = await listOllamaModels({
|
const res = await aiListModels();
|
||||||
baseURL: BASE_URL
|
const ms = normalizeModels(res);
|
||||||
});
|
models.value = ms
|
||||||
models.value = (res.models ?? []).map((m) => ({
|
.map((m) => ({
|
||||||
id: m.name,
|
id: String(m.name ?? m.id ?? ''),
|
||||||
name: m.name
|
name: String(m.name ?? m.id ?? '')
|
||||||
}));
|
}))
|
||||||
|
.filter((m) => !!m.id);
|
||||||
if (!modelId.value && models.value.length) {
|
if (!modelId.value && models.value.length) {
|
||||||
modelId.value = models.value[0].id;
|
modelId.value = models.value[0].id;
|
||||||
}
|
}
|
||||||
@@ -70,7 +56,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const clearChat = () => {
|
const clearChat = () => {
|
||||||
history.value = [];
|
|
||||||
assistantText.value = '';
|
assistantText.value = '';
|
||||||
errorText.value = '';
|
errorText.value = '';
|
||||||
};
|
};
|
||||||
@@ -82,27 +67,16 @@
|
|||||||
assistantText.value = '';
|
assistantText.value = '';
|
||||||
errorText.value = '';
|
errorText.value = '';
|
||||||
|
|
||||||
const system: Msg = { role: 'system', content: systemPrompt.value.trim() };
|
const prompt = userPrompt.value.trim();
|
||||||
const user: Msg = { role: 'user', content: userPrompt.value.trim() };
|
|
||||||
const messages: Msg[] = [
|
|
||||||
...(system.content ? [system] : []),
|
|
||||||
...history.value,
|
|
||||||
user
|
|
||||||
];
|
|
||||||
|
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
abortController.value = controller;
|
abortController.value = controller;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (stream.value) {
|
if (stream.value) {
|
||||||
await ollamaChatStream(
|
await aiChatStream(
|
||||||
|
{ prompt },
|
||||||
{
|
{
|
||||||
model: modelId.value,
|
|
||||||
messages,
|
|
||||||
options: { temperature: temperature.value }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
baseURL: BASE_URL,
|
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
onDelta: (t) => {
|
onDelta: (t) => {
|
||||||
assistantText.value += t;
|
assistantText.value += t;
|
||||||
@@ -110,30 +84,15 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const res = await ollamaChat(
|
// axios 已在拦截器里自动带上 token/tenant
|
||||||
{
|
assistantText.value = await aiChat({ prompt });
|
||||||
model: modelId.value,
|
|
||||||
messages,
|
|
||||||
options: { temperature: temperature.value }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
baseURL: BASE_URL,
|
|
||||||
signal: controller.signal
|
|
||||||
}
|
|
||||||
);
|
|
||||||
assistantText.value = res.message?.content ?? '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
history.value = [
|
|
||||||
...messages,
|
|
||||||
{ role: 'assistant', content: assistantText.value }
|
|
||||||
];
|
|
||||||
userPrompt.value = '';
|
userPrompt.value = '';
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
// Abort is expected when clicking "Stop".
|
// Abort is expected when clicking "Stop".
|
||||||
if (e?.name !== 'AbortError') {
|
if (e?.name !== 'AbortError') {
|
||||||
errorText.value = e?.message ?? String(e);
|
errorText.value = e?.message ?? String(e);
|
||||||
message.error('请求失败(可能是 CORS 或鉴权问题)');
|
message.error('请求失败(可能是后端未启动 / 鉴权 / 租户头缺失)');
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
sending.value = false;
|
sending.value = false;
|
||||||
@@ -184,13 +143,6 @@
|
|||||||
>
|
>
|
||||||
<span>流式</span>
|
<span>流式</span>
|
||||||
<a-switch v-model:checked="stream" />
|
<a-switch v-model:checked="stream" />
|
||||||
<span>温度</span>
|
|
||||||
<a-input-number
|
|
||||||
v-model:value="temperature"
|
|
||||||
:min="0"
|
|
||||||
:max="2"
|
|
||||||
:step="0.1"
|
|
||||||
/>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|||||||
797
src/views/cms/customerLead/index.vue
Normal file
797
src/views/cms/customerLead/index.vue
Normal file
@@ -0,0 +1,797 @@
|
|||||||
|
<template>
|
||||||
|
<div class="customer-lead-container">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<div class="search-form">
|
||||||
|
<el-form :inline="true" :model="searchForm" class="search-form-inline">
|
||||||
|
<el-form-item label="关键词">
|
||||||
|
<el-input v-model="searchForm.keyword" placeholder="姓名/电话/公司" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-select v-model="searchForm.status" placeholder="请选择" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in LeadStatusOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="来源">
|
||||||
|
<el-select v-model="searchForm.sourceType" placeholder="请选择" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in LeadSourceOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="业务员">
|
||||||
|
<el-select v-model="searchForm.salesmanId" placeholder="请选择" clearable filterable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in salesmanList"
|
||||||
|
:key="item.userId"
|
||||||
|
:label="item.nickname || item.realName"
|
||||||
|
:value="item.userId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dateRange"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
@change="handleDateChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 统计卡片 -->
|
||||||
|
<div class="statistics-cards">
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="stat-card">
|
||||||
|
<div class="stat-value">{{ statistics.total || 0 }}</div>
|
||||||
|
<div class="stat-label">总客资</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="stat-card warning">
|
||||||
|
<div class="stat-value">{{ statistics.pending || 0 }}</div>
|
||||||
|
<div class="stat-label">待跟进</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="stat-card success">
|
||||||
|
<div class="stat-value">{{ statistics.dealed || 0 }}</div>
|
||||||
|
<div class="stat-label">已成交</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<div class="stat-card primary">
|
||||||
|
<div class="stat-value">¥{{ statistics.dealAmount || 0 }}</div>
|
||||||
|
<div class="stat-label">成交金额</div>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<div class="toolbar-left">
|
||||||
|
<el-button type="primary" @click="handleCreate">新增客资</el-button>
|
||||||
|
<el-button type="success" @click="handleBatchDispatch">批量派单</el-button>
|
||||||
|
<el-button @click="handleExport">导出数据</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="toolbar-right">
|
||||||
|
<el-checkbox v-model="showAssigned" @change="handleShowAssignedChange">只看未分配</el-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableData"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column prop="leadId" label="ID" width="80" />
|
||||||
|
<el-table-column prop="name" label="客户姓名" min-width="100" />
|
||||||
|
<el-table-column prop="phone" label="联系电话" width="130" />
|
||||||
|
<el-table-column prop="company" label="公司名称" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="need" label="需求描述" min-width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="status" label="状态" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag :type="getStatusType(row.status)">{{ row.statusText }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="sourceType" label="来源" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ getSourceText(row.sourceType) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="assignedUserName" label="业务员" width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.assignedUserName">{{ row.assignedUserName }}</span>
|
||||||
|
<el-tag v-else type="info" size="small">待分配</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="followCount" label="跟进次数" width="90" align="center" />
|
||||||
|
<el-table-column prop="dealAmount" label="成交金额" width="110">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.dealAmount">¥{{ row.dealAmount }}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间" width="170" />
|
||||||
|
<el-table-column label="操作" width="280" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button link type="primary" size="small" @click="handleDetail(row)">详情</el-button>
|
||||||
|
<el-button link type="primary" size="small" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
<el-button link type="success" size="small" @click="handleDispatch(row)">派单</el-button>
|
||||||
|
<el-button link type="warning" size="small" @click="handleFollow(row)">跟进</el-button>
|
||||||
|
<el-button link type="danger" size="small" @click="handleDelete(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="pagination.pageNum"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:total="pagination.total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handlePageChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 新增/编辑弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="dialogVisible"
|
||||||
|
:title="dialogTitle"
|
||||||
|
width="600px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
||||||
|
<el-form-item label="客户姓名" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入客户姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系电话" prop="phone">
|
||||||
|
<el-input v-model="formData.phone" placeholder="请输入联系电话" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公司名称">
|
||||||
|
<el-input v-model="formData.company" placeholder="请输入公司名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="需求描述">
|
||||||
|
<el-input v-model="formData.need" type="textarea" :rows="3" placeholder="请输入需求描述" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分配业务员">
|
||||||
|
<el-select v-model="formData.assignedUserId" placeholder="请选择业务员" clearable filterable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in salesmanList"
|
||||||
|
:key="item.userId"
|
||||||
|
:label="item.nickname || item.realName"
|
||||||
|
:value="item.userId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="formData.remarks" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 详情弹窗 -->
|
||||||
|
<el-dialog v-model="detailVisible" title="客资详情" width="800px">
|
||||||
|
<el-descriptions :column="2" border>
|
||||||
|
<el-descriptions-item label="客户姓名">{{ currentRow?.name }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="联系电话">{{ currentRow?.phone }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="公司名称">{{ currentRow?.company || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="状态">
|
||||||
|
<el-tag :type="getStatusType(currentRow?.status)">{{ currentRow?.statusText }}</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="来源">{{ getSourceText(currentRow?.sourceType) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="分配业务员">{{ currentRow?.assignedUserName || '待分配' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="推荐人">{{ currentRow?.referrerName || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="跟进次数">{{ currentRow?.followCount || 0 }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="成交金额">¥{{ currentRow?.dealAmount || 0 }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="预约时间">{{ currentRow?.appointmentTime || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="需求描述" :span="2">{{ currentRow?.need || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注" :span="2">{{ currentRow?.remarks || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="创建时间">{{ currentRow?.createTime }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="派单时间">{{ currentRow?.dispatchTime || '-' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<!-- 跟进记录 -->
|
||||||
|
<div class="follow-history">
|
||||||
|
<h4>跟进记录</h4>
|
||||||
|
<el-timeline v-if="followHistory.length > 0">
|
||||||
|
<el-timeline-item
|
||||||
|
v-for="item in followHistory"
|
||||||
|
:key="item.followId"
|
||||||
|
:timestamp="item.createTime"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<el-card>
|
||||||
|
<p><strong>{{ item.followTypeText }}</strong> - {{ item.userName }}</p>
|
||||||
|
<p>{{ item.followContent }}</p>
|
||||||
|
<p v-if="item.nextFollowTime" class="next-follow">下次跟进:{{ item.nextFollowTime }} - {{ item.nextFollowPlan }}</p>
|
||||||
|
</el-card>
|
||||||
|
</el-timeline-item>
|
||||||
|
</el-timeline>
|
||||||
|
<el-empty v-else description="暂无跟进记录" />
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 派单弹窗 -->
|
||||||
|
<el-dialog v-model="dispatchVisible" title="派单" width="500px">
|
||||||
|
<el-form ref="dispatchFormRef" :model="dispatchForm" :rules="dispatchRules" label-width="100px">
|
||||||
|
<el-form-item label="选择业务员" prop="toUserId">
|
||||||
|
<el-select v-model="dispatchForm.toUserId" placeholder="请选择业务员" filterable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in salesmanList"
|
||||||
|
:key="item.userId"
|
||||||
|
:label="item.nickname || item.realName"
|
||||||
|
:value="item.userId"
|
||||||
|
>
|
||||||
|
<span>{{ item.nickname || item.realName }}</span>
|
||||||
|
<span class="lead-count"> ({{ item.leadCount || 0 }}个客资)</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="派单备注">
|
||||||
|
<el-input v-model="dispatchForm.remarks" type="textarea" :rows="3" placeholder="请输入派单备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="dispatchVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleDispatchSubmit">确定派单</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 跟进弹窗 -->
|
||||||
|
<el-dialog v-model="followVisible" title="添加跟进记录" width="600px">
|
||||||
|
<el-form ref="followFormRef" :model="followForm" :rules="followRules" label-width="100px">
|
||||||
|
<el-form-item label="跟进方式" prop="followType">
|
||||||
|
<el-radio-group v-model="followForm.followType">
|
||||||
|
<el-radio v-for="item in FollowTypeOptions" :key="item.value" :label="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="跟进内容" prop="followContent">
|
||||||
|
<el-input v-model="followForm.followContent" type="textarea" :rows="4" placeholder="请输入跟进内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下次跟进时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="followForm.nextFollowTime"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="选择日期时间"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下次跟进计划">
|
||||||
|
<el-input v-model="followForm.nextFollowPlan" type="textarea" :rows="2" placeholder="请输入下次跟进计划" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="更新状态">
|
||||||
|
<el-switch v-model="followForm.updateStatus" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="followForm.updateStatus" label="新状态">
|
||||||
|
<el-select v-model="followForm.newStatus" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in LeadStatusOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="followVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleFollowSubmit">保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
|
import type { FormInstance, FormRules } from 'element-plus';
|
||||||
|
import {
|
||||||
|
pageCustomerLead,
|
||||||
|
getCustomerLeadDetail,
|
||||||
|
createCustomerLead,
|
||||||
|
updateCustomerLead,
|
||||||
|
updateCustomerLeadStatus,
|
||||||
|
dispatchLead,
|
||||||
|
batchDispatchLeads,
|
||||||
|
addLeadFollowLog,
|
||||||
|
getLeadFollowHistory,
|
||||||
|
getLeadStatistics
|
||||||
|
} from '@/api/cms/customerLead';
|
||||||
|
import {
|
||||||
|
CustomerLead,
|
||||||
|
CustomerLeadParam,
|
||||||
|
LeadDispatchParam,
|
||||||
|
LeadFollowParam,
|
||||||
|
LeadStatusOptions,
|
||||||
|
LeadSourceOptions,
|
||||||
|
FollowTypeOptions
|
||||||
|
} from '@/api/cms/customerLead/model';
|
||||||
|
import { listUser } from '@/api/system/user';
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const tableData = ref<CustomerLead[]>([]);
|
||||||
|
const selectedRows = ref<CustomerLead[]>([]);
|
||||||
|
const statistics = ref<Record<string, number>>({});
|
||||||
|
const salesmanList = ref<any[]>([]);
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const searchForm = reactive<CustomerLeadParam>({
|
||||||
|
keyword: '',
|
||||||
|
status: undefined,
|
||||||
|
sourceType: '',
|
||||||
|
salesmanId: undefined,
|
||||||
|
startDate: '',
|
||||||
|
endDate: ''
|
||||||
|
});
|
||||||
|
const dateRange = ref<string[]>([]);
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
const pagination = reactive({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
// 弹窗状态
|
||||||
|
const dialogVisible = ref(false);
|
||||||
|
const detailVisible = ref(false);
|
||||||
|
const dispatchVisible = ref(false);
|
||||||
|
const followVisible = ref(false);
|
||||||
|
const dialogTitle = ref('新增客资');
|
||||||
|
const isEdit = ref(false);
|
||||||
|
|
||||||
|
// 当前行数据
|
||||||
|
const currentRow = ref<CustomerLead | null>(null);
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const formData = reactive<CustomerLead>({
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
company: '',
|
||||||
|
need: '',
|
||||||
|
assignedUserId: undefined,
|
||||||
|
remarks: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
const formRules: FormRules = {
|
||||||
|
name: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }],
|
||||||
|
phone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 派单表单
|
||||||
|
const dispatchForm = reactive<LeadDispatchParam>({
|
||||||
|
leadId: undefined,
|
||||||
|
toUserId: undefined,
|
||||||
|
remarks: ''
|
||||||
|
});
|
||||||
|
const dispatchFormRef = ref<FormInstance>();
|
||||||
|
const dispatchRules: FormRules = {
|
||||||
|
toUserId: [{ required: true, message: '请选择业务员', trigger: 'change' }]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跟进表单
|
||||||
|
const followForm = reactive<LeadFollowParam>({
|
||||||
|
leadId: undefined,
|
||||||
|
followType: 1,
|
||||||
|
followContent: '',
|
||||||
|
nextFollowTime: '',
|
||||||
|
nextFollowPlan: '',
|
||||||
|
updateStatus: false,
|
||||||
|
newStatus: undefined
|
||||||
|
});
|
||||||
|
const followFormRef = ref<FormInstance>();
|
||||||
|
const followRules: FormRules = {
|
||||||
|
followType: [{ required: true, message: '请选择跟进方式', trigger: 'change' }],
|
||||||
|
followContent: [{ required: true, message: '请输入跟进内容', trigger: 'blur' }]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跟进历史
|
||||||
|
const followHistory = ref<any[]>([]);
|
||||||
|
|
||||||
|
// 显示选项
|
||||||
|
const showAssigned = ref(false);
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
|
async function loadData() {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...searchForm,
|
||||||
|
pageNum: pagination.pageNum,
|
||||||
|
pageSize: pagination.pageSize
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await pageCustomerLead(params);
|
||||||
|
tableData.value = result.list;
|
||||||
|
pagination.total = result.total;
|
||||||
|
|
||||||
|
// 如果选中只看未分配,筛选
|
||||||
|
if (showAssigned.value) {
|
||||||
|
tableData.value = tableData.value.filter(item => !item.assignedUserId);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '加载数据失败');
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载统计数据
|
||||||
|
async function loadStatistics() {
|
||||||
|
try {
|
||||||
|
const result = await getLeadStatistics({});
|
||||||
|
statistics.value = result.basic || {};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载统计数据失败', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载业务员列表
|
||||||
|
async function loadSalesmanList() {
|
||||||
|
try {
|
||||||
|
const result = await listUser({ type: 1, pageSize: 100 });
|
||||||
|
salesmanList.value = result.list || [];
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载业务员列表失败', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
function handleSearch() {
|
||||||
|
pagination.pageNum = 1;
|
||||||
|
loadData();
|
||||||
|
loadStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
function handleReset() {
|
||||||
|
Object.assign(searchForm, {
|
||||||
|
keyword: '',
|
||||||
|
status: undefined,
|
||||||
|
sourceType: '',
|
||||||
|
salesmanId: undefined,
|
||||||
|
startDate: '',
|
||||||
|
endDate: ''
|
||||||
|
});
|
||||||
|
dateRange.value = [];
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 日期选择
|
||||||
|
function handleDateChange(val: string[]) {
|
||||||
|
if (val && val.length === 2) {
|
||||||
|
searchForm.startDate = val[0];
|
||||||
|
searchForm.endDate = val[1];
|
||||||
|
} else {
|
||||||
|
searchForm.startDate = '';
|
||||||
|
searchForm.endDate = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handleSizeChange(val: number) {
|
||||||
|
pagination.pageSize = val;
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(val: number) {
|
||||||
|
pagination.pageNum = val;
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择变化
|
||||||
|
function handleSelectionChange(rows: CustomerLead[]) {
|
||||||
|
selectedRows.value = rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取状态类型
|
||||||
|
function getStatusType(status?: number) {
|
||||||
|
const option = LeadStatusOptions.find(item => item.value === status);
|
||||||
|
return option?.color || 'info';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取来源文本
|
||||||
|
function getSourceText(source?: string) {
|
||||||
|
const option = LeadSourceOptions.find(item => item.value === source);
|
||||||
|
return option?.label || source || '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
function handleCreate() {
|
||||||
|
dialogTitle.value = '新增客资';
|
||||||
|
isEdit.value = false;
|
||||||
|
Object.assign(formData, {
|
||||||
|
leadId: undefined,
|
||||||
|
name: '',
|
||||||
|
phone: '',
|
||||||
|
company: '',
|
||||||
|
need: '',
|
||||||
|
assignedUserId: undefined,
|
||||||
|
remarks: ''
|
||||||
|
});
|
||||||
|
dialogVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
async function handleEdit(row: CustomerLead) {
|
||||||
|
dialogTitle.value = '编辑客资';
|
||||||
|
isEdit.value = true;
|
||||||
|
try {
|
||||||
|
const detail = await getCustomerLeadDetail(row.leadId!);
|
||||||
|
Object.assign(formData, detail);
|
||||||
|
dialogVisible.value = true;
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '获取详情失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情
|
||||||
|
async function handleDetail(row: CustomerLead) {
|
||||||
|
currentRow.value = row;
|
||||||
|
try {
|
||||||
|
const detail = await getCustomerLeadDetail(row.leadId!);
|
||||||
|
currentRow.value = detail;
|
||||||
|
followHistory.value = await getLeadFollowHistory(row.leadId!);
|
||||||
|
detailVisible.value = true;
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '获取详情失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
async function handleSubmit() {
|
||||||
|
if (!formRef.value) return;
|
||||||
|
|
||||||
|
await formRef.value.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
if (isEdit.value) {
|
||||||
|
await updateCustomerLead(formData);
|
||||||
|
ElMessage.success('更新成功');
|
||||||
|
} else {
|
||||||
|
await createCustomerLead(formData);
|
||||||
|
ElMessage.success('创建成功');
|
||||||
|
}
|
||||||
|
dialogVisible.value = false;
|
||||||
|
loadData();
|
||||||
|
loadStatistics();
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '操作失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 派单
|
||||||
|
function handleDispatch(row: CustomerLead) {
|
||||||
|
dispatchForm.leadId = row.leadId;
|
||||||
|
dispatchForm.toUserId = undefined;
|
||||||
|
dispatchForm.remarks = '';
|
||||||
|
dispatchVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量派单
|
||||||
|
function handleBatchDispatch() {
|
||||||
|
if (selectedRows.value.length === 0) {
|
||||||
|
ElMessage.warning('请先选择要派单的客资');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatchForm.leadIds = selectedRows.value.map(row => row.leadId!);
|
||||||
|
dispatchForm.batchMode = true;
|
||||||
|
dispatchForm.toUserId = undefined;
|
||||||
|
dispatchForm.remarks = '';
|
||||||
|
dispatchVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交派单
|
||||||
|
async function handleDispatchSubmit() {
|
||||||
|
if (!dispatchFormRef.value) return;
|
||||||
|
|
||||||
|
await dispatchFormRef.value.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
if (dispatchForm.batchMode) {
|
||||||
|
const result = await batchDispatchLeads(dispatchForm);
|
||||||
|
ElMessage.success(`成功派单 ${result.successCount} 条,失败 ${result.failCount} 条`);
|
||||||
|
} else {
|
||||||
|
await dispatchLead(dispatchForm);
|
||||||
|
ElMessage.success('派单成功');
|
||||||
|
}
|
||||||
|
dispatchVisible.value = false;
|
||||||
|
loadData();
|
||||||
|
loadStatistics();
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '派单失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跟进
|
||||||
|
function handleFollow(row: CustomerLead) {
|
||||||
|
followForm.leadId = row.leadId;
|
||||||
|
followForm.followType = 1;
|
||||||
|
followForm.followContent = '';
|
||||||
|
followForm.nextFollowTime = '';
|
||||||
|
followForm.nextFollowPlan = '';
|
||||||
|
followForm.updateStatus = false;
|
||||||
|
followForm.newStatus = undefined;
|
||||||
|
followVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交跟进
|
||||||
|
async function handleFollowSubmit() {
|
||||||
|
if (!followFormRef.value) return;
|
||||||
|
|
||||||
|
await followFormRef.value.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
await addLeadFollowLog(followForm);
|
||||||
|
ElMessage.success('添加跟进成功');
|
||||||
|
followVisible.value = false;
|
||||||
|
loadData();
|
||||||
|
loadStatistics();
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '添加跟进失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function handleDelete(row: CustomerLead) {
|
||||||
|
ElMessageBox.confirm('确定要删除这条客资吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(async () => {
|
||||||
|
// 调用删除接口
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
loadData();
|
||||||
|
loadStatistics();
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
async function handleExport() {
|
||||||
|
try {
|
||||||
|
// 实际项目中调用导出接口
|
||||||
|
ElMessage.info('导出功能开发中...');
|
||||||
|
} catch (error: any) {
|
||||||
|
ElMessage.error(error.message || '导出失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示切换
|
||||||
|
function handleShowAssignedChange() {
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData();
|
||||||
|
loadStatistics();
|
||||||
|
loadSalesmanList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.customer-lead-container {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-form {
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.statistics-cards {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
color: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 14px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.warning {
|
||||||
|
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.primary {
|
||||||
|
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-toolbar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.toolbar-left {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.follow-history {
|
||||||
|
margin-top: 24px;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
padding-top: 16px;
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next-follow {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lead-count {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
const getQrCodeUrl = (userId?: number) => {
|
const getQrCodeUrl = (userId?: number) => {
|
||||||
return `https://mp-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${
|
return `https://cms-api.websoft.top/api/wx-login/getOrderQRCodeUnlimited/uid_${
|
||||||
userId ?? ''
|
userId ?? ''
|
||||||
}`;
|
}`;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user