From ec045249ff1d306b31d9e68028839f9661169f50 Mon Sep 17 00:00:00 2001 From: jacobxu666 Date: Sun, 14 Jun 2026 17:22:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=B9=B4=E5=8D=A1?= =?UTF-8?q?=E5=92=8C=E8=AE=A2=E5=8D=95=20API=20=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- src/api/card.ts | 32 ++++++++++++++++++++++++++++++++ src/api/order.ts | 22 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/api/card.ts create mode 100644 src/api/order.ts 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 }) +}