This commit is contained in:
ylj20011123 2025-07-11 21:09:14 +08:00
parent f59a57b41b
commit 59c2d7d5bd
35 changed files with 6102 additions and 724 deletions

View File

@ -29,8 +29,9 @@ import IconFont from '@/components/IconFont';
import type { CurrentUser } from '@/models/user'
import session from '@/utils/session';
import upMenu from '@/assets/tab/upMenu.svg'
import { getFieldEnum, getFieldEnumTree, getFieldGetFieEnumList, getTravelFieldEnumTree, handleGetFieldEnumTreeTravel } from "@/services/options";
import { getFieldEnum, getFieldEnumTravel, getFieldEnumTree, getFieldGetFieEnumList, getTravelFieldEnumTree, handleGetFieldEnumTreeTravel, handleGetNestingFIELDENUMList } from "@/services/options";
import { handleGetServerpartTree } from '@/pages/basicManage/serverpartAssets/service';
import { handeGetNestingFIELDENUMList } from '@/pages/travelMember/service';
const { TabPane } = Tabs;
@ -205,6 +206,84 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
// 拿到所有枚举的方法
const handleGetAllFieldEnum = async () => {
// 云南会员类型枚举
getFieldEnumTravel({ FieldExplainField: 'MEMBERSHIP_TYPE', FieldEnumStatus: 1 }).then((MEMBERSHIPTYPEYN: any) => {
if (MEMBERSHIPTYPEYN && MEMBERSHIPTYPEYN.length > 0) {
const obj: any = {}
const list: any = []
MEMBERSHIPTYPEYN.forEach((item: any) => {
list.push({ label: item.label, value: item.value })
obj[item.value] = item.label
})
session.set('MEMBERSHIPTYPEYNList', list);
session.set('MEMBERSHIPTYPEYNObj', obj);
session.set('MEMBERSHIPTYPEYNTree', MEMBERSHIPTYPEYN);
}
})
// 云南的会员等级枚举
handeGetNestingFIELDENUMList({
FIELDEXPLAIN_FIELD: 'MEMBERSHIP_LEVEL_YN',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}).then((MEMBERSHIPLEVELYN: any) => {
if (MEMBERSHIPLEVELYN && MEMBERSHIPLEVELYN.length > 0) {
const obj: any = {}
const list: any = []
MEMBERSHIPLEVELYN.forEach((item: any) => {
list.push({ label: item.FIELDENUM_NAME, value: item.FIELDENUM_VALUE })
obj[item.FIELDENUM_VALUE] = item.FIELDENUM_NAME
})
session.set('MEMBERSHIPLEVELYNList', list);
session.set('MEMBERSHIPLEVELYNObj', obj);
session.set('MEMBERSHIPLEVELYNTree', MEMBERSHIPLEVELYN);
}
})
// 云南的会员积分枚举
handeGetNestingFIELDENUMList({
FIELDEXPLAIN_FIELD: 'POINT_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}).then((POINTTYPE: any) => {
if (POINTTYPE && POINTTYPE.length > 0) {
const obj: any = {}
const list: any = []
POINTTYPE.forEach((item: any) => {
list.push({ label: item.FIELDENUM_NAME, value: item.FIELDENUM_VALUE })
obj[item.FIELDENUM_VALUE] = item.FIELDENUM_NAME
})
session.set('POINTTYPEList', list);
session.set('POINTTYPEObj', obj);
session.set('POINTTYPETree', POINTTYPE);
}
})
// 云南的会员成长值枚举
handeGetNestingFIELDENUMList({
FIELDEXPLAIN_FIELD: 'GROWTH_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}).then((GROWTHTYPE: any) => {
if (GROWTHTYPE && GROWTHTYPE.length > 0) {
const obj: any = {}
const list: any = []
GROWTHTYPE.forEach((item: any) => {
list.push({ label: item.FIELDENUM_NAME, value: item.FIELDENUM_VALUE })
obj[item.FIELDENUM_VALUE] = item.FIELDENUM_NAME
})
session.set('GROWTHTYPEList', list);
session.set('GROWTHTYPEObj', obj);
session.set('GROWTHTYPETree', GROWTHTYPE);
}
})
// 云南门店业态
handleGetFieldEnumTreeTravel({ FieldExplainField: 'BUSINESS_TRADE', FieldEnumStatus: false }).then((BUSINESSTRADEYN: any) => {
if (BUSINESSTRADEYN && BUSINESSTRADEYN.length > 0) {
@ -388,6 +467,8 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
}
})
// 会员类型的枚举
// const MEMBERSHIPTYPE =
getFieldEnumTree({ FieldExplainField: 'MEMBERSHIP_TYPE' }).then((MEMBERSHIPTYPE: any) => {

View File

@ -25,6 +25,9 @@ import session from '@/utils/session';
import PageTitleBox from '@/components/PageTitleBox';
import { handeGetCOMMENTList, handeGetPictureList, handeGetRevenueReport } from '@/pages/travelMember/service';
import { deletePicture, uploadPicture } from '@/services/picture';
import { handleGetServerPartShopNewList } from '@/pages/basicManage/serviceArea/service';
import { handleGetServerpartShopList } from '@/pages/DataVerification/service';
import ModalFooter from '@/pages/travelMember/scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
@ -133,7 +136,10 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
hideInSearch: true,
ellipsis: true,
render: (_, record) => {
return record?.SELLER_NAME ? `${record?.SERVERPART_NAME || ""}${record?.SELLER_NAME}` : "-"
return record?.SELLER_NAME ? <a onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}>{`${record?.SERVERPART_NAME || ""}${record?.SELLER_NAME}`}</a> : "-"
}
},
{
@ -279,38 +285,38 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'option',
title: '操作',
valueType: 'option',
width: 120,
align: 'center',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
console.log('recordrecordrecordrecord', record);
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该服务区商家信息列表信息吗?"
onConfirm={async () => {
await handelDelete(record.SELLER_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
// {
// dataIndex: 'option',
// title: '操作',
// valueType: 'option',
// width: 120,
// align: 'center',
// fixed: 'right',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// console.log('recordrecordrecordrecord', record);
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该服务区商家信息列表信息吗?"
// onConfirm={async () => {
// await handelDelete(record.SELLER_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 关联商家的表格
@ -340,45 +346,46 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
valueType: "select",
valueEnum: shopregionObj
},
{
dataIndex: 'SCANCODE_ORDER',
title: '扫码点餐',
align: 'center',
width: 120,
hideInSearch: true,
valueType: "select",
valueEnum: {
"0": "禁用",
"1": "启用"
}
},
// {
// dataIndex: 'SCANCODE_ORDER',
// title: '扫码点餐',
// align: 'center',
// width: 120,
// hideInSearch: true,
// valueType: "select",
// valueEnum: {
// "0": "禁用",
// "1": "启用"
// }
// },
{
dataIndex: 'BUSINESS_STATE',
title: '经营状态',
align: 'center',
width: 120,
valueType: "select",
hideInSearch: true,
valueEnum: businessStateObj
},
{
dataIndex: 'SHOPDIRECTION',
title: '门店方向',
align: 'center',
width: 120,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'ISVALID',
title: '门店状态',
align: 'center',
width: 120,
valueEnum: {
"0": "无效",
"1": "有效"
},
initialValue: "1"
},
// {
// dataIndex: 'SHOPDIRECTION',
// title: '门店方向',
// align: 'center',
// width: 120,
// ellipsis: true,
// hideInSearch: true,
// },
// {
// dataIndex: 'ISVALID',
// title: '门店状态',
// align: 'center',
// width: 120,
// valueEnum: {
// "0": "无效",
// "1": "有效"
// },
// initialValue: "1"
// },
{
dataIndex: 'SERVERPARTSHOP_DESC',
title: '介绍说明',
@ -466,25 +473,25 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
width: 150,
align: 'center'
},
{
title: "操作",
dataIndex: "option",
width: 120,
align: 'center',
render: (_, record) => {
return <Space>
<Popconfirm
title="确认解除关联?"
onConfirm={async () => {
await handleRemoveSeller(record)
}}
>
<a></a>
</Popconfirm>
// {
// title: "操作",
// dataIndex: "option",
// width: 120,
// align: 'center',
// render: (_, record) => {
// return <Space>
// <Popconfirm
// title="确认解除关联?"
// onConfirm={async () => {
// await handleRemoveSeller(record)
// }}
// >
// <a>解除关联</a>
// </Popconfirm>
</Space>
}
}
// </Space>
// }
// }
]
// 评论信息表格
@ -581,6 +588,11 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
} else {
message.success('删除成功!');
actionRef.current?.reload()
setShowAddModal(false)
setSelectRowKeys(null)
setSelectRowDetail(null)
setSelectAssociationServerpart(null)
}
};
@ -740,8 +752,8 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
setRevenueLoading(false)
console.log('datadata', data);
if (data && data.length > 0) {
message.success('获取成功!')
let obj: any = data[0]
formRef.current?.setFieldsValue({
MONTHLYSALES: obj.TotalRevenue.Ticket_Count || "0",
CASHPAY: obj.TotalRevenue.Revenue_Amount || "0",
@ -766,6 +778,106 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
};
// 新增的确认按钮的方法
const handleModalOk = async () => {
// 判断是新增 还是关联 看看有没有 SELLER_ID 有就是关联 没有就是新增
if (currentRow?.SELLER_ID) {
if (!(selectedRowKeys && selectedRowKeys.length > 0)) {
message.error('请选择要关联的门店!')
return
}
// 关联 接口
const req: any = {
SellerId: currentRow?.SELLER_ID,
ShopIds: selectedRowKeys.toString()
}
const data = await handleGetRelateShopToSeller(req)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
setShowAddModal(false)
setSelectRowKeys(null)
setSelectRowDetail(null)
// formRef.current?.resetFields()
handleGetMemberDetail()
setSelectAssociationServerpart(null)
} else {
message.error(data.Result_Desc)
}
} else {
if (!(selectedRowKeys && selectedRowKeys.length > 0)) {
setShowAddModal(false)
setSelectRowKeys(null)
setSelectRowDetail(null)
setSelectAssociationServerpart(null)
} else {
console.log('selectedRowDetailselectedRowDetailselectedRowDetailselectedRowDetail', selectedRowDetail);
// 必须要是同一商户的 才能进去
let sellIdList: any = []
let SHOPTRADEList: any = []
let serverpartList: any = []
let SERVERPARTSHOP_IDS: string = ''
selectedRowDetail.forEach((item: any) => {
if (sellIdList.indexOf(item.SELLER_ID) === -1) {
sellIdList.push(item.SELLER_ID)
}
if (SHOPTRADEList.indexOf(item.SHOPTRADE) === -1) {
SHOPTRADEList.push(item.SHOPTRADE)
}
if (serverpartList.indexOf(item.SERVERPART_ID) === -1) {
serverpartList.push(item.SERVERPART_ID)
}
if (item.SERVERPARTSHOP_ID) {
if (SERVERPARTSHOP_IDS) {
SERVERPARTSHOP_IDS += `,${item.SERVERPARTSHOP_ID}`
} else {
SERVERPARTSHOP_IDS = `${item.SERVERPARTSHOP_ID}`
}
}
})
console.log('sellIdListsellIdListsellIdList', sellIdList);
console.log('SHOPTRADEListSHOPTRADEListSHOPTRADEList', SHOPTRADEList);
if (sellIdList && sellIdList.length > 1) {
message.error("仅支持选择一个商家!")
return
}
if (SHOPTRADEList && SHOPTRADEList.length > 1) {
message.error("仅支持选择一种业态!")
return
}
if (serverpartList && serverpartList.length > 1) {
message.error("仅支持选择一个服务区!")
return
}
let obj: any = selectedRowDetail[0]
// 调用商家详情
const req: any = {
SERVERPARTSELLERId: sellIdList[0]
}
const detail: any = await handleGetSERVERPARTSELLERDetail(req)
setShowAddModal(false)
setSelectRowKeys(null)
setSelectRowDetail(null)
setSelectAssociationServerpart(null)
setCurrentShopData(selectedRowDetail)
setCurrentRow({
...detail,
SHOPTRADE: obj.SHOPTRADE,
SERVERPART_ID: Number(obj.SERVERPART_ID),
SERVERPARTSHOP_IDS: SERVERPARTSHOP_IDS,
SERVERPART_NAME: obj.SERVERPART_NAME
})
handleModalVisible(true)
}
}
}
return (
<div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
@ -819,8 +931,8 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
icon={<PlusOutlined />}
type="primary"
onClick={() => {
// setShowAddModal(true)
handleModalVisible(true);
setShowAddModal(true)
// handleModalVisible(true);
}}
>
@ -867,39 +979,38 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
<Modal
title={'新建服务区商家信息'}
destroyOnClose
width={'75%'}
width={1200}
visible={showAddModal}
afterClose={() => {
}}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
onCancel={() => {
setShowAddModal(false)
setSelectRowKeys(null)
setSelectRowDetail(null)
setSelectAssociationServerpart(null)
}}
okText={"关联"}
okText={currentRow?.SELLER_ID ? "关联" : "确认"}
onOk={async () => { // 提交框内的数据
if (!(selectedRowKeys && selectedRowKeys.length > 0)) {
message.error('请选择要关联的门店!')
return
}
// 关联 接口
const req: any = {
SellerId: currentRow?.SELLER_ID,
ShopIds: selectedRowKeys.toString()
}
const data = await handleGetRelateShopToSeller(req)
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
setShowAddModal(false)
setSelectRowKeys(null)
setSelectRowDetail(null)
// formRef.current?.resetFields()
handleGetMemberDetail()
} else {
message.error(data.Result_Desc)
}
handleModalOk()
}}
// footer={<ModalFooter
// hideDelete={!currentRow?.SELLER_ID}
// handleDelete={async () => {
// await handelDelete(currentRow?.SELLER_ID)
// }}
// handleCancel={() => {
// setShowAddModal(false)
// setSelectRowKeys(null)
// setSelectRowDetail(null)
// setSelectAssociationServerpart(null)
// }}
// handleOK={() => {
// handleModalOk()
// }} />}
>
<div style={{ display: 'flex', alignItems: 'flex-start' }}>
<LeftSelectTree setSelectedId={setSelectAssociationServerpart} />
@ -915,26 +1026,51 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
return
}
const req: any = {
searchParameter: {
SearchParameter: {
SERVERPART_IDS: selectAssociationServerpart,
ISVALID: params?.ISVALID,
BUSINESS_STATE: params?.BUSINESS_STATE
ISVALID: 1
},
PageIndex: 1,
PageSize: 999999,
SortStr: "SHOPTRADE,SHOPREGION,SHOPSHORTNAME,SHOPCODE"
SortStr: "SHOPTRADE,SHOPSHORTNAME,SHOPREGION,SERVERPART_CODE",
}
const data = await handleGetSERVERPARTSHOPList(req)
if (data.List && data.List.length > 0) {
const data = await handleGetServerpartShopList(req)
console.log('datadatadatadatadata', data);
if (data && data.length > 0) {
let list: any = []
data.List.forEach((item: any) => {
if (!item.SELLER_ID) {
data.forEach((item: any) => {
if (item.SELLER_ID && item.SHOPTRADE) {
list.push(item)
}
})
return { data: list, success: true }
}
return { data: [], success: true }
// if (!selectAssociationServerpart) {
// return
// }
// const req: any = {
// searchParameter: {
// SERVERPART_IDS: selectAssociationServerpart,
// ISVALID: params?.ISVALID,
// BUSINESS_STATE: params?.BUSINESS_STATE
// },
// PageIndex: 1,
// PageSize: 999999,
// SortStr: "SHOPTRADE,SHOPREGION,SHOPSHORTNAME,SHOPCODE"
// }
// const data = await handleGetSERVERPARTSHOPList(req)
// if (data.List && data.List.length > 0) {
// let list: any = []
// data.List.forEach((item: any) => {
// if (!item.SELLER_ID) {
// list.push(item)
// }
// })
// return { data: list, success: true }
// }
// return { data: [], success: true }
}}
pagination={false}
rowSelection={{
@ -976,10 +1112,10 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
}
destroyOnClose={true}
bodyStyle={{
maxHeight: '700px', // 你可以根据需要调整高度
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
width={'65%'}
width={1200}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
@ -1013,13 +1149,13 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
</Draggable>
}}
footer={<div style={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}>
{
currentRow?.SELLER_ID ?
// currentRow?.SELLER_ID ?
currentRow?.SERVERPART_ID ?
<div>
<Button type={"primary"} onClick={() => {
{/* <Button type={"primary"} onClick={() => {
setShowAddModal(true)
}}></Button>
}}></Button> */}
<Button type={"primary"} loading={revenueLoading} onClick={() => {
handleGetRevenueData()
}}></Button>
@ -1050,11 +1186,14 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
autoFocusFirstInput
submitter={false}
preserve={false}
labelCol={{ style: { width: 100 } }}
request={async () => {
const data = await handleGetMemberDetail()
let list1: any = []
let list2: any = []
let list3: any = []
console.log('currentRowcurrentRowcurrentRowcurrentRow', currentRow);
if (currentRow?.IconList && currentRow?.IconList.length > 0) {
currentRow?.IconList.forEach((item: any) => {
@ -1164,6 +1303,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
return {
...data,
SHOPTRADE: currentRow?.SHOPTRADE ? Number(currentRow?.SHOPTRADE) : "",
SERVERPART_ID: currentRow?.SERVERPART_ID ? Number(currentRow?.SERVERPART_ID) : "",
// MerchantLogo: list1,
// DoorImage: list2,
// InteriorImage: list3,
@ -1211,6 +1351,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
message: '请输入商家名称!'
}
]}
disabled={currentRow?.SELLER_NAME}
/>
</Col>
<Col span={8}>
@ -1231,6 +1372,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
message: '请选择门店业态!'
}
]}
disabled={currentRow?.SHOPTRADE}
/>
</Col>
<Col span={8}>
@ -1261,6 +1403,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> =
filterOption: (input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
}}
disabled={currentRow?.SERVERPART_ID}
/>
</Col>
<Col span={8}>

View File

@ -11,6 +11,7 @@ import { getServerpartTree } from "@/services/options";
import useRequest from "@ahooksjs/use-request";
import './style.less'
import { getMerchantShopTree } from "@/pages/Setting/Users/service";
import session from "@/utils/session";
type DetailProps = {
@ -39,7 +40,12 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
if (currentUser?.UserPattern === 2000) {
data = await getMerchantShopTree({ BusinessManId: currentUser?.BusinessManID, ShowShop: false });
} else {
data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true)
let SERVERPARTTree = session.get('SERVERPARTTree')
if (SERVERPARTTree) {
data = SERVERPARTTree
} else {
data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true)
}
}
console.log('datatree', data);

View File

@ -1,15 +1,523 @@
// 点餐售后管理
import { ConnectState } from "@/models/connect";
import { connect, CurrentUser } from "umi";
// 点餐售后管理 售后服务管理
// 点餐类别管理 点餐分类管理
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
const AfterSalesManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
return (
<div>
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
</div>
)
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { handeDeleteFIELDENUM, handeGetFIELDENUMList, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service';
import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import classNames from 'classnames';
import session from '@/utils/session';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
message.error('请上传JPEG、jpg、png格式的图片文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('图片大小不超过 2MB!');
}
return isJpgOrPng && isLt2M;
}
const AfterSalesManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const { confirm } = Modal;
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 分类的树形结构数据
const [typeTreeData, setTypeTreeData] = useState<any>()
// 表单里面的是否预售
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj')
const { data: FIELDEXPLAIN_ID } = useRequest(async () => {
const req: any = {
SearchParameter: {
FIELDEXPLAIN_FIELD: "AFTERSALE_TYPE"
}
}
const data = await handeGetFIELDEXPLAINList(req)
if (data && data.length > 0) {
let obj: any = data[0]
return obj.FIELDEXPLAIN_ID
}
})
// 文件列表
const [fileList, setFileList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
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: any = [
{
dataIndex: 'FIELDENUM_NAME',
title: '类别名称',
align: 'center',
width: 300,
ellipsis: true,
hideInSearch: true,
hideInDescriptions: true,
render: (_, record) => {
return <a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>{record?.FIELDENUM_NAME || ""}</a>
}
},
{
dataIndex: 'FIELDENUM_VALUE',
title: '售后枚举',
align: 'center',
width: 120,
ellipsis: true,
// valueType: 'treeSelect',
// valueEnum: typeTreeData,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_INDEX',
title: '类别索引',
align: 'center',
width: 120,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_STATUS',
title: '有效状态',
align: 'center',
width: 120,
ellipsis: true,
valueType: "select",
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
{
dataIndex: 'FIELDENUM_DESC',
title: '备注说明',
align: 'center',
ellipsis: true,
hideInSearch: true,
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该点餐自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.FIELDENUM_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 删除点餐类别
const handelDelete = async (id: any) => {
const req: any = {
FIELDENUMId: id
}
const result = await handeDeleteFIELDENUM(req)
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
// 同步点餐列表
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.FIELDENUM_ID) {
req = {
...currentRow,
...res,
}
} else {
req = {
...res,
FIELDEXPLAIN_ID: FIELDEXPLAIN_ID,
FIELDENUM_PID: -1,
}
}
const data = await handeSynchroFIELDENUM(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return (
<PageContainer header={{
title: '',
breadcrumb: {}
}}>
<ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}`
}}
formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
bordered
// 请求数据
request={async (params, sorter) => {
const req = {
FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: params?.FIELDENUM_STATUS,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
setTypeTreeData(data)
return { data: data, success: true, total: data.length }
}
return { data: [], success: true }
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
/>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={
<div
className='orderCategoryModal'
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新售后类别' : '新建售后类别'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
footer={<ModalFooter
hideDelete={!currentRow?.FIELDENUM_ID}
handleDelete={async () => {
await handelDelete(currentRow?.FIELDENUM_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle='.orderCategoryModal'
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
labelCol={{ style: { width: 80 } }}
submitter={false}
preserve={false}
initialValues={currentRow ? {
...currentRow,
} : {
FIELDENUM_STATUS: 1,
}}
onFinish={async (values) => {
let newValue = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID };
}
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
handleConfirmLoading(false)
setFormPRESALE_TYPE(false)
}}
>
<Row gutter={8}>
{/* <Col span={12}>
<ProFormTreeSelect
name="FIELDENUM_PID"
label="上级类别"
request={async () => {
if (typeTreeData && typeTreeData.length > 0) {
let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData]
return list
} else {
const req = {
FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 })
setTypeTreeData(data)
return data
} else {
return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }]
}
}
}}
fieldProps={{
fieldNames: {
label: 'FIELDENUM_NAME',
value: 'FIELDENUM_ID',
children: 'children'
},
showSearch: true,
filterTreeNode: (input, node) =>
(node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase())
}}
rules={[
{
required: true,
message: "请选择上级类别"
}
]}
/>
</Col> */}
<Col span={12}>
<ProFormText
name="FIELDENUM_NAME"
label="类别名称"
rules={[
{
required: true,
message: "请输入类别名称"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_INDEX"
label="类别索引"
rules={[
{
required: true,
message: "请输入类别索引"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_VALUE"
label="售后枚举"
rules={[
{
required: true,
message: "请输入售后枚举"
}
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="FIELDENUM_STATUS"
label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
rules={[
{
required: true,
message: "请选择有效状态"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="FIELDENUM_DESC"
label="备注"
/>
</Col>
</Row>
</ProForm>
</Modal>
</PageContainer >
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(AfterSalesManage);

View File

@ -1,15 +1,522 @@
// 售后类型管理
import { ConnectState } from "@/models/connect";
import { connect, CurrentUser } from "umi";
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
const AfterSalesTypeManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
return (
<div>
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
</div>
)
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { handeDeleteFIELDENUM, handeGetFIELDENUMList, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service';
import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import classNames from 'classnames';
import session from '@/utils/session';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
message.error('请上传JPEG、jpg、png格式的图片文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('图片大小不超过 2MB!');
}
return isJpgOrPng && isLt2M;
}
const AfterSalesManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const { confirm } = Modal;
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 分类的树形结构数据
const [typeTreeData, setTypeTreeData] = useState<any>()
// 表单里面的是否预售
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj')
const { data: FIELDEXPLAIN_ID } = useRequest(async () => {
const req: any = {
SearchParameter: {
FIELDEXPLAIN_FIELD: "AFTERSALE_TYPE"
}
}
const data = await handeGetFIELDEXPLAINList(req)
if (data && data.length > 0) {
let obj: any = data[0]
return obj.FIELDEXPLAIN_ID
}
})
// 文件列表
const [fileList, setFileList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
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: any = [
{
dataIndex: 'FIELDENUM_NAME',
title: '类别名称',
align: 'center',
width: 300,
ellipsis: true,
hideInSearch: true,
hideInDescriptions: true,
render: (_, record) => {
return <a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>{record?.FIELDENUM_NAME || ""}</a>
}
},
{
dataIndex: 'FIELDENUM_VALUE',
title: '售后枚举',
align: 'center',
width: 120,
ellipsis: true,
// valueType: 'treeSelect',
// valueEnum: typeTreeData,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_INDEX',
title: '类别索引',
align: 'center',
width: 120,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_STATUS',
title: '有效状态',
align: 'center',
width: 120,
ellipsis: true,
valueType: "select",
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
{
dataIndex: 'FIELDENUM_DESC',
title: '备注说明',
align: 'center',
ellipsis: true,
hideInSearch: true,
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该点餐自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.FIELDENUM_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 删除点餐类别
const handelDelete = async (id: any) => {
const req: any = {
FIELDENUMId: id
}
const result = await handeDeleteFIELDENUM(req)
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
// 同步点餐列表
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.FIELDENUM_ID) {
req = {
...currentRow,
...res,
}
} else {
req = {
...res,
FIELDEXPLAIN_ID: FIELDEXPLAIN_ID,
FIELDENUM_PID: -1,
}
}
const data = await handeSynchroFIELDENUM(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return (
<PageContainer header={{
title: '',
breadcrumb: {}
}}>
<ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}`
}}
formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
bordered
// 请求数据
request={async (params, sorter) => {
const req = {
FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: params?.FIELDENUM_STATUS,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
setTypeTreeData(data)
return { data: data, success: true, total: data.length }
}
return { data: [], success: true }
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
/>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={
<div
className='orderCategoryModal'
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新售后类别' : '新建售后类别'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
footer={<ModalFooter
hideDelete={!currentRow?.FIELDENUM_ID}
handleDelete={async () => {
await handelDelete(currentRow?.FIELDENUM_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle='.orderCategoryModal'
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
labelCol={{ style: { width: 80 } }}
submitter={false}
preserve={false}
initialValues={currentRow ? {
...currentRow,
} : {
FIELDENUM_STATUS: 1,
}}
onFinish={async (values) => {
let newValue = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID };
}
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
handleConfirmLoading(false)
setFormPRESALE_TYPE(false)
}}
>
<Row gutter={8}>
{/* <Col span={12}>
<ProFormTreeSelect
name="FIELDENUM_PID"
label="上级类别"
request={async () => {
if (typeTreeData && typeTreeData.length > 0) {
let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData]
return list
} else {
const req = {
FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 })
setTypeTreeData(data)
return data
} else {
return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }]
}
}
}}
fieldProps={{
fieldNames: {
label: 'FIELDENUM_NAME',
value: 'FIELDENUM_ID',
children: 'children'
},
showSearch: true,
filterTreeNode: (input, node) =>
(node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase())
}}
rules={[
{
required: true,
message: "请选择上级类别"
}
]}
/>
</Col> */}
<Col span={12}>
<ProFormText
name="FIELDENUM_NAME"
label="类别名称"
rules={[
{
required: true,
message: "请输入类别名称"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_INDEX"
label="类别索引"
rules={[
{
required: true,
message: "请输入类别索引"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_VALUE"
label="售后枚举"
rules={[
{
required: true,
message: "请输入售后枚举"
}
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="FIELDENUM_STATUS"
label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
rules={[
{
required: true,
message: "请选择有效状态"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="FIELDENUM_DESC"
label="备注"
/>
</Col>
</Row>
</ProForm>
</Modal>
</PageContainer >
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(AfterSalesTypeManage);
}))(AfterSalesManage);

View File

@ -0,0 +1,385 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import { Col, FormInstance, Modal, Row } from "antd";
import { useRef, useState } from "react";
import Draggable from "react-draggable";
import React from "react";
import ProForm, { ProFormSelect, ProFormText } from "@ant-design/pro-form";
import moment from 'moment'
import orderIcon from '@/assets/detail/orderIcon.png'
import closeIcon from '@/assets/detail/closeIcon.png'
import ProTable from "@ant-design/pro-table";
import { handeGetSALEBILLList, handeGetSALEDETAILList } from "../../service";
import './style.less'
type DetailProps = {
modalVisible: boolean //显示属性
handleCloseModal: any // 关闭调用的方法
currentRow: any
}
const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow }: DetailProps) => {
const formRef = useRef<FormInstance>();
const draggleRef = React.createRef<any>()
const modalRef = useRef<FormInstance>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
// const [currentRow, setCurrentRow] = useState<any>();
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
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 orderDetailColumns: any = [
{
dataIndex: "index",
title: "序号",
align: 'center',
hideInSearch: true,
valueType: "index",
width: 70,
ellipsis: true,
},
{
dataIndex: 'COMMODITY_NAME',
title: '商品名称',
align: 'center',
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
dataIndex: 'COMMODITY_BARCODE',
title: '商品条码',
align: 'center',
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
dataIndex: 'ORDER_COUNT',
title: '数量',
align: 'center',
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
dataIndex: 'AVERAGE_PRICE',
title: '单价',
align: 'center',
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
dataIndex: 'ORDER_AMOUNT',
title: '金额',
align: 'center',
hideInSearch: true,
width: 150,
ellipsis: true,
},
]
return (
<div>
<Modal
className="BookingMealOrderDetailModal"
title={false}
closeIcon={<div></div>}
destroyOnClose={true}
width={1200}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
// setCurrentRow(undefined);
}}
onCancel={() => {
handleConfirmLoading(false)
// handleModalVisible(false)
// setCurrentRow(undefined);
}}
footer={false}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle=".bookingOrderModalTop"
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={modalRef}
submitter={false}
initialValues={currentRow ? {
...currentRow,
ORDER_DATE: currentRow?.ORDER_DATE ? moment(currentRow?.ORDER_DATE).format('YYYY-MM-DD HH:mm:ss') : ''
} : {}}
>
<div className="bookingOrderModalTop">
<div className="modalTopLeft">
<img className="memberIcon" src={orderIcon} />
<span className="modalTitle"></span>
</div>
<div className="modalTopRight">
<img className="memberIcon" src={closeIcon} onClick={() => {
if (handleCloseModal) {
handleCloseModal()
}
}} />
</div>
</div>
<div className="bookingOrderModalCenter">
<div className="smallTitle"></div>
<Row gutter={8}>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"SALEBILL_CODE"}
label={"订单编码"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"CHANNEL_TYPE"}
label={"支付渠道"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"ORDER_DATE"}
label={"下单时间"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"RECORD_COUNT"}
label={"商品种类"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"TOTAL_COUNT"}
label={"商品件数"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"ORDER_AMOUNT"}
label={"订单金额"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"COUPON_AMOUNT"}
label={"优惠金额"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"PACK_AMOUNT"}
label={"打包金额"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"CONSUME_SCORE"}
label={"使用积分"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"PAY_AMOUNT"}
label={"实付金额"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"COST_AMOUNT"}
label={"成本金额"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"SALEBILL_STATE"}
label={"订单状态"}
readonly
style={{ marginBottom: '16px' }}
options={[
{ label: "订单待支付", value: 1005 },
{ label: "订单待制作", value: 1010 },
{ label: "订单待取餐", value: 2000 },
{ label: "订单已完成", value: 3000 },
{ label: "退款申请中", value: 8000 },
{ label: "订单已退款", value: 8900 },
{ label: "订单已关闭", value: 9000 },
{ label: "订单已撤销", value: 9999 },
]}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"COMMENT_STATE"}
label={"订单评价状态"}
readonly
style={{ marginBottom: '16px' }}
options={[
{ label: "未评价", value: 0 },
{ label: "已评价", value: 1 },
]}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"TAKE_TYPE"}
label={"取餐方式"}
readonly
style={{ marginBottom: '16px' }}
options={[
{ label: "堂食", value: 1000 },
{ label: "预约", value: 2000 },
]}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"PACK_TYPE"}
label={"就餐方式"}
readonly
style={{ marginBottom: '16px' }}
options={[
{ label: "堂食", value: 1000 },
{ label: "打包", value: 2000 },
]}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"TAKE_NUMBER"}
label={"取餐码"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
</Row>
</div>
</ProForm>
<ProTable
columns={orderDetailColumns}
bordered
search={false}
options={false}
request={async () => {
let SALEBILL_ID: string = ''
if (!currentRow?.SALEBILL_ID) {
const req: any = {
searchParameter: {
SALEBILL_CODE: currentRow?.TICKET_CODE
},
PageIndex: 1,
PageSize: 1,
}
const data = await handeGetSALEBILLList(req)
console.log('dasdas', data);
let obj: any = data.List && data.List.length > 0 ? data.List[0] : null
SALEBILL_ID = obj.SALEBILL_ID
modalRef.current?.setFieldsValue({
SALEBILL_CODE: obj.SALEBILL_CODE || "",
CHANNEL_TYPE: obj.CHANNEL_TYPE || "",
ORDER_DATE: obj.ORDER_DATE ? moment(obj.ORDER_DATE).format('YYYY-MM-DD HH:mm:ss') : "",
RECORD_COUNT: obj.RECORD_COUNT || "",
TOTAL_COUNT: obj.TOTAL_COUNT || "",
ORDER_AMOUNT: obj.ORDER_AMOUNT || "",
COUPON_AMOUNT: obj.COUPON_AMOUNT || "",
PACK_AMOUNT: obj.PACK_AMOUNT || "",
CONSUME_SCORE: obj.CONSUME_SCORE || "",
PAY_AMOUNT: obj.PAY_AMOUNT || "",
COST_AMOUNT: obj.COST_AMOUNT || "",
SALEBILL_STATE: obj.SALEBILL_STATE || "",
COMMENT_STATE: obj.COMMENT_STATE || "",
TAKE_TYPE: obj.TAKE_TYPE || "",
PACK_TYPE: obj.PACK_TYPE || "",
TAKE_NUMBER: obj.TAKE_NUMBER || "",
})
}
const req: any = {
searchParameter: {
SALEBILL_ID: currentRow?.SALEBILL_ID || SALEBILL_ID
},
PageIndex: 1,
PageSize: 999999,
}
const data = await handeGetSALEDETAILList(req)
console.log('datadatadata', data);
if (data.List && data.List.length > 0) {
return { data: data.List, success: true, total: data.TotalCount }
}
return { data: [], success: true }
}}
summary={() => {
// extra 是 request 返回的 extra 字段
return (
<tr>
<td colSpan={2} style={{ textAlign: 'center', fontWeight: 'bold' }}></td>
<td />
<td style={{ textAlign: 'center', fontWeight: 'bold' }}>{currentRow?.TOTAL_COUNT || 0}</td>
<td />
<td style={{ textAlign: 'center', fontWeight: 'bold' }}>{currentRow?.ORDER_AMOUNT?.toFixed(2) || '0.00'}</td>
</tr>
)
}}
/>
</Modal>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(OrderDetailModal);

View File

@ -0,0 +1,110 @@
.BookingMealOrderDetailModal {
.react-draggable {
.ant-modal-content {
border-radius: 16px;
.ant-modal-close {
display: none;
}
.ant-modal-body {
padding: 0;
height: 800px;
overflow-y: auto;
overflow: hidden;
.ant-form {
.bookingOrderModalTop {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #D5D8DE;
box-sizing: border-box;
padding-bottom: 10px;
box-sizing: border-box;
padding: 30px 20px;
.modalTopLeft {
display: flex;
align-items: center;
.memberIcon {
width: 18px;
height: 18px;
margin-right: 5px;
}
.modalTitle {
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 18px;
color: rgba(0, 0, 0, 0.85);
line-height: 18px;
text-align: left;
font-style: normal;
}
}
.modalTopRight {
width: 18px;
height: 18px;
.memberIcon {
width: 18px;
height: 18px;
cursor: pointer;
}
}
}
.bookingOrderModalCenter {
width: 100%;
height: 100%;
margin-top: 14px;
box-sizing: border-box;
padding: 0 34px;
.smallTitle {
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 16px;
color: #333333;
line-height: 10px;
text-align: left;
font-style: normal;
margin-bottom: 10px;
}
.smallTitle::after {
content: "";
width: 2px;
height: 14px;
background-color: #155DFE;
position: relative;
left: -5px;
top: 2px;
}
.ant-row {
.memberInfoDetailItem {
.ant-form-item {
margin-bottom: 12px;
}
}
}
}
}
}
.ant-modal-body::-webkit-scrollbar {
width: 0;
display: none;
}
}
}
}

View File

@ -16,6 +16,7 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele
import './style.less'
import orderIcon from '@/assets/detail/orderIcon.png'
import closeIcon from '@/assets/detail/closeIcon.png'
import OrderDetailModal from "./components/orderDetailModal";
const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
@ -300,9 +301,9 @@ const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
/>
</div>
<OrderDetailModal modalVisible={modalVisible} handleCloseModal={handleCloseModal} currentRow={currentRow} />
<Modal
{/* <Modal
className="BookingMealOrderDetailModal"
// title={
// <div
@ -531,10 +532,6 @@ const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
</div>
</ProForm>
<ProTable
columns={orderDetailColumns}
bordered
@ -569,7 +566,7 @@ const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
}}
/>
</Modal>
</Modal> */}
</div>
</div>
)

View File

@ -17,6 +17,7 @@ import PageTitleBox from "@/components/PageTitleBox";
import { handleGetCONSUMPTIONRECORDList } from "../service";
import moment from 'moment'
import session from "@/utils/session";
import OrderDetailModal from "../BookingMealOrder/components/orderDetailModal";
const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => {
@ -29,8 +30,12 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
const [collapsible, setCollapsible] = useState<boolean>(false)
const [treeView, setTreeView] = useState<any>()
const [printIndex, setPrintIndex] = useState<number>(new Date().getTime())
// 显示订单详情的悬浮框
const [showOrderModal, setShowOrderModal] = useState<boolean>(false)
const [currentRow, setCurrentRow] = useState<any>()
let CONSUMPTIONRECORDTYPEObj = session.get('CONSUMPTIONRECORDTYPEObj')
let MEMBERSHIPLEVELYNObj = session.get('MEMBERSHIPLEVELYNObj')
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
@ -58,14 +63,54 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
},
initialValue: [moment().format('YYYY-MM-DD'), moment().subtract(1, 'M').format('YYYY-MM-DD')],
},
// {
// title: "服务区名称",
// width: 150,
// dataIndex: "SERVERPART_NAME",
// hideInSearch: true,
// align: 'center',
// ellipsis: true,
// },
{
title: "服务区名称",
title: "用户昵称",
width: 150,
dataIndex: "SERVERPART_NAME",
dataIndex: "MEMBERSHIP_NAME",
hideInSearch: true,
align: 'center',
ellipsis: true,
},
{
title: "手机号码",
width: 150,
dataIndex: "MEMBERSHIP_MOBILEPHONE",
hideInSearch: true,
align: 'center',
ellipsis: true,
},
{
title: "会员等级",
width: 150,
dataIndex: "MEMBERSHIP_LEVEL",
hideInSearch: true,
align: 'center',
ellipsis: true,
valueType: 'select',
valueEnum: MEMBERSHIPLEVELYNObj
},
{
title: "订单编号",
width: 200,
dataIndex: "TICKET_CODE",
hideInSearch: true,
align: 'center',
ellipsis: true,
render: (_, record) => {
return record?.TICKET_CODE ? <a onClick={() => {
setCurrentRow(record)
setShowOrderModal(true)
}}>{record?.TICKET_CODE}</a> : "-"
}
},
{
title: "门店名称",
width: 150,
@ -142,7 +187,9 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
}
},
]
const handleCloseModal = () => {
setShowOrderModal(false)
}
return (
<div ref={(el) => {
@ -193,6 +240,9 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
/>
</div>
</div>
<OrderDetailModal modalVisible={showOrderModal} handleCloseModal={handleCloseModal} currentRow={currentRow} />
</div>
)
}

View File

@ -16,6 +16,7 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele
import PageTitleBox from "@/components/PageTitleBox";
import { handleGetMEMBERGROWTHList } from "../service";
import moment from 'moment'
import session from "@/utils/session";
const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => {
@ -29,6 +30,8 @@ const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
const [treeView, setTreeView] = useState<any>()
const [printIndex, setPrintIndex] = useState<number>(new Date().getTime())
let POINTTYPEObj = session.get('POINTTYPEObj')
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
@ -93,16 +96,20 @@ const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
{
title: "成长来源",
width: 120,
dataIndex: "GROWTH_VALUE",
dataIndex: "GROWTH_SOURCE",
align: 'center',
ellipsis: true,
valueType: 'select',
valueEnum: {
"0": "全部",
"1000": "消费赠送",
"2000": "消费抵扣",
"3000": "注册赠送",
...POINTTYPEObj
},
// valueEnum: {
// "0": "全部",
// "1000": "消费赠送",
// "2000": "消费抵扣",
// "3000": "注册赠送",
// },
initialValue: "0"
},
{
@ -162,10 +169,10 @@ const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props)
request={async (params) => {
const req: any = {
searchParameter: {
PROVINCE_CODE: currentUser?.ProvinceCode || "",
// PROVINCE_CODE: currentUser?.ProvinceCode || "",
OWNERUNIT_ID: 911,
SCORESETTING_STATE: 1,
GROWTH_VALUES: params?.GROWTH_VALUE === "0" ? "" : params?.GROWTH_VALUE,
GROWTH_SOURCES: params?.GROWTH_SOURCE === "0" ? "" : params?.GROWTH_SOURCE,
GROWTH_TYPE: params?.GROWTH_TYPE === "-2" ? '' : params?.GROWTH_TYPE
},
PageIndex: params?.current,

View File

@ -0,0 +1,522 @@
// 成长值枚举规则配置页面
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import classNames from 'classnames';
import session from '@/utils/session';
import ModalFooter from '../../scenicSpotConfig/component/modalFooter';
import { handeDeleteFIELDENUM, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM } from '../../service';
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
message.error('请上传JPEG、jpg、png格式的图片文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('图片大小不超过 2MB!');
}
return isJpgOrPng && isLt2M;
}
const GrowthConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const { confirm } = Modal;
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 分类的树形结构数据
const [typeTreeData, setTypeTreeData] = useState<any>()
// 表单里面的是否预售
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj')
const { data: FIELDEXPLAIN_ID } = useRequest(async () => {
const req: any = {
SearchParameter: {
FIELDEXPLAIN_FIELD: "GROWTH_TYPE"
}
}
const data = await handeGetFIELDEXPLAINList(req)
if (data && data.length > 0) {
let obj: any = data[0]
return obj.FIELDEXPLAIN_ID
}
})
// 文件列表
const [fileList, setFileList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
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: any = [
{
dataIndex: 'FIELDENUM_NAME',
title: '类别名称',
align: 'center',
width: 300,
ellipsis: true,
hideInSearch: true,
hideInDescriptions: true,
render: (_, record) => {
return <a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>{record?.FIELDENUM_NAME || ""}</a>
}
},
{
dataIndex: 'FIELDENUM_VALUE',
title: '售后枚举',
align: 'center',
width: 120,
ellipsis: true,
// valueType: 'treeSelect',
// valueEnum: typeTreeData,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_INDEX',
title: '类别索引',
align: 'center',
width: 120,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_STATUS',
title: '有效状态',
align: 'center',
width: 120,
ellipsis: true,
valueType: "select",
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
{
dataIndex: 'FIELDENUM_DESC',
title: '备注说明',
align: 'center',
ellipsis: true,
hideInSearch: true,
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该点餐自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.FIELDENUM_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 删除点餐类别
const handelDelete = async (id: any) => {
const req: any = {
FIELDENUMId: id
}
const result = await handeDeleteFIELDENUM(req)
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
// 同步点餐列表
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.FIELDENUM_ID) {
req = {
...currentRow,
...res,
}
} else {
req = {
...res,
FIELDEXPLAIN_ID: FIELDEXPLAIN_ID,
FIELDENUM_PID: -1,
}
}
const data = await handeSynchroFIELDENUM(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return (
<PageContainer header={{
title: '',
breadcrumb: {}
}}>
<ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}`
}}
formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
bordered
// 请求数据
request={async (params, sorter) => {
const req = {
FIELDEXPLAIN_FIELD: 'GROWTH_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: params?.FIELDENUM_STATUS,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
setTypeTreeData(data)
return { data: data, success: true, total: data.length }
}
return { data: [], success: true }
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
/>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={
<div
className='orderCategoryModal'
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新售后类别' : '新建售后类别'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
footer={<ModalFooter
hideDelete={!currentRow?.FIELDENUM_ID}
handleDelete={async () => {
await handelDelete(currentRow?.FIELDENUM_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle='.orderCategoryModal'
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
labelCol={{ style: { width: 80 } }}
submitter={false}
preserve={false}
initialValues={currentRow ? {
...currentRow,
} : {
FIELDENUM_STATUS: 1,
}}
onFinish={async (values) => {
let newValue = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID };
}
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
handleConfirmLoading(false)
setFormPRESALE_TYPE(false)
}}
>
<Row gutter={8}>
{/* <Col span={12}>
<ProFormTreeSelect
name="FIELDENUM_PID"
label="上级类别"
request={async () => {
if (typeTreeData && typeTreeData.length > 0) {
let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData]
return list
} else {
const req = {
FIELDEXPLAIN_FIELD: 'GROWTH_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 })
setTypeTreeData(data)
return data
} else {
return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }]
}
}
}}
fieldProps={{
fieldNames: {
label: 'FIELDENUM_NAME',
value: 'FIELDENUM_ID',
children: 'children'
},
showSearch: true,
filterTreeNode: (input, node) =>
(node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase())
}}
rules={[
{
required: true,
message: "请选择上级类别"
}
]}
/>
</Col> */}
<Col span={12}>
<ProFormText
name="FIELDENUM_NAME"
label="类别名称"
rules={[
{
required: true,
message: "请输入类别名称"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_INDEX"
label="类别索引"
rules={[
{
required: true,
message: "请输入类别索引"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_VALUE"
label="售后枚举"
rules={[
{
required: true,
message: "请输入售后枚举"
}
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="FIELDENUM_STATUS"
label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
rules={[
{
required: true,
message: "请选择有效状态"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="FIELDENUM_DESC"
label="备注"
/>
</Col>
</Row>
</ProForm>
</Modal>
</PageContainer >
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(GrowthConfig);

View File

@ -24,6 +24,8 @@ import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚
import { handleDeleteGROWTHSETTING, handleGetGROWTHSETTINGList, handleSynchroGROWTHSETTING } from '../service';
import session from '@/utils/session';
import PageTitleBox from '@/components/PageTitleBox';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
import GrowthConfig from './components/growthConfig';
@ -34,16 +36,17 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [showConfig, setShowConfig] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 会员成长值枚举
let GROWTHSETTINGTYPEList = session.get('GROWTHSETTINGTYPEList')
let GROWTHSETTINGTYPEObj = session.get('GROWTHSETTINGTYPEObj')
let GROWTHTYPEList = session.get('GROWTHTYPEList')
let GROWTHTYPEObj = session.get('GROWTHTYPEObj')
let MEMBERSHIP_TYPEList = session.get('MEMBERSHIP_TYPEList')
let MEMBERSHIP_TYPEObj = session.get('MEMBERSHIP_TYPEObj')
let MEMBERSHIP_LEVELList = session.get('MEMBERSHIP_LEVELList')
let MEMBERSHIP_LEVELObj = session.get('MEMBERSHIP_LEVELObj')
let MEMBERSHIPLEVELYNList = session.get('MEMBERSHIPLEVELYNList')
let MEMBERSHIPLEVELYNObj = session.get('MEMBERSHIPLEVELYNObj')
// 弹出框拖动效果
@ -75,7 +78,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
align: 'center',
hideInSearch: true,
valueType: 'select',
valueEnum: GROWTHSETTINGTYPEObj
valueEnum: GROWTHTYPEObj
},
{
dataIndex: 'GROWTHSETTING_NAME',
@ -84,6 +87,12 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
width: 120,
hideInSearch: true,
hideInDescriptions: true,
render: (_, record) => {
return record?.GROWTHSETTING_NAME ? <a onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}>{record?.GROWTHSETTING_NAME}</a> : '-'
}
},
{
dataIndex: 'MEMBERSHIP_TYPE',
@ -101,7 +110,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
width: 120,
hideInSearch: true,
valueType: 'select',
valueEnum: MEMBERSHIP_LEVELObj
valueEnum: MEMBERSHIPLEVELYNObj
},
{
dataIndex: 'PROMOTION_LEVEL',
@ -109,7 +118,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
width: 120,
align: 'center',
hideInSearch: true,
valueEnum: MEMBERSHIP_LEVELObj
valueEnum: MEMBERSHIPLEVELYNObj
},
{
dataIndex: 'GROWTH_VALUE',
@ -149,12 +158,12 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
title: '有效状态',
width: 120,
align: 'center',
hideInSearch: true,
valueType: 'select',
valueEnum: {
"1": "有效",
"0": "无效"
}
},
initialValue: "1"
},
// {
// dataIndex: 'STAFF_NAME',
@ -175,36 +184,36 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
// align: 'center',
// hideInSearch: true,
// },
{
dataIndex: 'option',
title: '操作',
width: 120,
align: 'center',
valueType: 'option',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该会员成长值配置列表信息吗?"
onConfirm={async () => {
await handelDelete(record.GROWTHSETTING_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 120,
// align: 'center',
// valueType: 'option',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该会员成长值配置列表信息吗?"
// onConfirm={async () => {
// await handelDelete(record.GROWTHSETTING_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
@ -217,6 +226,8 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
}
};
@ -274,7 +285,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
searchParameter: {
PROVINCE_CODE: currentUser?.ProvinceCode || "",
OWNERUNIT_ID: 911,
GROWTHSETTING_STATE: 1
GROWTHSETTING_STATE: params?.GROWTHSETTING_STATE
},
PageIndex: 1,
PageSize: 20
@ -299,6 +310,16 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
>
</Button>,
// 配置成长值规则枚举
<Button
key="new"
type="primary"
onClick={() => {
setShowConfig(true);
}}
>
</Button>
],
}}
pagination={{ defaultPageSize: 10 }}
@ -326,9 +347,11 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
/>
)}
</Drawer>
<Modal
title={
<div
className='GrowthValueModal'
style={{
width: '100%',
cursor: 'move',
@ -350,6 +373,28 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
footer={<ModalFooter
hideDelete={!currentRow?.GROWTHSETTING_ID}
handleDelete={async () => {
await handelDelete(currentRow?.GROWTHSETTING_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
@ -372,6 +417,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle='.GrowthValueModal'
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
@ -383,6 +429,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
autoFocusFirstInput
submitter={false}
preserve={false}
labelCol={{ style: { width: 80 } }}
initialValues={{
...currentRow,
SCORESETTING_STATE: (currentRow?.GROWTHSETTING_STATE || currentRow?.GROWTHSETTING_STATE === 0) ? currentRow?.GROWTHSETTING_STATE : 1
@ -391,9 +438,8 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
let newValue: any = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, SCORESETTING_ID: currentRow.SCORESETTING_ID };
newValue = { ...values, GROWTHSETTING_ID: currentRow.GROWTHSETTING_ID };
}
console.log('newValue', newValue);
await handleAddUpdate(newValue);
@ -411,7 +457,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
message: '请选择规则类型'
}
]}
options={GROWTHSETTINGTYPEList}
options={GROWTHTYPEList}
/>
</Col>
<Col span={12}>
@ -437,14 +483,14 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
<ProFormSelect
name="MEMBERSHIP_LEVEL"
label="会员等级"
options={MEMBERSHIP_LEVELList}
options={MEMBERSHIPLEVELYNList}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="PROMOTION_LEVEL"
label="晋升等级"
options={MEMBERSHIP_LEVELList}
options={MEMBERSHIPLEVELYNList}
/>
</Col>
<Col span={12}>
@ -486,6 +532,23 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
</Row>
</ProForm>
</Modal>
<Modal
title={"成长值枚举配置"}
destroyOnClose={true}
width={1200}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={showConfig}
footer={false}
onCancel={() => {
setShowConfig(false)
}}
>
<GrowthConfig />
</Modal>
</PageContainer>
);
};

View File

@ -25,6 +25,7 @@ import { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUS
import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
@ -101,7 +102,19 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
render: (_, record) => {
return <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<img style={{ width: '30px', height: '30px', marginRight: '5px', borderRadius: '50%' }} src={record?.USERDEFINEDTYPE_ICO || defaultIcon} />
<span style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }}>{record?.USERDEFINEDTYPE_NAME}</span>
<a style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }} onClick={() => {
if (record?.USERDEFINEDTYPE_ICO) {
setFileList([{
name: "",
url: record?.USERDEFINEDTYPE_ICO
}])
}
if (record?.PRESALE_TYPE) {
setFormPRESALE_TYPE(true)
}
setCurrentRow({ ...record });
handleModalVisible(true);
}}>{record?.USERDEFINEDTYPE_NAME}</a>
</div>
}
},
@ -111,21 +124,23 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
align: 'center',
width: 120,
ellipsis: true,
sorter: (a, b) => a.USERDEFINEDTYPE_INDEX - b.USERDEFINEDTYPE_INDEX,
defaultSortOrder: 'ascend',
hideInSearch: true,
},
{
dataIndex: 'USERDEFINEDTYPE_STATE',
title: '有效状态',
align: 'center',
width: 120,
ellipsis: true,
valueType: "select",
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
// {
// dataIndex: 'USERDEFINEDTYPE_STATE',
// title: '有效状态',
// align: 'center',
// width: 120,
// ellipsis: true,
// valueType: "select",
// valueEnum: {
// "1": "有效",
// "0": "无效"
// },
// initialValue: "1"
// },
{
dataIndex: 'SCANCODE_ORDER',
title: '上架状态',
@ -152,58 +167,58 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
"1": "是"
}
},
{
dataIndex: 'OWNERUNIT_NAME',
title: '业主单位',
align: 'center',
width: 180,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'option',
title: '操作',
width: 100,
ellipsis: true,
valueType: 'option',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
console.log('recordrecordrecord', record);
if (record?.USERDEFINEDTYPE_ICO) {
setFileList([{
name: "",
url: record?.USERDEFINEDTYPE_ICO
}])
}
// {
// dataIndex: 'OWNERUNIT_NAME',
// title: '业主单位',
// align: 'center',
// width: 180,
// ellipsis: true,
// hideInSearch: true,
// },
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// console.log('recordrecordrecord', record);
// if (record?.USERDEFINEDTYPE_ICO) {
// setFileList([{
// name: "",
// url: record?.USERDEFINEDTYPE_ICO
// }])
// }
if (record?.PRESALE_TYPE) {
setFormPRESALE_TYPE(true)
}
// if (record?.PRESALE_TYPE) {
// setFormPRESALE_TYPE(true)
// }
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该商品自定义类别列表信息吗?"
onConfirm={async () => {
handelDelete(record.USERDEFINEDTYPE_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该商品自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.USERDEFINEDTYPE_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
@ -226,6 +241,10 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
@ -296,7 +315,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
OWNERUNIT_ID: currentUser?.OwnerUnitId,
PROVINCE_CODE: "",
GOODSTYPE: 4000,
USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE
USERDEFINEDTYPE_STATE: 1
// SearchKey: ""
}
const data = await handlGetUSERDEFINEDTYPEList(req);
@ -344,6 +363,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
<Modal
title={
<div
className='MallClassModal'
style={{
width: '100%',
cursor: 'move',
@ -365,6 +385,10 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
@ -377,6 +401,25 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
setFormPRESALE_TYPE(false)
setFileList([])
}}
footer={<ModalFooter
hideDelete={!currentRow?.USERDEFINEDTYPE_ID}
handleDelete={() => {
handelDelete(currentRow.USERDEFINEDTYPE_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
@ -389,6 +432,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle={".MallClassModal"}
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
@ -397,6 +441,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined
<ProForm
layout={'horizontal'}
formRef={formRef}
labelCol={{ style: { width: 80 } }}
autoFocusFirstInput
submitter={false}
preserve={false}

View File

@ -0,0 +1,542 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import ProTable, { ActionType } from "@ant-design/pro-table";
import { Col, FormInstance, message, Modal, Popconfirm, Row, Space } from "antd";
import { useRef, useState } from "react";
import { handleDeleteMEMBERADDRESS, handleGetMEMBERADDRESSList, handleSynchroMEMBERADDRESS } from "../../service";
import React from "react";
import Draggable from "react-draggable";
import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
import moment from 'moment'
import ModalFooter from "../../scenicSpotConfig/component/modalFooter";
type DetailProps = {
currentBigRow: any
currentUser: any
}
const AddressDetail = ({ currentBigRow, currentUser }: DetailProps) => {
const modalActionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [province, setProvince] = useState<string>('');
const [city, setCity] = useState<string>('');
const [county, setCounty] = useState<string>('');
const [currentRow, setCurrentRow] = useState<any>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
// 抽屉里面的table的columns
const drawerColumns: any = [
{
dataIndex: 'searchText',
title: '',
width: 150,
align: 'center',
hideInTable: true,
fieldProps: {
placeholder: "输入收货人名称"
}
},
{
dataIndex: 'USER_NAME',
title: '收货人名称',
width: 150,
align: 'center',
ellipsis: true,
hideInSearch: true,
render: (_, record) => {
return record?.USER_NAME ? <a
onClick={() => {
console.log('record', record);
setProvince(record?.RECEIVE_PROVINCE)
setCity(record?.RECEIVE_CITY)
setCounty(record?.RECEIVE_COUNTY)
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
{record?.USER_NAME || "-"}
</a> : "-"
}
},
{
dataIndex: 'USER_SEX',
title: '收货人性别',
width: 120,
align: 'center',
hideInSearch: true,
valueType: 'select',
valueEnum: {
"1": "男",
"2": "女",
"0": "-",
}
},
{
dataIndex: 'MOBILEPHONE',
title: '手机号码',
width: 150,
align: 'center',
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'RECEIVE_PROVINCE',
title: '省/直辖市',
width: 120,
align: 'center',
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'RECEIVE_CITY',
title: '城市/直辖市',
width: 150,
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'RECEIVE_COUNTY',
title: '区/县',
width: 150,
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'ADDRESS',
title: '收货地址',
width: 300,
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'DOORPLATE',
title: '门牌号码',
width: 300,
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'ISDEFAULT',
title: '默认地址',
width: 120,
align: 'center',
hideInSearch: true,
ellipsis: true,
valueType: 'select',
valueEnum: {
"1": "是",
"0": "否",
}
},
{
dataIndex: 'TAGTYPE',
title: '地址类型',
width: 120,
align: 'center',
hideInSearch: true,
ellipsis: true,
valueType: 'select',
valueEnum: {
"1000": "家",
"2000": "公司",
"3000": "其他",
}
},
// {
// dataIndex: 'CREATE_STAFF_NAME',
// title: '创建人名称',
// align: 'center',
// hideInSearch: true,
// },
// {
// dataIndex: 'CREATE_DATE',
// title: '创建时间',
// valueType: 'date',
// align: 'center',
// hideInSearch: true,
// },
// {
// dataIndex: 'UPDATE_STAFF_NAME',
// title: '更新人名称',
// align: 'center',
// hideInSearch: true,
// },
// {
// dataIndex: 'UPDATE_DATE',
// title: '更新时间',
// valueType: 'date',
// align: 'center',
// hideInSearch: true,
// },
// {
// dataIndex: 'MEMBERADDRESS_DESC',
// title: '备注说明',
// align: 'center',
// hideInSearch: true,
// },
// {
// dataIndex: 'option',
// title: '操作',
// width: 120,
// align: 'center',
// valueType: 'option',
// hideInSearch: true,
// fixed: 'right',
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// console.log('record', record);
// setProvince(record?.RECEIVE_PROVINCE)
// setCity(record?.RECEIVE_CITY)
// setCounty(record?.RECEIVE_COUNTY)
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该会员收货地址列表信息吗?"
// onConfirm={async () => {
// console.log('res', record);
// await handelDelete(record.MEMBERADDRESS_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
const handelDelete = async (id: number) => {
const result = await handleDeleteMEMBERADDRESS({
MEMBERADDRESSId: id
});
console.log('resultresultresult', result);
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
modalActionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setProvince("")
setCity("")
setCounty("")
}
};
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 handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.MEMBERADDRESS_ID) {
req = {
...currentRow,
...res
}
} else {
req = {
...res,
ADDTIME: moment().format('YYYY-MM-DD HH:mm:ss'),
STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name,
OWNERUNIT_ID: currentUser?.OwnerUnitId,
OWNERUNIT_NAME: currentUser?.OwnerUnitName,
PROVINCE_CODE: currentUser?.ProvinceCode
}
}
const data = await handleSynchroMEMBERADDRESS(req);
if (data.Result_Code === 100) {
message.success(data.Result_Desc)
formRef?.current?.resetFields()
setCurrentRow(undefined)
handleModalVisible(false)
modalActionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
};
return (
<div>
<ProTable
search={false}
pagination={false}
options={false}
scroll={{ x: "100%", y: '500px' }}
columns={drawerColumns}
headerTitle={"用户地址"}
actionRef={modalActionRef}
bordered
request={async (params, sorter) => {
const req = {
SearchParameter: {
MEMBERSHIP_ID: currentBigRow?.MEMBERSHIP_ID,
PROVINCE_CODE: currentUser?.ProvinceCode || "",
OWNERUNIT_ID: 911,
ISVALID: 1
},
PageIndex: params.current,
PageSize: params.pageSize,
SortStr: "CREATE_DATE desc",
keyWord: {
Key: "USER_NAME",
Value: params?.searchText
}
}
const data = await handleGetMEMBERADDRESSList(req);
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) {
return { data: data.List, success: true, total: data.TotalCount }
}
return { data: [], success: true }
}}
/>
<Modal
title={
<div
className="modal-drag-title"
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新会员收货地址' : '新建会员收货地址'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setProvince("")
setCity("")
setCounty("")
}}
footer={<ModalFooter
hideDelete={!currentRow?.MEMBERADDRESS_ID}
handleDelete={async () => {
await handelDelete(currentRow?.MEMBERADDRESS_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setProvince("")
setCity("")
setCounty("")
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle=".modal-drag-title"
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
labelCol={{ style: { width: '80px' } }}
formRef={formRef}
autoFocusFirstInput
submitter={false}
preserve={false}
initialValues={currentRow}
onFinish={async (values) => {
let newValue: any = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, MEMBERADDRESS_ID: currentRow.MEMBERADDRESS_ID };
}
await handleAddUpdate(newValue);
handleConfirmLoading(false)
}}
>
<Row gutter={8}>
<Col span={12}>
<ProFormText
name="USER_NAME"
label="收货人名称"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="USER_SEX"
label="收货人性别"
options={[
{ label: "男", value: 1 },
{ label: "女", value: 2 },
]}
/>
</Col>
<Col span={12}>
<ProFormText
name="MOBILEPHONE"
label="手机号码"
/>
</Col>
<Col span={12}>
<ProFormText
name="RECEIVE_PROVINCE"
label="省"
fieldProps={{
onChange: (e: any) => {
console.log('eee', e);
setProvince(e.target.value)
}
}}
/>
</Col>
<Col span={12}>
<ProFormText
name="RECEIVE_CITY"
label="市"
fieldProps={{
onChange: (e: any) => {
setCity(e.target.value)
}
}}
/>
</Col>
<Col span={12}>
<ProFormText
name="RECEIVE_COUNTY"
label="区/县"
fieldProps={{
onChange: (e: any) => {
setCounty(e.target.value)
}
}}
/>
</Col>
<Col span={12}>
<ProFormText
name="ADDRESS"
label="收货地址"
disabled
/>
</Col>
<Col span={12}>
<ProFormText
name="DOORPLATE"
label="门牌号码"
/>
</Col>
<Col span={12}>
<ProFormSelect
name="ISDEFAULT"
label="默认地址"
options={[
{ label: "是", value: 1 },
{ label: "否", value: 0 },
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="TAGTYPE"
label="地址类型"
options={[
{ label: "家", value: 1000 },
{ label: "公司", value: 2000 },
{ label: "其他", value: 3000 },
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="ISVALID"
label="是否有效"
options={[
{ label: "是", value: 1 },
{ label: "否", value: 0 },
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="MEMBERADDRESS_DESC"
label="备注说明"
/>
</Col>
</Row>
</ProForm>
</Modal>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(AddressDetail);

View File

@ -21,6 +21,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { handeGetMemberAddressCombineList, handleDeleteMEMBERADDRESS, handleGetMEMBERADDRESSList, handleSynchroMEMBERADDRESS } from '../service';
import PageTitleBox from '@/components/PageTitleBox';
import AddressDetail from './components/addressDetail';
@ -531,6 +532,7 @@ const MemberAddress: React.FC<{ currentUser: CurrentUser | undefined }> = (props
}}
/>
{/* 这里和 会员详情里面的同步 如果有什么修改 记得一起改 */}
<Drawer
width={'80%'}
visible={showDetailDrawer}
@ -541,7 +543,8 @@ const MemberAddress: React.FC<{ currentUser: CurrentUser | undefined }> = (props
closable={false}
destroyOnClose
>
<ProTable
<AddressDetail currentBigRow={currentBigRow} currentUser={currentUser} />
{/* <ProTable
search={false}
pagination={false}
options={false}
@ -573,7 +576,7 @@ const MemberAddress: React.FC<{ currentUser: CurrentUser | undefined }> = (props
}
return { data: [], success: true }
}}
/>
/> */}
</Drawer>
<Modal

View File

@ -1,15 +1,523 @@
// 会员等级管理
import { ConnectState } from "@/models/connect";
import { connect, CurrentUser } from "umi";
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
const MembershipLevelManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
return (
<div>
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
</div>
)
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { handeDeleteFIELDENUM, handeGetFIELDENUMList, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service';
import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import classNames from 'classnames';
import session from '@/utils/session';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
message.error('请上传JPEG、jpg、png格式的图片文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('图片大小不超过 2MB!');
}
return isJpgOrPng && isLt2M;
}
const MembershipLevelManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const { confirm } = Modal;
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 分类的树形结构数据
const [typeTreeData, setTypeTreeData] = useState<any>()
// 表单里面的是否预售
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj')
const { data: FIELDEXPLAIN_ID } = useRequest(async () => {
const req: any = {
SearchParameter: {
FIELDEXPLAIN_FIELD: "MEMBERSHIP_LEVEL_YN"
}
}
const data = await handeGetFIELDEXPLAINList(req)
if (data && data.length > 0) {
let obj: any = data[0]
return obj.FIELDEXPLAIN_ID
}
})
// 文件列表
const [fileList, setFileList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
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: any = [
{
dataIndex: 'FIELDENUM_NAME',
title: '类别名称',
align: 'center',
width: 300,
ellipsis: true,
hideInSearch: true,
hideInDescriptions: true,
render: (_, record) => {
return <a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>{record?.FIELDENUM_NAME || ""}</a>
}
},
{
dataIndex: 'FIELDENUM_VALUE',
title: '等级枚举',
align: 'center',
width: 120,
ellipsis: true,
// valueType: 'treeSelect',
// valueEnum: typeTreeData,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_INDEX',
title: '类别索引',
align: 'center',
width: 120,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_STATUS',
title: '有效状态',
align: 'center',
width: 120,
ellipsis: true,
valueType: "select",
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
{
dataIndex: 'FIELDENUM_DESC',
title: '备注说明',
align: 'center',
ellipsis: true,
hideInSearch: true,
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该点餐自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.FIELDENUM_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 删除点餐类别
const handelDelete = async (id: any) => {
const req: any = {
FIELDENUMId: id
}
const result = await handeDeleteFIELDENUM(req)
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
// 同步点餐列表
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.FIELDENUM_ID) {
req = {
...currentRow,
...res,
}
} else {
req = {
...res,
FIELDEXPLAIN_ID: FIELDEXPLAIN_ID,
FIELDENUM_PID: -1,
}
}
const data = await handeSynchroFIELDENUM(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return (
<PageContainer header={{
title: '',
breadcrumb: {}
}}>
<ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}`
}}
formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
bordered
// 请求数据
request={async (params, sorter) => {
const req = {
FIELDEXPLAIN_FIELD: 'MEMBERSHIP_LEVEL_YN',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: params?.FIELDENUM_STATUS,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
console.log('datadatadatadatadata', data);
if (data && data.length > 0) {
setTypeTreeData(data)
return { data: data, success: true, total: data.length }
}
return { data: [], success: true }
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
/>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={
<div
className='membershipLevel'
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新会员等级类别' : '新建会员等级类别'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
footer={<ModalFooter
hideDelete={!currentRow?.FIELDENUM_ID}
handleDelete={async () => {
await handelDelete(currentRow?.FIELDENUM_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle='.membershipLevel'
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
labelCol={{ style: { width: 80 } }}
submitter={false}
preserve={false}
initialValues={currentRow ? {
...currentRow,
} : {
FIELDENUM_STATUS: 1,
}}
onFinish={async (values) => {
let newValue = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID };
}
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
handleConfirmLoading(false)
setFormPRESALE_TYPE(false)
}}
>
<Row gutter={8}>
{/* <Col span={12}>
<ProFormTreeSelect
name="FIELDENUM_PID"
label="上级类别"
request={async () => {
if (typeTreeData && typeTreeData.length > 0) {
let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData]
return list
} else {
const req = {
FIELDEXPLAIN_FIELD: 'MEMBERSHIP_LEVEL_YN',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 })
setTypeTreeData(data)
return data
} else {
return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }]
}
}
}}
fieldProps={{
fieldNames: {
label: 'FIELDENUM_NAME',
value: 'FIELDENUM_ID',
children: 'children'
},
showSearch: true,
filterTreeNode: (input, node) =>
(node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase())
}}
rules={[
{
required: true,
message: "请选择上级类别"
}
]}
/>
</Col> */}
<Col span={12}>
<ProFormText
name="FIELDENUM_NAME"
label="类别名称"
rules={[
{
required: true,
message: "请输入类别名称"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_INDEX"
label="类别索引"
rules={[
{
required: true,
message: "请输入类别索引"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_VALUE"
label="等级枚举"
rules={[
{
required: true,
message: "请输入等级枚举"
}
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="FIELDENUM_STATUS"
label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
rules={[
{
required: true,
message: "请选择有效状态"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="FIELDENUM_DESC"
label="备注"
/>
</Col>
</Row>
</ProForm>
</Modal>
</PageContainer >
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(MembershipLevelManage);

View File

@ -26,6 +26,7 @@ import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import classNames from 'classnames';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
@ -100,7 +101,24 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> =
render: (_, record) => {
return <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
<img style={{ width: '30px', height: '30px', marginRight: '5px', borderRadius: '50%' }} src={record?.USERDEFINEDTYPE_ICO || defaultIcon} />
<span style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }}>{record?.USERDEFINEDTYPE_NAME}</span>
<a style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }}
onClick={() => {
if (record?.USERDEFINEDTYPE_ICO) {
setFileList([{
name: "",
url: record?.USERDEFINEDTYPE_ICO
}])
}
if (record?.PRESALE_TYPE) {
setFormPRESALE_TYPE(true)
}
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>{record?.USERDEFINEDTYPE_NAME}</a>
</div>
}
},
@ -159,50 +177,50 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> =
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'option',
title: '操作',
width: 100,
ellipsis: true,
valueType: 'option',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
console.log('recordrecordrecord', record);
if (record?.USERDEFINEDTYPE_ICO) {
setFileList([{
name: "",
url: record?.USERDEFINEDTYPE_ICO
}])
}
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// console.log('recordrecordrecord', record);
// if (record?.USERDEFINEDTYPE_ICO) {
// setFileList([{
// name: "",
// url: record?.USERDEFINEDTYPE_ICO
// }])
// }
if (record?.PRESALE_TYPE) {
setFormPRESALE_TYPE(true)
}
// if (record?.PRESALE_TYPE) {
// setFormPRESALE_TYPE(true)
// }
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该点餐自定义类别列表信息吗?"
onConfirm={async () => {
handelDelete(record.USERDEFINEDTYPE_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该点餐自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.USERDEFINEDTYPE_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
@ -225,6 +243,11 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> =
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
@ -381,7 +404,27 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> =
setFormPRESALE_TYPE(false)
setFileList([])
}}
footer={
<ModalFooter
hideDelete={!currentRow?.USERDEFINEDTYPE_ID}
handleDelete={async () => {
await handelDelete(currentRow?.USERDEFINEDTYPE_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>
}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
@ -404,6 +447,7 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> =
formRef={formRef}
autoFocusFirstInput
submitter={false}
labelCol={{ style: { width: 80 } }}
preserve={false}
initialValues={currentRow ? {
...currentRow,

View File

@ -225,7 +225,7 @@ const OrderCategoryTree = ({ setSelectedId, reload, actionRef, currentUser, widt
</div>
</div>}
colSpan={!collapsible ? "300px" : "60px"}
title={!collapsible ? "请选择商城分类" : ""}
title={!collapsible ? "请选择经营商家" : ""}
headerBordered
collapsed={collapsible}
>

View File

@ -0,0 +1,232 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import ProCard from "@ant-design/pro-card";
import searchIcon from '@/assets/ai/searchIcon.png'
import { useRef, useState } from "react";
import { MenuFoldOutlined } from "@ant-design/icons";
import ProForm, { ProFormText } from "@ant-design/pro-form";
import { Button, Col, FormInstance, Row, Tree } from "antd";
import close from '@/assets/ai/close.png'
import { getServerpartTree } from "@/services/options";
import useRequest from "@ahooksjs/use-request";
import './style.less'
import { getMerchantShopTree } from "@/pages/Setting/Users/service";
import { handeGetSPRegionShopTree } from "../../service";
type DetailProps = {
setSelectedId: any; // 把选择的服务区 可以带给外层
reload?: boolean; // 选择服务区 是否可以刷新组件之外的内容
actionRef?: any; // 和reload配合使用 确认要刷新的内容
currentUser: any; // 当前用户的信息
width?: number; // 组件的宽度
otherFun?: any; // 点击之后要进行的其他操作 多个操作可以写在一个方法里面传进来
setCollapsible: any; // 是否收缩组件
collapsible: boolean; // 收缩组件的判断依据
haveTest?: boolean;// 是否有测试服务区
handleGetLeftTreeData?: any // 拿到树数据的方法 必须要有输出值的
noWj?: any // 把万佳商贸隐藏
selectOnly?: boolean// 传入的时候 仅支持单选
}
const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj, selectOnly }: DetailProps) => {
const searchTreeRef = useRef<FormInstance>();
// 默认的服务区树
const [allTreeViews, setAllTreeViews] = useState<any>()
// 是否要显示全部
const [isShowAllInTree, setIsShowAllInTree] = useState<boolean>(false)
// 加载服务区树
const { loading: treeLoading, data: treeViews } = useRequest(async () => {
const req: any = {
ProvinceCode: currentUser?.ProvinceCode,
// BusinessState: 1,
ShowOrder: true
}
const data = await handeGetSPRegionShopTree(req)
console.log('获取服务区经营商家树', data);
setTreeView(data)
})
// 显示服务区树搜索框
const [showServiceSearchBox, setShowServiceSearchBox] = useState<boolean>(false)
// 实际显示在左侧的服务区树
const [treeView, setTreeView] = useState<any>()
// 树要展开的行
const [treeShowRow, setTreeShowRow] = useState<any>()
// 筛选左侧的服务区树
const handleFilterServiceTree = async (value?: string) => {
const resList: any = JSON.parse(JSON.stringify(allTreeViews))
setSelectedId('')
if (resList && resList.length > 0 && value) {
setTreeView([])
const list: any = []
resList.forEach((item: any) => {
if (item.label.indexOf(value) !== -1) {
list.push(item)
} else {
if (item.children && item.children.length > 0) {
const childrenList: any = []
item.children.forEach((subItem: any) => {
if (subItem.label.indexOf(value) !== -1) {
childrenList.push(subItem)
}
})
item.children = childrenList
if (childrenList && childrenList.length > 0) {
list.push(item)
}
}
}
})
if (list && list.length > 0) {
const keyList: any = ['0-0']
list.forEach((item: any) => {
keyList.push(item.key)
})
setTreeShowRow(keyList)
}
setTimeout(() => {
setTreeView(list)
}, 100)
} else {
setTreeView([])
setTreeShowRow([])
setTreeView(allTreeViews)
}
}
// 根据传入的服务区id筛选剔除掉这个服务区
const handleFilterList = (list: any, id: any) => {
let res: any = []
list.forEach((item: any) => {
if (item.value === id) {
} else {
res.push(item)
}
})
console.log('res', res);
return res
}
// 仅支持单选一个服务区的时候 调用的方法
const convertTreeForSelectOnly = (treeData: any[]): any[] => {
return treeData.map(item => {
const newItem = {
...item,
disabled: item.type !== 1,
};
if (item.children) {
newItem.children = convertTreeForSelectOnly(item.children);
}
return newItem;
});
};
return (
<div>
<ProCard
style={{ width: !collapsible ? width ? `${width}px` : "300px" : "60px" }}
className="pageTable-leftnav"
bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20, width: !collapsible ? width ? `${width}px` : "300px" : "60px" }}
extra={<div className="leftSelectBox">
<img className="searchIcon" src={searchIcon} onClick={() => {
setShowServiceSearchBox(true)
}} />
<MenuFoldOutlined onClick={() => {
setCollapsible(!collapsible);
}} />
<div className="fixedBox" style={{ display: showServiceSearchBox ? 'flex' : 'none', width: width ? `${width}px` : '275px' }}>
<ProForm
formRef={searchTreeRef}
layout={'horizontal'}
submitter={{
render: () => {
return []
}
}}
isKeyPressSubmit
onFinish={(values: any) => {
return handleFilterServiceTree(values?.searchValue || '')
}}
>
<Row>
<Col span={15} className={'noBottom'}>
<ProFormText
name={'searchValue'}
fieldProps={{
placeholder: '请输入服务区名称'
}}
allowClear
/>
</Col>
<Col span={2}></Col>
<Col span={5}>
<Button type={'primary'} onClick={() => {
searchTreeRef.current?.submit()
}}></Button>
</Col>
</Row>
</ProForm>
<img style={{ width: '20px', height: '20px', cursor: 'pointer', marginLeft: '5px' }} src={close} onClick={() => {
setShowServiceSearchBox(false)
}} />
</div>
</div>}
colSpan={!collapsible ? "300px" : "60px"}
title={!collapsible ? "请选择服务区" : ""}
headerBordered
collapsed={collapsible}
>
{treeView && treeView.length > 0 ? <Tree
checkable
treeData={[{
label: '全部',
value: 0,
key: '0-0',
children: treeView
}]}
blockNode
// defaultExpandAll={isShowAllInTree ? false : true}
defaultExpandedKeys={['0-0']}
onCheck={(checkedKeys: React.Key[] | any, info) => {
if (selectOnly) {
// 只允许单选且只允许type为1
const checked = Array.isArray(checkedKeys.checked) ? checkedKeys.checked : checkedKeys;
const node = info.node;
if (node.type === 2) {
setSelectedId(node.value);
if (reload) {
actionRef?.current?.reload();
}
if (otherFun) {
otherFun(info);
}
} else {
// 取消非type=1的勾选
setSelectedId('');
}
} else {
// 多选逻辑
const selectedIds = info.checkedNodes.filter((n: any) => n?.type === 2)
setSelectedId(selectedIds.map((n: any) => n?.value)?.toString() || '')
if (reload) {
actionRef?.current?.reload()
}
if (otherFun) {
otherFun(info)
}
}
}}
fieldNames={{
title: "label",
key: "key"
}}
/> : ''}
</ProCard>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser,
}))(LeftSelectTree);

View File

@ -28,6 +28,8 @@ import defaultIcon from '../../../assets/brand/defaultIcon.png'
import OrderCategoryTree from './components/OrderCategoryTree';
import OrderCategoryManage from '../OrderCategoryManage';
import session from '@/utils/session';
import OrderCategoryTreeMultiple from './components/OrderCategoryTreeMultiple';
import Item from 'antd/lib/list/Item';
const beforeUpload = (file: any) => {
@ -47,6 +49,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
const { currentUser } = props
const { confirm } = Modal;
const actionRef = useRef<ActionType>();
const selectMerchantActionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
@ -80,6 +83,8 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
const [selectListShop, setSelectListShop] = useState<any>()
// 点击选择了的商品上架的加载效果
const [selectListShopLoading, setSelectListShopLoading] = useState<boolean>(false)
// 选择的当前商家
const [selectMerchant, setSelectMerchant] = useState<any>()
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
@ -96,6 +101,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
};
// 定义列表字段内容
const columns: any = [
{
title: '查询时间',
dataIndex: 'search_date',
@ -222,6 +228,11 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
];
// 新增商品的columns
const getProductsColumns: any = [
{
title: '查询内容',
dataIndex: 'SearchKeyValue',
hideInTable: true,
},
{
title: "序号",
width: 70,
@ -301,7 +312,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
req = {
...currentRow,
...res,
MERCHANTS_ID: selectedId,
// MERCHANTS_ID: selectedId,
OWNERUNIT_ID: currentUser?.OwnerUnitId,
OWNERUNIT_NAME: currentUser?.OwnerUnitName,
PROVINCE_CODE: currentUser?.ProvinceCode,
@ -312,7 +323,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
} else {
req = {
...res,
MERCHANTS_ID: selectedId,
// MERCHANTS_ID: selectedId,
OWNERUNIT_ID: currentUser?.OwnerUnitId,
OWNERUNIT_NAME: currentUser?.OwnerUnitName,
PROVINCE_CODE: currentUser?.ProvinceCode,
@ -407,7 +418,10 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
return (
<div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<OrderCategoryTree setSelectedId={setSelectedId} selectedId={selectedId} setCollapsible={setCollapsible} collapsible={collapsible} />
{/* 单选的 */}
{/* <OrderCategoryTree setSelectedId={setSelectedId} selectedId={selectedId} setCollapsible={setCollapsible} collapsible={collapsible} /> */}
{/* 多选的 */}
<OrderCategoryTreeMultiple setSelectedId={setSelectedId} selectedId={selectedId} setCollapsible={setCollapsible} collapsible={collapsible} />
<div style={{
width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
@ -432,7 +446,8 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
return []
}
console.log('selectedIdselectedIdselectedIdselectedIdselectedId', selectedId);
console.log('selectedId', selectedId);
const req = {
searchParameter: {
@ -442,7 +457,6 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
SELLER_IDS: selectedId || "",
UPPER_STATE: params?.UPPER_STATE === "-1" ? "" : params?.UPPER_STATE,
// USERDEFINEDTYPE_IDS: selectedId,
OPERATE_DATE_Start: params?.OPERATE_DATE_Start || "",
OPERATE_DATE_End: params?.OPERATE_DATE_End || "",
},
@ -463,17 +477,14 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
columns={columns}
toolbar={{
actions: [
selectedId ?
<>
<Button onClick={() => {
setGetProducts(true)
}}></Button>
< Button type={"primary"} onClick={() => {
<>
<Button type={"primary"} onClick={() => {
setGetProducts(true)
}}></Button>
{/* < Button type={"primary"} onClick={() => {
setShowDetail(true)
}}></Button>
</>
: "",
}}></Button> */}
</>
],
}}
/>
@ -603,6 +614,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
// 编辑数据
newValue = { ...values };
}
console.log('currentRowcurrentRowcurrentRow', currentRow);
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
@ -870,7 +882,11 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
<Modal
title={"获取商品"}
destroyOnClose={true}
width={1400}
width={1200}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={getProducts}
footer={<div style={{ width: "100%", display: 'flex', justifyContent: 'flex-end', boxSizing: 'border-box', padding: '0 16px' }}>
<Button type={"primary"} loading={selectListShopLoading} onClick={async () => {
@ -878,26 +894,59 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
setSelectListShopLoading(true)
console.log('selectListShopselectListShopselectListShop', selectListShop);
let idList: any = []
let list: any = []
selectListShop.forEach((item: any) => {
let obj: any = JSON.parse(JSON.stringify(item))
obj.MERCHANTS_ID = selectedId
obj.UPPER_STATE = 1
obj.STAFF_ID = currentUser?.ID
obj.STAFF_NAME = currentUser?.Name
obj.OPERATE_DATE = moment().format('YYYY-MM-DD HH:mm:ss')
obj.PROVINCE_CODE = currentUser?.ProvinceCode
list.push(obj)
if (idList.indexOf(item.SELLER_ID) === -1) {
idList.push(item.SELLER_ID)
}
})
console.log('idList', idList);
const req: any = {
list: list
let data: any = {}
for (let i = 0; i < idList.length; i++) {
let list: any = []
selectListShop.forEach((item: any) => {
let obj: any = JSON.parse(JSON.stringify(item))
// obj.MERCHANTS_ID = selectedId
obj.MERCHANTS_ID = item.SELLER_ID
obj.UPPER_STATE = 1
obj.STAFF_ID = currentUser?.ID
obj.STAFF_NAME = currentUser?.Name
obj.OPERATE_DATE = moment().format('YYYY-MM-DD HH:mm:ss')
obj.PROVINCE_CODE = currentUser?.ProvinceCode
list.push(obj)
})
const req: any = {
list: list
}
console.log('req', req);
data = await handeSyncSellerCommodityInfo(req)
}
console.log('req', req);
const data = await handeSyncSellerCommodityInfo(req)
console.log('data', data);
// let list: any = []
// selectListShop.forEach((item: any) => {
// let obj: any = JSON.parse(JSON.stringify(item))
// // obj.MERCHANTS_ID = selectedId
// obj.MERCHANTS_ID = item.SELLER_ID
// obj.UPPER_STATE = 1
// obj.STAFF_ID = currentUser?.ID
// obj.STAFF_NAME = currentUser?.Name
// obj.OPERATE_DATE = moment().format('YYYY-MM-DD HH:mm:ss')
// obj.PROVINCE_CODE = currentUser?.ProvinceCode
// list.push(obj)
// })
// const req: any = {
// list: list
// }
// console.log('req', req);
// const data = await handeSyncSellerCommodityInfo(req)
// console.log('data', data);
if (data.Result_Code === 100) {
message.success("同步成功!")
setGetProducts(false)
@ -916,45 +965,54 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
setGetProducts(false)
setSelectListShop([])
setSelectListShopLoading(false)
}}
bodyStyle={{
maxHeight: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
setSelectMerchant([])
}}
>
<ProTable
columns={getProductsColumns}
bordered
search={false}
rowKey={"COMMODITY_ID"}
options={false}
request={async () => {
const req: any = {
ProvinceCode: currentUser?.ProvinceCode,
ServerpartShopId: "",
SellerId: selectedId,
SearchKeyName: "",
SearchKeyValue: "",
PageIndex: 1,
PageSize: 999999,
SortStr: ""
}
console.log('reqreqreqreq', req);
const data = await handeGetBusinessCommodityList(req)
console.log('datadatadatadata', data);
if (data.List && data.List.length > 0) {
return { data: data.List, success: true, total: data.TotalCount }
}
return { data: [], success: true }
}}
rowSelection={{
type: "checkbox",
onChange: (_, selectedRows) => {
setSelectListShop(selectedRows)
}
}}
/>
<div style={{ width: '100%', height: '100%', display: 'flex', justifyContent: 'space-between' }}>
{/* <div style={{ width: '300px', height: '100%' }}> */}
{/* <OrderCategoryTree setSelectedId={setSelectMerchant} selectedId={selectMerchant} reload={true} actionRef={selectMerchantActionRef} /> */}
{/* <OrderCategoryTreeMultiple setSelectedId={setSelectedId} selectedId={selectedId} setCollapsible={setCollapsible} collapsible={collapsible} /> */}
{/* </div> */}
<div style={{ width: '100%', height: '100%' }}>
<ProTable
actionRef={selectMerchantActionRef}
columns={getProductsColumns}
bordered
scroll={{ x: '100%', y: '450px' }}
rowKey={"COMMODITY_ID"}
options={false}
request={async (params) => {
console.log('selectedIdselectedIdselectedId', selectedId);
const req: any = {
ProvinceCode: currentUser?.ProvinceCode,
ServerpartShopId: "",
// SellerId: selectMerchant?.toString(),
SellerId: selectedId?.toString(),
SearchKeyName: "COMMODITY_NAME",
SearchKeyValue: params?.SearchKeyValue || "",
PageIndex: 1,
PageSize: 999999,
SortStr: ""
}
console.log('reqreqreqreq', req);
const data = await handeGetBusinessCommodityList(req)
console.log('datadatadatadata', data);
if (data.List && data.List.length > 0) {
return { data: data.List, success: true, total: data.TotalCount }
}
return { data: [], success: true }
}}
rowSelection={{
type: "checkbox",
onChange: (_, selectedRows) => {
setSelectListShop(selectedRows)
}
}}
/>
</div>
</div>
</Modal>
</div >
);

View File

@ -16,6 +16,7 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele
import { handleGetCONSUMPTIONRECORDList, handleGetPOINTRECORDList } from "../service";
import PageTitleBox from "@/components/PageTitleBox";
import moment from 'moment'
import session from "@/utils/session";
const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => {
@ -29,6 +30,7 @@ const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => {
const [treeView, setTreeView] = useState<any>()
const [printIndex, setPrintIndex] = useState<number>(new Date().getTime())
let POINTTYPEObj = session.get('POINTTYPEObj')
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
@ -95,10 +97,14 @@ const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => {
align: 'center',
valueEnum: {
"0": "全部",
"1000": "消费赠送",
"2000": "消费抵扣",
"3000": "注册赠送"
...POINTTYPEObj
},
// valueEnum: {
// "0": "全部",
// "1000": "消费赠送",
// "2000": "消费抵扣",
// "3000": "注册赠送"
// },
initialValue: "0"
},
{
@ -161,7 +167,7 @@ const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => {
request={async (params) => {
const req: any = {
SearchParameter: {
PROVINCE_CODE: currentUser?.ProvinceCode || "",
// PROVINCE_CODE: currentUser?.ProvinceCode || "",
OWNERUNIT_ID: 911,
POINT_TYPE: params?.POINT_TYPE === '-2' ? '' : params?.POINT_TYPE,
POINT_SOURCE: params?.POINT_SOURCE === '0' ? '' : params?.POINT_SOURCE

View File

@ -0,0 +1,522 @@
// 积分枚举规则配置页面
import React, { useRef, useState, Suspense } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import PageTitleBox from '@/components/PageTitleBox';
import { uploadPicture } from '@/services/picture';
import defaultIcon from '../../../assets/brand/defaultIcon.png'
import classNames from 'classnames';
import session from '@/utils/session';
import { handeDeleteFIELDENUM, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM } from '../service';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
message.error('请上传JPEG、jpg、png格式的图片文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('图片大小不超过 2MB!');
}
return isJpgOrPng && isLt2M;
}
const PointConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
const { confirm } = Modal;
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 分类的树形结构数据
const [typeTreeData, setTypeTreeData] = useState<any>()
// 表单里面的是否预售
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj')
const { data: FIELDEXPLAIN_ID } = useRequest(async () => {
const req: any = {
SearchParameter: {
FIELDEXPLAIN_FIELD: "POINT_TYPE"
}
}
const data = await handeGetFIELDEXPLAINList(req)
if (data && data.length > 0) {
let obj: any = data[0]
return obj.FIELDEXPLAIN_ID
}
})
// 文件列表
const [fileList, setFileList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
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: any = [
{
dataIndex: 'FIELDENUM_NAME',
title: '类别名称',
align: 'center',
width: 300,
ellipsis: true,
hideInSearch: true,
hideInDescriptions: true,
render: (_, record) => {
return <a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>{record?.FIELDENUM_NAME || ""}</a>
}
},
{
dataIndex: 'FIELDENUM_VALUE',
title: '售后枚举',
align: 'center',
width: 120,
ellipsis: true,
// valueType: 'treeSelect',
// valueEnum: typeTreeData,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_INDEX',
title: '类别索引',
align: 'center',
width: 120,
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'FIELDENUM_STATUS',
title: '有效状态',
align: 'center',
width: 120,
ellipsis: true,
valueType: "select",
valueEnum: {
"1": "有效",
"0": "无效"
},
initialValue: "1"
},
{
dataIndex: 'FIELDENUM_DESC',
title: '备注说明',
align: 'center',
ellipsis: true,
hideInSearch: true,
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 100,
// ellipsis: true,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该点餐自定义类别列表信息吗?"
// onConfirm={async () => {
// handelDelete(record.FIELDENUM_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 删除点餐类别
const handelDelete = async (id: any) => {
const req: any = {
FIELDENUMId: id
}
const result = await handeDeleteFIELDENUM(req)
if (result.Result_Code !== 100) {
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}
}
// 同步点餐列表
const handleAddUpdate = async (res: any) => {
let req: any = {}
if (currentRow?.FIELDENUM_ID) {
req = {
...currentRow,
...res,
}
} else {
req = {
...res,
FIELDEXPLAIN_ID: FIELDEXPLAIN_ID,
FIELDENUM_PID: -1,
}
}
const data = await handeSynchroFIELDENUM(req)
handleConfirmLoading(false)
if (data.Result_Code === 100) {
message.success("新增成功!")
setCurrentRow(undefined)
formRef?.current?.resetFields()
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
actionRef.current?.reload()
} else {
message.error(data.Result_Desc)
}
}
return (
<PageContainer header={{
title: '',
breadcrumb: {}
}}>
<ProTable
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
scroll={{ y: 'calc(100vh - 410px)' }}
rowKey={(record) => {
return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}`
}}
formRef={formRef}
headerTitle={<PageTitleBox props={props} />} // 列表表头
actionRef={actionRef}
search={{ span: 6, labelWidth: 'auto' }}
bordered
// 请求数据
request={async (params, sorter) => {
const req = {
FIELDEXPLAIN_FIELD: 'POINT_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: params?.FIELDENUM_STATUS,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
setTypeTreeData(data)
return { data: data, success: true, total: data.length }
}
return { data: [], success: true }
}}
columns={columns}
toolbar={{
actions: [
// 新增按钮
<Button
key="new"
icon={<PlusOutlined />}
type="primary"
onClick={() => {
handleModalVisible(true);
}}
>
</Button>,
],
}}
/>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={
<div
className='orderCategoryModal'
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{currentRow ? '更新售后类别' : '新建售后类别'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
formRef.current?.resetFields();
setCurrentRow(undefined);
}}
footer={<ModalFooter
hideDelete={!currentRow?.FIELDENUM_ID}
handleDelete={async () => {
await handelDelete(currentRow?.FIELDENUM_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFormPRESALE_TYPE(false)
setFileList([])
}}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle='.orderCategoryModal'
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
labelCol={{ style: { width: 80 } }}
submitter={false}
preserve={false}
initialValues={currentRow ? {
...currentRow,
} : {
FIELDENUM_STATUS: 1,
}}
onFinish={async (values) => {
let newValue = { ...values };
if (currentRow) {
// 编辑数据
newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID };
}
// 如果有开关,要把开关的代码写进去
await handleAddUpdate(newValue);
handleConfirmLoading(false)
setFormPRESALE_TYPE(false)
}}
>
<Row gutter={8}>
{/* <Col span={12}>
<ProFormTreeSelect
name="FIELDENUM_PID"
label="上级类别"
request={async () => {
if (typeTreeData && typeTreeData.length > 0) {
let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData]
return list
} else {
const req = {
FIELDEXPLAIN_FIELD: 'POINT_TYPE',
FIELDEXPLAIN_ID: "",
FIELDENUM_PID: "",
FIELDENUM_STATUS: 1,
SearchKey: ""
}
const data = await handeGetNestingFIELDENUMList(req);
if (data && data.length > 0) {
data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 })
setTypeTreeData(data)
return data
} else {
return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }]
}
}
}}
fieldProps={{
fieldNames: {
label: 'FIELDENUM_NAME',
value: 'FIELDENUM_ID',
children: 'children'
},
showSearch: true,
filterTreeNode: (input, node) =>
(node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase())
}}
rules={[
{
required: true,
message: "请选择上级类别"
}
]}
/>
</Col> */}
<Col span={12}>
<ProFormText
name="FIELDENUM_NAME"
label="类别名称"
rules={[
{
required: true,
message: "请输入类别名称"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_INDEX"
label="类别索引"
rules={[
{
required: true,
message: "请输入类别索引"
}
]}
/>
</Col>
<Col span={12}>
<ProFormDigit
name="FIELDENUM_VALUE"
label="售后枚举"
rules={[
{
required: true,
message: "请输入售后枚举"
}
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="FIELDENUM_STATUS"
label="有效状态"
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
rules={[
{
required: true,
message: "请选择有效状态"
}
]}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="FIELDENUM_DESC"
label="备注"
/>
</Col>
</Row>
</ProForm>
</Modal>
</PageContainer >
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(PointConfig);

View File

@ -24,6 +24,8 @@ import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚
import { handleDeleteSCORESETTING, handleGetSCORESETTINGList, handleSynchroSCORESETTING } from '../service';
import session from '@/utils/session';
import PageTitleBox from '@/components/PageTitleBox';
import ModalFooter from '../scenicSpotConfig/component/modalFooter';
import PointConfig from './PointConfig';
@ -34,12 +36,19 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
const [currentRow, setCurrentRow] = useState<any>();
const [showDetail, setShowDetail] = useState<boolean>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [showConfigModal, setShowConfigModal] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const [searchParams, setSearchParams] = useState<any>();
// 积分类型的枚举
let SCORETYPEList = session.get('SCORETYPEList')
let SCORETYPEObj = session.get('SCORETYPEObj')
let SCORETYPETree = session.get('SCORETYPETree')
let MEMBERSHIPLEVELYNObj = session.get('MEMBERSHIPLEVELYNObj')
let MEMBERSHIPLEVELYNList = session.get('MEMBERSHIPLEVELYNList')
let MEMBERSHIPTYPEYNList = session.get('MEMBERSHIPTYPEYNList')
let MEMBERSHIPTYPEYNObj = session.get('MEMBERSHIPTYPEYNObj')
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
@ -77,9 +86,35 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
{
dataIndex: 'SCORE_NAME',
title: '规则名称',
width: 200,
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.SCORE_NAME ? <a onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}>
{record?.SCORE_NAME}
</a> : '-'
}
},
{
dataIndex: 'MEMBERSHIP_LEVEL',
title: '会员等级',
width: 120,
align: 'center',
hideInSearch: true,
valueType: 'select',
valueEnum: MEMBERSHIPLEVELYNObj
},
{
dataIndex: 'MEMBERSHIP_TYPE',
title: '会员类型',
width: 120,
align: 'center',
hideInSearch: true,
valueType: 'select',
valueEnum: MEMBERSHIPTYPEYNObj
},
{
dataIndex: 'EXCHANGE_BASE',
@ -95,14 +130,14 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'MEET_AMOUNT',
title: '满足金额',
valueType: 'money',
width: 120,
align: 'center',
hideInSearch: true,
},
// {
// dataIndex: 'MEET_AMOUNT',
// title: '满足金额',
// valueType: 'money',
// width: 120,
// align: 'center',
// hideInSearch: true,
// },
{
dataIndex: 'EARN_POINTS',
title: '赚取积分',
@ -117,28 +152,28 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
align: 'center',
hideInSearch: true,
},
{
dataIndex: 'START_DATE',
title: '开始时间',
width: 150,
valueType: 'date',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.START_DATE ? moment(record?.START_DATE).format('YYYY-MM-DD HH:mm:ss') : ""
}
},
{
dataIndex: 'END_DATE',
title: '结束时间',
width: 150,
valueType: 'date',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.END_DATE ? moment(record?.END_DATE).format('YYYY-MM-DD HH:mm:ss') : ""
}
},
// {
// dataIndex: 'START_DATE',
// title: '开始时间',
// width: 150,
// valueType: 'date',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return record?.START_DATE ? moment(record?.START_DATE).format('YYYY-MM-DD HH:mm:ss') : ""
// }
// },
// {
// dataIndex: 'END_DATE',
// title: '结束时间',
// width: 150,
// valueType: 'date',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return record?.END_DATE ? moment(record?.END_DATE).format('YYYY-MM-DD HH:mm:ss') : ""
// }
// },
// {
// dataIndex: 'EXPIRY_DATE',
// title: '有效期',
@ -163,12 +198,12 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
title: '有效状态',
width: 120,
align: 'center',
hideInSearch: true,
valueType: 'select',
valueEnum: {
"1": "有效",
"0": "无效"
}
},
initialValue: "1"
},
{
dataIndex: 'ADDTIME',
@ -199,36 +234,36 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
// align: 'center',
// hideInSearch: true,
// },
{
dataIndex: 'option',
title: '操作',
width: 150,
valueType: 'option',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该积分规则列表信息吗?"
onConfirm={async () => {
await handelDelete(record.SCORESETTING_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 150,
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该积分规则列表信息吗?"
// onConfirm={async () => {
// await handelDelete(record.SCORESETTING_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
];
const handelDelete = async (id: number) => {
@ -241,6 +276,8 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
} else {
message.success('删除成功!');
actionRef.current?.reload()
handleConfirmLoading(false)
handleModalVisible(false)
}
};
@ -251,11 +288,15 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
if (currentRow?.SCORESETTING_ID) {
req = {
...currentRow,
...res
...res,
MEMBERSHIP_TYPE: res.MEMBERSHIP_TYPE === 0 ? '' : res.MEMBERSHIP_TYPE,
MEMBERSHIP_LEVEL: res.MEMBERSHIP_LEVEL === 0 ? '' : res.MEMBERSHIP_LEVEL,
}
} else {
req = {
...res,
MEMBERSHIP_TYPE: res.MEMBERSHIP_TYPE === 0 ? '' : res.MEMBERSHIP_TYPE,
MEMBERSHIP_LEVEL: res.MEMBERSHIP_LEVEL === 0 ? '' : res.MEMBERSHIP_LEVEL,
ADDTIME: moment().format('YYYY-MM-DD HH:mm:ss'),
STAFF_ID: currentUser?.ID,
STAFF_NAME: currentUser?.Name,
@ -304,7 +345,7 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
searchParameter: {
PROVINCE_CODE: currentUser?.ProvinceCode || "",
OWNERUNIT_ID: 911,
SCORESETTING_STATE: 1
SCORESETTING_STATE: params?.SCORESETTING_STATE
},
PageIndex: 1,
PageSize: 20
@ -330,6 +371,15 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
>
</Button>,
<Button
key="new"
type="primary"
onClick={() => {
setShowConfigModal(true);
}}
>
</Button>
],
}}
pagination={{ defaultPageSize: 10 }}
@ -360,6 +410,10 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
@ -370,6 +424,23 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
handleConfirmLoading(false)
handleModalVisible(false)
}}
footer={<ModalFooter
hideDelete={!currentRow?.SCORESETTING_ID}
handleDelete={async () => {
await handelDelete(currentRow?.SCORESETTING_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
@ -394,9 +465,11 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
autoFocusFirstInput
submitter={false}
preserve={false}
labelCol={{ style: { width: 80 } }}
initialValues={{
...currentRow,
SCORESETTING_STATE: (currentRow?.SCORESETTING_STATE || currentRow?.SCORESETTING_STATE === 0) ? currentRow?.SCORESETTING_STATE : 1
SCORESETTING_STATE: (currentRow?.SCORESETTING_STATE || currentRow?.SCORESETTING_STATE === 0) ? currentRow?.SCORESETTING_STATE : 1,
MEMBERSHIP_LEVEL: currentRow?.MEMBERSHIP_LEVEL ? currentRow?.MEMBERSHIP_LEVEL.toString() : ""
}}
onFinish={async (values) => {
let newValue: any = { ...values };
@ -448,30 +521,49 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
]}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="MEMBERSHIP_LEVEL"
label="会员等级"
options={MEMBERSHIPLEVELYNList}
/>
</Col>
<Col span={12}>
<ProFormSelect
name="MEMBERSHIP_TYPE"
label="会员类型"
options={MEMBERSHIPTYPEYNList}
/>
</Col>
<Col span={12}>
<ProFormText
name="EXCHANGE_BASE"
label="兑换基数"
/>
</Col>
<Col span={12}>
<ProFormText
name="CONVERTIBLE_PROPORTION"
label="兑换比例"
/>
</Col>
<Col span={12}>
<ProFormText
name="MEET_AMOUNT"
label="满足金额"
/>
</Col>
<Col span={12}>
<ProFormText
name="EARN_POINTS"
label="赚取积分"
/>
</Col>
<Col span={12}>
<ProFormText
name="CONVERTIBLE_PROPORTION"
label="兑换基数"
/>
</Col>
{/* <Col span={12}>
<ProFormText
name="MEET_AMOUNT"
label="满足金额"
/>
</Col> */}
<Col span={12}>
<ProFormText
name="GROWTH_VALUE"
@ -488,7 +580,7 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
]}
/>
</Col>
<Col span={12}>
{/* <Col span={12}>
<ProFormDatePicker
width="lg"
name="START_DATE"
@ -501,10 +593,7 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
name="END_DATE"
label="结束时间"
/>
</Col>
</Col> */}
<Col span={24}>
<ProFormTextArea
name="SCORESETTING_DESC"
@ -514,6 +603,23 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
</Row>
</ProForm>
</Modal>
<Modal
title={"成长值枚举配置"}
destroyOnClose={true}
width={1200}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={showConfigModal}
footer={false}
onCancel={() => {
setShowConfigModal(false)
}}
>
<PointConfig />
</Modal>
</PageContainer>
);
};

View File

@ -95,28 +95,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
return record?.COMMODITY_STATE === 1 || record?.USERDEFINEDTYPE_STATE === 1 ? '有效' : '无效'
}
},
{
dataIndex: 'USERDEFINEDTYPE_DATE',
title: '添加时间',
width: 200,
ellipsis: true,
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.USERDEFINEDTYPE_DATE ? moment(record?.USERDEFINEDTYPE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
},
{
dataIndex: 'OPERATE_DATE',
title: '操作时间',
width: 200,
align: 'center',
ellipsis: true,
hideInSearch: true,
render: (_, record) => {
return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
},
{
dataIndex: 'USERDEFINEDTYPE_DESC',
title: '备注说明',
@ -136,6 +115,28 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
ellipsis: true,
hideInSearch: true,
},
{
dataIndex: 'OPERATE_DATE',
title: '修改时间',
width: 200,
align: 'center',
ellipsis: true,
hideInSearch: true,
render: (_, record) => {
return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
},
{
dataIndex: 'USERDEFINEDTYPE_DATE',
title: '新增时间',
width: 200,
ellipsis: true,
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.USERDEFINEDTYPE_DATE ? moment(record?.USERDEFINEDTYPE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
},
{
dataIndex: 'option',
title: '操作',
@ -389,6 +390,10 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
@ -423,6 +428,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine
autoFocusFirstInput
submitter={false}
preserve={false}
labelCol={{ style: { width: 80 } }}
// initialValues={currentRow}
request={async () => {
return currentRow ? {

View File

@ -1,15 +1,443 @@
// 注册留存分析
import { ConnectState } from "@/models/connect";
import { connect, CurrentUser } from "umi";
const RegistrationRetentionAnalysis: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
import { connect, Link } from "umi";
import type { CurrentUser } from "umi";
import type { ConnectState } from "@/models/connect";
import React, { useEffect, useRef, useState } from "react";
import ProCard from "@ant-design/pro-card";
import { MenuFoldOutlined } from "@ant-design/icons";
import { FormInstance, Tooltip } from "antd";
import { Button, message, Space, Spin, Tree } from "antd";
import useRequest from "@ahooksjs/use-request";
import { getServerpartTree } from "@/services/options";
import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table";
import ReactHTMLTableToExcel from "react-html-table-to-excel";
import moment from 'moment'
import PageTitleBox from "@/components/PageTitleBox";
import { handleGetBEHAVIORRECORDList } from "@/pages/Setting/OperationLog/service";
const RegistrationRetentionAnalysis: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { dispatch, children, 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 [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 [tableData, setTableData] = useState<any>()
// 表格加载效果
const [tableLoading, setTableLoading] = useState<boolean>(false)
// 判断是否是第一次
const [isFirst, setIsFirst] = useState<boolean>(true)
const [columnsStateMap, setColumnsStateMap] = useState<any>({
BEHAVIORRECORD_ID: { show: false },
OPERATING_SYSTEM: { show: false },
BROWSER_VERSION: { show: false },
});
// 改变panes
const handleTabsPanes = (payload: any): void => {
if (dispatch) {
dispatch({
type: 'global/changeTabsRoutes',
payload: { data: payload, action: 'add' },
});
}
};
const columns: any = [
{
title: '日志编号',
width: 120,
hideInSearch: true,
dataIndex: 'BEHAVIORRECORD_ID'
},
{
title: '查询内容',
hideInTable: true,
dataIndex: 'searchValue'
},
{
title: '系统模块',
width: 150,
hideInSearch: true,
ellipsis: true,
dataIndex: 'BEHAVIORRECORD_ROUTNAME',
render: (_, record) => {
// return record?.BEHAVIORRECORD_ROUTNAME ? <a onClick={() => {
// console.log('record', record);
// const req: any = {
// key: record.BEHAVIORRECORD_ROUT,
// path: record.BEHAVIORRECORD_ROUT,
// title: record.BEHAVIORRECORD_ROUTNAME,
// children: children
// }
// console.log('req', req);
// handleTabsPanes(req)
// }}>
// {record?.BEHAVIORRECORD_ROUTNAME || ""}
// </a> : "-"
return record?.BEHAVIORRECORD_ROUTNAME ? <Link to={record.BEHAVIORRECORD_ROUT}>
{record?.BEHAVIORRECORD_ROUTNAME}
</Link> : ""
}
},
{
title: '操作类型',
dataIndex: 'BEHAVIORRECORD_TYPE',
// hideInSearch: true,
width: 100,
valueType: 'select',
align: 'center',
valueEnum: {
"1000": '操作',
"1001": '编辑',
"1002": '删除',
"2000": '查询'
},
initialValue: "2000",
},
{
title: '操作人员',
hideInSearch: true,
dataIndex: 'USER_NAME',
ellipsis: true,
width: 120,
// render: (_, record) => {
// return <Tooltip title={record?.BEHAVIORRECORD_EXPLAIN || ''}>
// {record?.USER_NAME || '-'}
// </Tooltip>
// }
},
{
title: '操作地址',
hideInSearch: true,
dataIndex: 'USER_LOGINIP',
width: 150,
},
{
title: '操作地点',
hideInSearch: true,
dataIndex: 'USER_LOGINPLACE',
width: 160,
ellipsis: true,
},
{
title: '响应时间(s)',
hideInSearch: true,
dataIndex: 'BEHAVIORRECORD_DURATION',
width: 120,
align: 'center',
sorter: (a, b) => a.BEHAVIORRECORD_DURATION - b.BEHAVIORRECORD_DURATION,
render: (_, record) => {
return `${record?.BEHAVIORRECORD_DURATION ? record?.BEHAVIORRECORD_DURATION : ""}`
}
},
{
title: '操作内容',
hideInSearch: true,
dataIndex: 'BEHAVIORRECORD_EXPLAIN',
width: 250,
align: 'center',
ellipsis: true,
},
// {
// title: '操作状态',
// dataIndex: 'status',
// hideInSearch: true,
// width: 100,
// render: (_, record) => {
// return '成功'
// }
// },
{
title: '操作日期',
width: 160,
valueType: 'date',
dataIndex: 'BEHAVIORRECORD_TIME',
initialValue: moment(),
render: (_, record) => {
return record?.BEHAVIORRECORD_TIME
}
},
{
title: '操作平台',
width: 160,
dataIndex: 'SOURCE_PLATFORM',
valueType: 'select',
valueEnum: {
// "驿商云平台": "驿商云平台",
// "数智化看板": "数智化看板",
// "驿行畅旅": "驿行畅旅",
// "驿付商家版": "驿付商家版",
// "微信公众号": "微信公众号",
// "驿商云客户端": "驿商云客户端",
"彩云驿出行": "彩云驿出行",
},
initialValue: '彩云驿出行'
},
{
title: '操作系统',
width: 150,
hideInSearch: true,
dataIndex: 'OPERATING_SYSTEM',
},
{
title: '浏览器版本',
width: 150,
hideInSearch: true,
dataIndex: 'BROWSER_VERSION',
},
{
title: '接口信息',
width: 150,
hideInSearch: true,
dataIndex: 'REQUEST_INFO',
ellipsis: true,
},
// {
// title: '调用入参',
// width: 150,
// hideInSearch: true,
// dataIndex: 'BEHAVIORRECORD_DESC',
// ellipsis: true,
// },
// {
// title: '操作',
// width: 120,
// dataIndex: 'options'
// }
]
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-saleRankReport'); // 给table添加id值与按钮上的table字段对应
container.appendChild(tempTable); // 把创建的节点添加到页面容器中
setShowLoading(false)
downloadBtnRef.current.handleDownload();
setShowExportTable(false)
tempTable.remove() // 防止重复打印一个内容
}
const handleGetTableData = async () => {
const res: any = formRef.current?.getFieldsValue()
console.log('resresres', res);
let params: any = {
BEHAVIORRECORD_TIME: moment(res.BEHAVIORRECORD_TIME._d).format('YYYY-MM-DD'),
SOURCE_PLATFORM: res.SOURCE_PLATFORM,
BEHAVIORRECORD_TYPE: res.BEHAVIORRECORD_TYPE,
...res
}
setTableLoading(true)
const req: any = {
SearchParameter: {
BEHAVIORRECORD_TIME_Start: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'),
BEHAVIORRECORD_TIME_End: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'),
SOURCE_PLATFORMS: params?.SOURCE_PLATFORM,
// BEHAVIORRECORD_TYPE: params?.BEHAVIORRECORD_TYPE
},
SortStr: 'BEHAVIORRECORD_TIME desc',
KeyWord: {
Key: 'BEHAVIORRECORD_ROUTNAME,USER_NAME,VISIT_CHANNELS,BEHAVIORRECORD_PREROUT',
Value: params?.searchValue || ''
},
PageIndex: 1,
PageSize: 100
}
setSearchParams(params)
const data = await handleGetBEHAVIORRECORDList(req)
setTableData(data)
setTableLoading(false)
const allReq: any = {
SearchParameter: {
BEHAVIORRECORD_TIME_Start: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'),
BEHAVIORRECORD_TIME_End: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'),
SOURCE_PLATFORMS: params?.SOURCE_PLATFORM,
// BEHAVIORRECORD_TYPE: params?.BEHAVIORRECORD_TYPE
},
SortStr: 'BEHAVIORRECORD_TIME desc',
KeyWord: {
Key: 'BEHAVIORRECORD_ROUTNAME,USER_NAME,VISIT_CHANNELS,BEHAVIORRECORD_PREROUT',
Value: params?.searchValue || ''
},
PageIndex: 1,
PageSize: 999999
}
const allData = await handleGetBEHAVIORRECORDList(allReq)
setTableData(allData)
setIsFirst(false)
}
useEffect(async () => {
handleGetTableData()
}, [])
return (
<div>
<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
}}
scroll={{ y: 'calc(100vh - 450px)' }}
headerTitle={<PageTitleBox props={props} />} // 列表表头
search={{ span: 6 }}
pagination={{ pageSize: 100 }}
dataSource={tableData}
loading={tableLoading}
request={async (params) => {
if (!isFirst) {
handleGetTableData()
}
// console.log('data', data);
// if (data && data.length > 0) {
// setReqDetailList(data)
// return { data, success: true }
// }
// return { data: [], success: true }
}}
toolbar={{
actions: [
<span style={{ visibility: 'hidden' }}>
<ReactHTMLTableToExcel
buttonText={'导出excel'}
ref={downloadBtnRef}
table="table-to-xls-saleRankReport"
filename={`操作日志列表`}
sheet="sheet1"
/>
</span>,
<Button
key="new"
type="primary"
onClick={(e) => {
if (reqDetailList && reqDetailList.length > 0) {
setShowLoading(true)
setTimeout(() => {
setShowExportTable(true)
setTimeout(() => {
exportTable(e)
}, 100)
}, 100)
} else {
message.error('暂无数据可导出!')
}
}}
>
excel
</Button>
]
}}
columnsState={{
value: columnsStateMap,
onChange: setColumnsStateMap,
}}
onChange={(pagination, filters, sorter, extra) => {
if (extra.action === 'sort') {
return;
}
}}
/>
</div>
</div>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(RegistrationRetentionAnalysis);
}))(RegistrationRetentionAnalysis);

View File

@ -12,6 +12,7 @@ import Draggable from "react-draggable";
import React from "react";
import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
import moment from 'moment'
import ModalFooter from "../scenicSpotConfig/component/modalFooter";
const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
const { currentUser } = props
@ -29,6 +30,8 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const [currentRow, setCurrentRow] = useState<any>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
// 当前查询的文字
const [currentSearchText, setCurrentSearchText] = useState<string>('')
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
@ -71,6 +74,14 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
hideInSearch: true,
width: 300,
ellipsis: true,
render: (_, record) => {
return record?.MERCHANTS_NAME ? <a onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}>
{highlightText(record?.MERCHANTS_NAME, currentSearchText)}
</a> : "-"
}
},
{
dataIndex: 'MERCHANTS_EN',
@ -79,6 +90,9 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
hideInSearch: true,
width: 150,
ellipsis: true,
render: (_, record) => {
return highlightText(record?.MERCHANTS_EN, currentSearchText)
}
},
{
dataIndex: 'MERCHANTS_TYPE',
@ -117,6 +131,14 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
},
initialValue: "1"
},
{
dataIndex: 'searchText',
title: '查询内容',
align: 'center',
hideInTable: true,
width: 120,
ellipsis: true,
},
{
dataIndex: 'MERCHANTS_TELEPHONE',
title: '联系电话',
@ -125,40 +147,57 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
width: 120,
ellipsis: true,
},
{
dataIndex: 'option',
title: '操作',
valueType: 'option',
align: 'center',
hideInSearch: true,
width: 120,
fixed: "right",
ellipsis: true,
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
setCurrentRow({ ...record });
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该商品管理列表信息吗?"
onConfirm={async () => {
await handelDelete(record.MERCHANTS_ID);
}}
>
<a></a>
</Popconfirm>
</Space>
);
},
},
// {
// dataIndex: 'option',
// title: '操作',
// valueType: 'option',
// align: 'center',
// hideInSearch: true,
// width: 120,
// fixed: "right",
// ellipsis: true,
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// setCurrentRow({ ...record });
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该商品管理列表信息吗?"
// onConfirm={async () => {
// await handelDelete(record.MERCHANTS_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space>
// );
// },
// },
]
// 给颜色标红的
const highlightText = (text: string, searchText: string) => {
if (!text || !searchText) return text;
const regex = new RegExp(`(${searchText})`, 'gi');
const parts = text.split(regex);
return (
<span>
{parts.map((part, i) =>
part.toLowerCase() === searchText.toLowerCase() ?
<span key={i} style={{ color: 'red' }}>{part}</span> :
part
)}
</span>
);
};
const handelDelete = async (MERCHANTS_ID: number) => {
const result = await handeDeleteMERCHANTS({ MERCHANTSId: MERCHANTS_ID });
@ -166,6 +205,8 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
handleConfirmLoading(false)
handleModalVisible(false)
actionRef.current?.reload()
}
};
@ -241,9 +282,14 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
MERCHANTS_AUTOTYPE: selectedId,
MERCHANTS_STATE: params?.MERCHANTS_STATE === '-1' ? '' : params?.MERCHANTS_STATE
},
keyWord: {
key: "MERCHANTS_NAME,MERCHANTS_EN",
value: params?.searchText || ""
},
PageIndex: 1,
PageSize: 999999,
}
setCurrentSearchText(params?.searchText || "")
const data = await handeGetMERCHANTSList(req);
console.log('datadatadatadatadata', data);
if (data.List && data.List.length > 0) {
@ -296,7 +342,11 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
</div>
}
destroyOnClose={true}
width={1200}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
confirmLoading={confirmLoading}
afterClose={() => {
@ -307,6 +357,22 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
handleConfirmLoading(false)
handleModalVisible(false)
}}
footer={<ModalFooter
hideDelete={!currentRow?.MERCHANTS_ID}
handleDelete={() => {
handelDelete(currentRow?.MERCHANTS_ID)
}}
handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
}}
handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}}
/>}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
@ -328,6 +394,7 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
layout={'horizontal'}
formRef={formRef}
autoFocusFirstInput
labelCol={{ style: { width: 80 } }}
submitter={false}
preserve={false}
initialValues={currentRow ? {

View File

@ -23,6 +23,7 @@ import './style.less'
import memberInfoIcon from '@/assets/detail/memberInfoIcon.png'
import closeIcon from '@/assets/detail/closeIcon.png'
import memberDetailIcon from '@/assets/detail/memberDetailIcon.png'
import AddressDetail from "../MemberAddress/components/addressDetail";
@ -76,7 +77,6 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
MEMBERSHIP_ADDRESS: { show: false },
PLUS_EXPIRYDATE: { show: false },
RECOMMEND_NAME: { show: false },
ADDTIME: { show: false },
MEMBERSHIP_DESC: { show: false },
});
const onDraggaleStart = (event, uiData) => {
@ -95,21 +95,20 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
const columns: any = [
{
title: "查询内容",
title: "用户昵称",
width: 200,
dataIndex: "MEMBERSHIP_NAME",
ellipsis: true,
align: 'center',
fixed: 'left',
// render: (_, record) => {
// return <a onClick={() => {
// console.log('recordrecord', record);
// setCurrentRow(record)
// setShowDetailDrawer(true)
// }}>
// {record?.MEMBERSHIP_NAME || ""}
// </a>
// }
render: (_, record) => {
return <a onClick={() => {
setCurrentRow(record)
setShowDetailDrawer(true)
}}>
{record?.MEMBERSHIP_NAME || ""}
</a>
},
fieldProps: {
placeholder: "请输入要查询的内容"
}
@ -247,21 +246,22 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
dataIndex: "MEMBERSHIP_POINT",
hideInSearch: true,
ellipsis: true,
sorter: true,
align: 'center',
},
{
title: "付费会员",
width: 120,
dataIndex: "ISPLUS",
hideInSearch: true,
ellipsis: true,
align: 'center',
valueType: 'select',
valueEnum: {
0: "否",
1: "是"
}
},
// {
// title: "付费会员",
// width: 120,
// dataIndex: "ISPLUS",
// hideInSearch: true,
// ellipsis: true,
// align: 'center',
// valueType: 'select',
// valueEnum: {
// 0: "否",
// 1: "是"
// }
// },
{
title: "付费有效期",
width: 120,
@ -276,6 +276,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
dataIndex: "ACCOUNT_BALANCE",
hideInSearch: true,
ellipsis: true,
sorter: true,
align: 'center',
},
{
@ -286,24 +287,31 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
ellipsis: true,
align: 'center',
},
// {
// title: "会员状态",
// width: 120,
// dataIndex: "MEMBERSHIP_STATE",
// ellipsis: true,
// align: 'center',
// valueType: 'select',
// valueEnum: COMPANY_STATEObj,
// initialValue: "1000"
// },
{
title: "会员状态",
width: 120,
dataIndex: "MEMBERSHIP_STATE",
ellipsis: true,
align: 'center',
valueType: 'select',
valueEnum: COMPANY_STATEObj,
initialValue: "1000"
},
{
title: "添加时间",
title: "注册时间",
width: 150,
dataIndex: "ADDTIME",
align: 'center',
hideInSearch: true,
ellipsis: true,
align: 'center',
sorter: true,
// sorter: (a, b) => {
// const timeA = new Date(a.ADDTIME).getTime();
// const timeB = new Date(b.ADDTIME).getTime();
// return timeB - timeA; // 倒序排序
// },
// 默认排序配置
defaultSortOrder: 'descend',
render: (_, record) => {
return record?.ADDTIME ? moment(record?.ADDTIME).format('YYYY-MM-DD') : '-'
}
@ -315,23 +323,23 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
hideInSearch: true,
ellipsis: true,
},
{
title: "操作",
width: 120,
dataIndex: "options",
hideInSearch: true,
align: 'center',
ellipsis: true,
fixed: "right",
render: (_, record) => {
return <Space>
<a onClick={() => {
setCurrentRow(record)
setShowDetailDrawer(true)
}}></a>
</Space>
}
}
// {
// title: "操作",
// width: 120,
// dataIndex: "options",
// hideInSearch: true,
// align: 'center',
// ellipsis: true,
// fixed: "right",
// render: (_, record) => {
// return <Space>
// <a onClick={() => {
// setCurrentRow(record)
// setShowDetailDrawer(true)
// }}>详情</a>
// </Space>
// }
// }
]
const exportTable = (e) => {
@ -660,8 +668,11 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
scroll={{ x: '100%', y: 'calc(100vh - 450px)' }}
headerTitle={<PageTitleBox props={props} />}
search={{ span: 6 }}
request={async (params) => {
console.log('paramsparamsparams', params);
request={async (params, sorter) => {
const sortstr = Object.keys(sorter).map(n => {
const value = sorter[n]
return value ? `${n} ${value.replace('end', '')}` : ''
})
const req: any = {
SearchParameter: {
PROVINCE_CODE: currentUser?.ProvinceCode || "",
@ -676,6 +687,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
},
PageIndex: params.current || 1,
PageSize: 20,
sortstr: sortstr.length ? sortstr.toString() : "",
}
setSearchParams(params)
const data = await handleGetMEMBERSHIPList(req)
@ -744,6 +756,10 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
modalRef.current?.resetFields();
setCurrentRow(undefined);
}}
bodyStyle={{
maxHeight: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
onCancel={() => {
setShowDetailDrawer(false)
setCurrentRow(undefined);
@ -753,7 +769,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle=".modal-drag-title"
handle=".modalTop"
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
@ -767,10 +783,10 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
initialValues={currentRow ? {
...currentRow,
MEMBERSHIP_BIRTHDAY: currentRow?.MEMBERSHIP_BIRTHDAY ? moment(currentRow?.MEMBERSHIP_BIRTHDAY).format('YYYY-MM-DD') : '',
ADDTIME: currentRow?.ADDTIME ? moment(currentRow?.ADDTIME).format('YYYY-MM-DD HH:mm:ss') : ''
ADDTIME: currentRow?.ADDTIME ? moment(currentRow?.ADDTIME).format('YYYY-MM-DD') : '',
} : {}}
>
<div className="modalTop">
<div className="modalTop" style={{ position: 'fixed', background: '#fff', borderTopLeftRadius: "16px", borderTopRightRadius: "16px", zIndex: 999, borderBottom: '1px solid #D5D8DE' }}>
<div className="modalTopLeft">
<img className="memberIcon" src={memberInfoIcon} />
<span className="modalTitle"></span>
@ -781,7 +797,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
}} />
</div>
</div>
<div className="topDetail">
<div className="topDetail" style={{ paddingTop: '90px' }}>
<div className="topDetailLeft">
<img className="headerImage" src={currentRow?.MEMBERSHIP_HEADIMAGEURL || "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"} />
</div>
@ -799,6 +815,15 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
<div className="topDetailItem">
<Row gutter={8}>
<Col span={8} className="memberInfoDetailItem">
<ProFormSelect
name={"MEMBERSHIP_SEX"}
label={"性别"}
readonly
options={[{ label: "男", value: 1 }, { label: "女", value: 2 }, { label: "-", value: 0 }]}
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"CERTIFICATE_NUMBER"}
@ -831,14 +856,22 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={16} className="memberInfoDetailItem">
<Col span={8} className="memberInfoDetailItem">
<ProFormText
name={"ADDTIME"}
label={"注册时间"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
{/* <Col span={16} className="memberInfoDetailItem">
<ProFormText
name={"MEMBERSHIP_ADDRESS"}
label={"联系地址"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
</Col> */}
</Row>
</div>
@ -859,6 +892,9 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
<span className={selectTab === 4 ? "carNavTitle selectCarNavTitle" : "carNavTitle"} onClick={() => {
setSelectTab(4)
}}></span>
<span className={selectTab === 5 ? "carNavTitle selectCarNavTitle" : "carNavTitle"} onClick={() => {
setSelectTab(5)
}}></span>
</div>
@ -944,14 +980,14 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
style={{ marginBottom: '16px' }}
/>
</Col>
<Col span={18} className="memberInfoDetailItem">
{/* <Col span={18} className="memberInfoDetailItem">
<ProFormText
name={"ADDTIME"}
label={"添加时间"}
readonly
style={{ marginBottom: '16px' }}
/>
</Col>
</Col> */}
<Col span={24} className="memberInfoDetailItem">
<ProFormTextArea
name={"MEMBERSHIP_DESC"}
@ -1052,6 +1088,10 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
/>
: ''
}
{
selectTab === 5 ? <AddressDetail currentBigRow={currentRow} currentUser={currentUser} /> : ''
}
</ProForm>
</Modal>

View File

@ -0,0 +1,51 @@
import { connect } from "umi";
import type { ConnectState } from "@/models/connect";
import { Button } from "antd";
type DetailProps = {
hideDelete?: boolean
handleDelete?: any
hideCancel?: boolean
handleCancel?: any
hideOK?: boolean
handleOK?: any
}
const ModalFooter = ({ hideDelete, handleDelete, hideCancel, handleCancel, hideOK, handleOK }: DetailProps) => {
return (
<div style={{ width: '100%', boxSizing: 'border-box', padding: '0 12px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div>
{
hideDelete ? "" :
<Button type="primary" danger onClick={() => {
if (handleDelete) {
handleDelete()
}
}}></Button>
}
</div>
<div>
{
hideCancel ? '' :
<Button onClick={() => {
if (handleCancel) {
handleCancel()
}
}}></Button>
}
{
hideOK ? '' :
<Button type={"primary"} onClick={() => {
if (handleOK) {
handleOK()
}
}}></Button>
}
</div>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(ModalFooter);

View File

@ -25,6 +25,7 @@ import PageTitleBox from "@/components/PageTitleBox";
import { handeDeleteSCENICAREA, handeGetSCENICAREAList, handeSynchroSCENICAREA } from '../service';
import session from '@/utils/session';
import { deletePicture, uploadPicture } from '@/services/picture';
import ModalFooter from './component/modalFooter';
const beforeUpload = (file: any) => {
@ -93,6 +94,29 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
hideInSearch: true,
hideInDescriptions: true,
fixed: "left",
render: (_, record) => {
return <a onClick={() => {
let imgList: any = []
if (record?.ImageList && record?.ImageList.length > 0) {
record?.ImageList.forEach((item: any) => {
let obj = JSON.parse(JSON.stringify(item))
obj.url = obj.ImageUrl
obj.name = obj.ImageName
obj.uid = item.ImageId
obj.status = 'done'
imgList.push(obj)
})
}
setCurrentRow({
...record,
SCENICAREA_Image: imgList
});
setFileList(imgList);
handleModalVisible(true);
}}>
{record?.SCENICAREA_NAME || ""}
</a>
}
},
{
dataIndex: 'SCENICAREA_TYPE',
@ -196,53 +220,53 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-"
}
},
{
dataIndex: 'option',
title: '操作',
width: 120,
ellipsis: true,
valueType: 'option',
hideInSearch: true,
align: 'center',
fixed: "right",
render: (_, record) => {
return (
<Space>
<a
onClick={() => {
let imgList: any = []
if (record?.ImageList && record?.ImageList.length > 0) {
record?.ImageList.forEach((item: any) => {
let obj = JSON.parse(JSON.stringify(item))
obj.url = obj.ImageUrl
obj.name = obj.ImageName
obj.uid = item.ImageId
obj.status = 'done'
imgList.push(obj)
})
}
setCurrentRow({
...record,
SCENICAREA_Image: imgList
});
setFileList(imgList);
handleModalVisible(true);
}}
>
</a>
<Popconfirm
title="确认删除该景区信息列表信息吗?"
onConfirm={async () => {
await handelDelete(record.SCENICAREA_ID);
}}
>
<a></a>
</Popconfirm>
</Space >
);
},
},
// {
// dataIndex: 'option',
// title: '操作',
// width: 120,
// ellipsis: true,
// valueType: 'option',
// hideInSearch: true,
// align: 'center',
// fixed: "right",
// render: (_, record) => {
// return (
// <Space>
// <a
// onClick={() => {
// let imgList: any = []
// if (record?.ImageList && record?.ImageList.length > 0) {
// record?.ImageList.forEach((item: any) => {
// let obj = JSON.parse(JSON.stringify(item))
// obj.url = obj.ImageUrl
// obj.name = obj.ImageName
// obj.uid = item.ImageId
// obj.status = 'done'
// imgList.push(obj)
// })
// }
// setCurrentRow({
// ...record,
// SCENICAREA_Image: imgList
// });
// setFileList(imgList);
// handleModalVisible(true);
// }}
// >
// 编辑
// </a>
// <Popconfirm
// title="确认删除该景区信息列表信息吗?"
// onConfirm={async () => {
// await handelDelete(record.SCENICAREA_ID);
// }}
// >
// <a>删除</a>
// </Popconfirm>
// </Space >
// );
// },
// },
];
// 预览上传后的图片
@ -261,6 +285,9 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`);
} else {
message.success('删除成功!');
handleConfirmLoading(false)
handleModalVisible(false)
setFileList([])
actionRef.current?.reload()
}
};
@ -422,7 +449,7 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
destroyOnClose={true}
width={900}
bodyStyle={{
maxHeight: '700px', // 你可以根据需要调整高度
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={modalVisible}
@ -436,7 +463,19 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
handleModalVisible(false)
setFileList([])
}}
footer={<ModalFooter hideDelete={!currentRow?.SCENICAREA_ID} handleDelete={async () => {
await handelDelete(currentRow?.SCENICAREA_ID);
}} handleCancel={() => {
handleConfirmLoading(false)
handleModalVisible(false)
setFileList([])
}} handleOK={() => {
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
formRef?.current?.submit()
})
}} />}
onOk={async () => { // 提交框内的数据
formRef?.current?.validateFields().then(() => {
handleConfirmLoading(true)
@ -460,6 +499,7 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
autoFocusFirstInput
submitter={false}
preserve={false}
labelCol={{ style: { width: 80 } }}
initialValues={currentRow ? {
...currentRow,
SCENICAREA_Image: currentRow?.ImageList
@ -667,8 +707,8 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr
</Col>
</Row>
</ProForm>
</Modal>
</div>
</Modal >
</div >
);
};
export default connect(({ user }: ConnectState) => ({

View File

@ -44,6 +44,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
// 选择的tab
const [selectTab, setSelectTab] = useState<any>()
const shopregionObj: any = session.get('shopregionObj')
const LOADBEARINGList = session.get('LOADBEARINGList')
// 拖动结束
@ -183,6 +184,68 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
onFinish={async (values) => {
}}
>
{/* <Row style={{ marginTop: '18px' }}>
<Col span={1}>
</Col>
<Col span={21}>
<Radio.Group onChange={(e: any) => {
setServerPartType(Number(e.target.value))
}} value={serverPartType}>
<Radio value={1}></Radio>
<Radio value={2}></Radio>
</Radio.Group>
</Col>
</Row> */}
{
pageType === 2 ?
<div style={{ width: '100%', boxSizing: 'border-box', padding: "10px 48px 0" }}>
<Tabs activeKey={selectTab} onChange={(e: any) => {
setSelectTab(e)
}} items={areaTabList} />
</div> : ''
}
<div style={{ display: 'none' }}>
<Row>
<Col span={1}>
</Col>
<Col span={5}>
<ProFormSelect
label={"当前分区"}
name={"currentArea"}
disabled={serverPartType === 2 && currentRow?.currentArea}
request={async () => {
if (currentRow?.SERVERPART_ID) {
const req: any = {
ServerpartId: currentRow?.SERVERPART_ID
}
const regData = await handleNewGetSERVERPARTDetail(req)
const list: any = regData.ServerPartInfo
console.log('regData', regData);
console.log('formDetailAll222', formDetailAll);
if (list && list.length > 0) {
const obj: any = session.get('shopregionObj')
const res: any = []
list.forEach((item: any) => {
if (item.SERVERPART_REGION) {
res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION })
}
})
console.log('res', res);
formRef.current?.setFieldsValue({ currentArea: res[0].value })
return res
}
}
}}
/>
</Col>
<Col span={17}>
</Col>
</Row>
</div>
<Divider orientation="left"></Divider>
<Row>
@ -190,6 +253,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
<ProFormText
name="SERVERPART_NAME"
label="服务区名称"
disabled
/>
</Col>
<Col span={8}>
@ -202,6 +266,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
treeData={serverpart_typeTree}
allowClear
disabled
/>
</Form.Item>
</Col>
@ -250,6 +315,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
<ProFormText
name="MANAGERCOMPANY"
label="管理单位"
disabled
/>
</Col>
<Col span={8}>
@ -289,12 +355,14 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
<ProFormText
name="OWNEDCOMPANY"
label="产权单位"
disabled
/>
</Col>
<Col span={8}>
<ProFormText
name="TAXPAYER_IDENTIFYCODE"
label="信用代码"
disabled
/>
</Col>
<Col span={8}>
@ -339,70 +407,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) =
</Col>
</Row>
<Row style={{ marginBottom: '8px' }}>
<Col span={1}>
</Col>
<Col span={21}>
<Radio.Group onChange={(e: any) => {
setServerPartType(Number(e.target.value))
}} value={serverPartType}>
<Radio value={1}></Radio>
<Radio value={2}></Radio>
</Radio.Group>
</Col>
</Row>
{
pageType === 2 ?
<div style={{ width: '100%', boxSizing: 'border-box', padding: "0 48px" }}>
<Tabs activeKey={selectTab} onChange={(e: any) => {
setSelectTab(e)
}} items={areaTabList} />
</div> : ''
}
<div style={{ display: 'none' }}>
<Row>
<Col span={1}>
</Col>
<Col span={5}>
<ProFormSelect
label={"当前分区"}
name={"currentArea"}
disabled={serverPartType === 2 && currentRow?.currentArea}
request={async () => {
if (currentRow?.SERVERPART_ID) {
const req: any = {
ServerpartId: currentRow?.SERVERPART_ID
}
const regData = await handleNewGetSERVERPARTDetail(req)
const list: any = regData.ServerPartInfo
console.log('regData', regData);
console.log('formDetailAll222', formDetailAll);
if (list && list.length > 0) {
const obj: any = session.get('shopregionObj')
const res: any = []
list.forEach((item: any) => {
if (item.SERVERPART_REGION) {
res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION })
}
})
console.log('res', res);
formRef.current?.setFieldsValue({ currentArea: res[0].value })
return res
}
}
}}
/>
</Col>
<Col span={17}>
</Col>
</Row>
</div>
<div style={{ width: '100%', boxSizing: 'border-box', padding: '0 48px', fontSize: '16px', fontWeight: 600 }}>{shopregionObj[selectTab] || ""}</div>
<div style={{ display: areaTabList && areaTabList.length > 0 && selectTab === areaTabList[0].key ? 'block' : 'none' }}>
<Divider orientation="left"></Divider>

View File

@ -14,11 +14,14 @@ import { handleSynchroSERVERPART } from "@/pages/newDataAnalysis/service";
import useRequest from "@ahooksjs/use-request";
import { getServerpartTree } from "@/services/options";
import { handleSynchroNOTICEINFO } from "@/pages/basicManage/highwayHeadlines/service";
import ProForm, { ProFormUploadButton } from "@ant-design/pro-form";
import ProForm, { ProFormText, ProFormUploadButton } from "@ant-design/pro-form";
import { deletePicture, getPictureList, uploadPicture } from "@/services/picture";
import { handeGetPictureList } from "../service";
import SubMenu from "antd/lib/menu/SubMenu";
import Draggable from "react-draggable";
import searchIcon from '@/assets/ai/searchIcon.png'
import close from '@/assets/ai/close.png'
import './style.less'
const beforeUpload = (file: any) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
@ -35,6 +38,7 @@ const beforeUpload = (file: any) => {
const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { confirm } = Modal;
const { currentUser } = props
const searchTreeRef = useRef<FormInstance>();
const modalRef = useRef<FormInstance>();
const [collapsible, setCollapsible] = useState<boolean>(false)
const [treeView, setTreeView] = useState<any>()
@ -62,6 +66,14 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
const draggleRef = React.createRef<any>()
// 默认展开的菜单
const [defaultOpenKeys, setDefaultOpenKeys] = useState<any>();
// 显示服务区树搜索框
const [showServiceSearchBox, setShowServiceSearchBox] = useState<boolean>(false)
// 初始的最全的左侧菜单树 数据
const [menuData, setMenuData] = useState<any>();
// 判断左侧数据是否加载好了
const [showLeftTreeData, setShowLeftTreeData] = useState<boolean>(false)
const onDraggaleStart = (event, uiData) => {
const { clientWidth, clientHeight } = window.document.documentElement;
@ -86,7 +98,31 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
list.push(item)
}
})
setTreeView(list)
setMenuData(list)
let obj: any = handleGetTreeFirst(list)
if (obj && obj.length > 0) {
let defaultKey: any = []
if (obj && obj.length > 0) {
obj.forEach((item: any) => {
defaultKey.push(item.key)
})
}
setDefaultOpenKeys(defaultKey)
let lastObj: any = obj[obj.length - 1]
setCurrenMenu(lastObj.value)
setSelectedId('')
setCurrenRegion('')
// 只有修改服务区的时候 触发刷新
setShowRightForm(false)
setTimeout(() => {
setShowRightForm(true)
}, 10)
}
setShowLeftTreeData(true)
return data
})
// 根据左侧选中的菜单加载右侧数据
@ -388,6 +424,108 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
}))
}
// 拿到树形的第一个数据
interface TreeNode {
[key: string]: any;
children?: TreeNode[];
}
type TreeData = TreeNode | TreeNode[] | any;
const handleGetTreeFirst = (node: TreeData): TreeData[] => {
// 处理数组情况
if (Array.isArray(node)) {
return node.length > 0 ? handleGetTreeFirst(node[0]) : [];
}
// 处理对象情况
else if (typeof node === 'object' && node !== null) {
// 如果没有children或者children为空返回包含当前节点的数组
if (!node.children || node.children.length === 0) {
return [node];
}
// 否则递归处理第一个子节点,并将当前节点添加到结果数组前面
const childResult = handleGetTreeFirst(node.children[0]);
return [node, ...childResult];
}
// 基本数据类型直接返回包含该值的数组
return [node];
};
// 筛选左侧的服务区树
const handleFilterServiceTree = async (value?: string) => {
if (value) {
setShowLeftTreeData(false)
setTreeView([])
setTimeout(() => {
let treeViewData: any = JSON.parse(JSON.stringify(menuData))
let res = handleSearch(treeViewData, value)
console.log('resresresres', res);
let keyList: any = []
if (res && res.length > 0) {
res.forEach((item: any) => {
keyList.push(item.key)
})
setDefaultOpenKeys(keyList)
setTreeView(res)
setCurrenMenu("")
setSelectedId('')
setCurrenRegion('')
setShowLeftTreeData(true)
}
}, 10)
} else {
setTreeView(menuData)
}
console.log('valuevaluevaluevalue', value);
console.log('treeView', treeView);
console.log('menuData', menuData);
}
// 搜索方法
const handleSearch = (tree: any, searchLabel: string): TreeNode[] => {
const results: TreeNode[] = [];
// 处理数组情况(遍历每棵树)
if (Array.isArray(tree)) {
for (const node of tree) {
const nodeResults = handleSearch(node, searchLabel);
if (nodeResults.length > 0) {
results.push(...nodeResults);
}
}
return results;
}
// 检查当前节点是否是叶子节点且label匹配
const isLeaf = !tree.children || tree.children.length === 0;
if (isLeaf && tree.label.includes(searchLabel)) {
return [{ ...tree }]; // 返回当前节点的副本(作为一条独立路径)
}
// 如果不是叶子节点,递归检查子节点
if (tree.children && tree.children.length > 0) {
const matchedChildren: TreeNode[] = [];
for (const child of tree.children) {
const childResults = handleSearch(child, searchLabel);
if (childResults.length > 0) {
matchedChildren.push(...childResults);
}
}
// 如果有匹配的子节点,构造当前节点 + 所有匹配的子路径
if (matchedChildren.length > 0) {
return [{
...tree,
children: matchedChildren, // 保留所有匹配的子节点(不拆分)
}];
}
}
return results; // 默认返回空数组(无匹配)
}
return (
<div >
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
@ -395,19 +533,58 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
style={{ width: !collapsible ? "300px" : "60px" }}
className="pageTable-leftnav"
bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20, width: !collapsible ? "300px" : "60px" }}
extra={<div className="leftSelectBox">
<img className="searchIcon" src={searchIcon} onClick={() => {
setShowServiceSearchBox(true)
}} />
<MenuFoldOutlined onClick={() => {
setCollapsible(!collapsible);
}} />
<div className="fixedBox" style={{ display: showServiceSearchBox ? 'flex' : 'none', width: '275px' }}>
<ProForm
formRef={searchTreeRef}
layout={'horizontal'}
submitter={{
render: () => {
return []
}
}}
isKeyPressSubmit
onFinish={(values: any) => {
return handleFilterServiceTree(values?.searchValue || '')
}}
>
<Row>
<Col span={15} className={'noBottom'}>
<ProFormText
name={'searchValue'}
fieldProps={{
placeholder: '请输入服务区名称'
}}
allowClear
/>
</Col>
<Col span={2}></Col>
<Col span={5}>
<Button type={'primary'} onClick={() => {
searchTreeRef.current?.submit()
}}></Button>
</Col>
</Row>
</ProForm>
<img style={{ width: '20px', height: '20px', cursor: 'pointer', marginLeft: '5px' }} src={close} onClick={() => {
setShowServiceSearchBox(false)
}} />
</div>
</div>}
colSpan={!collapsible ? "300px" : "60px"}
title={!collapsible ? "请选择服务区" : ""}
headerBordered
collapsed={collapsible}
extra={
<MenuFoldOutlined onClick={() => {
setCollapsible(!collapsible);
}} rev={undefined} />
}
>
{!treeLoading && <Menu
{showLeftTreeData && <Menu
mode="inline"
style={{ height: 'calc(100vh - 220px)', overflowY: 'auto', overflowX: 'hidden' }}
selectedKeys={selectedId
@ -420,6 +597,7 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
onSelect={(item, key, keyPath, selectedKeys, domEvent) => {
loadSelectedId(item)
}}
defaultOpenKeys={defaultOpenKeys}
>
{getMenuDom(treeView, loadSelectedId)}
</Menu>}
@ -465,7 +643,7 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
paddingRight: 0,
overflowY: "auto"
}}>
<div style={{ height: 'calc(100% - 60px)', overflowY: 'auto', boxSizing: "border-box", paddingTop: '12px' }}>
<div style={{ width: '100%', padding: '12px 18px 0 0', height: 'calc(100% - 60px)', overflowY: 'auto', boxSizing: "border-box" }}>
{
showRightForm ?
<ServerpartInfo pageType={2} onRef={serverPartRef} currentRow={{ SERVERPART_ID: currenMenu ? currenMenu : '' }} onShow={showRightForm} /> :
@ -560,9 +738,9 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
</div>
}
destroyOnClose={true}
width={1200}
width={900}
bodyStyle={{
maxHeight: '700px', // 你可以根据需要调整高度
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={showUploadImgModal}
@ -633,30 +811,28 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
activeKey={selectActiveKey}
items={[
{
label: `服务区图片上传`,
label: `服务区`,
key: '1',
},
{
label: `母婴室图片上传`,
label: `母婴室`,
key: '2',
},
{
label: `司机之家图片上传`,
label: `司机之家`,
key: '3',
},
{
label: `住宿客房图片上传`,
label: `住宿客房`,
key: '4',
},
{
label: `便利店图片上传`,
label: `便利店`,
key: '5',
},
]}
/>
<ProForm
key={selectActiveKey}
layout={'horizontal'}

View File

@ -0,0 +1,29 @@
.pageTable-leftnav{
.leftSelectBox{
position: relative;
.searchIcon{
width: 20px;
height: 20px;
cursor: pointer;
margin-right: 15px;
}
.fixedBox{
position: absolute;
width: 275px;
background: #fff;
right: -10px;
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
border-radius: 8px;
box-sizing: border-box;
padding: 12px;
z-index: 2;
display: flex;
align-items: center;
.noBottom{
.ant-form-item{
margin-bottom: 0!important;
}
}
}
}
}

View File

@ -662,4 +662,54 @@ export async function handeSyncSellerCommodityInfo(params: any) {
return []
}
return data
}
// 获取售后类型的列表数据
export async function handeGetNestingFIELDENUMList(params: any) {
const data = await requestEncryption(`/Dictionary/GetNestingFIELDENUMList`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return wrapTreeNode(data.Result_Data.List)
}
// 同步售后类别
export async function handeSynchroFIELDENUM(params: any) {
const data = await requestEncryption(`/Dictionary/SynchroFIELDENUM`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 删除售后类别
export async function handeDeleteFIELDENUM(params: any) {
const data = await requestEncryption(`/Dictionary/DeleteFIELDENUM`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data
}
// 获取字段类型列表
export async function handeGetFIELDEXPLAINList(params: any) {
const data = await requestEncryption(`/Dictionary/GetFIELDEXPLAINList`, {
method: 'POST',
data: { ...params, requestEncryption: true }
})
if (data.Result_Code !== 100) {
return []
}
return data.Result_Data.List
}

View File

@ -138,6 +138,29 @@ export async function handleGetFieldEnumTreeTravel(params: FieldParamsModel) {
return [...options];
}
// 出行平台请求树的
export async function handleGetNestingFIELDENUMList(params: FieldParamsModel) {
const sessionName = `${params.sessionName ? params.sessionName : params.FieldExplainField}Tree`;
const FieldExplain = session.get(sessionName);
// if (FieldExplain && !params?.noStorge) {
// return FieldExplain;
// }
const data = await requestEncryption(`/Dictionary/GetNestingFIELDENUMList`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return [];
}
const options = params.notformate ? formateTreeField(data.Result_Data.List) : wrapTreeNode(data.Result_Data.List);
session.set(sessionName, options);
// const oneList = getName(options)
// session.set(`${sessionName}One`,oneList);
return [...options];
}
/* 获取枚举列表 出行平台的枚举 */
export async function getTravelFieldEnumTree(params: FieldParamsModel) {
@ -172,6 +195,24 @@ export async function getFieldEnum(params: FieldParamsModel): Promise<{ label: s
return options;
}
export async function getFieldEnumTravel(params: FieldParamsModel): Promise<{ label: string; value: string | number }[]> {
// const FieldExplain = session.get(params.sessionName ? params.sessionName : params.FieldExplainField);
// if (FieldExplain) {
// return [...FieldExplain];
// }
const data = await requestEncryption(`/FrameWork/GetFieldEnumByField`, {
method: 'GET',
params,
});
if (data.Result_Code !== 100) {
return [];
}
const options = params.notformate ? data.Result_Data.List : formateField(data.Result_Data.List);
// session.set(params.sessionName ? params.sessionName : params.FieldExplainField, options);
return options;
}
// 服务区树对象类
export interface ServerpartTree {
label: string; // 名称 ,

View File

@ -9,7 +9,7 @@
// 字段枚举 model 下拉框数据字典)
type FieldParamsModel = {
FieldExplainField: string;
FieldEnumStatus?: string | Boolean;
FieldEnumStatus?: any;
FieldEnumValue?: string;
notformate?: boolean;
sessionName?: string;