将单套餐分配和套餐系列分配改成代理系列授权
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m23s

This commit is contained in:
sexygoat
2026-03-04 17:22:47 +08:00
parent 237eeed87a
commit 08d5043b3f
14 changed files with 2367 additions and 2654 deletions

View File

@@ -23,8 +23,7 @@ export { DeviceService } from './device'
export { CarrierService } from './carrier'
export { PackageSeriesService } from './packageSeries'
export { PackageManageService } from './packageManage'
export { ShopPackageAllocationService } from './shopPackageAllocation'
export { ShopSeriesAllocationService } from './shopSeriesAllocation'
export { ShopSeriesGrantService } from './shopSeriesGrant'
export { OrderService } from './order'
// TODO: 按需添加其他业务模块

View File

@@ -1,104 +0,0 @@
/**
* 单套餐分配 API 服务
*/
import { BaseService } from '../BaseService'
import type {
ShopPackageAllocationResponse,
ShopPackageAllocationQueryParams,
CreateShopPackageAllocationRequest,
UpdateShopPackageAllocationRequest,
UpdateShopPackageAllocationStatusRequest,
BaseResponse,
PaginationResponse
} from '@/types/api'
export class ShopPackageAllocationService extends BaseService {
/**
* 获取单套餐分配列表
* GET /api/admin/shop-package-allocations
* @param params 查询参数
*/
static getShopPackageAllocations(
params?: ShopPackageAllocationQueryParams
): Promise<PaginationResponse<ShopPackageAllocationResponse>> {
return this.getPage<ShopPackageAllocationResponse>(
'/api/admin/shop-package-allocations',
params
)
}
/**
* 创建单套餐分配
* POST /api/admin/shop-package-allocations
* @param data 分配数据
*/
static createShopPackageAllocation(
data: CreateShopPackageAllocationRequest
): Promise<BaseResponse<ShopPackageAllocationResponse>> {
return this.create<ShopPackageAllocationResponse>('/api/admin/shop-package-allocations', data)
}
/**
* 获取单套餐分配详情
* GET /api/admin/shop-package-allocations/{id}
* @param id 分配ID
*/
static getShopPackageAllocationDetail(
id: number
): Promise<BaseResponse<ShopPackageAllocationResponse>> {
return this.getOne<ShopPackageAllocationResponse>(`/api/admin/shop-package-allocations/${id}`)
}
/**
* 更新单套餐分配
* PUT /api/admin/shop-package-allocations/{id}
* @param id 分配ID
* @param data 分配数据(只允许修改成本价)
*/
static updateShopPackageAllocation(
id: number,
data: UpdateShopPackageAllocationRequest
): Promise<BaseResponse<ShopPackageAllocationResponse>> {
return this.update<ShopPackageAllocationResponse>(
`/api/admin/shop-package-allocations/${id}`,
data
)
}
/**
* 删除单套餐分配
* DELETE /api/admin/shop-package-allocations/{id}
* @param id 分配ID
*/
static deleteShopPackageAllocation(id: number): Promise<BaseResponse> {
return this.remove(`/api/admin/shop-package-allocations/${id}`)
}
/**
* 更新单套餐分配成本价
* PUT /api/admin/shop-package-allocations/{id}/cost-price
* @param id 分配ID
* @param costPrice 成本价(分)
*/
static updateShopPackageAllocationCostPrice(
id: number,
costPrice: number
): Promise<BaseResponse<ShopPackageAllocationResponse>> {
return this.put<BaseResponse<ShopPackageAllocationResponse>>(
`/api/admin/shop-package-allocations/${id}/cost-price`,
{ cost_price: costPrice }
)
}
/**
* 更新单套餐分配状态
* PUT /api/admin/shop-package-allocations/{id}/status
* @param id 分配ID
* @param status 状态 (1:启用, 2:禁用)
*/
static updateShopPackageAllocationStatus(id: number, status: number): Promise<BaseResponse> {
const data: UpdateShopPackageAllocationStatusRequest = { status }
return this.put<BaseResponse>(`/api/admin/shop-package-allocations/${id}/status`, data)
}
}

View File

