新增
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m7s

This commit is contained in:
sexygoat
2026-03-19 18:32:02 +08:00
parent 407287f538
commit f06d8c9133
22 changed files with 2260 additions and 117 deletions

View File

@@ -381,4 +381,28 @@ export class CardService extends BaseService {
`/api/admin/iot-cards/${iccid}/realname-link`
)
}
/**
* 启用 IoT 卡
* @param id IoT卡ID
*/
static enableIotCard(id: number): Promise<BaseResponse> {
return this.post<BaseResponse>(`/api/admin/iot-cards/${id}/enable`, {})
}
/**
* 停用 IoT 卡
* @param id IoT卡ID
*/
static disableIotCard(id: number): Promise<BaseResponse> {
return this.post<BaseResponse>(`/api/admin/iot-cards/${id}/disable`, {})
}
/**
* 手动停用 IoT 卡
* @param id IoT卡ID
*/
static deactivateIotCard(id: number): Promise<BaseResponse> {
return this.patch<BaseResponse>(`/api/admin/iot-cards/${id}/deactivate`, {})
}
}

View File

@@ -230,4 +230,12 @@ export class DeviceService extends BaseService {
data
)
}
/**
* 手动停用设备
* @param id 设备ID
*/
static deactivateDevice(id: number): Promise<BaseResponse> {
return this.patch<BaseResponse>(`/api/admin/devices/${id}/deactivate`, {})
}
}

129
src/api/modules/exchange.ts Normal file
View File

@@ -0,0 +1,129 @@
/**
* 换货管理 API 服务
*/
import { BaseService } from '../BaseService'
import type { BaseResponse, PaginationResponse } from '@/types/api'
// 换货单查询参数
export interface ExchangeQueryParams {
page?: number
page_size?: number
status?: number // 换货状态
identifier?: string // 资产标识符(模糊匹配)
created_at_start?: string // 创建时间起始
created_at_end?: string // 创建时间结束
}
// 创建换货单请求
export interface CreateExchangeRequest {
exchange_reason: string // 换货原因
old_asset_type: string // 旧资产类型 (iot_card 或 device)
old_identifier: string // 旧资产标识符(ICCID/虚拟号/IMEI/SN)
remark?: string // 备注(可选)
}
// 换货单响应
export interface ExchangeResponse {
id: number
exchange_no: string
exchange_reason: string
old_asset_type: string
old_asset_identifier: string
new_asset_type: string
new_asset_identifier: string
status: number // 换货状态1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)
status_text: string
recipient_name?: string
recipient_phone?: string
recipient_address?: string
express_company?: string
express_no?: string
remark?: string
created_at: string
updated_at: string
}
// 换货发货请求
export interface ShipExchangeRequest {
express_company: string // 快递公司
express_no: string // 快递单号
migrate_data: boolean // 是否迁移数据
new_identifier: string // 新资产标识符(ICCID/虚拟号/IMEI/SN)
}
// 取消换货请求
export interface CancelExchangeRequest {
remark?: string // 取消备注(可选)
}
export class ExchangeService extends BaseService {
/**
* 获取换货单列表
* GET /api/admin/exchanges
* @param params 查询参数
*/
static getExchanges(
params?: ExchangeQueryParams
): Promise<BaseResponse<{ list: ExchangeResponse[]; page: number; page_size: number; total: number }>> {
return this.get<
BaseResponse<{ list: ExchangeResponse[]; page: number; page_size: number; total: number }>
>('/api/admin/exchanges', params)
}
/**
* 创建换货单
* POST /api/admin/exchanges
* @param data 创建参数
*/
static createExchange(data: CreateExchangeRequest): Promise<BaseResponse<ExchangeResponse>> {
return this.create<ExchangeResponse>('/api/admin/exchanges', data)
}
/**
* 获取换货单详情
* GET /api/admin/exchanges/{id}
* @param id 换货单ID
*/
static getExchangeDetail(id: number): Promise<BaseResponse<ExchangeResponse>> {
return this.getOne<ExchangeResponse>(`/api/admin/exchanges/${id}`)
}
/**
* 取消换货
* POST /api/admin/exchanges/{id}/cancel
* @param id 换货单ID
* @param data 取消参数
*/
static cancelExchange(id: number, data?: CancelExchangeRequest): Promise<BaseResponse> {
return this.post<BaseResponse>(`/api/admin/exchanges/${id}/cancel`, data || {})
}
/**
* 确认换货完成
* POST /api/admin/exchanges/{id}/complete
* @param id 换货单ID
*/
static completeExchange(id: number): Promise<BaseResponse> {
return this.post<BaseResponse>(`/api/admin/exchanges/${id}/complete`, {})
}
/**
* 旧资产转新
* POST /api/admin/exchanges/{id}/renew
* @param id 换货单ID
*/
static renewExchange(id: number): Promise<BaseResponse> {
return this.post<BaseResponse>(`/api/admin/exchanges/${id}/renew`, {})
}
/**
* 换货发货
* POST /api/admin/exchanges/{id}/ship
* @param id 换货单ID
* @param data 发货参数
*/
static shipExchange(id: number, data: ShipExchangeRequest): Promise<BaseResponse<ExchangeResponse>> {
return this.post<BaseResponse<ExchangeResponse>>(`/api/admin/exchanges/${id}/ship`, data)
}
}

View File

@@ -28,6 +28,7 @@ export { OrderService } from './order'
export { AssetService } from './asset'
export { AgentRechargeService } from './agentRecharge'
export { WechatConfigService } from './wechatConfig'
export { ExchangeService } from './exchange'
// TODO: 按需添加其他业务模块
// export { SettingService } from './setting'

View File

@@ -87,4 +87,14 @@ export class PackageManageService extends BaseService {
const data: UpdatePackageShelfStatusRequest = { shelf_status }
return this.patch<BaseResponse>(`/api/admin/packages/${id}/shelf`, data)
}
/**
* 修改套餐零售价(代理)
* PATCH /api/admin/packages/{id}/retail-price
* @param id 套餐ID
* @param retail_price 零售价(分)
*/
static updateRetailPrice(id: number, retail_price: number): Promise<BaseResponse> {
return this.patch<BaseResponse>(`/api/admin/packages/${id}/retail-price`, { retail_price })
}
}