diff --git a/src/api/card.ts b/src/api/card.ts new file mode 100644 index 0000000..8a443e2 --- /dev/null +++ b/src/api/card.ts @@ -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 { + return get('/card/list', params) +} + +/** 获取年卡详情 */ +export function getCardDetail(id: string): Promise { + return get('/card/detail', { id }) +} + +/** 激活年卡 */ +export function activateCard(cardId: string, data: ActivateParams): Promise { + return post('/card/activate', { cardId, ...data }) +} + +/** 绑定年卡 */ +export function bindCard(cardNo: string): Promise { + return post('/card/bind', { cardNo }) +} + +/** 获取我的年卡列表 */ +export function getMyCards(): Promise { + return get('/card/my-list') +} + +/** 获取入园码 */ +export function getEntryQrCode(cardId: string): Promise { + return get('/card/qrcode', { cardId }) +} diff --git a/src/api/order.ts b/src/api/order.ts new file mode 100644 index 0000000..29297ab --- /dev/null +++ b/src/api/order.ts @@ -0,0 +1,22 @@ +import { get, post } from './request' +import type { OrderInfo, CreateOrderParams, MockPayResult } from './types' + +/** 创建订单 */ +export function createOrder(data: CreateOrderParams): Promise { + return post('/order/create', data) +} + +/** 模拟支付(第一版替代微信支付) */ +export function mockPay(orderId: string): Promise { + return post('/order/mock-pay', { orderId }) +} + +/** 获取订单列表 */ +export function getOrderList(params?: { status?: string }): Promise { + return get('/order/list', params) +} + +/** 获取订单详情 */ +export function getOrderDetail(id: string): Promise { + return get('/order/detail', { id }) +}