优化网站导航模块

This commit is contained in:
2024-08-23 22:28:24 +08:00
parent 1d81fa9270
commit 13832d9de0
964 changed files with 90774 additions and 31362 deletions

View 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));
}

View 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;
}