fetch(add): 订单管理-企业设备
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m30s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m30s
This commit is contained in:
109
src/api/modules/shopPackageAllocation.ts
Normal file
109
src/api/modules/shopPackageAllocation.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 单套餐分配 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user