台球开关台小程序
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.
 
 

374 lines
9.3 KiB

/**
* 开台操作相关类型定义
* 对应接口:/api/v2/TablesDev/start_device
*/
/**
* 操作类型枚举
* 注意:余额开台通过 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,
}
/**
* 支付方式枚举
*/
export enum PayType {
/** 微信支付 */
WechatPay = 1,
/** 支付宝 */
Alipay = 2,
/** 银联支付 */
UnionPay = 3,
/** 余额支付 */
Balance = 4,
/** 银行卡支付 */
BankCard = 5,
}
/**
* 开台请求参数
*/
export interface StartGroupDevRequestDto {
/** 设备编码(必填) */
grpSn: string
/** OpenId(必填) */
openId: string
/** 操作类型:押金开台(1)、定时开台(2)、信用开台(3)、团购券开台(4)、立即关台(5)、续费(6)、关灯重开(7)、替人付费关台(8) */
ctrlType?: CtrlType
/** 消费金额 */
amount?: number
/** 支付方式:微信支付(1)、支付宝(2)、银联支付(3)、余额支付(4)、银行卡支付(5) */
payType?: PayType
/** 交易类型:1-JSAPI/小程序、2-Native扫码、3-APP、4-付款码、5-H5、6-刷脸、7-小程序支付 */
tradeType?: number
/** 开台时长(小时),定时开台使用 */
durationHours?: number
/** 团购券码,团购券开台使用 */
couponCode?: string
/** 备注 */
remark?: string
/** 附加数据(JSON格式) */
attach?: string
}
/**
* 微信支付参数
*/
export interface WechatPayParameters {
/** 时间戳 */
timeStamp: string
/** 随机字符串 */
nonceStr: string
/** 统一下单接口返回的 prepay_id */
package: string
/** 签名方式 */
signType: string
/** 签名 */
paySign: string
}
/**
* 支付响应数据(嵌套在 StartDeviceResponse 中)
*/
export interface PaymentResponseDto {
/** 商户订单号 */
outTradeNo: string
/** 支付渠道:1-微信、2-支付宝、3-银联等 */
channel: number
/** 调起支付所需参数(微信支付时使用) */
payParameters: WechatPayParameters | null
/** 支付链接(扫码支付时使用) */
payUrl: string
}
/**
* 开台响应数据(对应 data 字段内容)
*/
export interface StartDeviceResponse {
/** 消费记录ID */
consumptionId: number
/** 错误描述(业务失败时有值) */
errorMessage: string
/** 支付信息(需要支付时有值,余额支付等无需支付时为 null) */
paymentResponseDto: PaymentResponseDto | null
}
/**
* 台球桌信息
*/
export interface TableInfo {
/** 设备编码 */
grpSn: string
/** 台球桌名称 */
tableName: string
/** 台球桌类型 */
tableType: string
/** 门店名称 */
storeName: string
/** 门店电话 */
storePhone: string
/** 价格(元/小时) */
price: number
/** VIP价格(元/小时) */
vipPrice: number
/** 押金金额 */
deposit: number
/** 价格时段 */
pricePeriod: string
}
/**
* 订单信息
*/
export interface OrderInfo {
/** 操作记录ID */
operationId: number
/** 设备编码 */
grpSn: string
/** 开始时间 */
startTime: string
/** 已消费时长(分钟) */
consumedMinutes: number
/** 已消费金额 */
consumedAmount: number
/** 剩余时长(分钟) */
remainingMinutes?: number
/** 订单编号 */
orderNo: string
/** 开台方式 */
startMethod: string
/** 收费标准 */
pricingRule: string
}
/**
* 获取台球桌价格请求参数
*/
export interface PriceRequestDto {
/** 用户微信 OpenId */
openId: string
/** 设备序列号 */
groupDevSn: string
}
// ─── 获取开台信息接口相关类型 ───────────────────────────────────────────────
/**
* 分时价格
*/
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'
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
}
// ─── 关台接口(/api/v2/TablesDev/stop)相关类型 ───────────────────────────────
/**
* 关台操作请求参数(对应 /api/v2/TablesDev/stop 接口)
* ctrlType 使用 CtrlType 枚举:5-立即关台、6-续费、7-关灯重开、8-替人付费关台
*/
export interface StopGroupDevRequestDto {
/** 设备序列号(必填) */
grpSn: string
/** 用户 OpenId(必填) */
openId: string
/** 操作类型:5-立即关台、6-续费、7-关灯重开、8-替人付费关台 */
ctrlType?: CtrlType
/** 支付方式:1-微信支付、2-支付宝、3-银联支付、4-余额支付、5-银行卡支付(可选) */
payType?: PayType
/** 交易类型:1-JSAPI小程序、2-Native扫码、3-APP、4-付款码、5-H5(可选) */
tradeType?: number
/** 续费金额(单位:元),仅 ctrlType=6(续费) 时需要 */
renewalAmount?: number
}
/**
* 关台操作响应数据(对应 /api/v2/TablesDev/stop 接口 data 字段)
*/
export interface StopGroupDevResponseDto {
/** 设备序列号 */
grpSn: string
/** 操作 ID(用于支付轮询) */
operationId: number
/** 关台时间 */
stopTime: string
/** 最终消费金额 */
finalAmount: number
/** 退款金额 */
refundAmount: number
/** 操作类型(对应 CtrlType:5-立即关台、6-续费、7-关灯重开) */
stopType: CtrlType
/** 续费时返回新的结束时间 */
newStopTime: string
/** 微信支付参数(needPay=true 时有值,否则为 null) */
payParameters: WechatPayParameters | null
/** 是否需要前端调起支付 */
needPay: boolean
/** 商户订单号,前端轮询用 */
outTradeNo: string
}
// ─── 查询开台状态接口(/api/v2/TablesDev/check-open-status)相关类型 ──────────
/**
* 开台状态枚举
* Pending → Processing → Opened / Failed
*/
export type OpenStatus = 'Pending' | 'Processing' | 'Opened' | 'Failed'
/**
* 查询开台状态响应(对应 data 字段)
* 接口:GET /api/v2/TablesDev/check-open-status?outTradeNo=xxx
*/
export interface CheckOpenStatusResponse {
/** 商户订单号 */
outTradeNo: string
/** 是否已成功开台 */
isOpened: boolean
/** 开台状态:Pending-等待中、Processing-处理中、Opened-已开台、Failed-失败 */
openStatus: OpenStatus
/** 设备编码 */
grpSn: string
/** 设备工作状态:0-空闲,1-使用中,2-已预约,3-维护中,4-开台中 */
workStatus: number
/** 工作状态描述 */
workStatusDesc: string
/** 当前开台记录 ID(开台成功后有值,用于关台页) */
operationId: number
/** 开台时间 */
startTime: string
/** 预计结束时间(定时开台时有值) */
expectedEndTime: string
/** 开台人用户编码 */
userSn: string
}