可以了的一版

This commit is contained in:
ylj20011123 2025-11-03 09:06:40 +08:00
parent 4be0bb5c3a
commit 52119dd4d1
29 changed files with 5606 additions and 36 deletions

View File

@ -586,6 +586,11 @@ export default [
name: 'roles', name: 'roles',
component: './Setting/Roles/index', component: './Setting/Roles/index',
}, },
{
path: '/setting/users',
name: 'users',
component: './Setting/Users/index',
},
] ]
}, },
{ {

BIN
dist.zip

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "ant-design-pro", "name": "ant-design-pro",
"version": "4.5.65", "version": "4.5.66",
"private": true, "private": true,
"description": "An out-of-box UI solution for enterprise applications", "description": "An out-of-box UI solution for enterprise applications",
"scripts": { "scripts": {

View File

@ -32,6 +32,7 @@ export type CurrentUser = {
ServerpartIds: string; // 服务区ids ServerpartIds: string; // 服务区ids
unreadCount: number; // 未读消息数量 unreadCount: number; // 未读消息数量
SupplierID: number; SupplierID: number;
SupplierName?: string
}; };
export type UserModelState = { export type UserModelState = {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,378 @@
/*
* @Author: cclu
* @Date: 2021-12-13 11:01:23
* @LastEditTime: 2024-08-30 18:54:12
* @LastEditors: cclu 1106109051@qq.com
* @Description:
* @FilePath: \cloud-platform\src\pages\Setting\Users\index.tsx
*/
import { connect } from "umi";
import React, { useState, useRef } from "react";
import { Button, Drawer, Tree } from 'antd';
import ProTable from "@ant-design/pro-table";
import { PageContainer } from "@ant-design/pro-layout";
import { PlusOutlined } from "@ant-design/icons";
import type { UserModel } from "./data";
import type { ProColumns, ActionType } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from "@ant-design/pro-descriptions";
import type { ConnectState } from "@/models/connect";
import type { CurrentUser } from '@/models/user';
import Edit from './components/edit';
import ProCard from "@ant-design/pro-card";
import useRequest from "@ahooksjs/use-request";
import ProDescriptions from "@ant-design/pro-descriptions";
import { getUserSystemRole, getUserList, getUserTypeTree } from './service'
const UserList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const actionRef = useRef<ActionType>();
const [showDetail, setShowDetail] = useState<boolean>(false);
const [userTypeId, setUserTypeId] = useState<Record<number, []>>();
const [tableTab, setTableTab] = useState<React.Key>(`${currentUser?.UserPattern}`);
const [openType, setOpenType] = useState<any>()// 打开是编辑还是新增
const [collapsible, setCollapsible] = useState<boolean>(false) // 是否显示账号分类查询树
const [currentRow, setCurrentRow] = useState<UserModel>(); // 当前选中行
const [createModalVisible, handleModalVisible] = useState<boolean>(false); // 分布更新窗口的弹窗
const [userTypeObj, setUserTypeObj] = useState<any>()
const selectTab = useRef(`${currentUser?.UserPattern}`)
const { loading: treeLoading, data: treeViews } = useRequest(async () => {
const req: any = {
ProvinceCode: currentUser?.UserPattern === 2000 ? currentUser?.BusinessManID : currentUser?.ProvinceCode,
}
const data = await getUserTypeTree(req)
let res: any = []
if (data && data.length > 0) {
data.forEach((item: any) => {
res.push(item)
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
res.push(subItem)
if (subItem.children && subItem.children.length > 0) {
subItem.children.forEach((thirdItem: any) => {
res.push(thirdItem)
})
}
})
}
})
}
console.log('res', res);
let obj: any = {}
if (res && res.length > 0) {
res.forEach((item: any) => {
obj[item.value] = item.label
})
}
console.log('obj', obj);
setUserTypeObj(obj)
})
// 请求账号部门tree
const { run: getUserTypeMenu, loading: typeLoading, data: userTypeTree } = useRequest((type) => getUserTypeTree({ UserTypePattern: type || tableTab, ShowStatus: true }))
// const [userTypeMenu, setUserTypeMenu] = useState<{1000: {}, 2000: {}}>(()=>getUserTypeTree(tableTab)); // 分布更新窗口的弹窗
// 根据角色id查询权限树
const { run: getRoleMenu, data: roleMenuTree } = useRequest(async (SystemRoleId?: number) => {
const data = await getUserSystemRole(SystemRoleId ? `${SystemRoleId}` : '')
return data
}, { manual: true })
const leftTab = [{ key: `1000`, name: '业主' }, { key: `4000`, name: '供应商' }, { key: `2000`, name: '商户' }, { key: `3000`, name: '游客' }, { key: `9000`, name: '内部' }]
const ueserCloudTab = currentUser?.UserPattern === 9000 ? leftTab : currentUser?.UserPattern === 1000 ? [{ key: `1000`, name: '业主' }, { key: `4000`, name: '供应商' }] : leftTab.filter(n => n.key === `${currentUser?.UserPattern}`)
// const ueserCloudTab = leftTab
// 表格列数据显示配置
const columns: ProColumns<UserModel>[] = [
{
title: '查询账号',
dataIndex: 'searchKey',
hideInDescriptions: true,
hideInTable: true,
fieldProps: {
placeholder: '请输入账号/用户名称/业主单位/手机号/经营单位'
}
},
{
title: '有效状态',
dataIndex: 'USER_STATUS',
hideInTable: true,
valueType: 'select',
valueEnum: {
"": "全部",
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
{
title: '经营单位',
dataIndex: 'BUSINESSMAN_NAME',
sorter: (a, b) => {
return (a.BUSINESSMAN_NAME || '').localeCompare((b.BUSINESSMAN_NAME || ''))
},
hideInSearch: true,
hideInTable: tableTab !== '2000',
hideInDescriptions: tableTab !== '2000',
},
{
title: '账号部门',
dataIndex: 'USERTYPE_ID',
hideInTable: tableTab === '3000' || tableTab === '9000',
hideInSearch: true,
hideInDescriptions: true,
valueType: "treeSelect",
fieldProps: {
options: userTypeTree,
},
},
{
title: '账号',
dataIndex: 'USER_PASSPORT',
sorter: (a, b) => {
return (a.USER_PASSPORT || '').localeCompare((b.USER_PASSPORT || ''))
},
hideInSearch: true,
},
{
title: '用户名称',
dataIndex: 'USER_NAME',
sorter: (a, b) => {
return (a.USER_NAME || '').localeCompare((b.USER_NAME || ''))
},
hideInDescriptions: true,
hideInSearch: true,
render: (_, record) => {
return <a key="fname" onClick={() => {
getRoleMenu(record.USER_ID)
setCurrentRow(record)
setShowDetail(true)
}}>{_}</a>
}
},
{
title: '手机号',
dataIndex: 'USER_MOBILEPHONE',
hideInSearch: true
},
// {
// title: '账号类型',
// dataIndex: 'USER_PATTERN',
// hideInSearch: true,
// valueType: 'select',
// valueEnum: {
// 1000: { text: '业主' },
// 2000: { text: '商户' },
// },
// },
{
title: '状态',
dataIndex: 'USER_STATUS',
hideInSearch: true,
filters: true,
onFilter: true,
valueType: 'select',
initialValue: 1,
valueEnum: {
all: { text: '全部', status: 'Default' },
0: { text: '无效', status: 'Default' },
1: { text: '有效', status: 'Processing' },
},
},
{
title: '业主单位',
dataIndex: 'PROVINCE_UNIT',
hideInSearch: true,
sorter: (a, b) => {
return (a.PROVINCE_UNIT || '').localeCompare((b.PROVINCE_UNIT || ''))
},
hideInTable: tableTab === '2000',
valueType: "treeSelect",
fieldProps: {
options: userTypeTree,
},
},
{
title: '备注',
dataIndex: 'USER_DESC',
hideInSearch: true,
hideInTable: tableTab === '2000',
render: (_, record) => {
return record?.USER_DESC
}
},
{
title: '操作',
valueType: 'option',
hideInDescriptions: true,
// width: 180,
render: (text, record) => [
<a
key="editable"
onClick={() => {
handleModalVisible(true);
setOpenType('edit')
setCurrentRow({ ...record });
}}
>
</a>,
]
}
]
return (<PageContainer header={{
title: '',
breadcrumb: {},
}}>
<ProCard split="vertical" style={{ backgroundColor: '#fff' }}>
{/* 左侧树筛选 */}
<ProCard
className="pageTable-leftnav"
bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20 }}
// extra={<MenuFoldOutlined onClick={() => { setCollapsible(!collapsible) }} />}
colSpan={!collapsible ? "360px" : "60px"}
// title={!collapsible ? "请选择账号部门" : ""}
// headerBordered
// collapsed={collapsible}
tabs={{
activeKey: tableTab,
onChange: (key) => {
console.log('key', key)
setTableTab(key as string);
selectTab.current = key
getUserTypeMenu(key)
},
}}
>
{ueserCloudTab.map(n => {
return <ProCard.TabPane key={n.key} tab={n.name}>
<Tree
checkable
style={{ padding: '20px' }}
// eslint-disable-next-line no-nested-ternary
treeData={!typeLoading ? (currentUser?.UserPattern === 9000 ? userTypeTree : userTypeTree[0]?.children) : []}
fieldNames={{
title: "label",
// key: "USERTYPE_ID"
}}
blockNode
// onSelect={onSelect}
onCheck={(checkedKeys: React.Key[] | any) => {
setUserTypeId({ [n.key]: checkedKeys })
if (actionRef.current) {
// actionRef.current?.reset()
actionRef.current?.reload()
}
}}
>
</Tree>
</ProCard.TabPane>
})}
</ProCard>
{/* 右侧表格主体 */}
<ProCard bodyStyle={{ paddingTop: 0, paddingBottom: 0, paddingRight: 0 }}>
<ProTable<UserModel>
headerTitle="账号管理"
rowKey="USER_ID"
actionRef={actionRef}
request={async (params, sorter) => {
console.log('params', params);
const sortstr = Object.keys(sorter).map(n => {
const value = sorter[n]
return value ? `${n} ${value.replace('end', '')}` : ''
})
const data = await getUserList({
...params,
USER_STATUS: params?.USER_STATUS,
USER_PATTERN: tableTab,
UserTypeIds: userTypeId && userTypeId[tableTab] ? userTypeId[tableTab].toString() : '',
SortStr: sortstr ? sortstr.toString() : 'USER_INDEX',
keyWord: params.searchKey ? { key: "USER_PASSPORT,USER_NAME,USER_MOBILEPHONE,PROVINCE_UNIT,BUSINESSMAN_NAME", value: params.searchKey } : null, // 关键词查询
})
return data
}}
onReset={() => {
actionRef.current?.reload()
}}
params={{ USER_PATTERN: tableTab }}
columns={columns}
toolbar={{
actions:
currentUser?.UserPattern === 1000 || currentUser?.UserPattern === 9000 ?
[
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
console.log('currentUser?.UserPattern', currentUser?.UserPattern)
handleModalVisible(true)
setOpenType('add')
}}
></Button>,
] : []
}}
pagination={{ defaultPageSize: 10 }}
/>
</ProCard>
</ProCard>
{/* 用户详情 */}
<Drawer
// eslint-disable-next-line no-nested-ternary
width={showDetail ? 600 : (createModalVisible ? '73%' : undefined)}
visible={showDetail || createModalVisible}
onClose={() => {
setCurrentRow(undefined);
setShowDetail(false);
handleModalVisible(false)
setOpenType('')
}}
closable={false}
bodyStyle={createModalVisible ? { backgroundColor: "#f9f9f9", padding: 0 } : {}}
>
{/* 编辑或新增账号 */}
{createModalVisible && <Edit selectTab={selectTab.current} tableTab={tableTab} openType={openType} detail={currentRow} currentUser={currentUser} reloadTable={(success: boolean) => {
if (success) {
if (actionRef.current) {
actionRef.current.reload();
}
}
}} />}
{/* 查看账号详情 */}
{showDetail && <ProDescriptions<UserModel>
column={1}
title={currentRow?.USER_NAME}
request={async () => ({
data: currentRow || {},
})}
params={{
id: currentRow?.USER_NAME,
}}
columns={columns as ProDescriptionsItemProps<UserModel>[]}
>
<ProDescriptions.Item label="用户角色权限">
{roleMenuTree?.length ? <Tree
style={{ backgroundColor: '#FDFCFC', paddingRight: 24 }}
treeData={roleMenuTree}
defaultExpandAll={true}
fieldNames={
{ title: "label", key: 'value' }
}>
</Tree> : '-'}
</ProDescriptions.Item>
</ProDescriptions>
}
</Drawer>
</PageContainer>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser,
}))(UserList);

View File

