customer.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * 客户管理相关API
  3. * 复用后端 UserController 接口
  4. */
  5. import { get, put } from '@/utils/request';
  6. export interface CustomerQueryParams {
  7. page?: number;
  8. pageSize?: number;
  9. phone?: string;
  10. nickname?: string;
  11. status?: number;
  12. }
  13. export interface CustomerListResponse {
  14. list: any[];
  15. total: number;
  16. pageSize: number;
  17. currentPage: number;
  18. }
  19. /**
  20. * 获取客户列表
  21. */
  22. export async function getCustomerList(params: CustomerQueryParams = {}): Promise<CustomerListResponse> {
  23. return get('/users/list', params);
  24. }
  25. /**
  26. * 获取客户详情
  27. */
  28. export async function getCustomerDetail(id: string): Promise<any> {
  29. return get(`/users/${id}`);
  30. }
  31. /**
  32. * 获取客户统计数据
  33. */
  34. export async function getCustomerStatistics(): Promise<any> {
  35. return get('/users/statistics');
  36. }
  37. /**
  38. * 更新客户状态
  39. */
  40. export async function updateCustomerStatus(id: string, status: number): Promise<any> {
  41. return put(`/users/${id}/status`, { status });
  42. }
  43. /**
  44. * 更新客户信用分
  45. */
  46. export async function updateCustomerCredit(id: string, creditScore: number): Promise<any> {
  47. return put(`/users/${id}/credit`, { creditScore });
  48. }