feat(credit): 添加小程序端客户管理功能
- 创建小程序端客户数据模型和API接口 - 实现分页查询、新增、修改、删除等基础CRUD操作 - 添加小程序端客户管理页面和编辑弹窗组件 - 集成表格展示、搜索、批量操作等功能 - 配置开发环境API地址为http://127.0.0.1:9200/api
This commit is contained in:
105
src/api/credit/creditMpCustomer/index.ts
Normal file
105
src/api/credit/creditMpCustomer/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { CreditMpCustomer, CreditMpCustomerParam } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询小程序端客户
|
||||
*/
|
||||
export async function pageCreditMpCustomer(params: CreditMpCustomerParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CreditMpCustomer>>>(
|
||||
'/credit/credit-mp-customer/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小程序端客户列表
|
||||
*/
|
||||
export async function listCreditMpCustomer(params?: CreditMpCustomerParam) {
|
||||
const res = await request.get<ApiResult<CreditMpCustomer[]>>(
|
||||
'/credit/credit-mp-customer',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小程序端客户
|
||||
*/
|
||||
export async function addCreditMpCustomer(data: CreditMpCustomer) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/credit/credit-mp-customer',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小程序端客户
|
||||
*/
|
||||
export async function updateCreditMpCustomer(data: CreditMpCustomer) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/credit/credit-mp-customer',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除小程序端客户
|
||||
*/
|
||||
export async function removeCreditMpCustomer(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/credit/credit-mp-customer/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除小程序端客户
|
||||
*/
|
||||
export async function removeBatchCreditMpCustomer(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/credit/credit-mp-customer/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询小程序端客户
|
||||
*/
|
||||
export async function getCreditMpCustomer(id: number) {
|
||||
const res = await request.get<ApiResult<CreditMpCustomer>>(
|
||||
'/credit/credit-mp-customer/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user