@ -0,0 +1,390 @@
/*
* @Author: your name
* @Date: 2022-04-28 10:47:35
* @LastEditTime: 2024-08-23 15:25:03
* @LastEditors: cclu 1106109051@qq.com
* @Description:
* @FilePath: \cloud-platform\src\pages\basicManage\Merchats\components\LinkManTable.tsx
*/
import useRequest from '@ahooksjs/use-request';
import React, { useImperativeHandle, useRef, useState } from 'react';
import ProTable, { EditableProTable } from '@ant-design/pro-table';
import type { ActionType, ProColumns } from "@ant-design/pro-table";
import type { LinkManModel } from "../data";
import { getBrandList, getTreeList, handleDeleteRTCoopMerchants, handleRTCoopMerchantsList, handleSynchroRTCoopMerchants } from '../service';
import { FormInstance, message } from "antd";
import { Avatar, Button, Col, Menu, Modal, Popconfirm, Row, Image } from "antd";
import { getBusniessBrandTree } from "@/pages/basicManage/service";
import { getFieldEnumTree } from "@/services/options";
import { getList } from "@/pages/Test/INTERFACE/service";
import { FileSearchOutlined, PlusOutlined } from "@ant-design/icons";
import { MerchantModel } from "../data";
import { ModalForm, ProFormText } from "@ant-design/pro-form";
import SubMenu from 'antd/lib/menu/SubMenu';
import Item from 'antd/lib/list/Item';
import moment from 'moment/moment'
const BrandTable = ({ merchartsId, onRef, currentRow }: { merchartsId: number, onRef?: any, currentRow?: any }) => {
const formRef = useRef<FormInstance>();
const addFormRef = useRef<FormInstance>();
const actionRef = useRef<ActionType>();
const brandActionRef = useRef<ActionType>();
const { loading, data } = useRequest(async () => {
if (merchartsId) {
const data = await getBrandList({ CoopMerchantsId: merchartsId })
return data
}
return []
})
const { loadingBrand, data: busiessBrand = [] } = useRequest(getBusniessBrandTree)
const [modalVisible, setModalVisible] = useState<boolean>(false)
const [brandVisible, setBrandVisible] = useState<boolean>() // 选择品牌弹出框
const [brand, setBrand] = useState<any>() // 选中的品牌
const [currenMenu, setCurrenMenu] = useState<any>(); // 当前弹出的左侧菜单选中的详细数据
const [selectedKeys, setSelectedKeys] = useState<any>(); // 当前弹出的左侧菜单选中的ids值
const [dataSource, setDataSource] = useState<LinkManModel[]>()
const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]);
if (!loading && !dataSource) {
setDataSource(data)
}
// 根据选中的经营业态查询品牌
const searchBrand = (item: any) => {
setSelectedKeys(item.selectedKeys || [])
const [_, value] = item.key.split('-')
setCurrenMenu({ 'BRAND_INDUSTRY': value, current: 1 })
brandActionRef.current?.reload()
}
// 生成商户左侧菜单
const getMenuDom = (data: any[], callback: () => void, noBrand?: boolean) => {
return (data.map((element: any) => {
if ((!noBrand && element.BrandTreeList && element.BrandTreeList.length > 0) || element.children) {
return (
<SubMenu title={element.BusinessTrade_Name}
icon={<Avatar src={element.BusinessTrade_ICO} size={16} style={{ marginRight: 4 }} shape="square" />}
key={`BUSINESSTRADE_ID-${element.BusinessTrade_Id}`}
onTitleClick={(item) => {
if (!currenMenu || item.key !== `BUSINESSTRADE_ID-${currenMenu?.BUSINESSTRADE_ID}`) {
callback.call(callback, item)
}
item.domEvent.stopPropagation();
}}
>
{!noBrand && element.BrandTreeList.length > 0 && element.BrandTreeList.map((c: any) =>
<Menu.Item key={`BRAND_ID-${c.Brand_ID}`}
icon={<Avatar src={c.Brand_ICO} style={{ backgroundColor: '#fafafa' }} size={22} shape="square" />} >
{c.Brand_Name}
</Menu.Item>
)}
{element.children && element.children.length > 0 && getMenuDom(element.children, callback, noBrand || undefined)}
</SubMenu>
)
}
return (<Menu.Item icon={<Avatar src={element.BusinessTrade_ICO} size={16} shape="square" />}
key={`BUSINESSTRADE_ID-${element.BusinessTrade_Id}`}>{element.BusinessTrade_Name}</Menu.Item>)
}))
}
// 拿到这一次选中的品牌
const [currentBrand, setCurrentBrand] = useState<any>()
const columns: ProColumns<any>[] = [
{
title: '品牌图标',
dataIndex: 'LINKER_NAME',
render: (_, record) => {
return <Image style={{ width: '20px', height: '20px' }} src={record?.BRAND_ICO} />
}
},
{
title: '经营业态',
dataIndex: 'BUSINESSTRADE_NAME',
},
{
title: '经营品牌',
dataIndex: 'BRAND_NAME',
},
{
title: '操作',
valueType: 'option',
width: 160,
render: (text, record, _, action) => [
<Popconfirm
title="确认删除该联系人吗?"
onConfirm={async () => {
console.log('delete', record);
handleDelete(record)
}}
>
<a></a>
</Popconfirm>
],
}
]
// 删除
const handleDelete = async (obj: any) => {
const req: any = {
RTCoopMerchantsId: obj?.RTCOOPMERCHANTS_ID
}
const data = await handleDeleteRTCoopMerchants(req)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
useImperativeHandle(onRef, () => ({
dataSource
}));
return (
<>
<ProTable
rowKey={(record) => {
return `${record?.INTERFACE_ID}`
}}
formRef={formRef}
headerTitle="品牌列表" // 列表表头
actionRef={actionRef}
search={false}
request={async () => {
if (!merchartsId) {
return []
}
const req: any = {
CoopMerchantsId: merchartsId
}
const data = await handleRTCoopMerchantsList(req)
console.log('currentBrand', currentBrand);
console.log('data', data);
if (data && data.length > 0) {
setDataSource(data)
return { data, success: true }
} else {
setDataSource([])
return { data: [], success: true }
}
}}
// dataSource={dataSource}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
setModalVisible(true)
}}
>
</Button>,
],
}}
options={false}
pagination={false}
/>
<ModalForm
title={'新建品牌'}
layout={'horizontal'}
width={628}
wrapperCol={{ span: 16 }}
labelCol={{ span: 6 }}
formRef={addFormRef}
visible={modalVisible}
autoFocusFirstInput
modalProps={{
onCancel: () => {
setModalVisible(false)
setCurrentBrand(undefined)
},
}}
onVisibleChange={(value) => {
}}
onFinish={async (values) => {
// // 判断有没有品牌数据
// let dataList: any = brandTableRef.current?.dataSource
// let resList: any = []
// if(dataList && dataList.length>0){
// dataList.forEach((item: any)=>{
// resList.push({
// label: item.BRAND_NAME,
// value: item.BRAND_ID,
// key: '',
// type:'',
// desc:'',
// ico: item.BRAND_INTRO
// })
// })
// }
console.log('CurrentBrand', currentBrand);
console.log('currentRow', currentRow);
// 同步商户和品牌的关系列表
const secondReq: any = {
COOPMERCHANTS_ID: currentRow?.COOPMERCHANTS_ID,
BUSINESS_TRADE: currentBrand?.BUSINESS_TRADE,
BUSINESS_BRAND: currentBrand?.BUSINESS_BRAND,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss')
// RTCOOPMERCHANTS_ID: '',
// COOPMERCHANTS_NAME: currentRow?.COOPMERCHANTS_NAME,
// BUSINESSTRADE_NAME: currentBrand?.BUSINESSTRADE_NAME,
// BRAND_NAME: currentBrand?.BRAND_NAME,
// SERVERPART_NAME:'',
// BRAND_ICO: currentBrand?.BRAND_INTRO,
}
const secondData = await handleSynchroRTCoopMerchants(secondReq)
if (secondData.Result_Code === 100) {
message.success(secondData.Result_Desc)
addFormRef.current?.setFieldsValue({ BRAND_NAME: '' })
setCurrentBrand(undefined)
setModalVisible(false)
actionRef.current?.reload()
} else {
message.error(secondData.Result_Desc)
}
}}
>
<ProFormText
label="经营品牌"
name="BRAND_NAME"
placeholder="请选择经营品牌"
addonAfter={<Button type="primary" icon={<FileSearchOutlined />} onClick={() => {
setBrandVisible(true)
}}></Button>}
// rules={[
// {
// required: true,
// message: '请选择经营品牌',
// },
// ]}
readonly
/>
</ModalForm>
{/* 新增的弹出框 */}
<Modal visible={brandVisible}
title="请选择经营业态和品牌"
width={1024}
onOk={() => {
setBrandVisible(false)
const data = {
...brand,
BUSINESS_BRAND: brand?.BRAND_ID,
BRAND_NAME: brand?.BRAND_NAME,
}
setCurrentBrand(data)
addFormRef.current?.setFieldsValue(data)
}}
onCancel={() => {
setBrandVisible(false)
setBrand(undefined)
}}
afterClose={() => {
setCurrenMenu({})
brandActionRef.current?.reset()
}}
bodyStyle={{ padding: 0 }}
>
<Row>
<Col span={6}>
{
<Menu
mode="inline"
style={{ height: 610, overflowY: 'auto', overflowX: 'hidden' }}
selectedKeys={selectedKeys}
onSelect={(item) => {
searchBrand(item)
}}
>{getMenuDom(busiessBrand, searchBrand, true)}
</Menu>
}
</Col>
<Col span={18}>
<ProTable
rowKey="BRAND_ID"
size="small"
columns={[
{
dataIndex: 'BRAND_INTRO',
hideInSearch: true,
width: 48,
render: (_, record) => {
return <Avatar src={_} size={24}>{record.BRAND_NAME.substring(0, 1)}</Avatar>
},
hideInDescriptions: true,
},
{
dataIndex: 'BRAND_NAME',
title: '品牌名称',
hideInSearch: true
},
{
dataIndex: 'keyWord',
title: '品牌名称',
hideInTable: true
// hideInSearch: true
},
]}
request={async (params) => {
if (brandVisible) {
const data = await getTreeList({
...params,
keyWord: params.keyWord ? { value: params.keyWord, key: 'BRAND_NAME' } : null
})
return data
}
return { data: [], success: true }
}}
params={currenMenu}
search={{ span: 12, }}
pagination={{ defaultPageSize: 10, size: 'small', showSizeChanger: false }}
onReset={() => {
setCurrenMenu({})
brandActionRef.current?.reload()
}}
options={false}
style={{ minHeight: 610 }}
actionRef={brandActionRef}
rowSelection={{
type: "radio",
onChange: (selectedRowKeys, selectedRows) => {
console.log('selectedRows', selectedRows);
setBrand(selectedRows[0])
}
}}
tableAlertRender={false}
>
</ProTable>
</Col>
</Row>
</Modal>
</>
)
}
export default BrandTable;

View File

@ -0,0 +1,155 @@
/*
* @Author: your name
* @Date: 2022-04-28 10:47:35
* @LastEditTime: 2024-09-12 16:48:40
* @LastEditors: cclu 1106109051@qq.com
* @Description:
* @FilePath: \cloud-platform\src\pages\basicManage\Merchats\components\LinkManTable.tsx
*/
import useRequest from '@ahooksjs/use-request';
import { Popconfirm } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { EditableProTable } from '@ant-design/pro-table';
import type { ActionType, ProColumns } from "@ant-design/pro-table";
import type { LinkManModel } from "../data";
import { getLinkManList, updateLinkMan, delLinkMan } from '../service';
import { getBusniessBrandTree } from "@/pages/basicManage/service";
const LinkManTable = ({ merchartsId, show }: { merchartsId: number, show: boolean }) => {
const actionRef = useRef<ActionType>();
// const { loading, data } = useRequest(async () => {
// console.log('merchartsId', merchartsId);
// if (merchartsId) {
// const data = await getLinkManList(merchartsId)
// console.log('datadasdasdasdas', data);
// return data
// }
// return []
// })
// 请求经营品牌树
const [dataSource, setDataSource] = useState<LinkManModel[]>()
const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]);
// if (!loading && !dataSource) {
// setDataSource(data)
// }
const columns: ProColumns<LinkManModel>[] = [
{
title: '联系人',
dataIndex: 'LINKER_NAME',
formItemProps: (form, { rowIndex }) => {
return {
rules: rowIndex > 2 ? [{ required: true, message: '此项为必填项' }] : [],
};
},
},
{
title: '联系方式',
dataIndex: 'LINKER_MOBILEPHONE'
},
{
title: '状态',
dataIndex: 'LINKER_STATE',
valueType: 'select',
// width:120,
valueEnum: { 1: { text: '有效', status: 'sucess' }, 0: { text: '无效', status: 'error' } }
},
{
title: '操作',
valueType: 'option',
width: 160,
render: (text, record, _, action) => [
<a
key="editable"
onClick={() => {
action?.startEditable?.(record.COOPMERCHANTS_LINKER_ID);
}}
>
</a>,
// <Popconfirm
// title="确认删除该联系人吗?"
// onConfirm={async () => {
// const sucesse = await delLinkMan(record.COOPMERCHANTS_LINKER_ID);
// if (sucesse && actionRef.current) {
// actionRef.current.reload();
// }
// }}
// >
// <a>删除</a>
// </Popconfirm>
// <a
// key="delete"
// onClick={() => {
// if (record.COOPMERCHANTS_LINKER_ID) {
// delLinkMan(record.COOPMERCHANTS_LINKER_ID);
// }
// }}
// >
// 移除
// </a>
],
}
]
// 拿到表格数据的方法
const handleGetTableData = async () => {
const data = await getLinkManList(merchartsId)
setDataSource(data)
console.log('datadasdasdasdas', data);
}
useEffect(async () => {
console.log('merchartsId', merchartsId);
if (merchartsId) {
handleGetTableData()
}
}, [])
return (
<EditableProTable<LinkManModel>
rowKey="COOPMERCHANTS_LINKER_ID"
columns={columns}
recordCreatorProps={{
// newRecordType: "dataSource",
record: () => ({
COOPMERCHANTS_LINKER_ID: new Date().getTime(),
LINKER_STATE: "1"
}),
}}
// request={async () => dataSource}
value={dataSource}
onChange={setDataSource}
editable={{
type: 'multiple',
editableKeys,
onSave: async (rowKey, data, row) => {
data.COOPMERCHANTS_ID = merchartsId;
await updateLinkMan(data)
await handleGetTableData()
},
onDelete: async (key, row) => {
console.log('row', row);
delLinkMan(row.COOPMERCHANTS_LINKER_ID)
},
onValuesChange: (record, recordList) => {
setDataSource(recordList);
},
onChange: setEditableRowKeys,
}}
></EditableProTable>
)
}
export default LinkManTable;

View File

