diff --git a/config/routes.ts b/config/routes.ts index 3c737d7..b552535 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -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', diff --git a/src/pages/PurchaseAgentList/recommend.tsx b/src/pages/PurchaseAgentList/recommend.tsx new file mode 100644 index 0000000..b0b00b8 --- /dev/null +++ b/src/pages/PurchaseAgentList/recommend.tsx @@ -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(); + const access: any = useAccess(); + + const [selectModalVisible, setSelectModalVisible] = useState(false); + const [selectedAgentIds, setSelectedAgentIds] = useState([]); + + 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[] = [ + { + 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 ? : '-' + }, + { + title: '操作', + fixed: 'right', + width: 180, + valueType: 'option', + render: (_, record, index, action) => [ + + , + + , + + + + ], + }, + ]; + const addColumns: ProColumns[] = [ + { + 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 ? : '-' + }, + ]; + + return ( + + + 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: [ + + + + ], + }} + 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={() => []} + /> + { + setSelectModalVisible(false); + setSelectedAgentIds([]); + }} + width={1000} + footer={[ + , + , + ]} + > + + 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, + }} + /> + + + ); +}; +export default TableList; \ No newline at end of file diff --git a/src/services/pop-b2b2c/errorController.ts b/src/services/pop-b2b2c/errorController.ts index f29cc7f..5f0967b 100644 --- a/src/services/pop-b2b2c/errorController.ts +++ b/src/services/pop-b2b2c/errorController.ts @@ -2,41 +2,41 @@ /* eslint-disable */ import request from '@/utils/request'; -/** error GET /error */ -export async function errorUsingGet(options?: { [key: string]: any }) { - return request>('/error', { +/** errorHtml GET /error */ +export async function errorHtmlUsingGet(options?: { [key: string]: any }) { + return request('/error', { method: 'GET', ...(options || {}), }); } -/** error PUT /error */ -export async function errorUsingPut(options?: { [key: string]: any }) { - return request>('/error', { +/** errorHtml PUT /error */ +export async function errorHtmlUsingPut(options?: { [key: string]: any }) { + return request('/error', { method: 'PUT', ...(options || {}), }); } -/** error POST /error */ -export async function errorUsingPost(options?: { [key: string]: any }) { - return request>('/error', { +/** errorHtml POST /error */ +export async function errorHtmlUsingPost(options?: { [key: string]: any }) { + return request('/error', { method: 'POST', ...(options || {}), }); } -/** error DELETE /error */ -export async function errorUsingDelete(options?: { [key: string]: any }) { - return request>('/error', { +/** errorHtml DELETE /error */ +export async function errorHtmlUsingDelete(options?: { [key: string]: any }) { + return request('/error', { method: 'DELETE', ...(options || {}), }); } -/** error PATCH /error */ -export async function errorUsingPatch(options?: { [key: string]: any }) { - return request>('/error', { +/** errorHtml PATCH /error */ +export async function errorHtmlUsingPatch(options?: { [key: string]: any }) { + return request('/error', { method: 'PATCH', ...(options || {}), }); diff --git a/src/services/pop-b2b2c/index.ts b/src/services/pop-b2b2c/index.ts index 3954694..20f47af 100644 --- a/src/services/pop-b2b2c/index.ts +++ b/src/services/pop-b2b2c/index.ts @@ -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, diff --git a/src/services/pop-b2b2c/pbcOrderController.ts b/src/services/pop-b2b2c/pbcOrderController.ts index f9f1dcd..649df1c 100644 --- a/src/services/pop-b2b2c/pbcOrderController.ts +++ b/src/services/pop-b2b2c/pbcOrderController.ts @@ -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(`/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(`/b2b2c/pbcOrder/deliverGoodForBusiness/${param0}`, { - method: 'POST', + method: 'GET', params: { ...queryParams }, ...(options || {}), }); diff --git a/src/services/pop-b2b2c/pbcPurchaseAgentInfoController.ts b/src/services/pop-b2b2c/pbcPurchaseAgentInfoController.ts index 775fe89..fbc41bc 100644 --- a/src/services/pop-b2b2c/pbcPurchaseAgentInfoController.ts +++ b/src/services/pop-b2b2c/pbcPurchaseAgentInfoController.ts @@ -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( '/b2b2c/pbcPurchaseAgentInfo/purchaseAgentDetail', diff --git a/src/services/pop-b2b2c/pbcRecommendPurchaseAgentController.ts b/src/services/pop-b2b2c/pbcRecommendPurchaseAgentController.ts new file mode 100644 index 0000000..8e93952 --- /dev/null +++ b/src/services/pop-b2b2c/pbcRecommendPurchaseAgentController.ts @@ -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( + '/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( + '/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( + '/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( + '/b2b2c/pbcRecommendPurchaseAgent/getRecommendPurchaseAgentList', + { + method: 'GET', + ...(options || {}), + }, + ); +} + +/** 获取没有在推荐列表的小哥列表,这里返回的是小哥列表 GET /b2b2c/pbcRecommendPurchaseAgent/getUnRecommendPurchaseAgentList */ +export async function getUnRecommendPurchaseAgentListUsingGet(options?: { [key: string]: any }) { + return request( + '/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( + `/b2b2c/pbcRecommendPurchaseAgent/moveRecommendPurchaseAgent/${param0}`, + { + method: 'GET', + params: { + ...queryParams, + }, + ...(options || {}), + }, + ); +} diff --git a/src/services/pop-b2b2c/typings.d.ts b/src/services/pop-b2b2c/typings.d.ts index cf67176..91afff2 100644 --- a/src/services/pop-b2b2c/typings.d.ts +++ b/src/services/pop-b2b2c/typings.d.ts @@ -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;