fetch(add): 账户管理
This commit is contained in:
65
src/api/modules/customerAccount.ts
Normal file
65
src/api/modules/customerAccount.ts
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user