feat(admin): 从文章详情页面改为文章管理页面
- 修改页面配置,设置新的导航栏标题和样式 - 重新设计页面布局,增加搜索栏、文章列表和操作按钮 - 添加文章搜索、分页加载和删除功能 - 优化文章列表项的样式和交互 - 新增礼品卡相关API和组件 - 更新优惠券组件,增加到期提醒和筛选功能
This commit is contained in:
@@ -84,8 +84,6 @@ export interface ShopArticle {
|
||||
bmUsers?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 项目ID
|
||||
projectId?: number;
|
||||
// 语言
|
||||
|
||||
@@ -54,6 +54,7 @@ export interface ShopCoupon {
|
||||
limitPerUser?: number;
|
||||
// 是否启用(0禁用 1启用)
|
||||
enabled?: string;
|
||||
sortBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
180
src/api/shop/shopGift/index.ts
Normal file
180
src/api/shop/shopGift/index.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { ShopGift, ShopGiftParam, GiftRedeemParam, GiftUseParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询礼品卡
|
||||
*/
|
||||
export async function pageShopGift(params: ShopGiftParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopGift>>>(
|
||||
'/shop/shop-gift/page',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询礼品卡列表
|
||||
*/
|
||||
export async function listShopGift(params?: ShopGiftParam) {
|
||||
const res = await request.get<ApiResult<ShopGift[]>>(
|
||||
'/shop/shop-gift',
|
||||
params
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加礼品卡
|
||||
*/
|
||||
export async function addShopGift(data: ShopGift) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-gift',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成礼品卡
|
||||
*/
|
||||
export async function makeShopGift(data: ShopGift) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-gift/make',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改礼品卡
|
||||
*/
|
||||
export async function updateShopGift(data: ShopGift) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-gift',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除礼品卡
|
||||
*/
|
||||
export async function removeShopGift(id?: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-gift/' + id
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除礼品卡
|
||||
*/
|
||||
export async function removeBatchShopGift(data: (number | undefined)[]) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-gift/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询礼品卡
|
||||
*/
|
||||
export async function getShopGift(id: number) {
|
||||
const res = await request.get<ApiResult<ShopGift>>(
|
||||
'/shop/shop-gift/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 兑换礼品卡
|
||||
*/
|
||||
export async function redeemGift(params: GiftRedeemParam) {
|
||||
const res = await request.post<ApiResult<ShopGift>>(
|
||||
'/shop/shop-gift/redeem',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用礼品卡
|
||||
*/
|
||||
export async function useGift(params: GiftUseParam) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-gift/use',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的礼品卡列表
|
||||
*/
|
||||
export async function getUserGifts(params: ShopGiftParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopGift>>>(
|
||||
'/shop/shop-gift/page',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证礼品卡兑换码
|
||||
*/
|
||||
export async function validateGiftCode(code: string) {
|
||||
const res = await request.get<ApiResult<ShopGift>>(
|
||||
`/shop/shop-gift/validate/${code}`
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
export async function exportShopGift(ids?: number[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-gift/export',
|
||||
ids
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
115
src/api/shop/shopGift/model/index.ts
Normal file
115
src/api/shop/shopGift/model/index.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 礼品卡
|
||||
*/
|
||||
export interface ShopGift {
|
||||
// 礼品卡ID
|
||||
id?: number;
|
||||
// 礼品卡名称
|
||||
name?: string;
|
||||
// 礼品卡描述
|
||||
description?: string;
|
||||
// 礼品卡兑换码
|
||||
code?: string;
|
||||
// 关联商品ID
|
||||
goodsId?: number;
|
||||
// 商品名称
|
||||
goodsName?: string;
|
||||
// 商品图片
|
||||
goodsImage?: string;
|
||||
// 礼品卡面值
|
||||
faceValue?: string;
|
||||
// 礼品卡类型 (10实物礼品卡 20虚拟礼品卡 30服务礼品卡)
|
||||
type?: number;
|
||||
// 领取时间
|
||||
takeTime?: string;
|
||||
// 使用时间
|
||||
useTime?: string;
|
||||
// 过期时间
|
||||
expireTime?: string;
|
||||
// 有效期天数
|
||||
validDays?: number;
|
||||
// 操作人
|
||||
operatorUserId?: number;
|
||||
// 是否展示
|
||||
isShow?: string;
|
||||
// 状态 (0未使用 1已使用 2已过期 3已失效)
|
||||
status?: number;
|
||||
// 使用状态 (0可用 1已使用 2已过期)
|
||||
useStatus?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 使用说明
|
||||
instructions?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 拥有者用户ID
|
||||
userId?: number;
|
||||
// 发放者用户ID
|
||||
issuerUserId?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
// 数量
|
||||
num?: number;
|
||||
// 已发放数量
|
||||
issuedCount?: number;
|
||||
// 总发放数量
|
||||
totalCount?: number;
|
||||
// 使用门店/地址
|
||||
useLocation?: string;
|
||||
// 客服联系方式
|
||||
contactInfo?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡搜索条件
|
||||
*/
|
||||
export interface ShopGiftParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
// 礼品卡类型筛选
|
||||
type?: number;
|
||||
// 状态筛选
|
||||
status?: number;
|
||||
// 使用状态筛选
|
||||
useStatus?: number;
|
||||
// 用户ID筛选
|
||||
userId?: number;
|
||||
// 商品ID筛选
|
||||
goodsId?: number;
|
||||
// 是否过期筛选
|
||||
isExpired?: boolean;
|
||||
// 排序字段
|
||||
sortBy?: 'createTime' | 'expireTime' | 'faceValue' | 'useTime';
|
||||
// 排序方向
|
||||
sortOrder?: 'asc' | 'desc';
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡兑换参数
|
||||
*/
|
||||
export interface GiftRedeemParam {
|
||||
// 兑换码
|
||||
code: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡使用参数
|
||||
*/
|
||||
export interface GiftUseParam {
|
||||
// 礼品卡ID
|
||||
giftId: number;
|
||||
// 使用地址/门店
|
||||
useLocation?: string;
|
||||
// 使用备注
|
||||
useNote?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user