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,65 @@
/**
* 客户账号管理 API
*/
import { BaseService } from '../BaseService'
import type { BaseResponse } from '@/types/api'
import type {
CustomerAccountItem,
CustomerAccountPageResult,
CustomerAccountQueryParams,
CreateCustomerAccountParams,
UpdateCustomerAccountParams,
UpdateCustomerAccountPasswordParams,
UpdateCustomerAccountStatusParams
} from '@/types/api/customerAccount'
export class CustomerAccountService extends BaseService {
/**
* 查询客户账号列表
*/
static getCustomerAccounts(
params?: CustomerAccountQueryParams
): Promise<BaseResponse<CustomerAccountPageResult>> {
return this.get<BaseResponse<CustomerAccountPageResult>>('/api/admin/customer-accounts', params)
}
/**
* 新增代理商账号
*/
static createCustomerAccount(
data: CreateCustomerAccountParams
): Promise<BaseResponse<CustomerAccountItem>> {
return this.post<BaseResponse<CustomerAccountItem>>('/api/admin/customer-accounts', data)
}
/**
* 编辑账号
*/
static updateCustomerAccount(
id: number,
data: UpdateCustomerAccountParams
): Promise<BaseResponse<CustomerAccountItem>> {
return this.put<BaseResponse<CustomerAccountItem>>(`/api/admin/customer-accounts/${id}`, data)
}
/**
* 修改账号密码
*/
static updateCustomerAccountPassword(
id: number,
data: UpdateCustomerAccountPasswordParams
): Promise<BaseResponse> {
return this.put<BaseResponse>(`/api/admin/customer-accounts/${id}/password`, data)
}
/**
* 修改账号状态
*/
static updateCustomerAccountStatus(
id: number,
data: UpdateCustomerAccountStatusParams
): Promise<BaseResponse> {
return this.put<BaseResponse>(`/api/admin/customer-accounts/${id}/status`, data)
}
}