推荐小哥

dev-v2
Joe 8 months ago
parent dc9da7f205
commit a721fc5866

@ -113,16 +113,22 @@ export default [
],
},
{
name: '采购员审核',
name: '采购员管理',
path: '/purchase-agent',
icon: 'verified',
access: 'purchaseAgentQuery',
routes: [
{
path: '',
path: 'list',
name: '采购员审核',
access: 'purchaseAgentQuery',
component: './PurchaseAgentList',
},
{
path: 'recommend',
name: '推荐小哥',
access: 'recommendPurchaseAgentQuery',
component: './PurchaseAgentList/recommend',
},
{
name: '详情',
path: 'detail/:id',

@ -0,0 +1,310 @@
import { useRef, useState } from 'react';
import { Button, message, Modal, Image } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { Access, useAccess } from 'umi';
import {
addBatchRecommendPurchaseAgentUsingPost,
deleteBatchRecommendPurchaseAgentUsingPost,
getRecommendPurchaseAgentListForAdminUsingGet,
getUnRecommendPurchaseAgentListUsingGet,
moveRecommendPurchaseAgentUsingGet
} from '@/services/pop-b2b2c/pbcRecommendPurchaseAgentController';
const TableList: React.FC = () => {
const actionRef = useRef<ActionType>();
const access: any = useAccess();
const [selectModalVisible, setSelectModalVisible] = useState<boolean>(false);
const [selectedAgentIds, setSelectedAgentIds] = useState<number[]>([]);
const handleAddRecommend = async () => {
const res = await getUnRecommendPurchaseAgentListUsingGet();
if (res.retcode && res.data) {
if (res.data.length === 0) {
message.warning('没有可推荐的小哥');
return;
}
setSelectModalVisible(true);
}
};
const handleConfirmAdd = async () => {
if (selectedAgentIds.length === 0) {
message.warning('请选择要添加的小哥');
return;
}
Modal.confirm({
title: '确认添加',
content: `确定要添加${selectedAgentIds.length}个小哥到推荐列表吗?`,
onOk: async () => {
const result = await addBatchRecommendPurchaseAgentUsingPost(selectedAgentIds);
if (result.retcode) {
message.success('添加成功');
setSelectModalVisible(false);
setSelectedAgentIds([]);
actionRef.current?.reload();
} else {
message.error(result.retmsg);
}
},
});
};
const handleMove = async (id: number, type: 'up' | 'down') => {
const res = await moveRecommendPurchaseAgentUsingGet({ recommendPurchaseAgentId: id, type });
if (res.retcode) {
message.success('移动成功');
actionRef.current?.reload();
} else {
message.error(res.retmsg);
}
};
const handleDelete = async (ids: number[]) => {
Modal.confirm({
title: '确认删除',
content: `确定要删除选中的${ids.length}个推荐小哥吗?`,
onOk: async () => {
const res = await deleteBatchRecommendPurchaseAgentUsingPost(ids);
if (res.retcode) {
message.success('删除成功');
actionRef.current?.reload();
} else {
message.error(res.retmsg);
}
},
});
};
const columns: ProColumns<API.PbcRecommendPurchaseAgent_>[] = [
{
title: '小哥姓名',
dataIndex: 'pbcPurchaseAgentName',
render: (_, record) => {
return record.pbcPurchaseAgentInfo?.pbcPurchaseAgentName ?? '-';
},
},
{
title: '年龄',
dataIndex: 'pbcPurchaseAgentAge',
search: false,
render: (_, record) => {
return record.pbcPurchaseAgentInfo?.pbcPurchaseAgentAge ?? '-';
},
},
{
title: '联系电话',
width: 110,
dataIndex: 'pbcPurchaseAgentMobile',
render: (_, record) => {
return record.pbcPurchaseAgentInfo?.pbcPurchaseAgentMobile ?? '-';
},
},
{
title: '从业年数',
dataIndex: 'pbcPurchaseAgentWorkingAge',
search: false,
render: (_, record) => record.pbcPurchaseAgentInfo?.pbcPurchaseAgentWorkingAge ? `${record.pbcPurchaseAgentInfo?.pbcPurchaseAgentWorkingAge}` : '-'
},
{
title: '常驻区域',
dataIndex: 'pbcPurchaseAgentResidentArea',
search: false,
render: (_, record) => {
return record.pbcPurchaseAgentInfo?.pbcPurchaseAgentResidentArea ?? '-';
},
},
{
title: '擅长面料用途',
dataIndex: 'pbcPurchaseAgentFabricUse',
ellipsis: true,
search: false,
render: (_, record) => {
return record.pbcPurchaseAgentInfo?.pbcPurchaseAgentFabricUse ?? '-';
},
},
{
title: '头像',
dataIndex: 'pbcPurchaseAgentImage',
search: false,
render: (_, record) => record.pbcPurchaseAgentInfo?.pbcPurchaseAgentImage ? <Image width={50} src={record.pbcPurchaseAgentInfo?.pbcPurchaseAgentImage} /> : '-'
},
{
title: '操作',
fixed: 'right',
width: 180,
valueType: 'option',
render: (_, record, index, action) => [
<Access key="switch" accessible={!!access.recommendPurchaseAgentSave}>
<Button
type="link"
disabled={index === 0}
onClick={() => handleMove(record.pbcId || 0, 'up')}
>
</Button>,
<Button
type="link"
disabled={index === (action?.pageInfo?.total || 0) - 1}
onClick={() => handleMove(record.pbcId || 0, 'down')}
>
</Button>
</Access>,
<Access key="delete" accessible={!!access.recommendPurchaseAgentRemove}>
<Button
type="link"
danger
onClick={() => handleDelete([record.pbcId || 0])}
>
</Button>
</Access>
],
},
];
const addColumns: ProColumns<API.PbcPurchaseAgentInfo_>[] = [
{
title: '小哥姓名',
dataIndex: 'pbcPurchaseAgentName',
},
{
title: '年龄',
dataIndex: 'pbcPurchaseAgentAge',
search: false,
},
{
title: '联系电话',
dataIndex: 'pbcPurchaseAgentMobile',
},
{
title: '从业年数',
dataIndex: 'pbcPurchaseAgentWorkingAge',
search: false,
render: (text) => text ? `${text}` : '-'
},
{
title: '常驻区域',
dataIndex: 'pbcPurchaseAgentResidentArea',
search: false,
},
{
title: '擅长面料用途',
dataIndex: 'pbcPurchaseAgentFabricUse',
ellipsis: true,
search: false,
},
{
title: '头像',
dataIndex: 'pbcPurchaseAgentImage',
search: false,
render: (text: any) => text ? <Image width={50} src={text} /> : '-'
},
];
return (
<PageContainer
header={{
title: '',
breadcrumb: {},
}}
>
<ProTable<API.PbcRecommendPurchaseAgent_>
columns={columns}
actionRef={actionRef}
request={async (params) => {
const res = await getRecommendPurchaseAgentListForAdminUsingGet({
...params,
});
return {
data: res.data || [],
success: !!res.retcode,
total: res.data?.length,
};
}}
rowKey="pbcId"
size="small"
bordered
search={false}
toolbar={{
actions: [
<Access key="switch" accessible={!!access.recommendPurchaseAgentSave}>
<Button key="add" type="primary" onClick={handleAddRecommend}>
</Button>
</Access>
],
}}
rowSelection={{
onChange: (selectedRowKeys) => {
if (selectedRowKeys.length > 0) {
handleDelete(selectedRowKeys as number[]);
}
},
}}
pagination={{
defaultPageSize: 20,
showSizeChanger: true,
}}
scroll={{
y: 'calc(100vh - 320px)',
}}
dateFormatter="string"
options={false}
toolBarRender={() => []}
/>
<Modal
title="选择推荐小哥"
open={selectModalVisible}
onCancel={() => {
setSelectModalVisible(false);
setSelectedAgentIds([]);
}}
width={1000}
footer={[
<Button
key="cancel"
onClick={() => {
setSelectModalVisible(false);
setSelectedAgentIds([]);
}}
>
</Button>,
<Button key="submit" type="primary" onClick={handleConfirmAdd}>
</Button>,
]}
>
<ProTable<API.PbcPurchaseAgentInfo_>
columns={addColumns}
request={async () => {
const res = await getUnRecommendPurchaseAgentListUsingGet();
return {
data: res.data || [],
success: !!res.retcode,
};
}}
rowKey="pbcId"
size="small"
bordered
search={false}
options={false}
pagination={false}
rowSelection={{
selectedRowKeys: selectedAgentIds,
onChange: (selectedRowKeys) => {
setSelectedAgentIds(selectedRowKeys as number[]);
},
}}
scroll={{
y: 400,
}}
/>
</Modal>
</PageContainer>
);
};
export default TableList;

@ -2,41 +2,41 @@
/* eslint-disable */
import request from '@/utils/request';
/** error GET /error */
export async function errorUsingGet(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml GET /error */
export async function errorHtmlUsingGet(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'GET',
...(options || {}),
});
}
/** error PUT /error */
export async function errorUsingPut(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml PUT /error */
export async function errorHtmlUsingPut(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'PUT',
...(options || {}),
});
}
/** error POST /error */
export async function errorUsingPost(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml POST /error */
export async function errorHtmlUsingPost(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'POST',
...(options || {}),
});
}
/** error DELETE /error */
export async function errorUsingDelete(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml DELETE /error */
export async function errorHtmlUsingDelete(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'DELETE',
...(options || {}),
});
}
/** error PATCH /error */
export async function errorUsingPatch(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', {
/** errorHtml PATCH /error */
export async function errorHtmlUsingPatch(options?: { [key: string]: any }) {
return request<API.ModelAndView>('/error', {
method: 'PATCH',
...(options || {}),
});

@ -32,6 +32,7 @@ import * as pbcProductShopCartController from './pbcProductShopCartController';
import * as pbcPurchaseAgentInfoController from './pbcPurchaseAgentInfoController';
import * as pbcQrController from './pbcQrController';
import * as pbcRecommendBusinessController from './pbcRecommendBusinessController';
import * as pbcRecommendPurchaseAgentController from './pbcRecommendPurchaseAgentController';
import * as pbcRequirementController from './pbcRequirementController';
import * as pbcRequirementReplyController from './pbcRequirementReplyController';
import * as pbcRoleController from './pbcRoleController';
@ -71,6 +72,7 @@ export default {
pbcProductShopCartController,
pbcPurchaseAgentInfoController,
pbcRecommendBusinessController,
pbcRecommendPurchaseAgentController,
pbcRequirementController,
pbcRequirementReplyController,
pbcRoleController,

@ -2,15 +2,15 @@
/* eslint-disable */
import request from '@/utils/request';
/** 卖家发货订单,如果类型是到店自取,则就是状态变成已发货;如果类型是邮寄,还需要生成快递 卖家 POST /b2b2c/pbcOrder/admin/deliverGoodForAdmin/${param0} */
export async function deliverGoodForAdminUsingPost(
/** 卖家发货订单,如果类型是到店自取,则就是状态变成已发货;如果类型是邮寄,还需要生成快递 卖家 GET /b2b2c/pbcOrder/admin/deliverGoodForAdmin/${param0} */
export async function deliverGoodForAdminUsingGet(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.deliverGoodForAdminUsingPOSTParams,
params: API.deliverGoodForAdminUsingGETParams,
options?: { [key: string]: any },
) {
const { orderId: param0, ...queryParams } = params;
return request<API.AjaxResultString_>(`/b2b2c/pbcOrder/admin/deliverGoodForAdmin/${param0}`, {
method: 'POST',
method: 'GET',
params: { ...queryParams },
...(options || {}),
});
@ -58,15 +58,15 @@ export async function confirmReceiveForBuyerUsingGet(
});
}
/** 卖家发货订单,如果类型是到店自取,则就是状态变成已发货;如果类型是邮寄,还需要生成快递 卖家 POST /b2b2c/pbcOrder/deliverGoodForBusiness/${param0} */
export async function deliverGoodForBusinessUsingPost(
/** 卖家发货订单,如果类型是到店自取,则就是状态变成已发货;如果类型是邮寄,还需要生成快递 卖家 GET /b2b2c/pbcOrder/deliverGoodForBusiness/${param0} */
export async function deliverGoodForBusinessUsingGet(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.deliverGoodForBusinessUsingPOSTParams,
params: API.deliverGoodForBusinessUsingGETParams,
options?: { [key: string]: any },
) {
const { orderId: param0, ...queryParams } = params;
return request<API.AjaxResultString_>(`/b2b2c/pbcOrder/deliverGoodForBusiness/${param0}`, {
method: 'POST',
method: 'GET',
params: { ...queryParams },
...(options || {}),
});

@ -89,7 +89,7 @@ export async function getPurchaseAgentPageUsingPost(
);
}
/** 前端获取采购员申请详情 后台 GET /b2b2c/pbcPurchaseAgentInfo/purchaseAgentDetail */
/** 前端获取采购员申请详情 前端 GET /b2b2c/pbcPurchaseAgentInfo/purchaseAgentDetail */
export async function purchaseAgentDetailUsingGet(options?: { [key: string]: any }) {
return request<API.AjaxResultPbcPurchaseAgentInfo_>(
'/b2b2c/pbcPurchaseAgentInfo/purchaseAgentDetail',

@ -0,0 +1,93 @@
// @ts-ignore
/* eslint-disable */
import request from '@/utils/request';
/** 后台批量新增推荐小哥 POST /b2b2c/pbcRecommendPurchaseAgent/addBatchRecommendPurchaseAgent */
export async function addBatchRecommendPurchaseAgentUsingPost(
body: number[],
options?: { [key: string]: any },
) {
return request<API.AjaxResultString_>(
'/b2b2c/pbcRecommendPurchaseAgent/addBatchRecommendPurchaseAgent',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
},
);
}
/** 后台获取在推荐列表的小哥列表 GET /b2b2c/pbcRecommendPurchaseAgent/admin/getRecommendPurchaseAgentList */
export async function getRecommendPurchaseAgentListForAdminUsingGet(options?: {
[key: string]: any;
}) {
return request<API.AjaxResultListPbcRecommendPurchaseAgent_>(
'/b2b2c/pbcRecommendPurchaseAgent/admin/getRecommendPurchaseAgentList',
{
method: 'GET',
...(options || {}),
},
);
}
/** 后台批量删除推荐小哥,传入推荐小哥表的id列表不是小哥表的id POST /b2b2c/pbcRecommendPurchaseAgent/deleteBatchRecommendPurchaseAgent */
export async function deleteBatchRecommendPurchaseAgentUsingPost(
body: number[],
options?: { [key: string]: any },
) {
return request<API.AjaxResultString_>(
'/b2b2c/pbcRecommendPurchaseAgent/deleteBatchRecommendPurchaseAgent',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
},
);
}
/** 前端获取在推荐列表的小哥列表 GET /b2b2c/pbcRecommendPurchaseAgent/getRecommendPurchaseAgentList */
export async function getRecommendPurchaseAgentListUsingGet(options?: { [key: string]: any }) {
return request<API.AjaxResultListPbcRecommendPurchaseAgent_>(
'/b2b2c/pbcRecommendPurchaseAgent/getRecommendPurchaseAgentList',
{
method: 'GET',
...(options || {}),
},
);
}
/** 获取没有在推荐列表的小哥列表,这里返回的是小哥列表 GET /b2b2c/pbcRecommendPurchaseAgent/getUnRecommendPurchaseAgentList */
export async function getUnRecommendPurchaseAgentListUsingGet(options?: { [key: string]: any }) {
return request<API.AjaxResultListPbcPurchaseAgentInfo_>(
'/b2b2c/pbcRecommendPurchaseAgent/getUnRecommendPurchaseAgentList',
{
method: 'GET',
...(options || {}),
},
);
}
/** 后台上下移动推荐小哥,路径参数up上移down下移 卖家移动单个 GET /b2b2c/pbcRecommendPurchaseAgent/moveRecommendPurchaseAgent/${param0} */
export async function moveRecommendPurchaseAgentUsingGet(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.moveRecommendPurchaseAgentUsingGETParams,
options?: { [key: string]: any },
) {
const { type: param0, ...queryParams } = params;
return request<API.AjaxResultString_>(
`/b2b2c/pbcRecommendPurchaseAgent/moveRecommendPurchaseAgent/${param0}`,
{
method: 'GET',
params: {
...queryParams,
},
...(options || {}),
},
);
}

@ -598,12 +598,24 @@ declare namespace API {
retmsg?: string;
};
type AjaxResultListPbcPurchaseAgentInfo_ = {
data?: PbcPurchaseAgentInfo_[];
retcode?: number;
retmsg?: string;
};
type AjaxResultListPbcRecommendBusiness_ = {
data?: PbcRecommendBusiness_[];
retcode?: number;
retmsg?: string;
};
type AjaxResultListPbcRecommendPurchaseAgent_ = {
data?: PbcRecommendPurchaseAgent_[];
retcode?: number;
retmsg?: string;
};
type AjaxResultListPbcRole_ = {
data?: PbcRole[];
retcode?: number;
@ -1095,12 +1107,12 @@ declare namespace API {
id: number;
};
type deliverGoodForAdminUsingPOSTParams = {
type deliverGoodForAdminUsingGETParams = {
/** orderId */
orderId: number;
};
type deliverGoodForBusinessUsingPOSTParams = {
type deliverGoodForBusinessUsingGETParams = {
/** orderId */
orderId: number;
};
@ -1690,6 +1702,13 @@ declare namespace API {
type: string;
};
type moveRecommendPurchaseAgentUsingGETParams = {
/** recommendPurchaseAgentId */
recommendPurchaseAgentId: number;
/** type */
type: string;
};
type orderDetailForAdminUsingGETParams = {
/** orderId */
orderId: number;
@ -3493,6 +3512,10 @@ declare namespace API {
pbcPurchaseAgentWorkingAge?: number;
/** 审核状态0是待审核1是审核通过2是审核被拒绝 */
pbcReviewStatus?: number;
/** 服务次数 */
pbcServiceCnt?: number;
/** 活跃状态 */
pbcServiceState?: string;
/** 状态,0是删除1是正常2是作废 */
pbcState?: number;
/** 更新时间 */
@ -3531,6 +3554,30 @@ declare namespace API {
pbcUpdateByUserName?: string;
};
type PbcRecommendPurchaseAgent_ = {
/** 创建时间 */
pbcCreateAt?: string;
/** 创建人 */
pbcCreateBy?: number;
/** 创建人 */
pbcCreateByUserName?: string;
/** 主键 */
pbcId?: number;
/** 推荐采购员id */
pbcPurchaseAgentId?: number;
pbcPurchaseAgentInfo?: PbcPurchaseAgentInfo_;
/** 排序 */
pbcSort?: number;
/** 状态,0是删除1是正常2是作废 */
pbcState?: number;
/** 更新时间 */
pbcUpdateAt?: string;
/** 更新人 */
pbcUpdateBy?: number;
/** 更新人 */
pbcUpdateByUserName?: string;
};
type PbcRegisterStaticalVO = {
businessNumber?: number;
vipNumber?: number;

Loading…
Cancel
Save