优化网站导航模块
This commit is contained in:
106
modules/api/booking_____/card/index.ts
Normal file
106
modules/api/booking_____/card/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Card, CardParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询会员卡
|
||||
*/
|
||||
export async function pageCard(params: CardParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Card>>>(
|
||||
MODULES_API_URL + '/booking/card/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员卡列表
|
||||
*/
|
||||
export async function listCard(params?: CardParam) {
|
||||
const res = await request.get<ApiResult<Card[]>>(
|
||||
MODULES_API_URL + '/booking/card',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加会员卡
|
||||
*/
|
||||
export async function addCard(data: Card) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/card',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员卡
|
||||
*/
|
||||
export async function updateCard(data: Card) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/card',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员卡
|
||||
*/
|
||||
export async function removeCard(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/card/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除会员卡
|
||||
*/
|
||||
export async function removeBatchCard(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/card/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询会员卡
|
||||
*/
|
||||
export async function getCard(id: number) {
|
||||
const res = await request.get<ApiResult<Card>>(
|
||||
MODULES_API_URL + '/booking/card/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
57
modules/api/booking_____/card/model/index.ts
Normal file
57
modules/api/booking_____/card/model/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 会员卡
|
||||
*/
|
||||
export interface Card {
|
||||
// ID
|
||||
cardId?: number;
|
||||
// 会员卡名称
|
||||
cardName?: string;
|
||||
// 会员卡标识
|
||||
cardCode?: string;
|
||||
// 会员卡类型
|
||||
type?: string;
|
||||
// 成人儿童
|
||||
cardType?: number;
|
||||
// 会员卡图片
|
||||
image?: string;
|
||||
// 价格
|
||||
price?: number;
|
||||
// 次数
|
||||
number?: number;
|
||||
// 月份
|
||||
month?: number;
|
||||
// 折扣
|
||||
discount?: number;
|
||||
// 老师介绍
|
||||
content?: string;
|
||||
// 关联用户
|
||||
userId?: number;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 商户名称
|
||||
merchantName?: string;
|
||||
// 商户类型
|
||||
merchantType?: string;
|
||||
// 可使用的场馆ID
|
||||
merchantIds?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员卡搜索条件
|
||||
*/
|
||||
export interface CardParam extends PageParam {
|
||||
cardId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user