2026-07-26 12:54:46 +08:00
|
|
|
|
import http from '@/utils/httpRequest'
|
|
|
|
|
|
import type { ManageListResponse, ManageResponse, ManagePageParams } from './types'
|
|
|
|
|
|
|
|
|
|
|
|
// ===================== 天卡池 =====================
|
|
|
|
|
|
|
|
|
|
|
|
/** 天卡池实体 */
|
|
|
|
|
|
export interface DayCardPoolItem {
|
|
|
|
|
|
id: number
|
|
|
|
|
|
/** 卡密(橘视厅激活码) */
|
|
|
|
|
|
cardCode: string
|
|
|
|
|
|
/** 第三方引用标识(橘视厅免密登录 uid) */
|
|
|
|
|
|
thirdPartyRef: string
|
|
|
|
|
|
/** 第三方卡号(D + 24位随机,App 用于访问内容) */
|
|
|
|
|
|
thirdCardNo: string
|
|
|
|
|
|
cardType: string
|
|
|
|
|
|
partnerId: number
|
|
|
|
|
|
/** 状态: UNUSED / RESERVED / USED */
|
|
|
|
|
|
status: string
|
|
|
|
|
|
/** 激活状态: PENDING / SUCCESS / FAILED */
|
|
|
|
|
|
activateStatus: string
|
|
|
|
|
|
activateError: string | null
|
|
|
|
|
|
activatedAt: string | null
|
|
|
|
|
|
orderNo: string | null
|
|
|
|
|
|
deviceId: number | null
|
|
|
|
|
|
importBatchId: number | null
|
|
|
|
|
|
expireAt: string | null
|
|
|
|
|
|
usedAt: string | null
|
|
|
|
|
|
createdAt: string
|
|
|
|
|
|
updatedAt: string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 卡池列表参数 */
|
|
|
|
|
|
export interface DayCardPoolListParams extends ManagePageParams {
|
|
|
|
|
|
partnerId?: number
|
|
|
|
|
|
status?: string
|
|
|
|
|
|
cardCode?: string
|
|
|
|
|
|
orderNo?: string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 卡池统计 */
|
|
|
|
|
|
export interface DayCardPoolStats {
|
|
|
|
|
|
total: number
|
|
|
|
|
|
available: number
|
|
|
|
|
|
reserved: number
|
|
|
|
|
|
used: number
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 导入卡密请求 */
|
|
|
|
|
|
export interface DayCardPoolImportData {
|
|
|
|
|
|
partnerId: number
|
|
|
|
|
|
cardCodes: string[]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 导入卡密响应 */
|
|
|
|
|
|
export interface DayCardPoolImportResult {
|
|
|
|
|
|
successCount: number
|
|
|
|
|
|
totalCount: number
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 导入批次 */
|
|
|
|
|
|
export interface DayCardImportBatch {
|
|
|
|
|
|
id: number
|
|
|
|
|
|
batchNo: string
|
|
|
|
|
|
partnerId: number
|
|
|
|
|
|
status: string
|
|
|
|
|
|
totalCount: number
|
|
|
|
|
|
successCount: number
|
|
|
|
|
|
failCount: number
|
|
|
|
|
|
remark: string | null
|
|
|
|
|
|
createdAt: string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取天卡池列表 */
|
|
|
|
|
|
export function getDayCardPoolList (params?: DayCardPoolListParams): Promise<ManageListResponse<DayCardPoolItem>> {
|
|
|
|
|
|
return http.get(http.adornUrl('/manage/daycard/pool/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取卡池统计 */
|
|
|
|
|
|
export function getDayCardPoolStats (partnerId?: number): Promise<ManageResponse<{ stats?: DayCardPoolStats }>> {
|
|
|
|
|
|
return http.get(http.adornUrl('/manage/daycard/pool/stats'), { params: http.adornParams({ partnerId }) }).then(res => res.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 导入卡密 */
|
|
|
|
|
|
export function importDayCardPool (data: DayCardPoolImportData): Promise<ManageResponse<DayCardPoolImportResult>> {
|
|
|
|
|
|
return http.post(http.adornUrl('/manage/daycard/pool/import'), http.adornData(data)).then(res => res.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===================== 天卡订单 =====================
|
|
|
|
|
|
|
|
|
|
|
|
/** 天卡订单实体 */
|
|
|
|
|
|
export interface DayCardOrderItem {
|
|
|
|
|
|
id: number
|
|
|
|
|
|
orderNo: string
|
|
|
|
|
|
partnerId: number
|
|
|
|
|
|
deviceId: number
|
|
|
|
|
|
storeOrgId: number
|
|
|
|
|
|
channelOrgId: number
|
|
|
|
|
|
/** 卡号(值为 DayCardPoolEntity.cardCode) */
|
|
|
|
|
|
cardNo: string | null
|
|
|
|
|
|
/** 订单状态: CREATED / PAYING / PAID / PAY_FAILED / CANCELLED */
|
|
|
|
|
|
status: string
|
|
|
|
|
|
amount: number
|
|
|
|
|
|
/** 支付渠道: WECHAT 等 */
|
|
|
|
|
|
payChannel: string | null
|
|
|
|
|
|
/** 微信支付二维码链接 */
|
|
|
|
|
|
codeUrl: string | null
|
|
|
|
|
|
payNo: string | null
|
|
|
|
|
|
payAmount: number | null
|
|
|
|
|
|
payTime: string | null
|
|
|
|
|
|
expireTime: string | null
|
|
|
|
|
|
cancelTime: string | null
|
|
|
|
|
|
createdAt: string
|
|
|
|
|
|
updatedAt: string
|
|
|
|
|
|
/** 非表字段 */
|
|
|
|
|
|
partnerName?: string
|
|
|
|
|
|
deviceMac?: string
|
2026-08-01 14:48:22 +08:00
|
|
|
|
/** 设备MAC(deviceMac 为空时用此字段) */
|
|
|
|
|
|
mac?: string
|
|
|
|
|
|
deviceSn?: string
|
|
|
|
|
|
agentOrgId?: number
|
|
|
|
|
|
/** 组织路径快照 */
|
|
|
|
|
|
orgPathSnapshot?: string
|
|
|
|
|
|
channelOrderNo?: string
|
2026-07-26 12:54:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 订单列表参数 */
|
|
|
|
|
|
export interface DayCardOrderListParams extends ManagePageParams {
|
|
|
|
|
|
partnerId?: number
|
|
|
|
|
|
orderNo?: string
|
|
|
|
|
|
status?: string
|
|
|
|
|
|
startDate?: string
|
|
|
|
|
|
endDate?: string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取订单列表 */
|
|
|
|
|
|
export function getDayCardOrderList (params?: DayCardOrderListParams): Promise<ManageListResponse<DayCardOrderItem>> {
|
|
|
|
|
|
return http.get(http.adornUrl('/manage/daycard/list'), { params: http.adornParams(params || {}) }).then(res => res.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取订单详情 */
|
|
|
|
|
|
export function getDayCardOrderInfo (orderNo: string): Promise<ManageResponse<{ order?: DayCardOrderItem }>> {
|
|
|
|
|
|
return http.get(http.adornUrl(`/manage/daycard/info/${orderNo}`), { params: http.adornParams() }).then(res => res.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===================== 设备权益 =====================
|
|
|
|
|
|
|
|
|
|
|
|
/** 设备天卡权益 */
|
|
|
|
|
|
export interface DeviceBenefits {
|
|
|
|
|
|
hasBenefits: boolean
|
|
|
|
|
|
thirdCardNo?: string
|
|
|
|
|
|
cardCode?: string
|
|
|
|
|
|
expireAt?: string
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 查询设备天卡权益 */
|
|
|
|
|
|
export function getDeviceBenefits (deviceId: number): Promise<ManageResponse<DeviceBenefits>> {
|
|
|
|
|
|
return http.get(http.adornUrl(`/manage/daycard/benefits/${deviceId}`), { params: http.adornParams() }).then(res => res.data)
|
|
|
|
|
|
}
|