@@ -1,85 +0,0 @@
/**
* 套餐系列分配 API 服务
*/
import { BaseService } from '../BaseService'
import type {
ShopSeriesAllocationResponse,
ShopSeriesAllocationQueryParams,
CreateShopSeriesAllocationRequest,
UpdateShopSeriesAllocationRequest,
UpdateShopSeriesAllocationStatusRequest,
BaseResponse,
PaginationResponse
} from '@/types/api'
export class ShopSeriesAllocationService extends BaseService {
/**
* 获取套餐系列分配分页列表
* GET /api/admin/shop-series-allocations
* @param params 查询参数
*/
static getShopSeriesAllocations(
params?: ShopSeriesAllocationQueryParams
): Promise<PaginationResponse<ShopSeriesAllocationResponse>> {
return this.getPage<ShopSeriesAllocationResponse>('/api/admin/shop-series-allocations', params)
}
/**
* 创建套餐系列分配
* POST /api/admin/shop-series-allocations
* @param data 分配数据
*/
static createShopSeriesAllocation(
data: CreateShopSeriesAllocationRequest
): Promise<BaseResponse<ShopSeriesAllocationResponse>> {
return this.create<ShopSeriesAllocationResponse>('/api/admin/shop-series-allocations', data)
}
/**
* 获取套餐系列分配详情
* GET /api/admin/shop-series-allocations/{id}
* @param id 分配ID
*/
static getShopSeriesAllocationDetail(
id: number
): Promise<BaseResponse<ShopSeriesAllocationResponse>> {
return this.getOne<ShopSeriesAllocationResponse>(`/api/admin/shop-series-allocations/${id}`)
}
/**
* 更新套餐系列分配
* PUT /api/admin/shop-series-allocations/{id}
* @param id 分配ID
* @param data 分配数据
*/
static updateShopSeriesAllocation(
id: number,
data: UpdateShopSeriesAllocationRequest
): Promise<BaseResponse<ShopSeriesAllocationResponse>> {
return this.update<ShopSeriesAllocationResponse>(
`/api/admin/shop-series-allocations/${id}`,
data
)
}
/**
* 删除套餐系列分配
* DELETE /api/admin/shop-series-allocations/{id}
* @param id 分配ID
*/
static deleteShopSeriesAllocation(id: number): Promise<BaseResponse> {
return this.remove(`/api/admin/shop-series-allocations/${id}`)
}
/**
* 更新套餐系列分配状态
* PUT /api/admin/shop-series-allocations/{id}/status
* @param id 分配ID
* @param status 状态 (1:启用, 2:禁用)
*/
static updateShopSeriesAllocationStatus(id: number, status: number): Promise<BaseResponse> {
const data: UpdateShopSeriesAllocationStatusRequest = { status }
return this.put<BaseResponse>(`/api/admin/shop-series-allocations/${id}/status`, data)
}
}

View File

@@ -0,0 +1,90 @@
/**
* 代理系列授权 API 服务
*/
import { BaseService } from '../BaseService'
import type {
ShopSeriesGrantResponse,
ShopSeriesGrantQueryParams,
CreateShopSeriesGrantRequest,
UpdateShopSeriesGrantRequest,
ManageGrantPackagesRequest,
BaseResponse,
PaginationResponse
} from '@/types/api'
export class ShopSeriesGrantService extends BaseService {
/**
* 获取代理系列授权分页列表
* GET /api/admin/shop-series-grants
* @param params 查询参数
*/
static getShopSeriesGrants(
params?: ShopSeriesGrantQueryParams
): Promise<PaginationResponse<ShopSeriesGrantResponse>> {
return this.getPage<ShopSeriesGrantResponse>('/api/admin/shop-series-grants', params)
}
/**
* 创建代理系列授权
* POST /api/admin/shop-series-grants
* @param data 授权数据
*/
static createShopSeriesGrant(
data: CreateShopSeriesGrantRequest
): Promise<BaseResponse<ShopSeriesGrantResponse>> {
return this.create<ShopSeriesGrantResponse>('/api/admin/shop-series-grants', data)
}
/**
* 获取代理系列授权详情
* GET /api/admin/shop-series-grants/{id}
* @param id 授权ID
*/
static getShopSeriesGrantDetail(
id: number
): Promise<BaseResponse<ShopSeriesGrantResponse>> {
return this.getOne<ShopSeriesGrantResponse>(`/api/admin/shop-series-grants/${id}`)
}
/**
* 更新代理系列授权
* PUT /api/admin/shop-series-grants/{id}
* @param id 授权ID
* @param data 授权数据
*/
static updateShopSeriesGrant(
id: number,
data: UpdateShopSeriesGrantRequest
): Promise<BaseResponse<ShopSeriesGrantResponse>> {
return this.update<ShopSeriesGrantResponse>(
`/api/admin/shop-series-grants/${id}`,
data
)
}
/**
* 删除代理系列授权
* DELETE /api/admin/shop-series-grants/{id}
* @param id 授权ID
*/
static deleteShopSeriesGrant(id: number): Promise<BaseResponse> {
return this.remove(`/api/admin/shop-series-grants/${id}`)
}
/**
* 管理代理系列授权的套餐
* PUT /api/admin/shop-series-grants/{id}/packages
* @param id 授权ID
* @param data 套餐管理数据
*/
static manageGrantPackages(
id: number,
data: ManageGrantPackagesRequest
): Promise<BaseResponse<ShopSeriesGrantResponse>> {
return this.put<BaseResponse<ShopSeriesGrantResponse>>(
`/api/admin/shop-series-grants/${id}/packages`,
data
)
}
}