- 添加了.dockerignore、.env.example和.gitignore配置文件 - 实现了文件服务器、模块API和服务器API的代理功能 - 创建了动态路由页面用于展示文章列表和详情 - 实现了商品详情页面包括图片展示和价格信息 - 添加了静态页面展示功能支持富文本内容渲染 - 配置了SEO元数据和面包屑导航组件
106 lines
2.5 KiB
TypeScript
106 lines
2.5 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { ShopUserCoupon, ShopUserCouponParam } from './model';
|
|
|
|
/**
|
|
* 分页查询用户优惠券
|
|
*/
|
|
export async function pageShopUserCoupon(params: ShopUserCouponParam) {
|
|
const res = await request.get<ApiResult<PageResult<ShopUserCoupon>>>(
|
|
'/shop/shop-user-coupon/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 查询用户优惠券列表
|
|
*/
|
|
export async function listShopUserCoupon(params?: ShopUserCouponParam) {
|
|
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
|
|
'/shop/shop-user-coupon',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 添加用户优惠券
|
|
*/
|
|
export async function addShopUserCoupon(data: ShopUserCoupon) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/shop/shop-user-coupon',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 修改用户优惠券
|
|
*/
|
|
export async function updateShopUserCoupon(data: ShopUserCoupon) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/shop/shop-user-coupon',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 删除用户优惠券
|
|
*/
|
|
export async function removeShopUserCoupon(id?: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/shop/shop-user-coupon/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除用户优惠券
|
|
*/
|
|
export async function removeBatchShopUserCoupon(data: (number | undefined)[]) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/shop/shop-user-coupon/batch',
|
|
{
|
|
data
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询用户优惠券
|
|
*/
|
|
export async function getShopUserCoupon(id: number) {
|
|
const res = await request.get<ApiResult<ShopUserCoupon>>(
|
|
'/shop/shop-user-coupon/' + id
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|