@ -0,0 +1,266 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import { FormInstance, ModalForm, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
import { MerchantModel } from "../data";
import { useRef, useState } from "react";
import { Col, Form, message, Row, Switch } from "antd";
import { updateMerchants } from "../service";
import { getFieldEnum } from "@/services/options";
import LinkManTable from "./LinkManTable";
import BrandTable from "./BrandTable";
import Draggable from "react-draggable";
import React from "react";
// 更新信息
const handleAddUpdate = async (fields: MerchantModel) => {
const hide = message.loading('正在提交...');
const result = await updateMerchants(fields);
hide();
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`);
return false;
}
message.success(fields.COOPMERCHANTS_ID ? '更新成功!' : '新建成功!');
return true;
};
type DetailProps = {
currentRow: any;
modalVisible: any;
handleModalVisible: any;
setCurrentRow: any
actionRef: any
disabled: any
setDraggleDisabled: any
bounds: any
onDraggaleStart: any
draggleRef: any
}
const AddEdit = ({ currentRow, modalVisible, handleModalVisible, setCurrentRow, actionRef, disabled, setDraggleDisabled, onDraggaleStart, bounds, draggleRef }: DetailProps) => {
const formRef = useRef<FormInstance>();
const brandTableRef = useRef<any>()
return (
<div>
{/* 编辑信息 */}
<ModalForm<MerchantModel>
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新商户信息' : '新建商户'}
</div>
}
modalProps={{
modalRender: (modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
},
destroyOnClose: true,
onCancel: () => {
setCurrentRow(undefined);
handleModalVisible(false)
}
}}
layout={'horizontal'}
width={1024}
wrapperCol={{ span: 16 }}
labelCol={{ span: 6 }}
formRef={formRef}
visible={modalVisible}
autoFocusFirstInput
request={() => {
if (currentRow) {
return { ...currentRow, COOPMERCHANTS_STATE: currentRow.COOPMERCHANTS_STATE ? 1 : 0 }
} else {
return { COOPMERCHANTS_STATE: 1 }
}
}}
// onVisibleChange={(value) => {
// console.log('ModalForm', value);
// handleModalVisible(value);
// if (value) {
// formRef.current?.setFieldsValue(
// currentRow ? { ...currentRow, COOPMERCHANTS_STATE: currentRow.COOPMERCHANTS_STATE ? 1 : 0 } : { COOPMERCHANTS_STATE: 1 },
// );
// console.log('currentRow', currentRow ? { ...currentRow, COOPMERCHANTS_STATE: currentRow.COOPMERCHANTS_STATE ? 1 : 0 } : { COOPMERCHANTS_STATE: 1 });
// } else {
// formRef.current?.resetFields();
// setCurrentRow(undefined);
// }
// }}
onFinish={async (values) => {
let newValue: MerchantModel = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, COOPMERCHANTS_ID: currentRow.COOPMERCHANTS_ID };
}
newValue.COOPMERCHANTS_STATE = values.COOPMERCHANTS_STATE ? 1 : 0
console.log('newValue', newValue);
const success = await handleAddUpdate(newValue as MerchantModel);
if (success) {
if (actionRef.current) {
actionRef.current.reload();
}
handleModalVisible(false);
}
return false;
}}
>
<div style={{ height: '600px', overflowY: 'scroll', boxSizing: 'border-box' }}>
<Row gutter={20}>
<Col span={12}>
<ProFormText
name="COOPMERCHANTS_NAME"
label="商户名称"
placeholder="请输入名称"
rules={[
{
required: true,
message: '请输入名称',
},
]}
/>
<ProFormText
name="TAXPAYER_IDENTIFYCODE"
label="统一信用代码"
placeholder="统一信用代码"
/>
<ProFormText name="BANK_NAME" label="开户行" placeholder="请输入开户行"
rules={[
{
required: true,
message: '请输入开户行',
},
]} />
<ProFormText
name="COOPMERCHANTS_LINKMAN"
label="法人姓名"
placeholder="请输入法人姓名"
/>
<ProFormSelect
name="MERCHANTTYPE_ID"
label="所属类别"
placeholder="请选择所属类别"
// tooltip="若无你需选择商户类别,请添加后选择"
rules={[
{
required: true,
message: '请选择所属类别',
},
]}
request={async () => {
const options = await getFieldEnum({ FieldExplainField: 'MERCHANTS_TYPE' });
return options
}}
/>
</Col>
<Col span={12}>
<ProFormText
name="COOPMERCHANTS_EN"
label="商户简称"
placeholder="请输入名称"
/>
<ProFormText
name="COOPMERCHANTS_CODE"
label="商户编码"
placeholder="请输入商户编码"
/>
<ProFormSelect
name="COOPMERCHANTS_NATURE"
label="商户性质"
placeholder="请选择商户性质"
rules={[
{
required: true,
message: '请选择商户性质',
},
]}
options={[{ value: 1000, label: '企业' }, { value: 2000, label: '个体' }, { value: 3000, label: '自然人' }]}
/>
<ProFormText name="BANK_ACCOUNT" label="银行账号" placeholder="请输入银行账号" rules={[
{
required: true,
message: '请输入银行账号',
},
]} />
<ProFormText
name="COOPMERCHANTS_MOBILEPHONE"
label="联系电话"
placeholder="请输入手机号"
/>
{/* 当前依赖包动画过渡有问题 临时采用 Form.Item 方式进行Switch交互 */}
<Form.Item
name="COOPMERCHANTS_STATE"
label="是否有效"
rules={[
{
required: true,
message: '是否无效',
},
]}
>
<Switch
checkedChildren="有"
unCheckedChildren="无"
defaultChecked={currentRow ? !!currentRow.COOPMERCHANTS_STATE : true}
/>
</Form.Item>
</Col>
</Row>
<Row>
<Col span={24}>
<ProFormTextArea
name="COOPMERCHANTS_ADDRESS"
wrapperCol={{ span: 20 }}
labelCol={{ span: 3 }}
label="商户地址"
/>
</Col>
</Row>
{/* 联系人列表 */}
{
modalVisible ?
<LinkManTable merchartsId={currentRow?.COOPMERCHANTS_ID} show={modalVisible}></LinkManTable> : ''
}
{/* 品牌列表编辑新增 */}
{
modalVisible ?
<BrandTable onRef={brandTableRef} merchartsId={currentRow?.COOPMERCHANTS_ID} currentRow={currentRow} /> : ''
}
</div>
</ModalForm>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(AddEdit);

View File

@ -0,0 +1,68 @@
export type MerchantModel = {
COOPMERCHANTS_ID: number // 商户内码 ,
COOPMERCHANTS_PID: number // 父级内码 ,
OWNERUNIT_ID: number // 业主内码 ,
OWNERUNIT_NAME: string // 业主单位 ,
PROVINCE_CODE: number // 省份标识 ,
COOPMERCHANTS_NATURE: number // 商户性质 ,
COOPMERCHANTS_TYPE: string // 商户类型 ,
COOPMERCHANTS_CODE: string // 商户编码 ,
COOPMERCHANTS_NAME: string // 商户名称 ,
COOPMERCHANTS_EN: string // 商户简称 ,
TAXPAYER_IDENTIFYCODE: string // 统一信用代码 ,
COOPMERCHANTS_DRAWER: string // 开票人 ,
BANK_NAME: string // 开户银行 ,
BANK_ACCOUNT: string // 银行账号 ,
COOPMERCHANTS_LINKMAN: string // 法人员 ,
LINKER_NAME: string // 联系人员 ,
LINKER_MOBILEPHONE: string // 手机号码 ,
COOPMERCHANTS_TELEPHONE: string // 联系电话 ,
COOPMERCHANTS_MOBILEPHONE: string // 手机号码 ,
COOPMERCHANTS_ADDRESS: string // 联系地址 ,
COOPMERCHANTS_STATE: number // 商户状态 ,
STAFF_ID: number // 操作人内码 ,
STAFF_NAME: string // 操作人员 ,
OPERATE_DATE: string // 操作时间 ,
COOPMERCHANTS_DESC: string // 备注 ,
MERCHANTTYPE_ID: number // 自定义类别内码 ,
MERCHANTTYPE_NAME: string // 自定类别名 ,
COOPMERCHANTS_BRAND: string // 商户品牌
BrandList?: any
};
export type MerchantTypeModel = {
AUTOTYPE_ID: number; // 内码;
AUTOTYPE_NAME: string; // 项目名称;
AUTOTYPE_CODE: string; // 科目代码;
AUTOTYPE_PID: number; // 上级类别;
AUTOTYPE_INDEX: number; // 显示顺序;
AUTOTYPE_LEVEL: number; // 项目级别;
DATASOURCE_TYPE: number; // 所属类别;
SERVERPART_ID: number; // 服务区内码;
SERVERPARTSHOP_ID: number; // 门店内码;
AUTOTYPE_STAFFID: number; // 人员内码;
AUTOTYPE_STAFF: string; // 配置人员;
AUTOTYPE_DATE: string; // 配置时间;
AUTOTYPE_VALID: number; // 有效状态;
AUTOTYPE_TYPEID: number; // 类别类型;
AUTOTYPE_TYPENAME: string; // 类型名称;
FINANCE_DEPARTMENT: string; // 审核部门;
AUTOTYPE_DESC: string; // 备注;
};
export type LinkManModel = {
COOPMERCHANTS_LINKER_ID: number;// 内码 ,
COOPMERCHANTS_ID?: number;// 商户内码 ,
BANK_NAME?: string;// 开户银行 ,
BANK_ACCOUNT?: string;// 银行账号 ,
COOPMERCHANTS_DRAWER?: string;// 开票人 ,
LINKER_NAME?: string;// 联系人 ,
LINKER_TELEPHONE?: string;// 联系电话 ,
LINKER_MOBILEPHONE?: string;// 手机号码 ,
LINKER_ADDRESS?: string;// 联系人地址 ,
LINKER_STATE: string?;// 联系人状态(0无效1有效) ,
STAFF_ID?: number;// 操作人内码 ,
STAFF_NAME?: string;// 操作人名称 ,
OPERATE_DATE?: string;// 操作时间 ,
COOPMERCHANTS_LINKER_DESC?: string;// 备注说明
}

View File

@ -0,0 +1,506 @@
/*
* @Author: cclu
* @Date: 2022-04-28 10:47:35
* @LastEditTime: 2024-12-16 12:04:59
* @LastEditors: cclu 1106109051@qq.com
* @Description:
* @FilePath: \cloud-platform\src\pages\basicManage\Merchats\index.tsx
*/
import { getFieldEnum } from '@/services/options';
import { PlusOutlined } from '@ant-design/icons';
import ProDescriptions from '@ant-design/pro-descriptions';
import { ModalForm, ProFormSelect, ProFormSwitch, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
import { PageContainer } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { FormInstance } from 'antd';
import { Button, Col, Drawer, message, Row, Switch, Form } from 'antd';
import { useImperativeHandle, useRef, useState } from 'react';
import LinkManTable from './components/LinkManTable';
import BrandTable from './components/BrandTable';
import type { MerchantModel } from './data';
import { getList, updateMerchants, getShopDetail, getLinkManList } from './service';
import './style.less'
import closeIcon from "@/assets/brand/closeIcon.png";
import storeIcon from '@/assets/brand/storeIcon.png'
import legalPerson from '@/assets/brand/legalPerson.png'
import account from '@/assets/brand/account.png'
import code from '@/assets/brand/code.png'
import brandDesc from '@/assets/brand/brandDesc.png'
import shopIcon from '@/assets/brand/shopIcon.png'
import map from '@/assets/brand/map.png'
import button from '@/assets/brand/button.png'
import phone from '@/assets/brand/phone.png'
import success from '@/assets/brand/success.png'
import effective from "@/assets/brand/effective.png";
import wrong from "@/assets/brand/wrong.png";
import AddEdit from './components/addEdit';
import React from 'react';
import LoadingBox from '@/pages/reports/Finance/businessAnalysis/components/loading';
import PageTitleBox from '@/components/PageTitleBox';
// 更新信息
const handleAddUpdate = async (fields: MerchantModel) => {
const hide = message.loading('正在提交...');
const result = await updateMerchants(fields);
hide();
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`);
return false;
}
message.success(fields.COOPMERCHANTS_ID ? '更新成功!' : '新建成功!');
return true;
};
type DetailProps = {
isComponent?: boolean
onRef?: any
}
// const MerchatsTable = ({ isComponent, onRef }: DetailProps) => {
const MerchatsTable: React.FC<{ isComponent?: any, onRef?: any }> = (props) => {
const { isComponent, onRef } = props
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const brandTableRef = useRef<any>()
const [currentRow, setCurrentRow] = useState<MerchantModel>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [showDrawer, setShowDrawer] = useState<boolean>(false)// 是否显示抽屉
const [detail, setDetail] = useState<any>(); // 抽屉详情
const [contactsList, setContactsList] = useState<any>([])// 联系人列表
// 点击商户名称的点击事件的加载效果
const [detailLoading, setDetailLoading] = useState<boolean>(false)
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const draggleRef = React.createRef<any>()
// 选中的行
const [selectRow, setSelectRow] = useState<any>()
// 选中的行详情
const [selectRowDetail, setSelectRowDetail] = useState<any>()
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
const targetRect = draggleRef.current?.getBoundingClientRect();
if (!targetRect) {
return;
}
setBounds({
left: -targetRect.left + uiData.x,
right: clientWidth - (targetRect.right - uiData.x),
top: -targetRect.top + uiData.y,
bottom: clientHeight - (targetRect.bottom - uiData.y),
});
};
const columns: ProColumns<MerchantModel>[] = [
{
title: '查询条件',
dataIndex: 'searchKey',
hideInTable: true,
hideInDescriptions: true,
fieldProps: {
placeholder: "请输入商户名称/统一信用代码"
}
},
{
dataIndex: 'COOPMERCHANTS_NAME',
title: '商户名称',
hideInSearch: true,
hideInDescriptions: true,
sorter: true,
render: (_, record) => {
return <a
onClick={async () => {
setShowDrawer(true)
await handleGetDetailData(record)
}}
>
{record.COOPMERCHANTS_NAME}
</a>
}
},
{
dataIndex: 'COOPMERCHANTS_EN',
title: '简称',
hideInSearch: true,
hideInTable: true,
},
{
dataIndex: 'MERCHANTTYPE_NAME',
title: '类别',
hideInSearch: true,
hideInTable: true,
},
{
dataIndex: 'LINKER_NAME',
title: '联系人',
align: 'center',
width: 100,
hideInSearch: true,
},
{
dataIndex: 'LINKER_MOBILEPHONE',
title: '联系方式',
align: 'center',
width: 150,
hideInSearch: true,
},
{
dataIndex: 'TAXPAYER_IDENTIFYCODE',
title: '统一信用代码',
hideInTable: true,
hideInSearch: true,
},
{
dataIndex: 'COOPMERCHANTS_NATURE',
title: '商户性质',
valueType: 'select',
valueEnum: { 1000: '企业', 2000: '个体', 3000: '自然人' },
hideInTable: true,
hideInSearch: true,
},
{
dataIndex: 'BANK_NAME',
title: '开户行',
// width: 350,
hideInSearch: true,
},
{
dataIndex: 'BANK_ACCOUNT',
title: '银行账号',
width: 200,
hideInSearch: true,
},
{
dataIndex: 'COOPMERCHANTS_STATE',
title: '商户状态',
align: 'center',
width: 100,
valueType: 'select',
valueEnum: { 0: { text: '无效', status: 'error' }, 1: { text: '有效', status: 'success' } },
initialValue: '1'
},
{
dataIndex: 'MERCHANTS_ADDRESS',
title: '商户地址',
colSize: 24,
hideInTable: true,
hideInSearch: true,
},
{
dataIndex: 'STAFF_NAME',
title: '操作员',
hideInSearch: true,
hideInTable: true,
},
{
dataIndex: 'OPERATE_DATE',
title: '更新时间',
align: 'center',
width: 100,
valueType: 'fromNow',
hideInSearch: true,
},
{
dataIndex: 'option',
title: '操作',
width: 80,
align: 'center',
valueType: 'option',
hideInSearch: true,
hideInTable: isComponent,
render: (_, record) => {
return (
<a
onClick={() => {
console.log('record', record);
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
);
},
},
];
// 拿到详情数据
const handleGetDetailData = async (record: any) => {
setDetailLoading(true)
const data = await getShopDetail({ CoopMerchantsId: record.COOPMERCHANTS_ID })
setDetail(data)
const options = await getFieldEnum({ FieldExplainField: 'MERCHANTS_TYPE' });
options.forEach((item: any) => {
if (item.value === data.MERCHANTTYPE_ID) {
data.MERCHANTTYPE_IDNAME = item.label
}
})
const contacts = await getLinkManList(Number(record.COOPMERCHANTS_ID))
setContactsList(contacts)
setDetailLoading(false)
}
useImperativeHandle(onRef, () => ({
selectRow,
selectRowDetail
}));
return (
<PageContainer header={{
title: '',
breadcrumb: {},
}}>
<ProTable<MerchantModel>
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey="COOPMERCHANTS_ID"
formRef={formRef}
headerTitle={<PageTitleBox props={props} />}
className='MerchatsTable'
actionRef={actionRef}
search={{ span: 6 }}
request={async (params, sorter) => {
// 排序字段
const sortstr = Object.keys(sorter).map(n => {
const value = sorter[n]
return value ? `${n} ${value.replace('end', '')}` : ''
})
const data = await getList({
...params,
sortstr: sortstr.length ? sortstr.toString() : "OPERATE_DATE desc",
keyWord: params.searchKey ? { key: "COOPMERCHANTS_NAME,TAXPAYER_IDENTIFYCODE", value: params.searchKey } : null, // 关键词查询
pagesize: params.pageSize
});
return data;
}}
columns={columns}
toolbar={{
actions: [
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
pagination={{ defaultPageSize: 10 }}
options={false}
rowSelection={isComponent ? {
type: "radio",
onChange: (_, selectedRows) => {
// setSelectRow
console.log('_', _);
console.log('selectedRows', selectedRows);
if (selectedRows && selectedRows.length > 0) {
setSelectRow(selectedRows[0].COOPMERCHANTS_NAME)
setSelectRowDetail(selectedRows)
} else {
setSelectRow('')
setSelectRowDetail(undefined)
}
}
} : false}
/>
<Drawer
width={600}
visible={showDetail}
onClose={() => {
setCurrentRow(undefined);
setShowDetail(false);
}}
closable={false}
>
{currentRow?.COOPMERCHANTS_NAME && (
<ProDescriptions<MerchantModel>
column={2}
title={currentRow?.COOPMERCHANTS_NAME}
request={async () => ({
data: currentRow || {},
})}
params={{
id: currentRow?.COOPMERCHANTS_ID,
}}
columns={columns as ProDescriptionsItemProps<MerchantModel>[]}
/>
)}
</Drawer>
<AddEdit currentRow={currentRow} modalVisible={modalVisible} handleModalVisible={handleModalVisible} setCurrentRow={setCurrentRow}
actionRef={actionRef} disabled={disabled} setDraggleDisabled={setDraggleDisabled} bounds={bounds} onDraggaleStart={onDraggaleStart}
draggleRef={draggleRef} />
<Drawer
width={'560px'}
visible={showDrawer}
onClose={() => {
setShowDrawer(false);
}}
bodyStyle={{ padding: 0 }}
footer={
<div style={{ width: '100%', display: 'flex', justifyContent: 'flex-end' }}>
<Button onClick={() => { setShowDrawer(false) }}></Button>
{/* <Button type={'primary'}>确定</Button> */}
</div>
}
closable={false}
>
{
detailLoading ?
<LoadingBox /> :
<>
{
detail ?
<div className={'drawer'}>
<div className={'drawerTop'}>
<span className={'drawerTitle'}></span>
<img className={'closeIcon'} src={closeIcon} onClick={() => { setShowDrawer(false) }}></img>
</div>
<div className={'drawerContent'}>
<div className={'drawerHeader'}>
<div className={'top'}>
<div className={'topLeft'}>
<div className={'image'}>
<img className={'headerIcon'} src={storeIcon} />
</div>
<div className={'message'}>
<p className={'companyName'}>{detail.COOPMERCHANTS_NAME}</p>
<p className={'label'}>{detail.COOPMERCHANTS_NATURE === 1000 ? '企业' : '个体'}</p>
</div>
</div>
<div className={'topRight'}>
{
detail.COOPMERCHANTS_STATE === 1 ?
<div className={'state'}>
<img className={'stateIcon'} src={effective} />
<span className={'stateText'}>{'有效'}</span>
</div>
: <div className={'state'}>
<img className={'stateIcon'} src={wrong} />
<span className={'stateText'} style={{ color: '#ccc' }}>{'无效'}</span>
</div>
}
</div>
</div>
<div className={'list'}>
<div className={'item'} style={{ alignItems: 'flex-start' }}>
<img className={'icon'} src={legalPerson} style={{ marginTop: '4px' }}></img>
<span className={'messageLabel'}></span>
{
!detail.COOPMERCHANTS_LINKMAN && !detail.COOPMERCHANTS_TELEPHONE ? <span style={{ marginLeft: '24px' }}>-</span> :
<p className={'text'}><span style={{ marginRight: '12px' }}>{detail.COOPMERCHANTS_LINKMAN}</span> {detail.COOPMERCHANTS_MOBILEPHONE}</p>
}
</div>
<div className={'item'} style={{ alignItems: 'flex-start' }}>
<img className={'icon'} src={account} style={{ marginTop: '4px' }}></img>
<span className={'messageLabel'}></span>
{
!detail.BANK_NAME && !detail.BANK_ACCOUNT ? <span style={{ marginLeft: '24px' }}>-</span> :
<p className={'text'}><span style={{ marginRight: '12px' }}>{detail.BANK_NAME}</span> {detail.BANK_ACCOUNT}</p>
}
</div>
<div className={'item'}>
<img className={'icon'} src={code}></img>
<span className={'messageLabel'}></span>
<p className={'text'}>{detail.TAXPAYER_IDENTIFYCODE || '-'}</p>
</div>
</div>
</div>
<div className={'other'}>
<div className={'otherItem'}>
<img className={'icon'} src={button} />
<span className={'label'}></span>
<span className={'type'}>{detail.MERCHANTTYPE_IDNAME}</span>
</div>
<div className={'otherItem'} style={{ alignItems: 'flex-start' }}>
<img className={'icon'} src={brandDesc} style={{ marginTop: '4px' }} />
<span className={'label'} ></span>
<span className={'value'}>{detail.COOPMERCHANTS_EN || '-'}</span>
</div>
<div className={'otherItem'} style={{ alignItems: 'flex-start' }}>
<img className={'icon'} src={map} style={{ marginTop: '4px' }} />
<span className={'label'}></span>
<span className={'value'}>{detail.COOPMERCHANTS_ADDRESS || '-'}</span>
</div>
<div className={'otherItem'} style={{ alignItems: 'flex-start' }}>
<img className={'icon'} src={phone} style={{ marginTop: '7px' }} />
<span className={'label'} style={{ marginTop: '4px' }}></span>
<div className={'list'}>
{
contactsList.length && contactsList.length > 0 ?
contactsList.map((item: any) => {
return <div className={'listItem'}>
<span className={'name'}>{item.LINKER_NAME}</span>
<span className={'phone'}>{item.LINKER_MOBILEPHONE}</span>
{
item.LINKER_STATE === 1 ?
<div className={'state'}>
<img className={'icon'} src={success} />
<span className={'text'}></span>
</div>
:
<div className={'state'}>
<img className={'icon'} src={wrong} />
<span className={'text'} style={{ color: '#ccc' }}></span>
</div>
}
</div>
}) : ''
}
</div>
</div>
<div className={'otherItem'} style={{ alignItems: 'flex-start' }}>
<img className={'icon'} src={shopIcon} style={{ marginTop: '15px' }} />
<span className={'label'} style={{ marginTop: '11px' }}></span>
<div className={'imgList'}>
{
detail.BrandList.length && detail.BrandList.length > 0 ?
detail.BrandList.map((item: any) => {
return item.ico ? <img className={'imgItem'} src={item.ico} /> : ''
})
// [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}].map((item: any)=>{
// return <img className={'imgItem'} src={item.ico}/>
// })
: ''
}
</div>
</div>
</div>
</div>
</div>
: ''
}
</>
}
</Drawer>
</PageContainer>
);
};
export default MerchatsTable;

View File

@ -0,0 +1,312 @@
import { tableList } from '@/utils/format';
import request from '@/utils/request';
import type { LinkManModel, MerchantModel, MerchantTypeModel } from './data';
// 获取列表数据
export async function getList(params?: any) {
const search = params ? {
searchParameter: { ...params }, keyWord: params.keyWord,
sortstr: params.sortstr, PageIndex: params.current, pagesize: params.pagesize
} : {};
const data = await request(`/Merchants/GetCoopMerchantsList`, {
method: 'POST',
data: search,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return tableList(data.Result_Data);
}
export async function delMerchants(Merchantsid: number) {
return request(`/Merchants/DeleteCoopMerchants?Merchantid=${Merchantsid}`, {
method: 'POST',
requestType: 'form',
});
}
export async function updateMerchants(Merchants: MerchantModel) {
return request(`/Merchants/SynchroCoopMerchants`, {
method: 'POST',
data: Merchants,
requestType: 'form',
});
}
// 获取联系人列表数据
export async function getLinkManList(merchartsId: any) {
const search = { searchParameter: { COOPMERCHANTS_ID: merchartsId, LINKER_STATE: 1 }, PageIndex: 1, pagesize: 20 }
const data = await request(`/Merchants/GetCoopMerchantsLinkerList`, {
method: 'POST',
data: search,
});
if (data.Result_Code !== 100) {
return []
}
return data.Result_Data.List;
}
export async function delLinkMan(Merchantsid: number) {
return request(`/Merchants/DeleteCoopMerchantsLinker?CoopMerchantsLinkerId=${Merchantsid}`, {
method: 'POST',
requestType: 'form',
});
}
export async function updateLinkMan(Merchants: LinkManModel) {
return request(`/Merchants/SynchroCoopMerchantsLinker`, {
method: 'POST',
data: Merchants,
requestType: 'form',
});
}
// end===
// 商户类别
export async function getTypeList(params?: any) {
const search = params ? { ...params, PageIndex: params.current } : {};
const data = await request(`/Merchants/GetAutoTypeList`, {
method: 'GET',
params: search,
});
if (data.Result_Code === 500) {
return [];
}
return tableList(data.Result_Data);
}
export async function delMerchantsType(autoTypeId: number) {
return request(`/Merchants/DeleteAutotype?autoTypeId=${autoTypeId}`, {
method: 'POST',
requestType: 'form',
});
}
export async function updateMerchantsType(Merchants: MerchantTypeModel) {
return request(`/Merchants/SynchroAutotype`, {
method: 'POST',
data: Merchants,
requestType: 'form',
});
}
// 获取商家类别options 数据
export async function getTypeOptions(params?: any) {
const search = params ? { ...params, PageIndex: params.current } : {};
const data = await request(`/Merchants/GetAutoTypeList`, {
method: 'GET',
params: search,
});
if (data.Result_Code !== 100) {
return [];
}
if (data.Result_Data.List) {
const options: { label: string; value: number }[] = data.Result_Data.List.map((n: MerchantTypeModel) => {
const { AUTOTYPE_NAME, AUTOTYPE_ID } = n;
return ({ label: AUTOTYPE_NAME, value: AUTOTYPE_ID });
});
return options;
}
return [];
}
// 获取列表数据
export async function getMerchantsOpt(params?: any) {
const search = { searchParameter: { ...params, COOPMERCHANTS_STATE: 1, pagesize: 9999, pageindex: 1 } }
const data = await request(`/Merchants/GetCoopMerchantsList`, {
method: 'POST',
data: search,
});
if (data.Result_Code !== 100) {
return []
}
if (data.Result_Data.List) {
const options: { label: string; value: number }[] = data.Result_Data.List.map((n: MerchantModel) => {
const { COOPMERCHANTS_NAME, COOPMERCHANTS_ID } = n;
return ({ label: COOPMERCHANTS_NAME, value: COOPMERCHANTS_ID });
});
return options;
}
return data.Result_Data.List;
}
// 商家详情信息
export async function getShopDetail(params?: any) {
const data = await request(`/Merchants/GetCoopMerchantsDetail`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return data.Result_Data;
}
// 拿到当期汇总信息
export async function getMerchantSplit(params?: any) {
const data = await request(`/BusinessProject/GetMerchantSplit`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return data.Result_Data.List;
}
// 获取经营商户应收账款信息
export async function getReceivalbles(params?: any) {
const data = await request(`/BusinessProject/GetMerchantsReceivables`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return data.Result_Data;
}
// 获取品牌列表
export async function getBrandList(params?: any) {
const data = await request(`/Merchants/GetRTCoopMerchantsList`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return []
}
return data.Result_Data.List;
}
// 获取列表数据
export async function getTreeList(params?: any) {
const search = params ? {
SearchParameter: { ...params }, keyWord: params.keyWord,
PageIndex: params.current, pagesize: params.pageSize, SortStr: params.sortstr
} : {};
const data = await request(`/BaseInfo/GetBrandList`, {
method: 'POST',
data: search,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return tableList(data.Result_Data);
}
// 获取经营商户品牌列表
export async function handleRTCoopMerchantsList(params?: any) {
const data = await request(`/Merchants/GetRTCoopMerchantsList`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return data.Result_Data.List
}
// 删除经营商户品牌关联关系表
export async function handleDeleteRTCoopMerchants(params?: any) {
const data = await request(`/Merchants/DeleteRTCoopMerchants`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return data
}
// 同步经营商户品牌关联关系表
export async function handleSynchroRTCoopMerchants(params?: any) {
const data = await request(`/Merchants/SynchroRTCoopMerchants`, {
method: 'POST',
data: params,
});
if (data.Result_Code !== 100) {
return {
data: [],
current: 1,
pageSize: 10,
total: 0,
success: false
}
}
return data
}

View File

@ -0,0 +1,245 @@
.MerchatsTable{
.ant-pro-card{
.ant-pro-card-body{
.ant-pro-table-alert{
display: none !important;
}
}
}
}
.drawer{
width: 100%;
height: 100%;
box-sizing: border-box;
.drawerTop{
width: 100%;
height: 56px;
border-bottom: 1px solid rgba(0,0,0,0.06);
box-sizing: border-box;
padding: 16px 24px;
display: flex;
justify-content: space-between;
align-items: center;
.drawerTitle{
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 600;
color: rgba(0,0,0,0.85);
}
.closeIcon{
width: 16px;
height: 16px;
cursor: pointer;
}
}
.drawerContent{
width: 100%;
height: calc(100% - 80px);
box-sizing: border-box;
padding: 0 24px;
.drawerHeader{
width: 100%;
background: linear-gradient(180deg, RGBA(246, 249, 255, 1) 0%, RGBA(255, 255, 255, 1) 100%);
border-radius: 8px;
border: 1px solid #EFEFF3;
box-sizing: border-box;
padding: 20px;
margin-top: 24px;
display: flex;
flex-direction: column;
.top{
width: 100%;
display: flex;
align-items: flex-start;
justify-content: space-between;
.topLeft{
display: flex;
align-items: center;
.image{
width: 52px;
height: 52px;
background: #FFFFFF;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
.headerIcon{
width: 40px;
height: 40px;
}
}
.message{
margin-left: 12px;
.companyName{
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 600;
color: rgba(0,0,0,0.85);
line-height: 24px;
margin-bottom: 4px;
}
.label{
display: inline-block;
padding: 1px 8px;
background: #FDF6E3;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #571519;
margin-bottom: 0;
line-height: 22px;
}
}
}
.topRight{
.state{
display: flex;
align-items: center;
.stateIcon{
width: 16px;
height: 16px;
}
.stateText{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0DA241;
margin-left: 4px;
}
}
}
}
.list{
margin-top: 20px;
.item{
display: flex;
align-items: center;
margin-bottom: 8px;
p{
margin-bottom: 0;
}
.icon{
width: 16px;
height: 16px;
border-radius: 2px;
margin-right: 8px;
}
.messageLabel{
display: inline-block;
min-width: 100px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0,0,0,0.45);
line-height: 22px;
}
.text{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0,0,0,0.85);
line-height: 22px;
margin-left: 24px;
}
}
}
}
.other{
margin-top: 24px;
width: 100%;
.otherItem{
display: flex;
align-items: center;
margin-bottom: 17px;
.icon{
width: 16px;
height: 16px;
margin-right: 8px;
}
.label{
min-width:80px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0,0,0,0.65);
line-height: 22px;
margin-right: 24px;
}
.type{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0A2659;
line-height: 22px;
background: #EBF2FF;
border-radius: 2px;
padding: 1px 8px;
}
.value{
flex: 1;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0,0,0,0.85);
line-height: 22px;
}
.list{
.listItem{
width: 304px;
height: 30px;
background: #F6F7F8;
border-radius: 2px;
box-sizing: border-box;
padding: 4px 16px;
display: flex;
justify-content: space-between;
margin-bottom: 8px;
.name{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0,0,0,0.85);
line-height: 22px;
}
.phone{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(0,0,0,0.85);
line-height: 22px;
}
.state{
display: flex;
align-items: center;
.icon{
width: 14px;
height: 14px;
}
.text{
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0DA241;
line-height: 22px;
}
}
}
}
.imgList{
flex: 1;
.imgItem{
width: 40px;
height: 40px;
margin-right: 12px;
margin-bottom: 12px;
border-radius: 4px;
}
}
}
}
}
}

View File

@ -0,0 +1,194 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import ProForm, { FormInstance, ProFormDigit, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect } from "@ant-design/pro-form";
import { useImperativeHandle, useRef, useState } from "react";
import { Button, Col, Drawer, Row } from "antd";
import { handleGetBusinessManDetail, handleGetNestingOwnerUnitList } from "../service";
import { getFieldEnum } from "@/services/options";
import { PlusOutlined } from "@ant-design/icons";
import MerchatsTable from "../../Merchats";
type DetailProps = {
onRef: any
currentRow: any
selectShopRef?: any
currentUser?: any
handleGetShopData: any
pageType?: any
}
const AddForm = ({ onRef, currentRow, selectShopRef, currentUser, handleGetShopData, pageType }: DetailProps) => {
const MerchatsTableRef = useRef<any>()
const formRef = useRef<FormInstance>();
// 表格的详情
const [formDetail, setFormDetail] = useState<any>()
// 客户单位后面点击的加号出现的抽屉
const [onShowSelect, setOnShowSelect] = useState<boolean>(false)
useImperativeHandle(onRef, () => ({
formRef,
formDetail
}));
return (
<div>
<ProForm
formRef={formRef}
layout={'horizontal'}
submitter={false}
request={async () => {
if (currentRow?.OWNERUNIT_ID) {
const data = await handleGetBusinessManDetail({ BusinessManId: currentRow?.OWNERUNIT_ID })
console.log('data312312', data);
let obj: any = data.Result_Data
// 原数据
obj.PROVINCE_CODE = obj.PROVINCE_CODE.toString()
obj.OWNERUNIT_NATURE = obj.OWNERUNIT_NATURE.toString()
setFormDetail(data.Result_Data)
selectShopRef.current?.handleShopSelected(obj?.ShopList)
await selectShopRef.current?.handleGetTreeData(obj?.PROVINCE_CODE)
return data.Result_Data
}
// 左边选择门店的内容 因为需要拿到这边的省份数据 如果一起掉 它本身的会顶掉实际的 所以就在这儿掉
selectShopRef.current?.handleGetTreeData(currentUser?.ProvinceCode)
return {}
}}
>
<Row>
<Col span={24}>
<ProFormTreeSelect
name="OWNERUNIT_PID"
label="父级业主"
request={async () => {
const data = await handleGetNestingOwnerUnitList({ ShowStatus: true })
return data
}}
fieldProps={{
fieldNames: {
label: 'OWNERUNIT_NAME',
value: 'OWNERUNIT_ID',
children: 'children'
},
allowClear: true,
showSearch: true
}}
initialValue={currentRow?.OWNERUNIT_PID ? currentRow?.OWNERUNIT_PID : currentUser?.ProvinceCode === '340000' ? 275 : ''}
/>
</Col>
<Col span={24}>
<ProFormSelect
name="PROVINCE_CODE"
label="所属省份"
rules={[
{
required: true,
message: '请选择所属省份',
}
]}
request={async () => {
return await getFieldEnum({
// 这里要手动添加枚举字段(从下面这些字典中选择一个):服务区内码[ServerpartIds]
FieldExplainField: 'PROVINCE_CODE',
notformate: true,
});
}}
fieldProps={{
onChange: (e: any) => {
console.log('e', e);
console.log('selectShopRef.current?', selectShopRef.current);
selectShopRef.current?.handleGetTreeData(e)
}
}}
initialValue={currentUser?.ProvinceCode || '340000'}
/>
</Col>
<Col span={24}>
<ProFormSelect
name="OWNERUNIT_NATURE"
label="单位性质"
request={async () => {
return await getFieldEnum({
// 这里要手动添加枚举字段(从下面这些字典中选择一个):服务区内码[ServerpartIds]
FieldExplainField: 'OWNERUNIT_NATURE',
notformate: true,
});
}}
initialValue={'2000'}
/>
</Col>
<Col span={20}>
<ProFormText
name="OWNERUNIT_NAME"
label="客户单位"
rules={[
{
required: true,
message: '请输入客户单位',
}
]}
/>
</Col>
<Col span={4}>
<Button style={{ marginLeft: '24px' }} type={"primary"} icon={<PlusOutlined />} onClick={() => {
setOnShowSelect(true)
}}></Button>
</Col>
<Col span={24}>
<ProFormText
name="OWNERUNIT_EN"
label="客户简称"
/>
</Col>
<Col span={24}>
<ProFormDigit
name="OWNERUNIT_INDEX"
label="排序字段"
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="OWNERUNIT_DESC"
label="备注说明"
/>
</Col>
</Row>
</ProForm>
<Drawer
width="80%"
visible={onShowSelect}
onClose={() => {
setOnShowSelect(false)
}}
destroyOnClose
title={'经营商户列表'}
closable={false}
bodyStyle={{ backgroundColor: "#f9f9f9", padding: 16 }}
footer={<div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
<Button type={'primary'} onClick={() => {
setOnShowSelect(false)
let res: any = MerchatsTableRef.current?.selectRow
console.log('res', res);
if (res) {
formRef.current?.setFieldsValue({ OWNERUNIT_NAME: res })
}
}}></Button>
</div>}
>
<MerchatsTable isComponent={true} onRef={MerchatsTableRef} />
</Drawer>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(AddForm);

View File

@ -0,0 +1,384 @@
/*
* @Author: cclu 1106109051@qq.com
* @Date: 2024-08-22 10:51:03
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2024-08-22 18:38:19
* @FilePath: \cloud-platform\src\pages\basicManage\businessMan\components\businessManDetailDrawer.tsx
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import { Col, Drawer, FormInstance, message, Popconfirm, Row } from "antd";
import ProForm, { ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect } from "@ant-design/pro-form";
import { useRef, useState } from "react";
import { handleDeleteAUTOTYPE, handleDeleteOWNERSERVERPART, handleDeleteOWNERSERVERPARTSHOP, handleGetBusinessManDetail, handleGetNestingOwnerUnitList } from "../service";
import { getFieldEnum } from "@/services/options";
import ProTable, { ActionType } from "@ant-design/pro-table";
import moment from 'moment'
import useRequest from "@ahooksjs/use-request";
type DetailProps = {
showDetailDrawer: boolean
currentRow: any
setCurrentRow: any
setShowDetailDrawer: any
currentUser: any
parentRef: any
}
const BusinessManDetailDrawer = ({ showDetailDrawer, currentRow, setCurrentRow, setShowDetailDrawer, currentUser, parentRef }: DetailProps) => {
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const { loading: treeLoading, data: treeViews } = useRequest(async () => {
const data = await handleGetNestingOwnerUnitList({ ShowStatus: true })
console.log('treeViews', data);
return data
})
const [formDetail, setFormDetail] = useState<any>()
// 上级类别的选择列表
const [PIDSelectList, setPIDSelectList] = useState<any>()
// 表格列表
const [tableData, setTableData] = useState<any>()
const columns: any = [
{
title: '经营范围',
dataIndex: 'AUTOTYPE_NAME'
},
{
title: '显示顺序',
dataIndex: 'AUTOTYPE_INDEX'
},
{
title: '所属公司',
dataIndex: 'OWNERUNIT_NAME'
},
{
title: '有效状态',
dataIndex: 'AUTOTYPE_VALID',
valueType: 'select',
valueEnum: {
1: "有效",
0: "无效"
}
},
{
title: '操作',
render: (_, record) => {
return record?.ServerpartList && record?.ServerpartList.length > 0 ? '' : record?.AUTOTYPE_VALID === 0 ? '' : <Popconfirm title={`确认删除?`} onConfirm={async () => {
console.log('record', record);
const data = await handleDeleteAUTOTYPE({ AUTOTYPEId: record?.AUTOTYPE_ID })
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
handleGetReload()
} else {
message.error(data.Result_Desc)
}
}}
>
<a></a>
</Popconfirm>
}
}
]
const handleGetThirdColumns = (record?: any) => {
const columns: any = [
{
title: '门店名称',
dataIndex: 'SHOPNAME'
},
{
title: '门店编码',
dataIndex: 'SHOPCODE'
},
{
title: '所属公司',
dataIndex: 'OWNERUNIT_NAME'
},
{
title: '操作',
render: (_, record) => {
return <Popconfirm title={`确认删除?`} onConfirm={async () => {
console.log('record', record);
const data = await handleDeleteOWNERSERVERPARTSHOP({ OWNERSERVERPARTSHOPId: record?.OWNERSERVERPARTSHOP_ID })
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
handleGetReload()
} else {
message.error(data.Result_Desc)
}
}}
>
<a></a>
</Popconfirm>
}
}
]
return <ProTable
columns={columns}
pagination={false}
rowKey={(record) => {
return `${record?.OWNERSERVERPARTSHOP_ID}`
}}
dataSource={record?.ShopList}
bordered
search={false}
options={false}
/>
}
const handleGetSecondColumns = (record?: any) => {
console.log('record', record);
const columns: any = [
{
title: '服务区名称',
dataIndex: 'SERVERPART_NAME'
},
{
title: '服务区编码',
dataIndex: 'SERVERPART_CODE'
},
{
title: '所属公司',
dataIndex: 'OWNERUNIT_NAME'
},
{
title: '操作',
render: (_, record) => {
return record?.ShopList && record?.ShopList.length > 0 ? '' : <Popconfirm title={`确认删除?`} onConfirm={async () => {
console.log('record', record);
const data = await handleDeleteOWNERSERVERPART({ OWNERSERVERPARTId: record?.OWNERSERVERPART_ID })
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
handleGetReload()
} else {
message.error(data.Result_Desc)
}
}}
>
<a></a>
</Popconfirm>
}
}
]
return <ProTable
columns={columns}
pagination={false}
rowKey={(record) => {
return `${record?.OWNERSERVERPART_ID}`
}}
dataSource={record?.ServerpartList}
bordered
search={false}
options={false}
expandable={{
expandedRowRender: handleGetThirdColumns
}}
/>
}
// 重新刷新下面的嵌套表数据
const handleGetReload = async () => {
const data = await handleGetBusinessManDetail({ BusinessManId: currentRow?.OWNERUNIT_ID })
let obj: any = data.Result_Data
setTableData(obj.OrganizationList)
}
return (
<div>
<Drawer
width={'60%'}
visible={showDetailDrawer}
onClose={() => {
setCurrentRow(undefined);
setShowDetailDrawer(false);
}}
title={<span style={{ fontWeight: 600 }}></span>}
bodyStyle={{ backgroundColor: "#fff", padding: 16 }}
closable={false}
destroyOnClose
>
<ProForm
formRef={formRef}
submitter={false}
request={async () => {
if (currentRow?.OWNERUNIT_ID) {
const data = await handleGetBusinessManDetail({ BusinessManId: currentRow?.OWNERUNIT_ID })
console.log('data312312', data);
let obj: any = data.Result_Data
// 原数据
obj.PROVINCE_CODE = obj.PROVINCE_CODE.toString()
obj.OWNERUNIT_NATURE = obj.OWNERUNIT_NATURE.toString()
obj.OPERATE_DATE = moment(obj.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss')
obj.OWNERUNIT_PID = Number(obj.OWNERUNIT_PID)
obj.OWNERUNIT_ID = Number(obj.OWNERUNIT_ID)
let serverPartNumber: any = 0
let serverPartShopNumber: any = []
setFormDetail(data.Result_Data)
console.log('obj', obj);
if (obj.OrganizationList && obj.OrganizationList.length > 0) {
setTableData(obj.OrganizationList)
let res: any = []
obj.OrganizationList.forEach((item: any) => {
res.push({ label: item.AUTOTYPE_NAME, value: item.AUTOTYPE_ID })
if (item.ServerpartList && item.ServerpartList.length > 0) {
serverPartNumber += item.ServerpartList.length
item.ServerpartList.forEach((subItem: any) => {
if (subItem.ShopList && subItem.ShopList.length > 0) {
subItem.ShopList.forEach((thirdItem: any) => {
if (serverPartShopNumber.indexOf(thirdItem.SERVERPARTSHOP_ID) === -1) {
serverPartShopNumber.push(thirdItem.SERVERPARTSHOP_ID)
}
})
}
})
}
})
setPIDSelectList(res)
} else {
setPIDSelectList([])
setTableData([])
}
obj.serverPartNumber = serverPartNumber
obj.serverPartShopNumber = serverPartShopNumber && serverPartShopNumber.length > 0 ? serverPartShopNumber.length : ''
return obj
}
}}
>
<Row gutter={16}>
<Col span={8}>
<ProFormTreeSelect
label={"运营单位"}
name={"OWNERUNIT_ID"}
readonly
request={async () => {
const data = await handleGetNestingOwnerUnitList({ ShowStatus: true })
return data
}}
fieldProps={{
fieldNames: {
label: 'OWNERUNIT_NAME',
value: 'OWNERUNIT_ID',
children: 'children'
},
allowClear: true,
showSearch: true,
// treeData: treeViews
}}
/>
</Col>
<Col span={8}>
<ProFormSelect
label={"上级类别"}
name={"OWNERUNIT_PID"}
readonly
fieldProps={{
options: treeViews,
fieldNames: {
label: 'OWNERUNIT_NAME',
value: 'OWNERUNIT_ID'
}
}}
/>
</Col>
<Col span={8}>
<ProFormTreeSelect
label={"单位性质"}
name={"OWNERUNIT_NATURE"}
readonly
request={async () => {
return await getFieldEnum({
// 这里要手动添加枚举字段(从下面这些字典中选择一个):服务区内码[ServerpartIds]
FieldExplainField: 'OWNERUNIT_NATURE',
notformate: true,
});
}}
/>
</Col>
<Col span={8}>
<ProFormSelect
name="PROVINCE_CODE"
label="所属省份"
readonly
request={async () => {
return await getFieldEnum({
FieldExplainField: 'PROVINCE_CODE',
notformate: true,
});
}}
/>
</Col>
<Col span={8}>
<ProFormText
label={"客户单位"}
name={"OWNERUNIT_NAME"}
readonly
/>
</Col>
<Col span={8}>
<ProFormText
label={"客户简称"}
name={"OWNERUNIT_EN"}
readonly
/>
</Col>
<Col span={8}>
<ProFormText
label={"经营服务区"}
readonly
name={"serverPartNumber"}
/>
</Col>
<Col span={8}>
<ProFormText
label={"经营门店"}
readonly
name={"serverPartShopNumber"}
/>
</Col>
<Col span={8}>
<ProFormText
label={"配置时间"}
readonly
name={"OPERATE_DATE"}
/>
</Col>
</Row>
</ProForm>
<ProTable
actionRef={actionRef}
columns={columns}
pagination={false}
options={false}
search={false}
dataSource={tableData}
bordered
rowKey={(record) => {
return `${record?.AUTOTYPE_ID}`
}}
expandable={{
expandedRowRender: handleGetSecondColumns
}}
/>
</Drawer>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(BusinessManDetailDrawer);

View File

@ -0,0 +1,165 @@
/*
* @Author: cclu 1106109051@qq.com
* @Date: 2024-08-22 09:16:52
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2024-08-22 19:19:15
* @FilePath: \cloud-platform\src\pages\basicManage\businessMan\components\businessManDrawer.tsx
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
/*
* @Author: cclu 1106109051@qq.com
* @Date: 2024-08-22 09:16:52
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2024-08-22 09:23:09
* @FilePath: \cloud-platform\src\pages\basicManage\businessMan\components\businessManDrawer.tsx
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import { Button, Drawer, message, Popconfirm } from "antd";
import moment from 'moment'
import { handleCreateBusinessMan, handleDeleteBusinessMan } from "../service";
import { useEffect, useRef } from "react";
import SelectShop from "./selectShop";
import AddForm from "./addForm";
import '../index.less'
type DetailProps = {
showDrawer: boolean
currentRow?: any
setCurrentRow?: any
setShowDrawer: any
currentUser: any
parentRef?: any
pageType?: string
afterOk?: any
}
const BusinessManDrawer = ({ showDrawer, currentRow, setCurrentRow, setShowDrawer, currentUser, parentRef, pageType, afterOk }: DetailProps) => {
const selectShopRef = useRef<any>()
const addFormRef = useRef<any>()
// 新增客户单位的方法
const handleGetAddNew = async (obj?: any) => {
let req: any = {}
let shopList: any = selectShopRef.current?.selectId
let detail: any = addFormRef.current?.formDetail
console.log('shopList', shopList);
if (currentRow?.OWNERUNIT_ID) {
req = {
...detail,
...obj,
STAFF_ID: currentUser.ID,
STAFF_NAME: currentUser.Name,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
ShopList: shopList && shopList.length > 0 ? shopList : []
}
} else {
req = {
...obj,
OWNERUNIT_STATE: 1,
STAFF_ID: currentUser.ID,
STAFF_NAME: currentUser.Name,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
ShopList: shopList && shopList.length > 0 ? shopList : []
}
}
console.log('req', req);
const data = await handleCreateBusinessMan(req)
console.log('data', data);
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
if (parentRef) {
parentRef.current?.reload()
}
if (pageType === 'edit') {
if (afterOk) {
afterOk()
}
}
} else {
message.success(data.Result_Desc)
}
}
const handleGetShopData = async () => {
selectShopRef.current?.handleGetTreeData()
}
useEffect(() => {
if (showDrawer && !currentRow) {
selectShopRef.current?.handleGetTreeData()
}
}, [showDrawer])
return (
<div>
<Drawer
width={'60%'}
visible={showDrawer}
onClose={() => {
if (setCurrentRow) {
setCurrentRow(undefined);
}
setShowDrawer(false);
}}
title={<span style={{ fontWeight: 600 }}>{currentRow?.OWNERUNIT_ID ? '编辑客户单位' : '新增客户单位'}</span>}
className={"drawerBox"}
bodyStyle={{ backgroundColor: "#fff", padding: 16 }}
closable={false}
destroyOnClose
footer={<div style={{ width: '100%', boxSizing: 'border-box', padding: '0 16px', display: 'flex', justifyContent: 'flex-end' }}>
<Button type={"primary"} onClick={() => {
let res: any = addFormRef.current?.formRef.current?.getFieldsValue()
console.log('res', res);
handleGetAddNew(res)
}}></Button>
{
currentRow?.OWNERUNIT_ID ?
<Popconfirm
title="确认删除该商户单位管理信息吗?"
onConfirm={async () => {
const data = await handleDeleteBusinessMan({ BusinessManId: currentRow?.OWNERUNIT_ID })
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
if (parentRef) {
parentRef.current?.reload()
}
if (setCurrentRow) {
setCurrentRow(undefined);
}
setShowDrawer(false);
} else {
message.error(data.Result_Desc)
}
}}
>
<Button style={{ marginLeft: '8px' }}></Button>
</Popconfirm>
:
''
}
</div>}
>
<div className="drawerBoxContent">
{/* 编辑当行信息或新增内容 */}
<div className="rightContent">
<AddForm onRef={addFormRef} currentRow={currentRow} selectShopRef={selectShopRef} handleGetShopData={handleGetShopData} pageType={pageType} />
</div>
{/* 选择关联门店 */}
<div className="leftContent">
<SelectShop onRef={selectShopRef} onShow={showDrawer} addFormRef={addFormRef} />
</div>
</div>
</Drawer>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(BusinessManDrawer);

View File

@ -0,0 +1,20 @@
.selectShop{
width: 100%;
height: 100%;
border: 1px solid #97d6fe;
.selectShopTop{
width: 100%;
box-sizing: border-box;
padding: 8px 12px;
background-color: #e7f7ff;
}
.treeContent{
width: 100%;
height: calc(100% - 56px);
margin-top: 16px;
overflow-y: auto;
.ant-tree-treenode{
padding-bottom: 16px
}
}
}

View File

@ -0,0 +1,142 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import { useEffect, useImperativeHandle, useState } from "react";
import { Tree } from "antd";
import { DownOutlined } from "@ant-design/icons";
import './selectShop.less'
import LoadingBox from "@/pages/reports/Finance/businessAnalysis/components/loading";
import { handleGetServerpartShopTree, handleGetSPRegionShopTree } from "../service";
type DetailProps = {
onRef: any
onShow?: boolean
currentUser: any
addFormRef?: any
}
const SelectShop = ({ onRef, onShow, currentUser, addFormRef }: DetailProps) => {
const [treeData, setTreeData] = useState<any>()
const [selectId, setSelectId] = useState<any>()
const [treeLoading, setTreeLoading] = useState<boolean>(false)
// 默认选择项
const [defaultSelect,setDefaultSelect] = useState<any>()
// 拿到树形的数据
const handleGetTreeData = async (code?: any) => {
// let provinceCode =
console.log('code', code);
let req: any = {
ProvinceCode: code || currentUser?.ProvinceCode || '340000',
ShowWholePower: true,
ShowState: true
}
console.log('req', req);
setTreeLoading(true)
const data = await handleGetSPRegionShopTree(req)
console.log('data3232', data);
// let list: any = []
// if (data && data.length > 0) {
// data.forEach((item: any) => {
// let children: any = []
// if (item.children && item.children.length > 0) {
// item.children.forEach((subItem: any) => {
// children.push({ title: subItem.label, key: `2-${subItem.value}`, value: subItem.value, type: 2 })
// })
// }
// let obj: any = {
// title: item.label,
// key: `1-${item.value}`,
// value: item.value,
// children: children,
// type: 1
// }
// list.push(obj)
// })
// }
// console.log('list', list);
setTreeData(data)
setSelectId(undefined)
setTreeLoading(false)
}
// useEffect(() => {
// if (onShow) {
// handleGetTreeData()
// }
// }, [onShow])
// 赋值表单详情查到的门店选择
const handleShopSelected = (list: any)=>{
let res: any = []
let idList: any = []
if(list && list.length>0){
list.forEach((item: any)=>{
res.push({
label: '',
type: 2,
value: item.value,
key:`2-${item.value}`,
})
idList.push(`2-${item.value}`)
})
}
console.log('res',res);
console.log('idList',idList);
setDefaultSelect(idList)
setSelectId(res)
}
useImperativeHandle(onRef, () => ({
selectId,
handleGetTreeData,
handleShopSelected
}));
return (
<div className="selectShop">
<div className="selectShopTop"></div>
<div className="treeContent">
{
treeLoading ? <LoadingBox /> :
<Tree
checkable
treeData={treeData}
fieldNames={{
title: "label",
key: "key"
}}
checkedKeys={defaultSelect}
onCheck={(checkedKeys: React.Key[] | any, info) => {
console.log('checkedKeys',checkedKeys);
setDefaultSelect(checkedKeys)
const selectedIds = info.checkedNodes.filter(n => n?.type === 2)
setSelectId(selectedIds)
console.log('info', info);
console.log('selectedIds', selectedIds);
// let list: any = []
// if (selectedIds && selectedIds.length > 0) {
// selectedIds.forEach((item: any) => {
// list.push({ label: item.label, value: item.value })
// })
// }
}}
/>
}
</div>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(SelectShop);

View File

@ -0,0 +1,18 @@
.drawerBox{
.drawerBoxContent{
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.leftContent{
width: calc(50% - 16px);
height: 100%;
}
.rightContent{
width: calc(50% - 16px);
height: 100%;
overflow-y: auto;
}
}
}

View File

@ -0,0 +1,302 @@
/*
* @Author: cclu 1106109051@qq.com
* @Date: 2024-08-21 15:09:24
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2024-08-23 09:37:09
* @FilePath: \cloud-platform\src\pages\basicManage\businessMan\index.tsx
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { connect } from "umi";
import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect";
import React, { useRef, useState } from "react";
import { PlusOutlined } from "@ant-design/icons";
import { Drawer, FormInstance, Popconfirm } from "antd";
import { Button, message, Space, Spin } from "antd";
import { getFieldEnum } from "@/services/options";
import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table";
import { handleCreateBusinessMan, handleDeleteBusinessMan, handleGetNestingOwnerUnitList } from "./service";
import AddForm from "./components/addForm";
import SelectShop from "./components/selectShop";
import './index.less'
import moment from 'moment'
import BusinessManDrawer from "./components/businessManDrawer";
import BusinessManDetailDrawer from "./components/businessManDetailDrawer";
const businessMan: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props
const downloadBtnRef = useRef<any>()
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [reqDetailList, setReqDetailList] = useState<any>(); // 合计项数据源
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
const [collapsible, setCollapsible] = useState<boolean>(false)
const [treeView, setTreeView] = useState<any>()
const [printIndex, setPrintIndex] = useState<number>(new Date().getTime())
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
// 导出的加载效果
const [showLoading, setShowLoading] = useState<boolean>(false)
// 是否显示打印的表格
const [showExportTable, setShowExportTable] = useState<boolean>(false)
// 查询的条件
const [searchParams, setSearchParams] = useState<any>()
// 点击行的详情
const [currentRow, setCurrentRow] = useState<any>()
// 显示编辑的抽屉
const [showDrawer, setShowDrawer] = useState<boolean>(false)
// 显示详情抽屉
const [showDetailDrawer, setShowDetailDrawer] = useState<boolean>(false)
const columns: any = [
{
title: '商户单位',
dataIndex: 'OWNERUNIT_NAME',
hideInSearch: true,
render: (_, record) => {
return record?.OWNERUNIT_NATURE === 2000 ? <a onClick={() => {
console.log('record', record);
setCurrentRow(record)
setShowDetailDrawer(true)
}}>
{record?.OWNERUNIT_NAME || ''}
</a> : <span>{record?.OWNERUNIT_NAME}</span>
}
},
{
title: '商户性质',
dataIndex: 'OWNERUNIT_NATURE',
width: 120,
hideInSearch: true,
valueType: 'select',
align: 'center',
initialValue: 1000,
request: async () => {
const options = await getFieldEnum({ FieldExplainField: 'OWNERUNIT_NATURE' });
return options
},
},
{
title: '所在省份',
dataIndex: 'PROVINCE_CODE',
width: 120,
hideInSearch: true,
valueType: 'select',
align: 'center',
request: async () => {
const options = await getFieldEnum({ FieldExplainField: 'PROVINCE_CODE',notformate: true});
return options
},
},
{
title: '排序字段',
dataIndex: 'OWNERUNIT_INDEX',
hideInSearch: true,
align: 'center',
width: 100,
},
{
dataIndex: 'OWNERUNIT_STATE',
title: '有效状态',
width: 100,
valueType: 'select',
align: 'center',
hideInSearch: true,
request: async () => {
const options = await getFieldEnum({ FieldExplainField: 'COMMODITYSTATE' });
return options
},
},
{
dataIndex: 'option',
width: 120,
title: '操作',
align: 'center',
valueType: 'option',
hideInSearch: true,
render: (_, record) => {
return <>
{
record?.OWNERUNIT_NATURE === 2000 && record?.PROVINCE_CODE !== 0 ?
(<Space>
<a
onClick={() => {
setCurrentRow(record)
setShowDrawer(true)
}}
>
</a>
<Popconfirm
title="确认删除该商户单位管理信息吗?"
onConfirm={async () => {
handleDeleteRow(record?.OWNERUNIT_ID)
}}
>
<a></a>
</Popconfirm>
</Space>)
: ''
}
</>;
},
},
]
const exportTable = (e) => {
e.stopPropagation(); // 防止Collapse组件收起
const main = document.getElementsByClassName(`saleReportHideBox${printIndex}`)[0]
const thead = main.querySelector('thead').cloneNode(true); // 深克隆DOM节点
const tbody = main.querySelector('tbody').cloneNode(true); // 深克隆DOM节点
const container = document.querySelector('#hiddenBox');
const tempTable = document.createElement('table');
tempTable.appendChild(thead);
tempTable.appendChild(tbody);
tempTable.setAttribute('id', 'table-to-xls-businessMan'); // 给table添加id值与按钮上的table字段对应
container.appendChild(tempTable); // 把创建的节点添加到页面容器中
setShowLoading(false)
downloadBtnRef.current.handleDownload();
setShowExportTable(false)
tempTable.remove() // 防止重复打印一个内容
}
// 删除商户记录
const handleDeleteRow = async (id: any) => {
const data = await handleDeleteBusinessMan({ BusinessManId: id })
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return (
<div ref={(el) => {
// 打印报表
if (!reqDetailList || reqDetailList.length === 0) return;
setPrintOut(el);
}} >
{
showLoading ?
<div
style={{
width: '100%',
height: '100%',
background: 'rgba(0,0,0,0.1)',
position: 'fixed',
zIndex: 5,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
>
<div style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '15px 20px 10px',
background: '#fff',
borderRadius: '8px',
width: '200px'
}}>
<Spin />
<span style={{ marginLeft: '5px' }}>...</span>
</div>
</div> : ''
}
<div className={`saleReportHideBox${printIndex}`} style={{ position: 'fixed', zIndex: -1, top: 0, left: 0 }}>
{
showExportTable && reqDetailList && reqDetailList.length > 0 ?
<ProTable
columns={columns}
dataSource={reqDetailList}
pagination={false}
expandable={{
defaultExpandAllRows: true
}}
/> : ''
}
</div>
<div id='hiddenBox' style={{ position: 'fixed', zIndex: -1, top: 0, left: 0 }} />
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<div style={{
width: '100%',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
rowKey={(record) => {
return `${record?.OWNERUNIT_ID}`
}}
headerTitle={'客户单位管理列表'}
search={{ span: 6 }}
request={async (params) => {
const req: any = {
ShowStatus: true
}
setSearchParams(params)
const data = await handleGetNestingOwnerUnitList(req)
console.log('data', data);
if (data && data.length > 0) {
return { data, suceess: true }
}
return { data: [], success: true }
}}
toolbar={{
actions: [
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
setShowDrawer(true)
}}
>
</Button>
]
}}
/>
</div>
</div>
{/* 新增编辑的组件 */}
<BusinessManDrawer showDrawer={showDrawer} currentRow={currentRow} setCurrentRow={setCurrentRow} setShowDrawer={setShowDrawer} parentRef={actionRef} />
{/* 商户单位详情抽屉组件 */}
<BusinessManDetailDrawer showDetailDrawer={showDetailDrawer} setShowDetailDrawer={setShowDetailDrawer} currentRow={currentRow} setCurrentRow={setCurrentRow} parentRef={actionRef} />
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(businessMan);

View File

@ -0,0 +1,134 @@
import { wrapTreeNode } from "@/utils/format";
import request from "@/utils/request";
// 客户单位列表
export async function handleGetNestingOwnerUnitList(params: any) {
const data = await request(`/BaseInfo/GetNestingOwnerUnitList`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return wrapTreeNode(data.Result_Data.List);
}
// 客户单位编辑新增
export async function handleCreateBusinessMan(params: any) {
const data = await request(`/BusinessMan/CreateBusinessMan`, {
method: 'POST',
data: params
});
if (data.Result_Code !== 100) {
return data
}
return data;
}
// 客户单位详情
export async function handleGetBusinessManDetail(params: any) {
const data = await request(`/Merchants/GetBusinessManDetail`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return data;
}
// 没有缓存的门店列表
export async function handleGetServerpartShopTree(params: any) {
const data = await request(`/BaseInfo/GetServerpartShopTree`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return wrapTreeNode(data.Result_Data.List);
}
// 商户管理里面的选择门店的树列表
export async function handleGetSPRegionShopTree(params: any) {
const data = await request(`/BaseInfo/GetSPRegionShopTree`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return wrapTreeNode(data.Result_Data.List);
}
export async function handleDeleteBusinessMan(params: any) {
const data = await request(`/Merchants/DeleteBusinessMan`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return data;
}
// 嵌套表最外面一层的删除
export async function handleDeleteAUTOTYPE(params: any) {
const data = await request(`/BasicConfig/DeleteAUTOTYPE`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return data;
}
// 嵌套列表第二层的删除
export async function handleDeleteOWNERSERVERPART(params: any) {
const data = await request(`/BasicConfig/DeleteOWNERSERVERPART`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return data;
}
// 嵌套列表第三层的删除
export async function handleDeleteOWNERSERVERPARTSHOP(params: any) {
const data = await request(`/BasicConfig/DeleteOWNERSERVERPARTSHOP`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return data
}
return data;
}

View File

@ -0,0 +1,75 @@
/*
* @Author: zzy 411037547@qq.com
* @Date: 2022-04-28 10:47:35
* @LastEditors: zzy 411037547@qq.com
* @LastEditTime: 2022-05-16 23:03:48
* @FilePath: \cloud-platform\src\pages\basicManage\service.ts
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { tableList, wrapTreeNode } from '@/utils/format';
import request from '@/utils/request';
// 获取列表数据
export async function getBusniessBrandTree(params?: any) {
const data = await request(`/BaseInfo/GetTradeBrandTree`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return []
}
return wrapTreeNode(data.Result_Data.List);
}
// 获取经营商户
export async function getBusinessMerchatsList(params?: any) {
const data = await request(`/Merchants/GetTradeBrandMerchantsList`, {
method: 'POST',
data: { SearchParameter: { ...params }, keyWord: params.keyWord, PageIndex: params.current, pagesize: params.pageSize },
});
if (data.Result_Code !== 100) {
return [];
}
return tableList(data.Result_Data);
}
// 获取服务区门店简称
export async function handleGetShopShortNames(params?: any) {
const data = await request(`/BaseInfo/GetShopShortNames`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return []
}
return data.Result_Data.List;
}
// 获取数据变更日志
export async function handleGetChangeList(params?: any) {
const data = await request(`/Log/GetChangeList`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return []
}
return data.Result_Data.List;
}

View File

@ -1,6 +1,6 @@
import { connect } from "umi"; import { connect } from "umi";
import type { ConnectState } from "@/models/connect"; import type { ConnectState } from "@/models/connect";
import { Col, FormInstance, message, Modal, Row } from "antd"; import { Button, Col, FormInstance, message, Modal, Popconfirm, Row, Space } from "antd";
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import Draggable from "react-draggable"; import Draggable from "react-draggable";
import React from "react"; import React from "react";
@ -9,16 +9,26 @@ import moment from 'moment'
import orderIcon from '@/assets/detail/orderIcon.png' import orderIcon from '@/assets/detail/orderIcon.png'
import closeIcon from '@/assets/detail/closeIcon.png' import closeIcon from '@/assets/detail/closeIcon.png'
import ProTable from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table";
import { handeGetSALEADDRESSList, handeGetSALEBILLDetail, handeGetSALEBILLList, handeGetSALEDETAILDetail, handeGetSALEDETAILList } from "../../service"; import { PlusOutlined, DeleteOutlined } from '@ant-design/icons';
import { handeDeleteSaleBillInfo, handeGetSALEADDRESSList, handeGetSALEBILLDetail, handeGetSALEBILLList, handeGetSALEDETAILDetail, handeGetSALEDETAILList, handeModifyTrackingInfo, handeSendSaleBillGoods } from "../../service";
import './style.less' import './style.less'
interface LogisticsInfo {
id: string;
company: string;
trackingNumber: string;
}
type DetailProps = { type DetailProps = {
modalVisible: boolean //显示属性 modalVisible: boolean //显示属性
handleCloseModal: any // 关闭调用的方法 handleCloseModal: any // 关闭调用的方法
currentRow: any currentRow: any
detailType?: any // 判断是不是点餐的订单详情 可以显示不同内容 detailType?: any // 判断是不是点餐的订单详情 可以显示不同内容
showShipment?: boolean;// 判断 在待发货状态下 是否显示发货按钮
currentUser?: any // 页面公参
actionRef?: any// 父级表格实例
} }
const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailType }: DetailProps) => { const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailType, showShipment, currentUser, actionRef }: DetailProps) => {
const formRef = useRef<FormInstance>(); const formRef = useRef<FormInstance>();
const draggleRef = React.createRef<any>() const draggleRef = React.createRef<any>()
const modalRef = useRef<FormInstance>(); const modalRef = useRef<FormInstance>();
@ -29,6 +39,10 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动 const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
// 订单详情 // 订单详情
const [orderDetail, setOrderDetail] = useState<any>() const [orderDetail, setOrderDetail] = useState<any>()
// 物流信息列表
const [logisticsList, setLogisticsList] = useState<LogisticsInfo[]>([
{ id: '1', company: '', trackingNumber: '' }
])
const onDraggaleStart = (event, uiData) => { const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement; const { clientWidth, clientHeight } = window.document.documentElement;
@ -44,6 +58,44 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
}); });
}; };
// 添加物流信息
const addLogistics = () => {
const newLogistics: LogisticsInfo = {
id: Date.now().toString(),
company: '',
trackingNumber: ''
}
setLogisticsList([...logisticsList, newLogistics])
}
// 删除物流信息
const removeLogistics = (id: string) => {
if (logisticsList.length > 1) {
const newList = logisticsList.filter(item => item.id !== id)
setLogisticsList(newList)
} else {
message.warning('至少保留一组物流信息')
}
}
// 更新物流信息
const updateLogistics = (id: string, field: 'company' | 'trackingNumber', value: string) => {
const newList = logisticsList.map((item: LogisticsInfo) => {
if (item.id === id) {
return { ...item, [field]: value }
}
return item
})
setLogisticsList(newList)
}
// 获取物流信息数据
const getLogisticsData = () => {
return logisticsList.filter(logistics =>
logistics.company.trim() && logistics.trackingNumber.trim()
)
}
// 订单详情的表格 // 订单详情的表格
const orderDetailColumns: any = [ const orderDetailColumns: any = [
{ {
@ -97,6 +149,148 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
}, },
] ]
// 商品发货
const handleProductDelivery = async () => {
console.log('logisticsList', logisticsList);
let isOk: boolean = false
let str: string = ''
if (currentRow?.TAKE_TYPE === 1000) {
isOk = true
} else {
if (logisticsList && logisticsList.length > 0) {
// 判断是否都是有值的
let isAllHave: boolean = true
logisticsList.forEach((item: any) => {
if (!item.trackingNumber || !item.company) {
isAllHave = false
}
if (str) {
str += `,${item.trackingNumber}|${item.company}`
} else {
str = `${item.trackingNumber}|${item.company}`
}
})
if (!isAllHave) {
message.error('请先输入物流公司和快递单号!')
return
} else {
isOk = true
}
} else {
message.error('请先输入物流公司和快递单号!')
return
}
}
if (!isOk) {
return
}
const req: any = {
SaleBillChildId: currentRow?.SALEBILL_CHILD_ID,
SaleBillId: currentRow?.SALEBILL_ID,
TrackingInfo: str || ""
}
console.log('reqreq', req);
const data = await handeSendSaleBillGoods(req)
if (data.Result_Code === 100) {
message.success('发货成功!')
handleConfirmLoading(false)
if (handleCloseModal) {
handleCloseModal()
}
formRef.current?.resetFields();
setLogisticsList([{ id: '1', company: '', trackingNumber: '' }]);
if (actionRef) {
actionRef.current?.reload()
}
} else {
message.error(data.Result_Desc)
}
}
// 订单删除
const handleGetDeleteOrder = async () => {
const req: any = {
SaleBillChildId: currentRow?.SALEBILL_CHILD_ID || "",
SaleBillId: currentRow?.SALEBILL_ID,
}
const data = await handeDeleteSaleBillInfo(req)
if (data.Result_Code === 100) {
message.success('删除成功!')
handleConfirmLoading(false)
if (handleCloseModal) {
handleCloseModal()
}
formRef.current?.resetFields();
setLogisticsList([{ id: '1', company: '', trackingNumber: '' }]);
if (actionRef) {
actionRef.current?.reload()
}
} else {
message.error(data.Result_Desc)
}
}
// 更新物流信息
const handleUpdateLogisticsInformation = async () => {
console.log('logisticsList', logisticsList);
let isOk: boolean = false
let str: string = ''
if (currentRow?.TAKE_TYPE === 1000) {
isOk = true
} else {
if (logisticsList && logisticsList.length > 0) {
// 判断是否都是有值的
let isAllHave: boolean = true
logisticsList.forEach((item: any) => {
if (!item.trackingNumber || !item.company) {
isAllHave = false
}
if (str) {
str += `,${item.trackingNumber}|${item.company}`
} else {
str = `${item.trackingNumber}|${item.company}`
}
})
if (!isAllHave) {
message.error('请先输入物流公司和快递单号!')
return
} else {
isOk = true
}
} else {
message.error('请先输入物流公司和快递单号!')
return
}
}
if (!isOk) {
return
}
const req: any = {
SaleBillChildId: currentRow?.SALEBILL_CHILD_ID,
SaleBillId: currentRow?.SALEBILL_ID,
TrackingInfo: str || ""
}
const data = await handeModifyTrackingInfo(req)
if (data.Result_Code === 100) {
message.success('更新成功!')
handleConfirmLoading(false)
if (handleCloseModal) {
handleCloseModal()
}
formRef.current?.resetFields();
setLogisticsList([{ id: '1', company: '', trackingNumber: '' }]);
if (actionRef) {
actionRef.current?.reload()
}
} else {
message.error(data.Result_Desc)
}
}
return ( return (
<div> <div>
<Modal <Modal
@ -113,6 +307,7 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
confirmLoading={confirmLoading} confirmLoading={confirmLoading}
afterClose={() => { afterClose={() => {
formRef.current?.resetFields(); formRef.current?.resetFields();
setLogisticsList([{ id: '1', company: '', trackingNumber: '' }]);
// setCurrentRow(undefined); // setCurrentRow(undefined);
}} }}
onCancel={() => { onCancel={() => {
@ -123,7 +318,48 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
// handleModalVisible(false) // handleModalVisible(false)
// setCurrentRow(undefined); // setCurrentRow(undefined);
}} }}
footer={false} footer={showShipment ?
<div style={{ width: "100%", display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div>
{
currentUser?.UserPattern === 9000 ?
<Popconfirm
title={'确认删除订单?'}
onConfirm={async () => {
await handleGetDeleteOrder()
}}
>
<Button type={'primary'} danger></Button>
</Popconfirm> : ""
}
</div>
<div>
{
currentRow?.SALEBILL_STATE > 1020 && currentRow?.SALEBILL_STATE < 3000 ?
<Popconfirm
title={'确认更新物流信息?'}
onConfirm={async () => {
await handleUpdateLogisticsInformation()
}}
>
<Button type="primary"></Button>
</Popconfirm> :
currentRow?.SALEBILL_STATE === 1020 ?
<Popconfirm
title={'确认发货?'}
onConfirm={async () => {
await handleProductDelivery()
}}
>
<Button type="primary"></Button>
</Popconfirm> : ''
}
</div>
</div>
: false}
modalRender={(modal) => { modalRender={(modal) => {
return <Draggable return <Draggable
disabled={disabled} disabled={disabled}
@ -157,6 +393,26 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
console.log('dasdas44444', addressData); console.log('dasdas44444', addressData);
let addressObj: any = addressData[0] let addressObj: any = addressData[0]
// 物流公司和快递单号的回显
if (currentRow?.TABLE_NUMBER) {
let list: any = currentRow?.TABLE_NUMBER.split(',')
let res: any = []
if (list && list.length > 0) {
list.forEach((item: any, index: number) => {
res.push({
id: index + 1,
company: item.split('|')[1],
trackingNumber: item.split('|')[0],
})
})
}
if (res && res.length > 0) {
setLogisticsList(res)
} else {
setLogisticsList([{ id: '1', company: '', trackingNumber: '' }]);
}
}
return { return {
...data, ...data,
ORDER_PERSON: addressObj?.USER_NAME || "", ORDER_PERSON: addressObj?.USER_NAME || "",
@ -468,6 +724,90 @@ const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow, detailTy
/> />
</Col> </Col>
{
showShipment ?
<>
<Col span={24} className="memberInfoDetailItem">
<div style={{ marginBottom: '16px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '12px' }}>
<span style={{ fontWeight: 'bold', fontSize: '14px' }}></span>
<Button
type="dashed"
icon={<PlusOutlined />}
size="small"
onClick={addLogistics}
style={{ borderStyle: 'dashed' }}
>
</Button>
</div>
{logisticsList.map((logistics, index) => (
<div key={logistics.id} style={{ marginBottom: '12px', padding: '12px', border: '1px solid #d9d9d9', borderRadius: '6px', backgroundColor: '#fafafa' }}>
<Row gutter={8} align="middle">
<Col span={1}>
<span style={{ fontWeight: 'bold', color: '#666' }}>{index + 1}.</span>
</Col>
<Col span={8}>
<div style={{ marginBottom: '8px' }}>
<label style={{ color: '#666', fontSize: '14px', marginBottom: '4px', display: 'block' }}>
</label>
<input
type="text"
placeholder="请输入物流公司"
value={logistics.company}
onChange={(e) => updateLogistics(logistics.id, 'company', e.target.value)}
style={{
width: '100%',
padding: '4px 11px',
border: '1px solid #d9d9d9',
borderRadius: '6px',
fontSize: '14px'
}}
/>
</div>
</Col>
<Col span={8}>
<div style={{ marginBottom: '8px' }}>
<label style={{ color: '#666', fontSize: '14px', marginBottom: '4px', display: 'block' }}>
</label>
<input
type="text"
placeholder="请输入快递单号"
value={logistics.trackingNumber}
onChange={(e) => updateLogistics(logistics.id, 'trackingNumber', e.target.value)}
style={{
width: '100%',
padding: '4px 11px',
border: '1px solid #d9d9d9',
borderRadius: '6px',
fontSize: '14px'
}}
/>
</div>
</Col>
<Col span={6}>
<Button
type="text"
danger
icon={<DeleteOutlined />}
onClick={() => removeLogistics(logistics.id)}
style={{ marginTop: '24px' }}
disabled={logisticsList.length === 1}
>
</Button>
</Col>
</Row>
</div>
))}
</div>
</Col>
</> : ""
}
</Row> </Row>
</div> </div>
</ProForm> </ProForm>

View File

@ -31,6 +31,7 @@
background-color: #fff; background-color: #fff;
border-top-left-radius: 16px; border-top-left-radius: 16px;
border-top-right-radius: 16px; border-top-right-radius: 16px;
z-index: 999;
.modalTopLeft { .modalTopLeft {
display: flex; display: flex;

View File

@ -83,7 +83,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
} }
}, },
// initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')], // initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
initialValue: [moment().startOf('M'), moment()], initialValue: [moment(moment().subtract(1, 'd')).startOf('M'), moment()],
}, },
{ {
title: "订单状态", title: "订单状态",
@ -100,7 +100,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
"9000": "订单已关闭", "9000": "订单已关闭",
"9999": "订单已撤销" "9999": "订单已撤销"
}, },
initialValue: '0', initialValue: '1010',
hideInTable: true, hideInTable: true,
}, },
{ {
@ -545,7 +545,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser, isComponent?: boolea
</div> </div>
</div> </div>
<OrderDetailModal modalVisible={modalVisible} handleCloseModal={handleCloseModal} currentRow={currentRow} /> <OrderDetailModal modalVisible={modalVisible} handleCloseModal={handleCloseModal} currentRow={currentRow} showShipment={true} currentUser={currentUser} actionRef={actionRef} />
{/* <Modal {/* <Modal
className="MallOrderManageModal" className="MallOrderManageModal"

View File

@ -3,12 +3,12 @@ import { connect } from "umi";
import type { CurrentUser } from "umi"; import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect"; import type { ConnectState } from "@/models/connect";
import React, { useRef, useState } from "react"; import React, { useRef, useState } from "react";
import { Col, Modal, Row, type FormInstance } from "antd"; import { Button, Col, message, Modal, Popconfirm, Row, type FormInstance } from "antd";
import type { ActionType } from "@ant-design/pro-table"; import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table";
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
import moment from 'moment' import moment from 'moment'
import { handeGetSALEBILLList, handeGetSaleBillWholeList, handeGetSALEDETAILList } from "../service"; import { handeGetSALEBILLList, handeGetSaleBillWholeList, handeGetSALEDETAILList, handeWeChatRefundApply, handeWeRevokeRefundApply } from "../service";
import Draggable from "react-draggable"; import Draggable from "react-draggable";
import ProForm, { ProFormSelect, ProFormText } from "@ant-design/pro-form"; import ProForm, { ProFormSelect, ProFormText } from "@ant-design/pro-form";
import orderIcon from '@/assets/detail/orderIcon.png' import orderIcon from '@/assets/detail/orderIcon.png'
@ -81,7 +81,7 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
} }
}, },
// initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')], // initialValue: [moment().add(-1, 'M').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
initialValue: [moment().startOf('M'), moment()], initialValue: [moment(moment().subtract(1, 'd')).startOf('M'), moment()],
}, },
{ {
title: "订单状态", title: "订单状态",
@ -266,6 +266,57 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
setCurrentRow(undefined); setCurrentRow(undefined);
} }
// // 删除订单
// const handleGetDeleteOrder = async () => {
// }
// 同意退款
const handleGetAgreeToRefund = async () => {
console.log('currentRowcurrentRowcurrentRow', currentRow);
const req: any = {
mchid: "1672298991",
serial_no: "5BA7C0F427FC042DB5BF299E35B373D5EFCECD35",
mobileOrderCode: "",
saleBillCode: currentRow?.TABLE_NUMBER,
refundBillCode: currentRow?.SALEBILL_CODE,
refundReason: currentRow?.SALEBILL_DESC || "",
orderAmount: currentRow?.PAY_AMOUNT,
refundAmount: currentRow?.PAY_AMOUNT,
provinceCode: "530000"
}
console.log('reqreq', req);
const data = await handeWeChatRefundApply(req)
if (data.Result_Code === 100) {
message.success('退款成功!')
handleConfirmLoading(false)
handleModalVisible(false)
setCurrentRow(undefined);
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
// 撤销退款
const handleGetCancelRefund = async () => {
console.log('currentRowcurrentRowcurrentRow', currentRow);
const req: any = {
SaleBillChildId: "",
SaleBillId: currentRow?.SALEBILL_ID,
TrackingInfo: ""
}
const data = await handeWeRevokeRefundApply(req)
if (data.Result_Code === 100) {
message.success('撤销成功!')
handleConfirmLoading(false)
handleModalVisible(false)
setCurrentRow(undefined);
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return ( return (
<div> <div>
@ -367,7 +418,42 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
handleModalVisible(false) handleModalVisible(false)
setCurrentRow(undefined); setCurrentRow(undefined);
}} }}
footer={false} footer={<div>
{/* style={{ width: "100%", display: 'flex', alignItems: 'center', justifyContent: 'space-between' }} */}
{/* <div>
{
currentUser?.UserPattern === 9000 ?
<Popconfirm
title={'确认删除订单?'}
onConfirm={async () => {
await handleGetDeleteOrder()
}}
>
<Button type={'primary'} danger></Button>
</Popconfirm> : ""
}
</div> */}
<div>
<Popconfirm
title={'是否撤销退款?'}
onConfirm={async () => {
await handleGetCancelRefund()
}}
>
<Button danger>退</Button>
</Popconfirm>
<Popconfirm
title={'是否同意退款?'}
onConfirm={async () => {
await handleGetAgreeToRefund()
}}
>
<Button type={'primary'}>退</Button>
</Popconfirm>
</div>
</div>}
modalRender={(modal) => { modalRender={(modal) => {
return <Draggable return <Draggable
disabled={disabled} disabled={disabled}
@ -522,7 +608,7 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
]} ]}
/> />
</Col> </Col>
<Col span={8} className="memberInfoDetailItem"> {/* <Col span={8} className="memberInfoDetailItem">
<ProFormSelect <ProFormSelect
name={"TAKE_TYPE"} name={"TAKE_TYPE"}
label={"取餐方式"} label={"取餐方式"}
@ -533,8 +619,8 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
{ label: "预约", value: 2000 }, { label: "预约", value: 2000 },
]} ]}
/> />
</Col> </Col> */}
<Col span={8} className="memberInfoDetailItem"> {/* <Col span={8} className="memberInfoDetailItem">
<ProFormSelect <ProFormSelect
name={"PACK_TYPE"} name={"PACK_TYPE"}
label={"就餐方式"} label={"就餐方式"}
@ -553,7 +639,7 @@ const OrderAfterSalesManage: React.FC<{ currentUser: CurrentUser }> = (props) =>
readonly readonly
style={{ marginBottom: '16px' }} style={{ marginBottom: '16px' }}
/> />
</Col> </Col> */}
</Row> </Row>
</div> </div>
</ProForm> </ProForm>

View File

@ -24,7 +24,7 @@ import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚
import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用 import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用
import PageTitleBox from "@/components/PageTitleBox"; import PageTitleBox from "@/components/PageTitleBox";
import LeftSelectMallType from './component/LeftSelectMallType'; import LeftSelectMallType from './component/LeftSelectMallType';
import { handeDeleteCOMMODITY, handeDeleteRTCOMMODITY_MULTI, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeGetMERCHANTSList, handeGetRTCOMMODITY_MULTIList, handeSetCommodityState, handeSynchroCOMMODITY, handeSynchroRTCOMMODITYMULTIList, handleGetBRANDList, handlGetUSERDEFINEDTYPEList } from '../service'; import { handeDeleteCOMMODITY, handeDeleteRTCOMMODITY_MULTI, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeGetMERCHANTSList, handeGetRTCOMMODITY_MULTIList, handeSetCommodityState, handeSetGoodsDutyParagraph, handeSynchroCOMMODITY, handeSynchroRTCOMMODITYMULTIList, handleGetBRANDList, handlGetUSERDEFINEDTYPEList } from '../service';
import session from '@/utils/session'; import session from '@/utils/session';
import { deleteAHYDPicture, deletePicture, uploadAHYDPicture, uploadPicture } from '@/services/picture'; import { deleteAHYDPicture, deletePicture, uploadAHYDPicture, uploadPicture } from '@/services/picture';
import { handleSetlogSave } from '@/utils/format'; import { handleSetlogSave } from '@/utils/format';
@ -49,6 +49,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
const { confirm } = Modal; const { confirm } = Modal;
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const ruleActionRef = useRef<ActionType>(); const ruleActionRef = useRef<ActionType>();
// 税率的表单
const rateFormRef = useRef<FormInstance>();
const formRef = useRef<FormInstance>(); const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>(); const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>(); const [showDetail, setShowDetail] = useState<boolean>();
@ -103,6 +105,10 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
const [toListLoading, setToListLoading] = useState<boolean>(false) const [toListLoading, setToListLoading] = useState<boolean>(false)
// 当前查询的文字 // 当前查询的文字
const [currentSearchText, setCurrentSearchText] = useState<string>('') const [currentSearchText, setCurrentSearchText] = useState<string>('')
// 税率悬浮框
const [showRateModal, setShowRateModal] = useState<boolean>(false)
// 税率悬浮框的加载效果
const [rateLoading, setRateLoading] = useState<boolean>(false)
// 预览上传后的图片 // 预览上传后的图片
const handlePreview = async (type: number) => { const handlePreview = async (type: number) => {
@ -682,6 +688,16 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
} }
} }
// 设置税率
const handleSetTaxRate = async () => {
if (selectShopRowKey && selectShopRowKey.length > 0) {
console.log('selectShopRowKeyselectShopRowKeyselectShopRowKey', selectShopRowKey);
setShowRateModal(true)
} else {
message.error('请先选择商品!')
}
}
return ( return (
<div> <div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}> <div style={{ backgroundColor: '#fff', display: 'flex' }}>
@ -752,6 +768,18 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
</Button>, </Button>,
<Button <Button
type="primary"
onClick={() => {
handleSetTaxRate()
}}
>
</Button>,
<>
{
currentUser?.UserPattern !== 4000 ?
<>
< Button
key="new" key="new"
type="primary" type="primary"
loading={toListLoading} loading={toListLoading}
@ -760,7 +788,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
}} }}
> >
</Button>, </Button>
<Button <Button
key="new" key="new"
type="primary" type="primary"
@ -771,6 +799,9 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
> >
</Button> </Button>
</> : ""
}
</>
], ],
}} }}
pagination={{ defaultPageSize: 10 }} pagination={{ defaultPageSize: 10 }}
@ -1148,7 +1179,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
message: "请选择供货商户" message: "请选择供货商户"
} }
]} ]}
disabled={currentUser?.UserPattern === 4000}
initialValue={currentUser?.UserPattern === 4000 ? currentUser?.SupplierName : ''}
/> />
</Col> </Col>
<Divider orientation="left"></Divider> <Divider orientation="left"></Divider>
@ -1360,6 +1392,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
message: "请输入小程序!" message: "请输入小程序!"
} }
]} ]}
disabled={currentUser?.UserPattern === 4000 ? true : false}
initialValue={currentUser?.UserPattern === 4000 ? 38 : ''}
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
@ -1376,7 +1410,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
{ label: "未上架", value: 0 }, { label: "未上架", value: 0 },
{ label: "已上架", value: 1 }, { label: "已上架", value: 1 },
]} ]}
disabled={currentUser?.SupplierID ? true : false} disabled={currentUser?.SupplierID || currentUser?.UserPattern === 4000 ? true : false}
/> />
</Col> </Col>
<Col span={6}> <Col span={6}>
@ -1768,6 +1802,63 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
</Modal> </Modal>
{/* 税率悬浮框 */}
<Modal
title={"设置税率"}
destroyOnClose={true}
width={600}
visible={showRateModal}
confirmLoading={rateLoading}
onCancel={() => {
setShowRateModal(false)
}}
onOk={async () => { // 提交框内的数据
rateFormRef.current?.validateFields().then(res => {
rateFormRef.current?.submit()
})
}}
>
<ProForm
formRef={rateFormRef}
submitter={false}
onFinish={async (value: any) => {
const req: any = {
CommodityIds: selectShopRowKey.toString(),
DutyParagraph: value.selectRate
}
setRateLoading(true)
const data = await handeSetGoodsDutyParagraph(req)
setRateLoading(false)
if (data.Result_Code === 100) {
message.success('设置成功!')
setShowRateModal(false)
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}}
>
<ProFormSelect
label={"选择税率"}
name={'selectRate'}
rules={[
{
required: true,
message: '请选择税率!'
}
]}
fieldProps={{
options: DUTYPARAGRAPHList
}}
/>
</ProForm>
</Modal>
</div> </div>
</div> </div>
); );

