- 新增水票相关API接口,包括水票模板、用户水票、消费日志和水票释放功能 - 添加水票管理页面,实现水票的增删改查和详情展示功能 - 实现水票的分页查询和列表展示界面 - 替换原有的礼品卡功能为水票功能,在首页导航中更新路由链接 - 添加水票详情页面,支持二维码展示和兑换码复制功能 - 实现水票的状态管理和使用流程控制
106 lines
2.4 KiB
TypeScript
106 lines
2.4 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { GltUserTicketLog, GltUserTicketLogParam } from './model';
|
|
|
|
/**
|
|
* 分页查询消费日志
|
|
*/
|
|
export async function pageGltUserTicketLog(params: GltUserTicketLogParam) {
|
|
const res = await request.get<ApiResult<PageResult<GltUserTicketLog>>>(
|
|
'/glt/glt-user-ticket-log/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.code === 0) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 查询消费日志列表
|
|
*/
|
|
export async function listGltUserTicketLog(params?: GltUserTicketLogParam) {
|
|
const res = await request.get<ApiResult<GltUserTicketLog[]>>(
|
|
'/glt/glt-user-ticket-log',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 添加消费日志
|
|
*/
|
|
export async function addGltUserTicketLog(data: GltUserTicketLog) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/glt/glt-user-ticket-log',
|
|
data
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 修改消费日志
|
|
*/
|
|
export async function updateGltUserTicketLog(data: GltUserTicketLog) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/glt/glt-user-ticket-log',
|
|
data
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 删除消费日志
|
|
*/
|
|
export async function removeGltUserTicketLog(id?: number) {
|
|
const res = await request.del<ApiResult<unknown>>(
|
|
'/glt/glt-user-ticket-log/' + id
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除消费日志
|
|
*/
|
|
export async function removeBatchGltUserTicketLog(data: (number | undefined)[]) {
|
|
const res = await request.del<ApiResult<unknown>>(
|
|
'/glt/glt-user-ticket-log/batch',
|
|
{
|
|
data
|
|
}
|
|
);
|
|
if (res.code === 0) {
|
|
return res.message;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询消费日志
|
|
*/
|
|
export async function getGltUserTicketLog(id: number) {
|
|
const res = await request.get<ApiResult<GltUserTicketLog>>(
|
|
'/glt/glt-user-ticket-log/' + id
|
|
);
|
|
if (res.code === 0 && res.data) {
|
|
return res.data;
|
|
}
|
|
return Promise.reject(new Error(res.message));
|
|
}
|