- 移除 ApiResult 和 PageResult 的冗余导入 - 更新请求路径,移除 MODULES_API_URL 的使用 - 调整请求头,移除不必要的 Content-Type 设置 -统一处理 enabled 字段类型
106 lines
2.6 KiB
TypeScript
106 lines
2.6 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { ShopDealerWithdraw, ShopDealerWithdrawParam } from './model';
|
|
|
|
/**
|
|
* 分页查询分销商提现明细表
|
|
*/
|
|
export async function pageShopDealerWithdraw(params: ShopDealerWithdrawParam) {
|
|
const res = await request.get<ApiResult<PageResult<ShopDealerWithdraw>>>(
|
|
'/shop/shop-dealer-withdraw/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 查询分销商提现明细表列表
|
|
*/
|
|
export async function listShopDealerWithdraw(params?: ShopDealerWithdrawParam) {
|
|
const res = await request.get<ApiResult<ShopDealerWithdraw[]>>(
|
|
'/shop/shop-dealer-withdraw',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 添加分销商提现明细表
|
|
*/
|
|
export async function addShopDealerWithdraw(data: ShopDealerWithdraw) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/shop/shop-dealer-withdraw',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 修改分销商提现明细表
|
|
*/
|
|
export async function updateShopDealerWithdraw(data: ShopDealerWithdraw) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/shop/shop-dealer-withdraw',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 删除分销商提现明细表
|
|
*/
|
|
export async function removeShopDealerWithdraw(id?: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/shop/shop-dealer-withdraw/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除分销商提现明细表
|
|
*/
|
|
export async function removeBatchShopDealerWithdraw(data: (number | undefined)[]) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/shop/shop-dealer-withdraw/batch',
|
|
{
|
|
data
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询分销商提现明细表
|
|
*/
|
|
export async function getShopDealerWithdraw(id: number) {
|
|
const res = await request.get<ApiResult<ShopDealerWithdraw>>(
|
|
'/shop/shop-dealer-withdraw/' + id
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|