fetch(add): 账户管理

This commit is contained in:
sexygoat
2026-01-23 17:18:24 +08:00
parent 339abca4c0
commit b53fea43c6
93 changed files with 7094 additions and 3153 deletions

View File

@@ -0,0 +1,66 @@
/**
* 企业客户管理 API
*/
import { BaseService } from '../BaseService'
import type { BaseResponse } from '@/types/api'
import type {
EnterpriseItem,
EnterprisePageResult,
EnterpriseQueryParams,
CreateEnterpriseParams,
UpdateEnterpriseParams,
UpdateEnterprisePasswordParams,
UpdateEnterpriseStatusParams,
CreateEnterpriseResponse
} from '@/types/api/enterprise'
export class EnterpriseService extends BaseService {
/**
* 查询企业客户列表
*/
static getEnterprises(
params?: EnterpriseQueryParams
): Promise<BaseResponse<EnterprisePageResult>> {
return this.get<BaseResponse<EnterprisePageResult>>('/api/admin/enterprises', params)
}
/**
* 新增企业客户
*/
static createEnterprise(
data: CreateEnterpriseParams
): Promise<BaseResponse<CreateEnterpriseResponse>> {
return this.post<BaseResponse<CreateEnterpriseResponse>>('/api/admin/enterprises', data)
}
/**
* 编辑企业信息
*/
static updateEnterprise(
id: number,
data: UpdateEnterpriseParams
): Promise<BaseResponse<EnterpriseItem>> {
return this.put<BaseResponse<EnterpriseItem>>(`/api/admin/enterprises/${id}`, data)
}
/**
* 修改企业账号密码
*/
static updateEnterprisePassword(
id: number,
data: UpdateEnterprisePasswordParams
): Promise<BaseResponse> {
return this.put<BaseResponse>(`/api/admin/enterprises/${id}/password`, data)
}
/**
* 启用/禁用企业
*/
static updateEnterpriseStatus(
id: number,
data: UpdateEnterpriseStatusParams
): Promise<BaseResponse> {
return this.put<BaseResponse>(`/api/admin/enterprises/${id}/status`, data)
}
}