1、新增礼品卡模块
2、完善优惠券
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
import {ShopCouponApplyCate} from "@/api/shop/shopCouponApplyCate/model";
|
||||
import {ShopCouponApplyItem} from "@/api/shop/shopCouponApplyItem/model";
|
||||
|
||||
/**
|
||||
* 优惠券
|
||||
@@ -54,6 +56,8 @@ export interface ShopCoupon {
|
||||
limitPerUser?: number;
|
||||
// 是否启用(0禁用 1启用)
|
||||
enabled?: string;
|
||||
couponApplyCateList?: ShopCouponApplyCate[];
|
||||
couponApplyItemList?: ShopCouponApplyItem[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
11
src/api/shop/shopCouponApplyCate/model/index.ts
Normal file
11
src/api/shop/shopCouponApplyCate/model/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
/**
|
||||
* 优惠券
|
||||
*/
|
||||
export interface ShopCouponApplyCate {
|
||||
id?: number;
|
||||
couponId?: number;
|
||||
cateId?: number;
|
||||
cateLevel?: number;
|
||||
|
||||
}
|
||||
11
src/api/shop/shopCouponApplyItem/model/index.ts
Normal file
11
src/api/shop/shopCouponApplyItem/model/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
/**
|
||||
* 优惠券
|
||||
*/
|
||||
export interface ShopCouponApplyItem {
|
||||
id?: number;
|
||||
couponId?: number;
|
||||
type?: number;
|
||||
pk?: number;
|
||||
|
||||
}
|
||||
130
src/api/shop/shopGift/index.ts
Normal file
130
src/api/shop/shopGift/index.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { ShopGift, ShopGiftParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询礼品卡
|
||||
*/
|
||||
export async function pageShopGift(params: ShopGiftParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopGift>>>(
|
||||
MODULES_API_URL + '/shop/shop-gift/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询礼品卡列表
|
||||
*/
|
||||
export async function listShopGift(params?: ShopGiftParam) {
|
||||
const res = await request.get<ApiResult<ShopGift[]>>(
|
||||
MODULES_API_URL + '/shop/shop-gift',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加礼品卡
|
||||
*/
|
||||
export async function addShopGift(data: ShopGift) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-gift',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成礼品卡
|
||||
*/
|
||||
export async function makeShopGift(data: ShopGift) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-gift/make',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改礼品卡
|
||||
*/
|
||||
export async function updateShopGift(data: ShopGift) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-gift',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除礼品卡
|
||||
*/
|
||||
export async function removeShopGift(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-gift/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除礼品卡
|
||||
*/
|
||||
export async function removeBatchShopGift(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-gift/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询礼品卡
|
||||
*/
|
||||
export async function getShopGift(id: number) {
|
||||
const res = await request.get<ApiResult<ShopGift>>(
|
||||
MODULES_API_URL + '/shop/shop-gift/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function exportShopGift(ids?: number[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-gift/export',
|
||||
ids
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
46
src/api/shop/shopGift/model/index.ts
Normal file
46
src/api/shop/shopGift/model/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 礼品卡
|
||||
*/
|
||||
export interface ShopGift {
|
||||
//
|
||||
id?: number;
|
||||
//
|
||||
name?: string;
|
||||
// 秘钥
|
||||
code?: string;
|
||||
// 商品ID
|
||||
goodsId?: number;
|
||||
// 领取时间
|
||||
takeTime?: string;
|
||||
// 操作人
|
||||
operatorUserId?: number;
|
||||
// 是否展示
|
||||
isShow?: string;
|
||||
// 状态, 0上架 1待上架 2待审核 3审核不通过
|
||||
status?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
num?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡搜索条件
|
||||
*/
|
||||
export interface ShopGiftParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user