台球开关台小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

196 lines
4.6 KiB

/**
* 开台/关台/扫码相关类型定义
* 对应新版接口(磁力开台):
* - GET /api/v2/magdev/qrcode 扫码获取台桌信息
* - POST /api/v2/magdev/peroperate 去开台(预检)
* - POST /api/v2/magdev/operate 开台/关台/续费/关灯重开/分享等统一操作
* - GET /api/v2/magdev/getopstatus 查询开台结果
* 旧版 /api/v2/TablesDev/* 系列接口已废弃,相关类型与方法已移除,
* 具体操作请求参数见 src/types/magdev.ts 的 OperateRequestDto。
*/
/**
* 操作类型枚举
* 注意:余额开台通过 ctrlType=DepositStart + payType=Balance 组合实现
*/
export enum CtrlType {
/** 分享球台 / 取消分享(toggle) */
Share = 0,
/** 押金开台(余额开台时配合 payType=Balance 使用) */
DepositStart = 1,
/** 定时开台 */
TimedStart = 2,
/** 信用开台 */
CreditStart = 3,
/** 团购券开台 */
CouponStart = 4,
/** 立即关台 */
ImmediateClose = 5,
/** 续费 */
Renew = 6,
/** 关灯重开 */
TurnOffRestart = 7,
/** 替人付费关台 */
PayForOthersClose = 8,
/** AA制付款关台(棋牌室场景,台球暂未接入) */
AaPayClose = 9,
/** 打开存杆柜(存杆柜场景,暂未接入) */
OpenLocker = 10,
/** 打开棋牌室(开台过程中有人中途加入,暂未接入) */
OpenChessRoom = 11,
}
/**
* 支付方式枚举
*/
export enum PayType {
/** 微信支付 */
WechatPay = 1,
/** 支付宝 */
Alipay = 2,
/** 银联支付 */
UnionPay = 3,
/** 余额支付 */
Balance = 4,
/** 银行卡支付 */
BankCard = 5,
}
/**
* 微信支付参数
*/
export interface WechatPayParameters {
/** 时间戳 */
timeStamp: string
/** 随机字符串 */
nonceStr: string
/** 统一下单接口返回的 prepay_id */
package: string
/** 签名方式 */
signType: string
/** 签名 */
paySign: string
}
// ─── 获取开台信息接口相关类型(GET /api/v2/magdev/qrcode)──────────────────
/**
* 分时价格
*/
export interface TimePriceDto {
startTime: string
endTime: string
price: number
description: string
}
/**
* 价格信息
*/
export interface PriceInfoDto {
/** 标准价格(元/小时) */
standard: number
/** 会员价格 */
memberPrice: number
/** 价格单位 */
unit: string
/** 押金 */
deposit: number
/** 每分钟价格 */
pricePerMinute: number
/** 会员每分钟价格 */
memberPricePerMinute: number
/** 当前时段适用价格 */
currentPrice: number
/** 计价规则说明 */
descript: string
/** 价格时段说明 */
pricePeriod: string
/** 分时价格列表 */
timePrices: TimePriceDto[]
}
/**
* 球台设备信息
*/
export interface TableInfoDto {
id: number
sn: string
name: string
tableNumber: string
status: number
statusDescription: string
isShared: boolean
currentSession: string
area: string
chanNum: number
startChan: number
}
/**
* 开台方式选项
*/
export interface OptionDto {
title: string
/** 开台类型(对应 CtrlType 枚举值) */
type: number
description: string
actionText: string
refundPolicy: string
/** 是否可用(false 时显示为禁用) */
available: boolean
optionCode: number
icon: string
condition: string
actionUrl: string
}
/**
* 当前开台订单信息
*/
export interface OpInfoDto {
/** 操作记录 ID */
opId: number
orderNo: string
startTime: string
/** 已消费时长(后端已格式化,如"2小时30分钟") */
usedTime: string
usedMinutes: number
ctrlType: number
ctrlTypeDescription: string
payType: number
payTypeDescription: string
/** 已消费金额 */
currentAmount: number
/** 押金金额 */
deposit: number
/** 押金状态描述 */
depositStatus: string
/** 优惠金额 */
discountAmount: number
/** 应付金额 */
payableAmount: number
}
/**
* 扫码获取开台信息响应(对应 data 字段)
*/
export interface TableScanResponseDto {
/** open-可开台;close-已开台需关台 */
scanType: 'open' | 'close'
/** 是否本人开台,默认 true;false 表示扫的是别人正在使用的台(关台页需展示"帮他付款/AA制付款") */
isOwner: boolean
shopName: string
shopCode: string
instSn: string
/** 店长/门店联系电话(来自 qrcode.phone) */
phone: string
tableInfo: TableInfoDto
price: PriceInfoDto
businessHours: string
openOptions: OptionDto[]
recommendedOption: string
scanTime: string
/** 已开台时有值,可开台时为 null */
opInfo: OpInfoDto | null
}