feat: 新增年卡和订单 API 模块

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-06-14 17:22:35 +08:00
co-authored by Claude Opus 4.8
parent 4cd1040e5d
commit ec045249ff
2 changed files with 54 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import { get, post } from './request'
import type { CardInfo, CardDetail, MyCard, ActivateParams, QrCodeInfo } from './types'
/** 获取年卡列表 */
export function getCardList(params?: { keyword?: string; category?: string }): Promise<CardInfo[]> {
return get<CardInfo[]>('/card/list', params)
}
/** 获取年卡详情 */
export function getCardDetail(id: string): Promise<CardDetail> {
return get<CardDetail>('/card/detail', { id })
}
/** 激活年卡 */
export function activateCard(cardId: string, data: ActivateParams): Promise<boolean> {
return post<boolean>('/card/activate', { cardId, ...data })
}
/** 绑定年卡 */
export function bindCard(cardNo: string): Promise<boolean> {
return post<boolean>('/card/bind', { cardNo })
}
/** 获取我的年卡列表 */
export function getMyCards(): Promise<MyCard[]> {
return get<MyCard[]>('/card/my-list')
}
/** 获取入园码 */
export function getEntryQrCode(cardId: string): Promise<QrCodeInfo> {
return get<QrCodeInfo>('/card/qrcode', { cardId })
}
+22
View File
@@ -0,0 +1,22 @@
import { get, post } from './request'
import type { OrderInfo, CreateOrderParams, MockPayResult } from './types'
/** 创建订单 */
export function createOrder(data: CreateOrderParams): Promise<OrderInfo> {
return post<OrderInfo>('/order/create', data)
}
/** 模拟支付(第一版替代微信支付) */
export function mockPay(orderId: string): Promise<MockPayResult> {
return post<MockPayResult>('/order/mock-pay', { orderId })
}
/** 获取订单列表 */
export function getOrderList(params?: { status?: string }): Promise<OrderInfo[]> {
return get<OrderInfo[]>('/order/list', params)
}
/** 获取订单详情 */
export function getOrderDetail(id: string): Promise<OrderInfo> {
return get<OrderInfo>('/order/detail', { id })
}