View File

@ -1284,3 +1284,78 @@ export async function handeDeleteSERVERPARTSELLER(params: any) {
} }
return data return data
} }
// 微信支付退款申请
export async function handeWeChatRefundApply(params: any) {
const data = await requestEncryption(`/WeChatPay/WeChatRefundApply`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return data
}
return data
}
// 微信支付撤销退款申请
export async function handeWeRevokeRefundApply(params: any) {
const data = await requestEncryption(`/WeChatPay/RevokeRefundApply`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return data
}
return data
}
// 订单发货
export async function handeSendSaleBillGoods(params: any) {
const data = await requestEncryption(`/OnlineOrder/SendSaleBillGoods`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return data
}
return data
}
// 更新物流信息
export async function handeModifyTrackingInfo(params: any) {
const data = await requestEncryption(`/OnlineOrder/ModifyTrackingInfo`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return data
}
return data
}
// 删除订单信息
export async function handeDeleteSaleBillInfo(params: any) {
const data = await requestEncryption(`/OnlineOrder/DeleteSaleBillInfo`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return data
}
return data
}
// 设置商品税率
export async function handeSetGoodsDutyParagraph(params: any) {
const data = await requestEncryption(`/MallBasic/SetGoodsDutyParagraph`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return data
}
return data
}

View File

@ -1,4 +1,4 @@
// 由 scripts/writeVersion.js 自动生成 // 由 scripts/writeVersion.js 自动生成
export const VERSION = "4.5.65"; export const VERSION = "4.5.66";
export const GIT_HASH = "cc91234"; export const GIT_HASH = "4be0bb5";
export const BUILD_TIME = "2025-10-31T09:52:44.987Z"; export const BUILD_TIME = "2025-11-01T07:07:35.002Z";