init: 橘视厅酒店版会员系统前端
This commit is contained in:
55
src/api/manage/activationCode.ts
Normal file
55
src/api/manage/activationCode.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import http from '@/utils/httpRequest'
|
||||
import type { ManageResponse } from './types'
|
||||
|
||||
// ===================== 天卡设备激活码 =====================
|
||||
|
||||
/** 激活码实体 */
|
||||
export interface ActivationCodeItem {
|
||||
id: number
|
||||
/** 激活码(5位字符,如 7A3FK) */
|
||||
code: string
|
||||
/** 渠道组织ID */
|
||||
channelOrgId: number
|
||||
/** 门店组织ID */
|
||||
storeOrgId: number
|
||||
/** 状态:ACTIVE-启用 / DISABLED-禁用 */
|
||||
status: 'ACTIVE' | 'DISABLED'
|
||||
/** 最大可激活设备数(0=不限) */
|
||||
maxDeviceCount: number
|
||||
/** 已激活设备数 */
|
||||
activatedCount: number
|
||||
/** 备注 */
|
||||
remark: string | null
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
/** 生成激活码请求体 */
|
||||
export interface ActivationCodeGenerateBody {
|
||||
storeOrgId: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/** 按门店查询激活码列表(GET /manage/daycard/activation-code/list/{storeOrgId}) */
|
||||
export function getActivationCodeList (storeOrgId: number): Promise<ManageResponse<{ list: ActivationCodeItem[] }>> {
|
||||
return http.get(http.adornUrl(`/manage/daycard/activation-code/list/${storeOrgId}`), { params: http.adornParams() }).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 为门店生成激活码(每门店一个,已存在则返回已有的) */
|
||||
export function generateActivationCode (data: ActivationCodeGenerateBody): Promise<ManageResponse<ActivationCodeItem>> {
|
||||
return http.post(http.adornUrl('/manage/daycard/activation-code/generate'), http.adornData(data)).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 重新生成激活码(旧码失效) */
|
||||
export function regenerateActivationCode (id: number): Promise<ManageResponse<{ code: string }>> {
|
||||
return http.post(http.adornUrl(`/manage/daycard/activation-code/${id}/regenerate`), http.adornData({})).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 启用/禁用激活码(PUT /manage/daycard/activation-code/{id}/status) */
|
||||
export function updateActivationCodeStatus (id: number, status: 'ACTIVE' | 'DISABLED'): Promise<ManageResponse> {
|
||||
return http.put(http.adornUrl(`/manage/daycard/activation-code/${id}/status`), http.adornData({ status })).then(res => res.data)
|
||||
}
|
||||
|
||||
/** 删除激活码(软删除) */
|
||||
export function deleteActivationCode (id: number): Promise<ManageResponse> {
|
||||
return http.delete(http.adornUrl(`/manage/daycard/activation-code/${id}`)).then(res => res.data)
|
||||
}
|
||||
Reference in New Issue
Block a user