refactor(shop): 重构商铺相关 API
- 移除 ApiResult 和 PageResult 的冗余导入 - 更新请求路径,移除 MODULES_API_URL 的使用 - 调整请求头,移除不必要的 Content-Type 设置 -统一处理 enabled 字段类型
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
VITE_APP_NAME=后台管理(开发环境)
|
VITE_APP_NAME=后台管理(开发环境)
|
||||||
VITE_API_URL=http://127.0.0.1:9200/api
|
#VITE_API_URL=http://127.0.0.1:9200/api
|
||||||
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||||
|
|
||||||
|
|
||||||
#VITE_API_URL=https://cms-api.s209.websoft.top/api
|
VITE_API_URL=https://cms-api.websoft.top/api
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopCoupon, ShopCouponParam } from './model';
|
import type { ShopCoupon, ShopCouponParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询优惠券
|
* 分页查询优惠券
|
||||||
*/
|
*/
|
||||||
export async function pageShopCoupon(params: ShopCouponParam) {
|
export async function pageShopCoupon(params: ShopCouponParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopCoupon>>>(
|
const res = await request.get<ApiResult<PageResult<ShopCoupon>>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon/page',
|
'/shop/shop-coupon/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopCoupon(params: ShopCouponParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopCoupon(params?: ShopCouponParam) {
|
export async function listShopCoupon(params?: ShopCouponParam) {
|
||||||
const res = await request.get<ApiResult<ShopCoupon[]>>(
|
const res = await request.get<ApiResult<ShopCoupon[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon',
|
'/shop/shop-coupon',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,13 +39,8 @@ export async function listShopCoupon(params?: ShopCouponParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopCoupon(data: ShopCoupon) {
|
export async function addShopCoupon(data: ShopCoupon) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon',
|
'/shop/shop-coupon',
|
||||||
data,
|
data
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -59,13 +53,8 @@ export async function addShopCoupon(data: ShopCoupon) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopCoupon(data: ShopCoupon) {
|
export async function updateShopCoupon(data: ShopCoupon) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon',
|
'/shop/shop-coupon',
|
||||||
data,
|
data
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -78,7 +67,7 @@ export async function updateShopCoupon(data: ShopCoupon) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopCoupon(id?: number) {
|
export async function removeShopCoupon(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon/' + id
|
'/shop/shop-coupon/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -91,7 +80,7 @@ export async function removeShopCoupon(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopCoupon(data: (number | undefined)[]) {
|
export async function removeBatchShopCoupon(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon/batch',
|
'/shop/shop-coupon/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -107,7 +96,7 @@ export async function removeBatchShopCoupon(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function getShopCoupon(id: number) {
|
export async function getShopCoupon(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopCoupon>>(
|
const res = await request.get<ApiResult<ShopCoupon>>(
|
||||||
MODULES_API_URL + '/shop/shop-coupon/' + id
|
'/shop/shop-coupon/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠券
|
* 优惠券
|
||||||
@@ -53,7 +53,7 @@ export interface ShopCoupon {
|
|||||||
// 每人限领数量(-1表示无限制)
|
// 每人限领数量(-1表示无限制)
|
||||||
limitPerUser?: number;
|
limitPerUser?: number;
|
||||||
// 是否启用(0禁用 1启用)
|
// 是否启用(0禁用 1启用)
|
||||||
enabled?: boolean;
|
enabled?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerApply, ShopDealerApplyParam } from './model';
|
import type { ShopDealerApply, ShopDealerApplyParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商申请记录表
|
* 分页查询分销商申请记录表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerApply(params: ShopDealerApplyParam) {
|
export async function pageShopDealerApply(params: ShopDealerApplyParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerApply>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerApply>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply/page',
|
'/shop/shop-dealer-apply/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerApply(params: ShopDealerApplyParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerApply(params?: ShopDealerApplyParam) {
|
export async function listShopDealerApply(params?: ShopDealerApplyParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerApply[]>>(
|
const res = await request.get<ApiResult<ShopDealerApply[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply',
|
'/shop/shop-dealer-apply',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerApply(params?: ShopDealerApplyParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerApply(data: ShopDealerApply) {
|
export async function addShopDealerApply(data: ShopDealerApply) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply',
|
'/shop/shop-dealer-apply',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerApply(data: ShopDealerApply) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerApply(data: ShopDealerApply) {
|
export async function updateShopDealerApply(data: ShopDealerApply) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply',
|
'/shop/shop-dealer-apply',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerApply(data: ShopDealerApply) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerApply(id?: number) {
|
export async function removeShopDealerApply(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply/' + id
|
'/shop/shop-dealer-apply/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerApply(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerApply(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerApply(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply/batch',
|
'/shop/shop-dealer-apply/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerApply(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerApply(id: number) {
|
export async function getShopDealerApply(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerApply>>(
|
const res = await request.get<ApiResult<ShopDealerApply>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-apply/' + id
|
'/shop/shop-dealer-apply/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商申请记录表
|
* 分销商申请记录表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerCapital, ShopDealerCapitalParam } from './model';
|
import type { ShopDealerCapital, ShopDealerCapitalParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商资金明细表
|
* 分页查询分销商资金明细表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerCapital(params: ShopDealerCapitalParam) {
|
export async function pageShopDealerCapital(params: ShopDealerCapitalParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerCapital>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerCapital>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital/page',
|
'/shop/shop-dealer-capital/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerCapital(params: ShopDealerCapitalParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerCapital(params?: ShopDealerCapitalParam) {
|
export async function listShopDealerCapital(params?: ShopDealerCapitalParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerCapital[]>>(
|
const res = await request.get<ApiResult<ShopDealerCapital[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital',
|
'/shop/shop-dealer-capital',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerCapital(params?: ShopDealerCapitalParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerCapital(data: ShopDealerCapital) {
|
export async function addShopDealerCapital(data: ShopDealerCapital) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital',
|
'/shop/shop-dealer-capital',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerCapital(data: ShopDealerCapital) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerCapital(data: ShopDealerCapital) {
|
export async function updateShopDealerCapital(data: ShopDealerCapital) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital',
|
'/shop/shop-dealer-capital',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerCapital(data: ShopDealerCapital) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerCapital(id?: number) {
|
export async function removeShopDealerCapital(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital/' + id
|
'/shop/shop-dealer-capital/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerCapital(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerCapital(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerCapital(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital/batch',
|
'/shop/shop-dealer-capital/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerCapital(data: (number | undefined)[])
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerCapital(id: number) {
|
export async function getShopDealerCapital(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerCapital>>(
|
const res = await request.get<ApiResult<ShopDealerCapital>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-capital/' + id
|
'/shop/shop-dealer-capital/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商资金明细表
|
* 分销商资金明细表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerOrder, ShopDealerOrderParam } from './model';
|
import type { ShopDealerOrder, ShopDealerOrderParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商订单记录表
|
* 分页查询分销商订单记录表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerOrder(params: ShopDealerOrderParam) {
|
export async function pageShopDealerOrder(params: ShopDealerOrderParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerOrder>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerOrder>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order/page',
|
'/shop/shop-dealer-order/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerOrder(params: ShopDealerOrderParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerOrder(params?: ShopDealerOrderParam) {
|
export async function listShopDealerOrder(params?: ShopDealerOrderParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerOrder[]>>(
|
const res = await request.get<ApiResult<ShopDealerOrder[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order',
|
'/shop/shop-dealer-order',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerOrder(params?: ShopDealerOrderParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerOrder(data: ShopDealerOrder) {
|
export async function addShopDealerOrder(data: ShopDealerOrder) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order',
|
'/shop/shop-dealer-order',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerOrder(data: ShopDealerOrder) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerOrder(data: ShopDealerOrder) {
|
export async function updateShopDealerOrder(data: ShopDealerOrder) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order',
|
'/shop/shop-dealer-order',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerOrder(data: ShopDealerOrder) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerOrder(id?: number) {
|
export async function removeShopDealerOrder(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order/' + id
|
'/shop/shop-dealer-order/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerOrder(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerOrder(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerOrder(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order/batch',
|
'/shop/shop-dealer-order/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerOrder(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerOrder(id: number) {
|
export async function getShopDealerOrder(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerOrder>>(
|
const res = await request.get<ApiResult<ShopDealerOrder>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-order/' + id
|
'/shop/shop-dealer-order/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商订单记录表
|
* 分销商订单记录表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerReferee, ShopDealerRefereeParam } from './model';
|
import type { ShopDealerReferee, ShopDealerRefereeParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商推荐关系表
|
* 分页查询分销商推荐关系表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerReferee(params: ShopDealerRefereeParam) {
|
export async function pageShopDealerReferee(params: ShopDealerRefereeParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerReferee>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerReferee>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee/page',
|
'/shop/shop-dealer-referee/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerReferee(params: ShopDealerRefereeParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerReferee(params?: ShopDealerRefereeParam) {
|
export async function listShopDealerReferee(params?: ShopDealerRefereeParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerReferee[]>>(
|
const res = await request.get<ApiResult<ShopDealerReferee[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee',
|
'/shop/shop-dealer-referee',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerReferee(params?: ShopDealerRefereeParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerReferee(data: ShopDealerReferee) {
|
export async function addShopDealerReferee(data: ShopDealerReferee) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee',
|
'/shop/shop-dealer-referee',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerReferee(data: ShopDealerReferee) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerReferee(data: ShopDealerReferee) {
|
export async function updateShopDealerReferee(data: ShopDealerReferee) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee',
|
'/shop/shop-dealer-referee',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerReferee(data: ShopDealerReferee) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerReferee(id?: number) {
|
export async function removeShopDealerReferee(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee/' + id
|
'/shop/shop-dealer-referee/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerReferee(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerReferee(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerReferee(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee/batch',
|
'/shop/shop-dealer-referee/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerReferee(data: (number | undefined)[])
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerReferee(id: number) {
|
export async function getShopDealerReferee(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerReferee>>(
|
const res = await request.get<ApiResult<ShopDealerReferee>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-referee/' + id
|
'/shop/shop-dealer-referee/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商推荐关系表
|
* 分销商推荐关系表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerSetting, ShopDealerSettingParam } from './model';
|
import type { ShopDealerSetting, ShopDealerSettingParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商设置表
|
* 分页查询分销商设置表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerSetting(params: ShopDealerSettingParam) {
|
export async function pageShopDealerSetting(params: ShopDealerSettingParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerSetting>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerSetting>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting/page',
|
'/shop/shop-dealer-setting/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerSetting(params: ShopDealerSettingParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerSetting(params?: ShopDealerSettingParam) {
|
export async function listShopDealerSetting(params?: ShopDealerSettingParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerSetting[]>>(
|
const res = await request.get<ApiResult<ShopDealerSetting[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting',
|
'/shop/shop-dealer-setting',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerSetting(params?: ShopDealerSettingParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerSetting(data: ShopDealerSetting) {
|
export async function addShopDealerSetting(data: ShopDealerSetting) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting',
|
'/shop/shop-dealer-setting',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerSetting(data: ShopDealerSetting) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerSetting(data: ShopDealerSetting) {
|
export async function updateShopDealerSetting(data: ShopDealerSetting) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting',
|
'/shop/shop-dealer-setting',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerSetting(data: ShopDealerSetting) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerSetting(id?: number) {
|
export async function removeShopDealerSetting(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting/' + id
|
'/shop/shop-dealer-setting/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerSetting(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerSetting(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerSetting(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting/batch',
|
'/shop/shop-dealer-setting/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerSetting(data: (number | undefined)[])
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerSetting(id: number) {
|
export async function getShopDealerSetting(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerSetting>>(
|
const res = await request.get<ApiResult<ShopDealerSetting>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-setting/' + id
|
'/shop/shop-dealer-setting/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商设置表
|
* 分销商设置表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerUser, ShopDealerUserParam } from './model';
|
import type { ShopDealerUser, ShopDealerUserParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商用户记录表
|
* 分页查询分销商用户记录表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerUser(params: ShopDealerUserParam) {
|
export async function pageShopDealerUser(params: ShopDealerUserParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerUser>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerUser>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user/page',
|
'/shop/shop-dealer-user/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerUser(params: ShopDealerUserParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerUser(params?: ShopDealerUserParam) {
|
export async function listShopDealerUser(params?: ShopDealerUserParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerUser[]>>(
|
const res = await request.get<ApiResult<ShopDealerUser[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user',
|
'/shop/shop-dealer-user',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerUser(params?: ShopDealerUserParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerUser(data: ShopDealerUser) {
|
export async function addShopDealerUser(data: ShopDealerUser) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user',
|
'/shop/shop-dealer-user',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerUser(data: ShopDealerUser) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerUser(data: ShopDealerUser) {
|
export async function updateShopDealerUser(data: ShopDealerUser) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user',
|
'/shop/shop-dealer-user',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerUser(data: ShopDealerUser) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerUser(id?: number) {
|
export async function removeShopDealerUser(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user/' + id
|
'/shop/shop-dealer-user/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerUser(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerUser(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerUser(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user/batch',
|
'/shop/shop-dealer-user/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerUser(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerUser(id: number) {
|
export async function getShopDealerUser(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerUser>>(
|
const res = await request.get<ApiResult<ShopDealerUser>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-user/' + id
|
'/shop/shop-dealer-user/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商用户记录表
|
* 分销商用户记录表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopDealerWithdraw, ShopDealerWithdrawParam } from './model';
|
import type { ShopDealerWithdraw, ShopDealerWithdrawParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询分销商提现明细表
|
* 分页查询分销商提现明细表
|
||||||
*/
|
*/
|
||||||
export async function pageShopDealerWithdraw(params: ShopDealerWithdrawParam) {
|
export async function pageShopDealerWithdraw(params: ShopDealerWithdrawParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopDealerWithdraw>>>(
|
const res = await request.get<ApiResult<PageResult<ShopDealerWithdraw>>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/page',
|
'/shop/shop-dealer-withdraw/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopDealerWithdraw(params: ShopDealerWithdrawParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopDealerWithdraw(params?: ShopDealerWithdrawParam) {
|
export async function listShopDealerWithdraw(params?: ShopDealerWithdrawParam) {
|
||||||
const res = await request.get<ApiResult<ShopDealerWithdraw[]>>(
|
const res = await request.get<ApiResult<ShopDealerWithdraw[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw',
|
'/shop/shop-dealer-withdraw',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopDealerWithdraw(params?: ShopDealerWithdrawParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopDealerWithdraw(data: ShopDealerWithdraw) {
|
export async function addShopDealerWithdraw(data: ShopDealerWithdraw) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw',
|
'/shop/shop-dealer-withdraw',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopDealerWithdraw(data: ShopDealerWithdraw) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopDealerWithdraw(data: ShopDealerWithdraw) {
|
export async function updateShopDealerWithdraw(data: ShopDealerWithdraw) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw',
|
'/shop/shop-dealer-withdraw',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopDealerWithdraw(data: ShopDealerWithdraw) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopDealerWithdraw(id?: number) {
|
export async function removeShopDealerWithdraw(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/' + id
|
'/shop/shop-dealer-withdraw/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopDealerWithdraw(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopDealerWithdraw(data: (number | undefined)[]) {
|
export async function removeBatchShopDealerWithdraw(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/batch',
|
'/shop/shop-dealer-withdraw/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerWithdraw(data: (number | undefined)[]
|
|||||||
*/
|
*/
|
||||||
export async function getShopDealerWithdraw(id: number) {
|
export async function getShopDealerWithdraw(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopDealerWithdraw>>(
|
const res = await request.get<ApiResult<ShopDealerWithdraw>>(
|
||||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/' + id
|
'/shop/shop-dealer-withdraw/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商提现明细表
|
* 分销商提现明细表
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api/index';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopUserCoupon, ShopUserCouponParam } from './model';
|
import type { ShopUserCoupon, ShopUserCouponParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询用户优惠券
|
* 分页查询用户优惠券
|
||||||
*/
|
*/
|
||||||
export async function pageShopUserCoupon(params: ShopUserCouponParam) {
|
export async function pageShopUserCoupon(params: ShopUserCouponParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopUserCoupon>>>(
|
const res = await request.get<ApiResult<PageResult<ShopUserCoupon>>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon/page',
|
'/shop/shop-user-coupon/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopUserCoupon(params: ShopUserCouponParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopUserCoupon(params?: ShopUserCouponParam) {
|
export async function listShopUserCoupon(params?: ShopUserCouponParam) {
|
||||||
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
|
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon',
|
'/shop/shop-user-coupon',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopUserCoupon(params?: ShopUserCouponParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopUserCoupon(data: ShopUserCoupon) {
|
export async function addShopUserCoupon(data: ShopUserCoupon) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon',
|
'/shop/shop-user-coupon',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopUserCoupon(data: ShopUserCoupon) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopUserCoupon(data: ShopUserCoupon) {
|
export async function updateShopUserCoupon(data: ShopUserCoupon) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon',
|
'/shop/shop-user-coupon',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopUserCoupon(data: ShopUserCoupon) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopUserCoupon(id?: number) {
|
export async function removeShopUserCoupon(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon/' + id
|
'/shop/shop-user-coupon/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopUserCoupon(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopUserCoupon(data: (number | undefined)[]) {
|
export async function removeBatchShopUserCoupon(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon/batch',
|
'/shop/shop-user-coupon/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopUserCoupon(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function getShopUserCoupon(id: number) {
|
export async function getShopUserCoupon(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopUserCoupon>>(
|
const res = await request.get<ApiResult<ShopUserCoupon>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-coupon/' + id
|
'/shop/shop-user-coupon/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { PageParam } from '@/api/index';
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户优惠券
|
* 用户优惠券
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { ApiResult, PageResult } from '@/api';
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
import type { ShopUserReferee, ShopUserRefereeParam } from './model';
|
import type { ShopUserReferee, ShopUserRefereeParam } from './model';
|
||||||
import { MODULES_API_URL } from '@/config/setting';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询用户推荐关系表
|
* 分页查询用户推荐关系表
|
||||||
*/
|
*/
|
||||||
export async function pageShopUserReferee(params: ShopUserRefereeParam) {
|
export async function pageShopUserReferee(params: ShopUserRefereeParam) {
|
||||||
const res = await request.get<ApiResult<PageResult<ShopUserReferee>>>(
|
const res = await request.get<ApiResult<PageResult<ShopUserReferee>>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee/page',
|
'/shop/shop-user-referee/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +23,7 @@ export async function pageShopUserReferee(params: ShopUserRefereeParam) {
|
|||||||
*/
|
*/
|
||||||
export async function listShopUserReferee(params?: ShopUserRefereeParam) {
|
export async function listShopUserReferee(params?: ShopUserRefereeParam) {
|
||||||
const res = await request.get<ApiResult<ShopUserReferee[]>>(
|
const res = await request.get<ApiResult<ShopUserReferee[]>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee',
|
'/shop/shop-user-referee',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ export async function listShopUserReferee(params?: ShopUserRefereeParam) {
|
|||||||
*/
|
*/
|
||||||
export async function addShopUserReferee(data: ShopUserReferee) {
|
export async function addShopUserReferee(data: ShopUserReferee) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee',
|
'/shop/shop-user-referee',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +53,7 @@ export async function addShopUserReferee(data: ShopUserReferee) {
|
|||||||
*/
|
*/
|
||||||
export async function updateShopUserReferee(data: ShopUserReferee) {
|
export async function updateShopUserReferee(data: ShopUserReferee) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee',
|
'/shop/shop-user-referee',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +67,7 @@ export async function updateShopUserReferee(data: ShopUserReferee) {
|
|||||||
*/
|
*/
|
||||||
export async function removeShopUserReferee(id?: number) {
|
export async function removeShopUserReferee(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee/' + id
|
'/shop/shop-user-referee/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +80,7 @@ export async function removeShopUserReferee(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatchShopUserReferee(data: (number | undefined)[]) {
|
export async function removeBatchShopUserReferee(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee/batch',
|
'/shop/shop-user-referee/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ export async function removeBatchShopUserReferee(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function getShopUserReferee(id: number) {
|
export async function getShopUserReferee(id: number) {
|
||||||
const res = await request.get<ApiResult<ShopUserReferee>>(
|
const res = await request.get<ApiResult<ShopUserReferee>>(
|
||||||
MODULES_API_URL + '/shop/shop-user-referee/' + id
|
'/shop/shop-user-referee/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<ele-modal
|
<ele-modal
|
||||||
:width="700"
|
:width="800"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:maxable="maxable"
|
:maxable="maxable"
|
||||||
:title="isUpdate ? '编辑优惠券' : '添加优惠券'"
|
:title="isUpdate ? '编辑优惠券' : '添加优惠券'"
|
||||||
:body-style="{ paddingBottom: '28px', maxHeight: '70vh', overflowY: 'auto' }"
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
>
|
>
|
||||||
@@ -19,511 +19,321 @@
|
|||||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<!-- 基本信息 -->
|
<a-form-item label="优惠券名称" name="name">
|
||||||
<a-divider orientation="left">基本信息</a-divider>
|
|
||||||
|
|
||||||
<a-form-item
|
|
||||||
label="优惠券名称"
|
|
||||||
name="name"
|
|
||||||
>
|
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
placeholder="请输入优惠券名称"
|
placeholder="请输入优惠券名称"
|
||||||
v-model:value="form.name"
|
v-model:value="form.name"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
|
||||||
label="优惠券类型"
|
|
||||||
name="type"
|
|
||||||
>
|
|
||||||
<a-select
|
|
||||||
placeholder="请选择优惠券类型"
|
|
||||||
v-model:value="form.type"
|
|
||||||
@change="onTypeChange"
|
|
||||||
>
|
|
||||||
<a-select-option :value="10">满减券</a-select-option>
|
|
||||||
<a-select-option :value="20">折扣券</a-select-option>
|
|
||||||
<a-select-option :value="30">免费券</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="优惠券描述" name="description">
|
<a-form-item label="优惠券描述" name="description">
|
||||||
<a-textarea
|
<a-input
|
||||||
:rows="3"
|
allow-clear
|
||||||
placeholder="请输入优惠券描述"
|
placeholder="请输入优惠券描述"
|
||||||
v-model:value="form.description"
|
v-model:value="form.description"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="优惠券类型(10满减券 20折扣券 30免费劵)" name="type">
|
||||||
<!-- 优惠设置 -->
|
<a-input
|
||||||
<a-divider orientation="left">优惠设置</a-divider>
|
allow-clear
|
||||||
|
placeholder="请输入优惠券类型(10满减券 20折扣券 30免费劵)"
|
||||||
<a-form-item
|
v-model:value="form.type"
|
||||||
v-if="form.type === 10"
|
/>
|
||||||
label="减免金额"
|
</a-form-item>
|
||||||
name="reducePrice"
|
<a-form-item label="满减券-减免金额" name="reducePrice">
|
||||||
>
|
<a-input
|
||||||
<a-input-number
|
allow-clear
|
||||||
:min="0"
|
placeholder="请输入满减券-减免金额"
|
||||||
:precision="2"
|
|
||||||
placeholder="请输入减免金额"
|
|
||||||
v-model:value="form.reducePrice"
|
v-model:value="form.reducePrice"
|
||||||
style="width: 100%"
|
/>
|
||||||
>
|
|
||||||
<template #addonAfter>元</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="折扣券-折扣率(0-100)" name="discount">
|
||||||
<a-form-item
|
<a-input
|
||||||
v-if="form.type === 20"
|
allow-clear
|
||||||
label="折扣率"
|
placeholder="请输入折扣券-折扣率(0-100)"
|
||||||
name="discount"
|
|
||||||
>
|
|
||||||
<a-input-number
|
|
||||||
:min="1"
|
|
||||||
:max="99"
|
|
||||||
:precision="1"
|
|
||||||
placeholder="请输入折扣率"
|
|
||||||
v-model:value="form.discount"
|
v-model:value="form.discount"
|
||||||
style="width: 100%"
|
/>
|
||||||
>
|
|
||||||
<template #addonAfter>折</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="最低消费金额" name="minPrice">
|
||||||
<a-form-item
|
<a-input
|
||||||
label="最低消费金额"
|
allow-clear
|
||||||
name="minPrice"
|
placeholder="请输入最低消费金额"
|
||||||
>
|
|
||||||
<a-input-number
|
|
||||||
:min="0"
|
|
||||||
:precision="2"
|
|
||||||
placeholder="0表示无门槛"
|
|
||||||
v-model:value="form.minPrice"
|
v-model:value="form.minPrice"
|
||||||
style="width: 100%"
|
/>
|
||||||
>
|
|
||||||
<template #addonAfter>元</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="到期类型(10领取后生效 20固定时间)" name="expireType">
|
||||||
<!-- 有效期设置 -->
|
<a-input
|
||||||
<a-divider orientation="left">有效期设置</a-divider>
|
allow-clear
|
||||||
|
placeholder="请输入到期类型(10领取后生效 20固定时间)"
|
||||||
<a-form-item label="到期类型" name="expireType">
|
v-model:value="form.expireType"
|
||||||
<a-radio-group v-model:value="form.expireType" @change="onExpireTypeChange">
|
/>
|
||||||
<a-radio :value="10">领取后生效</a-radio>
|
|
||||||
<a-radio :value="20">固定时间</a-radio>
|
|
||||||
</a-radio-group>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="领取后生效-有效天数" name="expireDay">
|
||||||
<div :gutter="16" v-if="form.expireType === 10">
|
<a-input
|
||||||
<a-form-item
|
allow-clear
|
||||||
label="有效天数"
|
placeholder="请输入领取后生效-有效天数"
|
||||||
name="expireDay"
|
v-model:value="form.expireDay"
|
||||||
>
|
/>
|
||||||
<a-input-number
|
</a-form-item>
|
||||||
:min="1"
|
<a-form-item label="有效期开始时间" name="startTime">
|
||||||
placeholder="请输入有效天数"
|
<a-input
|
||||||
v-model:value="form.expireDay"
|
allow-clear
|
||||||
style="width: 100%"
|
placeholder="请输入有效期开始时间"
|
||||||
>
|
v-model:value="form.startTime"
|
||||||
<template #addonAfter>天</template>
|
/>
|
||||||
</a-input-number>
|
</a-form-item>
|
||||||
</a-form-item>
|
<a-form-item label="有效期结束时间" name="endTime">
|
||||||
</div>
|
<a-input
|
||||||
|
allow-clear
|
||||||
<div :gutter="16" v-if="form.expireType === 20">
|
placeholder="请输入有效期结束时间"
|
||||||
<a-form-item
|
v-model:value="form.endTime"
|
||||||
label="开始时间"
|
/>
|
||||||
name="startTime"
|
</a-form-item>
|
||||||
>
|
<a-form-item label="适用范围(10全部商品 20指定商品 30指定分类)" name="applyRange">
|
||||||
<a-date-picker
|
<a-input
|
||||||
placeholder="请选择开始时间"
|
allow-clear
|
||||||
v-model:value="form.startTime"
|
placeholder="请输入适用范围(10全部商品 20指定商品 30指定分类)"
|
||||||
style="width: 100%"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
valueFormat="YYYY-MM-DD"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item
|
|
||||||
label="结束时间"
|
|
||||||
name="endTime"
|
|
||||||
>
|
|
||||||
<a-date-picker
|
|
||||||
placeholder="请选择结束时间"
|
|
||||||
v-model:value="form.endTime"
|
|
||||||
style="width: 100%"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
valueFormat="YYYY-MM-DD"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</div>
|
|
||||||
<!-- 适用范围 -->
|
|
||||||
<a-divider orientation="left">适用范围</a-divider>
|
|
||||||
|
|
||||||
<a-form-item label="适用范围" name="applyRange">
|
|
||||||
<a-select
|
|
||||||
placeholder="请选择适用范围"
|
|
||||||
v-model:value="form.applyRange"
|
v-model:value="form.applyRange"
|
||||||
>
|
/>
|
||||||
<a-select-option :value="10">全部商品</a-select-option>
|
|
||||||
<a-select-option :value="20">指定商品</a-select-option>
|
|
||||||
<a-select-option :value="30">指定分类</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="适用范围配置(json格式)" name="applyRangeConfig">
|
||||||
<a-form-item
|
<a-input
|
||||||
v-if="form.applyRange === 20 || form.applyRange === 30"
|
allow-clear
|
||||||
label="范围配置"
|
placeholder="请输入适用范围配置(json格式)"
|
||||||
name="applyRangeConfig"
|
|
||||||
>
|
|
||||||
<a-textarea
|
|
||||||
:rows="3"
|
|
||||||
placeholder="请输入JSON格式的配置,如:[1,2,3]"
|
|
||||||
v-model:value="form.applyRangeConfig"
|
v-model:value="form.applyRangeConfig"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="是否过期(0未过期 1已过期)" name="isExpire">
|
||||||
<!-- 发放设置 -->
|
<a-input
|
||||||
<a-divider orientation="left">发放设置</a-divider>
|
allow-clear
|
||||||
|
placeholder="请输入是否过期(0未过期 1已过期)"
|
||||||
<a-form-item
|
v-model:value="form.isExpire"
|
||||||
label="发放总数量"
|
/>
|
||||||
name="totalCount"
|
|
||||||
>
|
|
||||||
<a-input-number
|
|
||||||
:min="-1"
|
|
||||||
placeholder="-1表示无限制"
|
|
||||||
v-model:value="form.totalCount"
|
|
||||||
style="width: 100%"
|
|
||||||
>
|
|
||||||
<template #addonAfter>张</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item label="排序(数字越小越靠前)" name="sortNumber">
|
||||||
label="每人限领"
|
|
||||||
name="limitPerUser"
|
|
||||||
>
|
|
||||||
<a-input-number
|
|
||||||
:min="-1"
|
|
||||||
placeholder="-1表示无限制"
|
|
||||||
v-model:value="form.limitPerUser"
|
|
||||||
style="width: 100%"
|
|
||||||
>
|
|
||||||
<template #addonAfter>张</template>
|
|
||||||
</a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item
|
|
||||||
label="排序"
|
|
||||||
name="sortNumber"
|
|
||||||
>
|
|
||||||
<a-input-number
|
<a-input-number
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="9999"
|
:max="9999"
|
||||||
placeholder="数字越小越靠前"
|
class="ele-fluid"
|
||||||
|
placeholder="请输入排序号"
|
||||||
v-model:value="form.sortNumber"
|
v-model:value="form.sortNumber"
|
||||||
style="width: 100%"
|
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="状态, 0正常, 1禁用" name="status">
|
||||||
<!-- 状态设置 -->
|
|
||||||
<a-divider orientation="left">状态设置</a-divider>
|
|
||||||
|
|
||||||
<a-form-item
|
|
||||||
label="显示状态"
|
|
||||||
name="status"
|
|
||||||
>
|
|
||||||
<a-radio-group v-model:value="form.status">
|
<a-radio-group v-model:value="form.status">
|
||||||
<a-radio :value="0">显示</a-radio>
|
<a-radio :value="0">显示</a-radio>
|
||||||
<a-radio :value="1">隐藏</a-radio>
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item label="是否删除, 0否, 1是" name="deleted">
|
||||||
label="启用状态"
|
<a-input
|
||||||
name="enabled"
|
allow-clear
|
||||||
>
|
placeholder="请输入是否删除, 0否, 1是"
|
||||||
<a-radio-group v-model:value="form.enabled">
|
v-model:value="form.deleted"
|
||||||
<a-radio :value="true">启用</a-radio>
|
/>
|
||||||
<a-radio :value="false">禁用</a-radio>
|
</a-form-item>
|
||||||
</a-radio-group>
|
<a-form-item label="创建用户ID" name="userId">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入创建用户ID"
|
||||||
|
v-model:value="form.userId"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="修改时间" name="updateTime">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入修改时间"
|
||||||
|
v-model:value="form.updateTime"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="发放总数量(-1表示无限制)" name="totalCount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入发放总数量(-1表示无限制)"
|
||||||
|
v-model:value="form.totalCount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="已发放数量" name="issuedCount">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入已发放数量"
|
||||||
|
v-model:value="form.issuedCount"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="每人限领数量(-1表示无限制)" name="limitPerUser">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入每人限领数量(-1表示无限制)"
|
||||||
|
v-model:value="form.limitPerUser"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="是否启用(0禁用 1启用)" name="enabled">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入是否启用(0禁用 1启用)"
|
||||||
|
v-model:value="form.enabled"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</ele-modal>
|
</ele-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {ref, reactive, watch} from 'vue';
|
import { ref, reactive, watch } from 'vue';
|
||||||
import {Form, message} from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import {assignObject} from 'ele-admin-pro';
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
import {addShopCoupon, updateShopCoupon} from '@/api/shop/shopCoupon';
|
import { addShopCoupon, updateShopCoupon } from '@/api/shop/shopCoupon';
|
||||||
import {ShopCoupon} from '@/api/shop/shopCoupon/model';
|
import { ShopCoupon } from '@/api/shop/shopCoupon/model';
|
||||||
import {useThemeStore} from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import {storeToRefs} from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import {ItemType} from 'ele-admin-pro/es/ele-image-upload/types';
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
import {FormInstance} from 'ant-design-vue/es/form';
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
const useForm = Form.useForm;
|
const useForm = Form.useForm;
|
||||||
// 是否开启响应式布局
|
// 是否开启响应式布局
|
||||||
const themeStore = useThemeStore();
|
const themeStore = useThemeStore();
|
||||||
const {styleResponsive} = storeToRefs(themeStore);
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
const props = defineProps<{
|
|
||||||
// 弹窗是否打开
|
|
||||||
visible: boolean;
|
|
||||||
// 修改回显的数据
|
|
||||||
data?: ShopCoupon | null;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const props = defineProps<{
|
||||||
(e: 'done'): void;
|
// 弹窗是否打开
|
||||||
(e: 'update:visible', visible: boolean): void;
|
visible: boolean;
|
||||||
}>();
|
// 修改回显的数据
|
||||||
|
data?: ShopCoupon | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
// 提交状态
|
const emit = defineEmits<{
|
||||||
const loading = ref(false);
|
(e: 'done'): void;
|
||||||
// 是否显示最大化切换按钮
|
(e: 'update:visible', visible: boolean): void;
|
||||||
const maxable = ref(true);
|
}>();
|
||||||
// 表格选中数据
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
|
||||||
const images = ref<ItemType[]>([]);
|
|
||||||
|
|
||||||
// 表单数据
|
// 提交状态
|
||||||
const form = reactive<ShopCoupon>({
|
const loading = ref(false);
|
||||||
id: undefined,
|
// 是否显示最大化切换按钮
|
||||||
name: '',
|
const maxable = ref(true);
|
||||||
description: '',
|
// 表格选中数据
|
||||||
type: 10, // 默认满减券
|
const formRef = ref<FormInstance | null>(null);
|
||||||
reducePrice: undefined,
|
const images = ref<ItemType[]>([]);
|
||||||
discount: undefined,
|
|
||||||
minPrice: '', // 默认无门槛
|
|
||||||
expireType: 10, // 默认领取后生效
|
|
||||||
expireDay: 30, // 默认30天
|
|
||||||
startTime: undefined,
|
|
||||||
endTime: undefined,
|
|
||||||
applyRange: 10, // 默认全部商品
|
|
||||||
applyRangeConfig: '',
|
|
||||||
isExpire: 0,
|
|
||||||
sortNumber: 100,
|
|
||||||
status: 0, // 默认显示
|
|
||||||
deleted: 0,
|
|
||||||
tenantId: undefined,
|
|
||||||
totalCount: -1, // 默认无限制
|
|
||||||
issuedCount: 0,
|
|
||||||
limitPerUser: -1, // 默认无限制
|
|
||||||
enabled: true, // 默认启用
|
|
||||||
});
|
|
||||||
|
|
||||||
/* 更新visible */
|
// 用户信息
|
||||||
const updateVisible = (value: boolean) => {
|
const form = reactive<ShopCoupon>({
|
||||||
emit('update:visible', value);
|
id: undefined,
|
||||||
};
|
name: undefined,
|
||||||
|
description: undefined,
|
||||||
|
type: undefined,
|
||||||
|
reducePrice: undefined,
|
||||||
|
discount: undefined,
|
||||||
|
minPrice: undefined,
|
||||||
|
expireType: undefined,
|
||||||
|
expireDay: undefined,
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
applyRange: undefined,
|
||||||
|
applyRangeConfig: undefined,
|
||||||
|
isExpire: undefined,
|
||||||
|
sortNumber: undefined,
|
||||||
|
status: undefined,
|
||||||
|
deleted: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
totalCount: undefined,
|
||||||
|
issuedCount: undefined,
|
||||||
|
limitPerUser: undefined,
|
||||||
|
enabled: undefined,
|
||||||
|
shopCouponId: undefined,
|
||||||
|
shopCouponName: '',
|
||||||
|
status: 0,
|
||||||
|
comments: '',
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
// 表单验证规则
|
/* 更新visible */
|
||||||
const rules = reactive({
|
const updateVisible = (value: boolean) => {
|
||||||
name: [
|
emit('update:visible', value);
|
||||||
{
|
};
|
||||||
required: true,
|
|
||||||
message: '请输入优惠券名称',
|
// 表单验证规则
|
||||||
trigger: 'blur'
|
const rules = reactive({
|
||||||
}
|
shopCouponName: [
|
||||||
],
|
{
|
||||||
type: [
|
required: true,
|
||||||
{
|
type: 'string',
|
||||||
required: true,
|
message: '请填写优惠券名称',
|
||||||
message: '请选择优惠券类型',
|
trigger: 'blur'
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
reducePrice: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入减免金额',
|
|
||||||
trigger: 'blur',
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.type === 10 && (!value || value <= 0)) {
|
|
||||||
return Promise.reject('减免金额必须大于0');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
],
|
});
|
||||||
discount: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入折扣率',
|
|
||||||
trigger: 'blur',
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.type === 20 && (!value || value <= 0 || value >= 100)) {
|
|
||||||
return Promise.reject('折扣率必须在1-99之间');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
expireType: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择到期类型',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
expireDay: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请输入有效天数',
|
|
||||||
trigger: 'blur',
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.expireType === 10 && (!value || value <= 0)) {
|
|
||||||
return Promise.reject('有效天数必须大于0');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
startTime: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择开始时间',
|
|
||||||
trigger: 'change',
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.expireType === 20 && !value) {
|
|
||||||
return Promise.reject('请选择开始时间');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
endTime: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择结束时间',
|
|
||||||
trigger: 'change',
|
|
||||||
validator: (rule: any, value: any) => {
|
|
||||||
if (form.expireType === 20 && !value) {
|
|
||||||
return Promise.reject('请选择结束时间');
|
|
||||||
}
|
|
||||||
if (form.expireType === 20 && form.startTime && value && value <= form.startTime) {
|
|
||||||
return Promise.reject('结束时间必须晚于开始时间');
|
|
||||||
}
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
applyRange: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择适用范围',
|
|
||||||
trigger: 'change'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const {resetFields} = useForm(form, rules);
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
/* 优惠券类型变化处理 */
|
uid: data.id,
|
||||||
const onTypeChange = (value: number) => {
|
url: data.path,
|
||||||
// 清空相关字段
|
status: 'done'
|
||||||
if (value !== 10) {
|
|
||||||
form.reducePrice = undefined;
|
|
||||||
}
|
|
||||||
if (value !== 20) {
|
|
||||||
form.discount = undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 到期类型变化处理 */
|
|
||||||
const onExpireTypeChange = (e: any) => {
|
|
||||||
const value = e.target.value;
|
|
||||||
// 清空相关字段
|
|
||||||
if (value !== 10) {
|
|
||||||
form.expireDay = undefined;
|
|
||||||
}
|
|
||||||
if (value !== 20) {
|
|
||||||
form.startTime = undefined;
|
|
||||||
form.endTime = undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 保存编辑 */
|
|
||||||
const save = () => {
|
|
||||||
if (!formRef.value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formRef.value
|
|
||||||
.validate()
|
|
||||||
.then(() => {
|
|
||||||
loading.value = true;
|
|
||||||
|
|
||||||
// 清理和准备提交数据
|
|
||||||
const formData = {
|
|
||||||
...form
|
|
||||||
};
|
|
||||||
|
|
||||||
// 清理不需要的字段
|
|
||||||
delete formData.shopCouponId;
|
|
||||||
delete formData.shopCouponName;
|
|
||||||
delete formData.comments;
|
|
||||||
|
|
||||||
// 确保数值类型正确
|
|
||||||
if (formData.type) formData.type = Number(formData.type);
|
|
||||||
if (formData.expireType) formData.expireType = Number(formData.expireType);
|
|
||||||
if (formData.applyRange) formData.applyRange = Number(formData.applyRange);
|
|
||||||
if (formData.status !== undefined) formData.status = Number(formData.status);
|
|
||||||
if (formData.enabled !== undefined) formData.enabled = Number(formData.enabled);
|
|
||||||
if (formData.deleted !== undefined) formData.deleted = Number(formData.deleted);
|
|
||||||
if (formData.isExpire !== undefined) formData.isExpire = Number(formData.isExpire);
|
|
||||||
if (formData.sortNumber !== undefined) formData.sortNumber = Number(formData.sortNumber);
|
|
||||||
if (formData.totalCount !== undefined) formData.totalCount = Number(formData.totalCount);
|
|
||||||
if (formData.limitPerUser !== undefined) formData.limitPerUser = Number(formData.limitPerUser);
|
|
||||||
if (formData.expireDay !== undefined) formData.expireDay = Number(formData.expireDay);
|
|
||||||
if (formData.reducePrice !== undefined) formData.reducePrice = Number(formData.reducePrice);
|
|
||||||
if (formData.discount !== undefined) formData.discount = Number(formData.discount);
|
|
||||||
if (formData.minPrice !== undefined) formData.minPrice = Number(formData.minPrice);
|
|
||||||
|
|
||||||
// 清理空值
|
|
||||||
Object.keys(formData).forEach(key => {
|
|
||||||
if (formData[key] === undefined || formData[key] === null || formData[key] === '') {
|
|
||||||
delete formData[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('提交的数据:', formData);
|
|
||||||
|
|
||||||
const saveOrUpdate = isUpdate.value ? updateShopCoupon : addShopCoupon;
|
|
||||||
saveOrUpdate(formData)
|
|
||||||
.then((msg) => {
|
|
||||||
loading.value = false;
|
|
||||||
message.success(msg);
|
|
||||||
updateVisible(false);
|
|
||||||
emit('done');
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
loading.value = false;
|
|
||||||
console.error('保存失败:', e);
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
});
|
});
|
||||||
};
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
const onDeleteItem = (index: number) => {
|
||||||
() => props.visible,
|
images.value.splice(index, 1);
|
||||||
(visible) => {
|
form.image = '';
|
||||||
if (visible) {
|
};
|
||||||
images.value = [];
|
|
||||||
if (props.data) {
|
const { resetFields } = useForm(form, rules);
|
||||||
assignObject(form, props.data);
|
|
||||||
isUpdate.value = true;
|
/* 保存编辑 */
|
||||||
} else {
|
const save = () => {
|
||||||
isUpdate.value = false;
|
if (!formRef.value) {
|
||||||
}
|
return;
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
}
|
||||||
},
|
formRef.value
|
||||||
{immediate: true}
|
.validate()
|
||||||
);
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateShopCoupon : addShopCoupon;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,377 +1,346 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
row-key="id"
|
row-key="shopCouponId"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:datasource="datasource"
|
:datasource="datasource"
|
||||||
:customRow="customRow"
|
:customRow="customRow"
|
||||||
tool-class="ele-toolbar-form"
|
tool-class="ele-toolbar-form"
|
||||||
class="sys-org-table"
|
class="sys-org-table"
|
||||||
:scroll="{ x: 1400, y: 'calc(100vh - 320px)' }"
|
>
|
||||||
size="middle"
|
<template #toolbar>
|
||||||
:pagination="{
|
<search
|
||||||
showSizeChanger: true,
|
@search="reload"
|
||||||
showQuickJumper: true,
|
:selection="selection"
|
||||||
showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条/共 ${total} 条`
|
@add="openEdit"
|
||||||
}"
|
@remove="removeBatch"
|
||||||
>
|
@batchMove="openMove"
|
||||||
<template #toolbar>
|
/>
|
||||||
<search
|
|
||||||
@search="reload"
|
|
||||||
:selection="selection"
|
|
||||||
@add="openEdit"
|
|
||||||
@remove="removeBatch"
|
|
||||||
@batchMove="openMove"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #bodyCell="{ column, record }">
|
|
||||||
<template v-if="column.key === 'couponStatus'">
|
|
||||||
<a-tag v-if="record.deleted === 1" color="red">已删除</a-tag>
|
|
||||||
<a-tag v-else-if="record.enabled === 0" color="orange">已禁用</a-tag>
|
|
||||||
<a-tag v-else-if="record.isExpire === 1" color="gray">已过期</a-tag>
|
|
||||||
<a-tag v-else-if="record.status === 1" color="red">隐藏</a-tag>
|
|
||||||
<a-tag v-else color="green">正常</a-tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template #bodyCell="{ column, record }">
|
||||||
<a @click="openEdit(record)" class="ele-text-primary">
|
<template v-if="column.key === 'image'">
|
||||||
<EditOutlined/>
|
<a-image :src="record.image" :width="50" />
|
||||||
编辑
|
</template>
|
||||||
</a>
|
<template v-if="column.key === 'status'">
|
||||||
<a-divider type="vertical"/>
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
<a-popconfirm
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
title="确定要删除此优惠券吗?"
|
</template>
|
||||||
@confirm="remove(record)"
|
<template v-if="column.key === 'action'">
|
||||||
placement="topRight"
|
<a-space>
|
||||||
>
|
<a @click="openEdit(record)">修改</a>
|
||||||
<a class="ele-text-danger">
|
<a-divider type="vertical" />
|
||||||
<DeleteOutlined/>
|
<a-popconfirm
|
||||||
删除
|
title="确定要删除此记录吗?"
|
||||||
</a>
|
@confirm="remove(record)"
|
||||||
</a-popconfirm>
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</ele-pro-table>
|
||||||
</ele-pro-table>
|
</a-card>
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<ShopCouponEdit v-model:visible="showEdit" :data="current" @done="reload"/>
|
<ShopCouponEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
</a-page-header>
|
</a-page-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {createVNode, ref} from 'vue';
|
import { createVNode, ref } from 'vue';
|
||||||
import {message, Modal} from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import {ExclamationCircleOutlined, EditOutlined, DeleteOutlined} from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import type {EleProTable} from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import {toDateString} from 'ele-admin-pro';
|
import { toDateString } from 'ele-admin-pro';
|
||||||
import type {
|
import type {
|
||||||
DatasourceFunction,
|
DatasourceFunction,
|
||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
import {getPageTitle} from '@/utils/common';
|
import {getPageTitle} from '@/utils/common';
|
||||||
import ShopCouponEdit from './components/shopCouponEdit.vue';
|
import ShopCouponEdit from './components/shopCouponEdit.vue';
|
||||||
import {pageShopCoupon, removeShopCoupon, removeBatchShopCoupon} from '@/api/shop/shopCoupon';
|
import { pageShopCoupon, removeShopCoupon, removeBatchShopCoupon } from '@/api/shop/shopCoupon';
|
||||||
import type {ShopCoupon, ShopCouponParam} from '@/api/shop/shopCoupon/model';
|
import type { ShopCoupon, ShopCouponParam } from '@/api/shop/shopCoupon/model';
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const selection = ref<ShopCoupon[]>([]);
|
const selection = ref<ShopCoupon[]>([]);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<ShopCoupon | null>(null);
|
const current = ref<ShopCoupon | null>(null);
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 是否显示批量移动弹窗
|
// 是否显示批量移动弹窗
|
||||||
const showMove = ref(false);
|
const showMove = ref(false);
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
|
||||||
limit,
|
|
||||||
where,
|
|
||||||
orders,
|
|
||||||
filters
|
|
||||||
}) => {
|
|
||||||
if (filters) {
|
|
||||||
where.status = filters.status;
|
|
||||||
}
|
|
||||||
return pageShopCoupon({
|
|
||||||
...where,
|
|
||||||
...orders,
|
|
||||||
page,
|
page,
|
||||||
limit
|
limit,
|
||||||
});
|
where,
|
||||||
};
|
orders,
|
||||||
|
filters
|
||||||
// 表格列配置
|
}) => {
|
||||||
const columns = ref<ColumnItem[]>([
|
if (filters) {
|
||||||
{
|
where.status = filters.status;
|
||||||
title: 'ID',
|
|
||||||
dataIndex: 'id',
|
|
||||||
key: 'id',
|
|
||||||
align: 'center',
|
|
||||||
width: 80,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '优惠券名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
key: 'name',
|
|
||||||
align: 'left',
|
|
||||||
width: 150,
|
|
||||||
ellipsis: true,
|
|
||||||
fixed: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
key: 'type',
|
|
||||||
align: 'center',
|
|
||||||
width: 100,
|
|
||||||
customRender: ({text}) => {
|
|
||||||
const typeMap: Record<number, string> = {
|
|
||||||
10: '满减券',
|
|
||||||
20: '折扣券',
|
|
||||||
30: '免费券'
|
|
||||||
};
|
|
||||||
return typeMap[text] || text;
|
|
||||||
}
|
}
|
||||||
},
|
return pageShopCoupon({
|
||||||
{
|
...where,
|
||||||
title: '优惠金额',
|
...orders,
|
||||||
key: 'couponValue',
|
page,
|
||||||
align: 'center',
|
limit
|
||||||
width: 120,
|
|
||||||
customRender: ({record}) => {
|
|
||||||
if (record.type === 10) {
|
|
||||||
return `减${record.reducePrice}元`;
|
|
||||||
} else if (record.type === 20) {
|
|
||||||
return `${record.discount}折`;
|
|
||||||
}
|
|
||||||
return '免费';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '最低消费',
|
|
||||||
dataIndex: 'minPrice',
|
|
||||||
key: 'minPrice',
|
|
||||||
align: 'center',
|
|
||||||
width: 100,
|
|
||||||
customRender: ({text}) => text ? `满${text}元` : '无门槛'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '有效期',
|
|
||||||
key: 'validity',
|
|
||||||
align: 'center',
|
|
||||||
width: 180,
|
|
||||||
customRender: ({record}) => {
|
|
||||||
if (record.expireType === 10) {
|
|
||||||
return `领取后${record.expireDay}天`;
|
|
||||||
} else {
|
|
||||||
return `${toDateString(record.startTime, 'MM-dd')} 至 ${toDateString(record.endTime, 'MM-dd')}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '适用范围',
|
|
||||||
dataIndex: 'applyRange',
|
|
||||||
key: 'applyRange',
|
|
||||||
align: 'center',
|
|
||||||
width: 100,
|
|
||||||
customRender: ({text}) => {
|
|
||||||
const rangeMap: Record<number, string> = {
|
|
||||||
10: '全部商品',
|
|
||||||
20: '指定商品',
|
|
||||||
30: '指定分类'
|
|
||||||
};
|
|
||||||
return rangeMap[text] || text;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '发放情况',
|
|
||||||
key: 'issueInfo',
|
|
||||||
align: 'center',
|
|
||||||
width: 120,
|
|
||||||
customRender: ({record}) => {
|
|
||||||
const total = record.totalCount === -1 ? '无限' : record.totalCount;
|
|
||||||
return `${record.issuedCount}/${total}`;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '限领数量',
|
|
||||||
dataIndex: 'limitPerUser',
|
|
||||||
key: 'limitPerUser',
|
|
||||||
align: 'center',
|
|
||||||
width: 100,
|
|
||||||
customRender: ({text}) => text === -1 ? '无限制' : `${text}张/人`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态',
|
|
||||||
key: 'couponStatus',
|
|
||||||
align: 'center',
|
|
||||||
width: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序',
|
|
||||||
dataIndex: 'sortNumber',
|
|
||||||
key: 'sortNumber',
|
|
||||||
align: 'center',
|
|
||||||
width: 80,
|
|
||||||
sorter: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
align: 'center',
|
|
||||||
width: 120,
|
|
||||||
sorter: true,
|
|
||||||
ellipsis: true,
|
|
||||||
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 150,
|
|
||||||
fixed: 'right',
|
|
||||||
align: 'center',
|
|
||||||
hideInSetting: true
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* 搜索 */
|
|
||||||
const reload = (where?: ShopCouponParam) => {
|
|
||||||
selection.value = [];
|
|
||||||
tableRef?.value?.reload({where: where});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
|
||||||
const openEdit = (row?: ShopCoupon) => {
|
|
||||||
current.value = row ?? null;
|
|
||||||
showEdit.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 打开批量移动弹窗 */
|
|
||||||
const openMove = () => {
|
|
||||||
showMove.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 删除单个 */
|
|
||||||
const remove = (row: ShopCoupon) => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeShopCoupon(row.id)
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
/* 批量删除 */
|
|
||||||
const removeBatch = () => {
|
|
||||||
if (!selection.value.length) {
|
|
||||||
message.error('请至少选择一条数据');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除选中的记录吗?',
|
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
|
||||||
maskClosable: true,
|
|
||||||
onOk: () => {
|
|
||||||
const hide = message.loading('请求中..', 0);
|
|
||||||
removeBatchShopCoupon(selection.value.map((d) => d.id))
|
|
||||||
.then((msg) => {
|
|
||||||
hide();
|
|
||||||
message.success(msg);
|
|
||||||
reload();
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
hide();
|
|
||||||
message.error(e.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 查询 */
|
|
||||||
const query = () => {
|
|
||||||
loading.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* 自定义行属性 */
|
|
||||||
const customRow = (record: ShopCoupon) => {
|
|
||||||
return {
|
|
||||||
// 行点击事件
|
|
||||||
onClick: () => {
|
|
||||||
// console.log(record);
|
|
||||||
},
|
|
||||||
// 行双击事件
|
|
||||||
onDblclick: () => {
|
|
||||||
openEdit(record);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
query();
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'id',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '优惠券名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '优惠券描述',
|
||||||
|
dataIndex: 'description',
|
||||||
|
key: 'description',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '优惠券类型(10满减券 20折扣券 30免费劵)',
|
||||||
|
dataIndex: 'type',
|
||||||
|
key: 'type',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '满减券-减免金额',
|
||||||
|
dataIndex: 'reducePrice',
|
||||||
|
key: 'reducePrice',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '折扣券-折扣率(0-100)',
|
||||||
|
dataIndex: 'discount',
|
||||||
|
key: 'discount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最低消费金额',
|
||||||
|
dataIndex: 'minPrice',
|
||||||
|
key: 'minPrice',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '到期类型(10领取后生效 20固定时间)',
|
||||||
|
dataIndex: 'expireType',
|
||||||
|
key: 'expireType',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '领取后生效-有效天数',
|
||||||
|
dataIndex: 'expireDay',
|
||||||
|
key: 'expireDay',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '有效期开始时间',
|
||||||
|
dataIndex: 'startTime',
|
||||||
|
key: 'startTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '有效期结束时间',
|
||||||
|
dataIndex: 'endTime',
|
||||||
|
key: 'endTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '适用范围(10全部商品 20指定商品 30指定分类)',
|
||||||
|
dataIndex: 'applyRange',
|
||||||
|
key: 'applyRange',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '适用范围配置(json格式)',
|
||||||
|
dataIndex: 'applyRangeConfig',
|
||||||
|
key: 'applyRangeConfig',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否过期(0未过期 1已过期)',
|
||||||
|
dataIndex: 'isExpire',
|
||||||
|
key: 'isExpire',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '排序(数字越小越靠前)',
|
||||||
|
dataIndex: 'sortNumber',
|
||||||
|
key: 'sortNumber',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态, 0正常, 1禁用',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否删除, 0否, 1是',
|
||||||
|
dataIndex: 'deleted',
|
||||||
|
key: 'deleted',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建用户ID',
|
||||||
|
dataIndex: 'userId',
|
||||||
|
key: 'userId',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
key: 'createTime',
|
||||||
|
align: 'center',
|
||||||
|
sorter: true,
|
||||||
|
ellipsis: true,
|
||||||
|
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
key: 'updateTime',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发放总数量(-1表示无限制)',
|
||||||
|
dataIndex: 'totalCount',
|
||||||
|
key: 'totalCount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '已发放数量',
|
||||||
|
dataIndex: 'issuedCount',
|
||||||
|
key: 'issuedCount',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '每人限领数量(-1表示无限制)',
|
||||||
|
dataIndex: 'limitPerUser',
|
||||||
|
key: 'limitPerUser',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否启用(0禁用 1启用)',
|
||||||
|
dataIndex: 'enabled',
|
||||||
|
key: 'enabled',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: ShopCouponParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: ShopCoupon) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: ShopCoupon) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeShopCoupon(row.shopCouponId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的记录吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeBatchShopCoupon(selection.value.map((d) => d.shopCouponId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: ShopCoupon) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: 'ShopCoupon'
|
name: 'ShopCoupon'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped></style>
|
||||||
.sys-org-table {
|
|
||||||
:deep(.ant-table) {
|
|
||||||
.ant-table-thead > tr > th {
|
|
||||||
background: #fafafa;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #262626;
|
|
||||||
border-bottom: 2px solid #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-tbody > tr > td {
|
|
||||||
padding: 12px 8px;
|
|
||||||
border-bottom: 1px solid #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-tbody > tr:hover > td {
|
|
||||||
background: #f8f9ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-tag {
|
|
||||||
margin: 0;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 12px;
|
|
||||||
padding: 2px 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-primary {
|
|
||||||
color: #1890ff;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #40a9ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ele-text-danger {
|
|
||||||
color: #ff4d4f;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #ff7875;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -16,10 +16,8 @@
|
|||||||
<a-tab-pane key="undelivered" tab="待发货"/>
|
<a-tab-pane key="undelivered" tab="待发货"/>
|
||||||
<a-tab-pane key="unreceived" tab="待收货"/>
|
<a-tab-pane key="unreceived" tab="待收货"/>
|
||||||
<a-tab-pane key="completed" tab="已完成"/>
|
<a-tab-pane key="completed" tab="已完成"/>
|
||||||
<a-tab-pane key="cancelled" tab="已取消"/>
|
|
||||||
<!-- <a-tab-pane key="unevaluated" tab="待评价"/>-->
|
|
||||||
<a-tab-pane key="refunded" tab="已退款"/>
|
<a-tab-pane key="refunded" tab="已退款"/>
|
||||||
<!-- <a-tab-pane key="deleted" tab="已删除"/>-->
|
<a-tab-pane key="cancelled" tab="已取消"/>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
<div class="ele-body">
|
|
||||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
<ele-pro-table
|
<ele-pro-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
@@ -46,8 +45,7 @@
|
|||||||
|
|
||||||
<!-- 编辑弹窗 -->
|
<!-- 编辑弹窗 -->
|
||||||
<ShopUserRefereeEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
<ShopUserRefereeEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
</div>
|
</a-page-header>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -61,6 +59,7 @@
|
|||||||
ColumnItem
|
ColumnItem
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import Search from './components/search.vue';
|
import Search from './components/search.vue';
|
||||||
|
import {getPageTitle} from '@/utils/common';
|
||||||
import ShopUserRefereeEdit from './components/shopUserRefereeEdit.vue';
|
import ShopUserRefereeEdit from './components/shopUserRefereeEdit.vue';
|
||||||
import { pageShopUserReferee, removeShopUserReferee, removeBatchShopUserReferee } from '@/api/shop/shopUserReferee';
|
import { pageShopUserReferee, removeShopUserReferee, removeBatchShopUserReferee } from '@/api/shop/shopUserReferee';
|
||||||
import type { ShopUserReferee, ShopUserRefereeParam } from '@/api/shop/shopUserReferee/model';
|
import type { ShopUserReferee, ShopUserRefereeParam } from '@/api/shop/shopUserReferee/model';
|
||||||
|
|||||||
Reference in New Issue
Block a user