diff --git a/config/routes.ts b/config/routes.ts index 2f86c2d..cb47071 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -861,12 +861,6 @@ export default [ name: 'SummaryOfReservation', component: './travelMember/SummaryOfReservation/index' }, - // 预约订单汇总 - { - path: 'SummaryOfReservation', - name: 'SummaryOfReservation', - component: './travelMember/SummaryOfReservation/index' - }, // 会员等级管理 { path: 'MembershipLevelManage', @@ -956,7 +950,13 @@ export default [ path: 'InventoryWarningManagement', name: 'InventoryWarningManagement', component: './travelMember/InventoryWarningManagement/index' - } + }, + // 首页广告 + { + path: 'HomepageAds', + name: 'HomepageAds', + component: './travelMember/HomepageAds/index' + }, ] }, { diff --git a/src/pages/reports/revenueConfirmation/components/compareList.tsx b/src/pages/reports/revenueConfirmation/components/compareList.tsx index 0dccc20..3ada094 100644 --- a/src/pages/reports/revenueConfirmation/components/compareList.tsx +++ b/src/pages/reports/revenueConfirmation/components/compareList.tsx @@ -209,6 +209,9 @@ const compareList: React.FC<{ const [previewIndex, setPreviewIndex] = useState(0) // 预览的附件 const [showImgList, setShowImgList] = useState() + // 重新申请加载效果 + const [reapply, setReapply] = useState(false) + // 预览上传后的图片 const handlePreview = async (file: any) => { @@ -2857,7 +2860,7 @@ const compareList: React.FC<{ precision: 2, onChange: (e: any) => { const res = editFormRef.current?.getFieldValue() - if (e || res.MobilePayCorrect) { + if (e || res?.MobilePayCorrect) { setShowRecalibration(true) } else { setShowRecalibration(false) @@ -2889,15 +2892,20 @@ const compareList: React.FC<{ onlyRead ? '' : <> { - compareCurrent?.Approvalstate > 0 && compareCurrent?.PEND_STATE === 0 ? : diff --git a/src/pages/travelMember/BookingMealOrder/index.tsx b/src/pages/travelMember/BookingMealOrder/index.tsx index 6d9607f..7efb1df 100644 --- a/src/pages/travelMember/BookingMealOrder/index.tsx +++ b/src/pages/travelMember/BookingMealOrder/index.tsx @@ -1,11 +1,432 @@ // 预约点餐订单 import { ConnectState } from "@/models/connect"; import { connect, CurrentUser } from "umi"; +import { useRef, useState } from "react"; +import ProTable, { ActionType } from "@ant-design/pro-table"; +import PageTitleBox from "@/components/PageTitleBox"; +import { Button, Col, FormInstance, message, Modal, Popconfirm, Row, Space } from "antd"; +import { PlusOutlined } from "@ant-design/icons"; +import { handeDeleteMERCHANTS, handeGetMERCHANTSList, handeGetSALEBILLList, handeSynchroMERCHANTS } from "../service"; +import Draggable from "react-draggable"; +import React from "react"; +import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form"; +import moment from 'moment' const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const draggleRef = React.createRef() + const actionRef = useRef(); + const formRef = useRef(); + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + const [collapsible, setCollapsible] = useState(false) + // 拿到左侧树的数据 + const [leftTreeData, setLeftTreeData] = useState() + const [modalVisible, handleModalVisible] = useState(); + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const [currentRow, setCurrentRow] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(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: "index", + title: "序号", + align: 'center', + hideInSearch: true, + valueType: "index", + width: 70, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_TYPE', + title: '商户类型', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_NAME', + title: '商户名称', + align: 'center', + hideInSearch: true, + width: 300, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_EN', + title: '商户简称', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_AUTOTYPE', + title: '商户性质', + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + valueEnum: { + "1000": "企业公司", + "2000": "个体", + "3000": "自然人" + } + }, + { + dataIndex: 'TAXPAYER_IDENTIFYCODE', + title: '统一信用代码', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_TELEPHONE', + title: '联系电话', + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + }, + { + dataIndex: 'option', + title: '操作', + valueType: 'option', + align: 'center', + hideInSearch: true, + width: 120, + fixed: "right", + ellipsis: true, + render: (_, record) => { + return ( + + { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + await handelDelete(record.MERCHANTS_ID); + }} + > + 删除 + + + ); + }, + }, + ] + + const handelDelete = async (MERCHANTS_ID: number) => { + const result = await handeDeleteMERCHANTS({ MERCHANTSId: MERCHANTS_ID }); + + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + const data = await handeSynchroMERCHANTS(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }; + return (
+
+
+ { + return `${record?.COMMODITY_ID}` + }} + formRef={formRef} + bordered + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + // 请求数据 + request={async (params, sorter) => { + const req = { + searchParameter: { + RESERVATION_DATE: "2025-06-01", + RESERVATION_ENDDATE: "2025-07-01", + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handeGetSALEBILLList(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 } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + + ], + }} + /> +
+ + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新商品管理' : '新建商品管理'} +
+ } + destroyOnClose={true} + width={1200} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID }; + } + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + handleModalVisible(false); + }} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
) } diff --git a/src/pages/travelMember/HomepageAds/index.tsx b/src/pages/travelMember/HomepageAds/index.tsx new file mode 100644 index 0000000..149e682 --- /dev/null +++ b/src/pages/travelMember/HomepageAds/index.tsx @@ -0,0 +1,476 @@ +// 首页广告 +// 地址管理 +import React, { useRef, useState, Suspense, useEffect } 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, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, 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, Tabs } 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 PageTitleBox from '@/components/PageTitleBox'; +import { handeGetUSERDEFINEDTYPEList, handlDeleteUSERDEFINEDTYPE, handlSynchroUSERDEFINEDTYPE } from '../service'; +import { render } from 'react-dom'; +import { uploadPicture } from '@/services/picture'; + +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 HomepageAds: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + const [province, setProvince] = useState(''); + const [city, setCity] = useState(''); + const [county, setCounty] = useState(''); + // tab选择框 判断是查看 首页大图的内容 还是小图的内容 + const tabList: any = [{ label: "首页大图", key: "1" }, { label: "轮播图", key: "2" }] + const [selectTab, setSelectTab] = useState("1") + + 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 [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + // 定义列表字段内容 + const columns: any = [ + { + dataIndex: 'USERDEFINEDTYPE_NAME', + title: '图片类型', + width: 150, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'USERDEFINEDTYPE_ICO', + title: '图片路径', + width: 150, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return { + setFileList([{ url: record?.USERDEFINEDTYPE_ICO }]) + handlePreview() + }} /> + } + }, + { + dataIndex: 'PRESALE_STARTTIME', + title: '显示开始时间', + width: 170, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'PRESALE_ENDTIME', + title: '显示结束时间', + width: 170, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'STAFF_NAME', + title: '操作人', + width: 170, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'OPERATE_DATE', + title: '操作时间', + width: 170, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD') : "-" + } + }, + { + dataIndex: 'option', + title: '操作', + width: 150, + align: 'center', + valueType: 'option', + hideInSearch: true, + render: (_, record) => { + return ( + + { + console.log('record', record); + setFileList(record?.USERDEFINEDTYPE_ICO ? [{ url: record?.USERDEFINEDTYPE_ICO }] : []) + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + await handelDelete(record.USERDEFINEDTYPE_ID); + }} + > + 删除 + + + ); + }, + }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + const handelDelete = async (id: number) => { + const result = await handlDeleteUSERDEFINEDTYPE({ + USERDEFINEDTYPEId: id + }); + console.log('resultresultresult', result); + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + const handleAddUpdate = async (res: any) => { + let req: any = {} + + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? moment(res.PRESALE_TIME[0]).format('YYYY-MM-DD HH:mm:ss') : "", + PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? moment(res.PRESALE_TIME[1]).format('YYYY-MM-DD HH:mm:ss') : "", + USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", + GOODSTYPE: selectTab === "1" ? 7001 : 7000, + } + } else { + req = { + ...res, + GOODSTYPE: selectTab === "1" ? 7001 : 7000, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? moment(res.PRESALE_TIME[0]).format('YYYY-MM-DD HH:mm:ss') : "", + PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? moment(res.PRESALE_TIME[1]).format('YYYY-MM-DD HH:mm:ss') : "", + USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode + } + } + const data = await handlSynchroUSERDEFINEDTYPE(req); + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + formRef?.current?.resetFields() + setCurrentRow(undefined) + handleModalVisible(false) + actionRef.current?.reload() + setFileList([]) + } else { + message.error(data.Result_Desc) + } + }; + + return ( +
+
+ { + setSelectTab(e) + }} /> +
+ + { + selectTab === "1" ? + { + console.log('params', params); + const req = { + SearchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + GOODSTYPE: 7001, + USERDEFINEDTYPE_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + SortStr: "OPERATE_DATE desc", + } + const data = await handeGetUSERDEFINEDTYPEList(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 } + }} + columns={columns} + toolbar={{ + actions: [ + + ] + }} + /> : "" + } + + { + selectTab === "2" ? + { + console.log('params', params); + const req = { + SearchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + GOODSTYPE: 7000, + USERDEFINEDTYPE_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + SortStr: "OPERATE_DATE desc", + } + const data = await handeGetUSERDEFINEDTYPEList(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 } + }} + columns={columns} + toolbar={{ + actions: [ + + ] + }} + /> : "" + } + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新会员收货地址' : '新建会员收货地址'} +
+ } + destroyOnClose={true} + width={900} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, MEMBERADDRESS_ID: currentRow.MEMBERADDRESS_ID }; + } + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + }} + > + + + + + + + + + + + + { + const formData = new FormData(); + formData.append('files', info.file); + formData.append('TableType', selectTab === "1" ? '1214' : "1213"); + formData.append('ImageName', typeof info.file !== 'string' ? info.file?.name : ''); + if (info.filename) { + const success = await uploadPicture(formData) + if (success) { + const list = [{ + // uid: `${success.ImageId}`, // 注意,这个uid一定不能少,否则上传失败 + name: success.Result_Data.ImageName, + // status: 'done', + url: success.Result_Data.ImageUrl, // url 是展示在页面上的绝对链接 + // imgUrl: success.ImagePath // + success.ImageUrl, + }] + + + setFileList(list) + } + } else { + message.error("您上传的图片不存在.") + } + } + }} + /> + + + + + + ); +}; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(HomepageAds); diff --git a/src/pages/travelMember/MallBrandManage/index.tsx b/src/pages/travelMember/MallBrandManage/index.tsx index d47fa4f..a75debe 100644 --- a/src/pages/travelMember/MallBrandManage/index.tsx +++ b/src/pages/travelMember/MallBrandManage/index.tsx @@ -141,8 +141,8 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { { - // setCurrentRow({ ...record }); - // handleModalVisible(true); + setCurrentRow({ ...record }); + handleModalVisible(true); }} > 编辑 diff --git a/src/pages/travelMember/MallOrderManage/index.tsx b/src/pages/travelMember/MallOrderManage/index.tsx index 5d70dc0..18e74dd 100644 --- a/src/pages/travelMember/MallOrderManage/index.tsx +++ b/src/pages/travelMember/MallOrderManage/index.tsx @@ -8,6 +8,7 @@ import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; import PageTitleBox from "@/components/PageTitleBox"; import moment from 'moment' +import { handeGetSALEBILLList, handeGetSALEDETAILList } from "../service"; const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -29,8 +30,8 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { search: { transform: (value) => { return { - StartDate: moment(value[0]).format('YYYY-MM-DD'), - EndDate: moment(value[1]).format('YYYY-MM-DD'), + ORDERDATE_START: moment(value[0]).format('YYYY-MM-DD'), + ORDERDATE_END: moment(value[1]).format('YYYY-MM-DD'), }; }, }, @@ -70,7 +71,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "供货商", - dataIndex: "", + dataIndex: "MERCHANTS_NAME", width: 200, hideInSearch: true, ellipsis: true, @@ -78,7 +79,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "收货人员", - dataIndex: "", + dataIndex: "ORDER_PERSON", width: 150, hideInSearch: true, ellipsis: true, @@ -86,7 +87,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "联系电话", - dataIndex: "", + dataIndex: "ORDER_PERSONTEL", width: 150, hideInSearch: true, ellipsis: true, @@ -94,7 +95,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "购买的商品", - dataIndex: "", + dataIndex: "COMMODITY_NAME", width: 300, hideInSearch: true, ellipsis: true, @@ -102,7 +103,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "订单金额", - dataIndex: "", + dataIndex: "ORDER_AMOUNT", width: 120, hideInSearch: true, ellipsis: true, @@ -110,7 +111,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "实付金额", - dataIndex: "", + dataIndex: "PAY_AMOUNT", width: 120, hideInSearch: true, ellipsis: true, @@ -118,15 +119,20 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "订单类型", - dataIndex: "", + dataIndex: "SALEBILL_TYPE", width: 120, hideInSearch: true, ellipsis: true, align: "center", + valueType: 'select', + valueEnum: { + "2000": "充值驿付会员", + "6000": "预约点餐" + } }, { title: "支付方式", - dataIndex: "", + dataIndex: "PAY_METHOD", width: 120, hideInSearch: true, ellipsis: true, @@ -134,15 +140,18 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "订单时间", - dataIndex: "", + dataIndex: "ORDER_DATE", width: 180, hideInSearch: true, ellipsis: true, align: "center", + render: (_, record) => { + return record?.ORDER_DATE ? moment(record?.ORDER_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" + } }, { title: "订单编号", - dataIndex: "", + dataIndex: "SALEBILL_CODE", width: 150, hideInSearch: true, ellipsis: true, @@ -150,7 +159,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "订单状态", - dataIndex: "", + dataIndex: "SALEBILL_STATE", width: 120, hideInSearch: true, ellipsis: true, @@ -158,7 +167,7 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { }, { title: "备注说明", - dataIndex: "", + dataIndex: "SALEBILL_DESC", width: 180, hideInSearch: true, ellipsis: true, @@ -190,7 +199,25 @@ const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { headerTitle={} // 列表表头 search={{ span: 6 }} request={async (params) => { - setSearchParams(params) + const req = { + SearchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + SALEBILL_TYPE: "3000", + ORDERDATE_START: params?.ORDERDATE_START || "", + ORDERDATE_END: params?.ORDERDATE_END || "", + SALEBILL_STATE: "" + }, + PageIndex: 1, + PageSize: 999999, + SortStr: "ORDER_DATE desc", + } + const data = await handeGetSALEBILLList(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 } }} toolbar={{ }} diff --git a/src/pages/travelMember/ProductListingManagement/index.tsx b/src/pages/travelMember/ProductListingManagement/index.tsx index 135a63f..d750ab0 100644 --- a/src/pages/travelMember/ProductListingManagement/index.tsx +++ b/src/pages/travelMember/ProductListingManagement/index.tsx @@ -1,3 +1,4 @@ +// 商品上架管理 import React, { useRef, useState, Suspense } from 'react'; import moment from 'moment'; // 时间相关引用,没有使用可以删除 import numeral from "numeral"; // 数字相关引用,没有使用可以删除 @@ -24,7 +25,7 @@ import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚 import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用 import PageTitleBox from "@/components/PageTitleBox"; import LeftSelectMallType from './component/LeftSelectMallType'; -import { handeDeleteCOMMODITY, handeGetCOMMODITYList, handeSynchroCOMMODITY, handleGetBRANDList } from '../service'; +import { handeDeleteCOMMODITY, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeSynchroCOMMODITY, handleGetBRANDList } from '../service'; import session from '@/utils/session'; @@ -57,6 +58,10 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop const [BRAND_NAMEList, setBRAND_NAMEList] = useState() // 拿到左侧树的数据 const [leftTreeData, setLeftTreeData] = useState() + // 多规格 + const [showMoreSpecs, setShowMoreSpecs] = useState(false) + // 新增规格的 悬浮框 + const [showAddSpecsModal, setShowAddSpecsModal] = useState(false) // 树相关的属性和方法 @@ -75,7 +80,6 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop bottom: clientHeight - (targetRect.bottom - uiData.y), }); }; - // 拖动结束 // 定义列表字段内容 @@ -227,6 +231,99 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop }, ]; + // 多规格表格的字段 + const specsColumns: any = [ + { + dataIndex: 'index', + title: '序号', + align: 'center', + width: 70, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: '', + title: '规格分类', + align: 'center', + width: 120, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: 'USERDEFINEDTYPE_NAME ', + title: '规格名称', + align: 'center', + width: 150, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: '', + title: '商品库存', + align: 'center', + width: 120, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: '', + title: '商品原价', + align: 'center', + width: 120, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: '', + title: '零售价格', + align: 'center', + width: 120, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: '', + title: '商品成本', + align: 'center', + width: 120, + ellipsis: true, + valueType: 'index', + } + ] + + // 新增多规格的表格 + const addSpecsCoumns: any = [ + { + dataIndex: 'index', + title: '序号', + align: 'center', + width: 70, + ellipsis: true, + valueType: 'index', + }, + { + dataIndex: '', + title: '规格分类', + align: 'center', + width: 150, + ellipsis: true, + }, + { + dataIndex: '', + title: '规格名称', + align: 'center', + width: 200, + ellipsis: true, + }, + { + dataIndex: '', + title: '供应商', + align: 'center', + width: 200, + ellipsis: true, + }, + ] + const handelDelete = async (commodityid: number) => { const result = await handeDeleteCOMMODITY({ COMMODITYId: commodityid }); @@ -283,6 +380,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop paddingBottom: 0, paddingRight: 0 }}> + {/* 最外层的列表 */} scroll={{ x: "100%", y: 'calc(100vh - 370px)' }} rowKey={(record) => { @@ -351,32 +449,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop pagination={{ defaultPageSize: 10 }} /> - - - - { - setCurrentRow(undefined); - setShowDetail(false); - }} - closable={false} - > - {currentRow?.COMMODITY_ID && ( - - column={2} - title={currentRow?.COMMODITY_NAME} - request={async () => ({ - data: currentRow || {}, - })} - params={{ - id: currentRow?.COMMODITY_ID, - }} - columns={columns as ProDescriptionsItemProps[]} - /> - )} - + {/* 添加商品的悬浮框 */} = (prop setBRAND_NAMEList([]) }} + footer={
+
+ { + currentRow ? + : "" + } +
+
+ + +
+
} onOk={async () => { // 提交框内的数据 formRef?.current?.validateFields().then(() => { handleConfirmLoading(true) @@ -799,6 +897,80 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
+ + {/* 多规格配置的悬浮框 */} + { + setShowMoreSpecs(false) + }} + onOk={async () => { // 提交框内的数据 + + }} + > + { + setShowAddSpecsModal(true) + }}>新增规格 + ] + }} + request={async () => { + const req: any = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handeGetCOMMODITY_MULTIList(req) + console.log('多规格管理', data); + + }} + /> + + + + {/* 添加多规格的悬浮框 */} + { + setShowAddSpecsModal(false) + }} + onOk={async () => { // 提交框内的数据 + + }} + > + { + console.log(selectedRowKeys, selectedRows); + }, + }} + /> + + + + ); diff --git a/src/pages/travelMember/SupplierClassification/index.tsx b/src/pages/travelMember/SupplierClassification/index.tsx index b0f5043..6dcbbc3 100644 --- a/src/pages/travelMember/SupplierClassification/index.tsx +++ b/src/pages/travelMember/SupplierClassification/index.tsx @@ -1,15 +1,528 @@ -// 供货商户分类 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +// 供应商分类 -const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { - return ( -
+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 { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' + + +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 SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(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 = [ + // { + // title: '上级类别', + // align: 'center', + // width: 150, + // ellipsis: true, + // dataIndex: 'USERDEFINEDTYPE_PID', + // hideInSearch: true, + // hideInDescriptions: true, + // }, + { + dataIndex: 'USERDEFINEDTYPE_NAME', + title: '供应商名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return
+ + {record?.USERDEFINEDTYPE_NAME} +
+ } + }, + { + dataIndex: '', + title: '类别代码', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'USERDEFINEDTYPE_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'USERDEFINEDTYPE_STATE', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'OWNERUNIT_NAME', + title: '业主单位', + align: 'center', + width: 180, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'OPERATE_DATE', + title: '配置时间', + align: 'center', + width: 180, + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + } + }, + { + dataIndex: 'option', + title: '操作', + width: 100, + ellipsis: true, + valueType: 'option', + align: 'center', + hideInSearch: true, + render: (_, record) => { + return ( + +
{ + console.log('recordrecordrecord', record); + if (record?.USERDEFINEDTYPE_ICO) { + setFileList([{ + name: "", + url: record?.USERDEFINEDTYPE_ICO + }]) + } + + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + handelDelete(record.USERDEFINEDTYPE_ID); + }} + > + 删除 + +
+ ); + }, + }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除商品类别 + const handelDelete = async (id: any) => { + const req: any = { + USERDEFINEDTYPEId: id + } + const result = await handlDeleteUSERDEFINEDTYPE(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + } + + // 同步商品列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + GOODSTYPE: 1000, + USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", + PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", + PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", + PROVINCE_CODE: currentUser?.ProvinceCode, + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...res, + GOODSTYPE: 1000, + USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", + PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", + PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", + PROVINCE_CODE: currentUser?.ProvinceCode, + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + const data = await handlSynchroUSERDEFINEDTYPE(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 ( + + { + return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 1000, + USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE + // SearchKey: "" + } + console.log('reqreq', req); + + const data = await handlGetUSERDEFINEDTYPEList(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: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新供应商类别' : '新建供应商类别'} + + } + destroyOnClose={true} + width={900} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID }; + } + + + console.log('fileListfileList', fileList); + console.log('newValuenewValuenewValue', newValue); + + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 1000, + } + const data = await handlGetUSERDEFINEDTYPEList(req); + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + data.List.unshirft({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }) + setTypeTreeData(data.List) + return data.List + } else { + return [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'USERDEFINEDTYPE_NAME', + value: 'USERDEFINEDTYPE_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser -}))(SupplierClassification); \ No newline at end of file +}))(SupplierClassification); + + diff --git a/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx b/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx new file mode 100644 index 0000000..dd33d0d --- /dev/null +++ b/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx @@ -0,0 +1,223 @@ +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 { handlGetUSERDEFINEDTYPEList } 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// 传入的时候 仅支持单选 + setData?: any // 把树形的数据 传出去 +} +const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj, selectOnly, setData }: DetailProps) => { + const searchTreeRef = useRef(); + // 默认的服务区树 + const [allTreeViews, setAllTreeViews] = useState() + // 是否要显示全部 + const [isShowAllInTree, setIsShowAllInTree] = useState(false) + // 加载服务区树 + const { loading: treeLoading, data: treeViews } = useRequest(async () => { + + }) + // 显示服务区树搜索框 + const [showServiceSearchBox, setShowServiceSearchBox] = useState(false) + // 实际显示在左侧的服务区树 + const [treeView, setTreeView] = useState() + // 树要展开的行 + const [treeShowRow, setTreeShowRow] = useState() + // 筛选左侧的服务区树 + 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 ( +
+ + {/* { + setShowServiceSearchBox(true) + }} /> */} + { + setCollapsible(!collapsible); + }} /> +
+ { + return [] + } + }} + isKeyPressSubmit + onFinish={(values: any) => { + return handleFilterServiceTree(values?.searchValue || '') + }} + > + + + + + + + + + + + + { + setShowServiceSearchBox(false) + }} /> +
+
} + colSpan={!collapsible ? "300px" : "60px"} + title={!collapsible ? "请选择商城分类" : ""} + headerBordered + collapsed={collapsible} + > + {treeView && treeView.length > 0 ? 0 ? treeShowRow : ['0-0'] : []} + onCheck={(checkedKeys: React.Key[] | any, info) => { + console.log('checkedKeyscheckedKeyscheckedKeys', checkedKeys); + console.log('infoinfoinfoinfoinfoinfo', info); + + // 多选逻辑 + // const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_PID !== -1) + const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_ID) + console.log('selectedIdsselectedIds', selectedIds); + setSelectedId(selectedIds.map((n: any) => n?.USERDEFINEDTYPE_ID)?.toString() || '') + if (reload) { + actionRef?.current?.reload() + } + if (otherFun) { + otherFun(info) + } + }} + fieldNames={{ + title: "USERDEFINEDTYPE_NAME", + key: "USERDEFINEDTYPE_ID" + }} + /> : ''} + + + ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser, +}))(LeftSelectMallType); diff --git a/src/pages/travelMember/SupplierMerchantManage/component/style.less b/src/pages/travelMember/SupplierMerchantManage/component/style.less new file mode 100644 index 0000000..2b979a6 --- /dev/null +++ b/src/pages/travelMember/SupplierMerchantManage/component/style.less @@ -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; + } + } + } + } + } \ No newline at end of file diff --git a/src/pages/travelMember/SupplierMerchantManage/index.tsx b/src/pages/travelMember/SupplierMerchantManage/index.tsx index afb36a3..c27cdbb 100644 --- a/src/pages/travelMember/SupplierMerchantManage/index.tsx +++ b/src/pages/travelMember/SupplierMerchantManage/index.tsx @@ -1,11 +1,432 @@ // 供货商户管理 import { ConnectState } from "@/models/connect"; import { connect, CurrentUser } from "umi"; +import LeftSelectMerchantType from './component/LeftSelectMerchantType' +import { useRef, useState } from "react"; +import ProTable, { ActionType } from "@ant-design/pro-table"; +import PageTitleBox from "@/components/PageTitleBox"; +import { Button, Col, FormInstance, message, Modal, Popconfirm, Row, Space } from "antd"; +import { PlusOutlined } from "@ant-design/icons"; +import { handeDeleteMERCHANTS, handeGetMERCHANTSList, handeSynchroMERCHANTS } from "../service"; +import Draggable from "react-draggable"; +import React from "react"; +import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form"; +import moment from 'moment' const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const draggleRef = React.createRef() + const actionRef = useRef(); + const formRef = useRef(); + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + const [collapsible, setCollapsible] = useState(false) + // 拿到左侧树的数据 + const [leftTreeData, setLeftTreeData] = useState() + const [modalVisible, handleModalVisible] = useState(); + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const [currentRow, setCurrentRow] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(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: "index", + title: "序号", + align: 'center', + hideInSearch: true, + valueType: "index", + width: 70, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_TYPE', + title: '商户类型', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_NAME', + title: '商户名称', + align: 'center', + hideInSearch: true, + width: 300, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_EN', + title: '商户简称', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_AUTOTYPE', + title: '商户性质', + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + valueEnum: { + "1000": "企业公司", + "2000": "个体", + "3000": "自然人" + } + }, + { + dataIndex: 'TAXPAYER_IDENTIFYCODE', + title: '统一信用代码', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'MERCHANTS_TELEPHONE', + title: '联系电话', + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + }, + { + dataIndex: 'option', + title: '操作', + valueType: 'option', + align: 'center', + hideInSearch: true, + width: 120, + fixed: "right", + ellipsis: true, + render: (_, record) => { + return ( + + { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + 编辑 + + { + await handelDelete(record.MERCHANTS_ID); + }} + > + 删除 + + + ); + }, + }, + ] + + const handelDelete = async (MERCHANTS_ID: number) => { + const result = await handeDeleteMERCHANTS({ MERCHANTSId: MERCHANTS_ID }); + + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...res, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode, + OPERATE_PERSON: currentUser?.ID, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + const data = await handeSynchroMERCHANTS(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }; + return (
+
+ +
+ { + return `${record?.COMMODITY_ID}` + }} + formRef={formRef} + bordered + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + // 请求数据 + request={async (params, sorter) => { + const req = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handeGetMERCHANTSList(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 } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + + ], + }} + /> +
+ + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新商品管理' : '新建商品管理'} +
+ } + destroyOnClose={true} + width={1200} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
+ }} + > + { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID }; + } + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + handleModalVisible(false); + }} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
) } diff --git a/src/pages/travelMember/service.ts b/src/pages/travelMember/service.ts index 604cd81..2fac3a7 100644 --- a/src/pages/travelMember/service.ts +++ b/src/pages/travelMember/service.ts @@ -32,7 +32,7 @@ export async function handleGetCONSUMPTIONRECORDList(params: any) { // 获取积分记录列表 export async function handleGetPOINTRECORDList(params: any) { - const data = await requestEncryption(`/MemberOrder/GetPOINTRECORDList`, { + const data = await requestEncryption(`/Member/GetPOINTRECORDList`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -45,7 +45,7 @@ export async function handleGetPOINTRECORDList(params: any) { // 获取成长值记录列表 export async function handleGetMEMBERGROWTHList(params: any) { - const data = await requestEncryption(`/MemberMarketing/GetGROWTHRECORDList`, { + const data = await requestEncryption(`/Member/GetGROWTHRECORDList`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -58,7 +58,7 @@ export async function handleGetMEMBERGROWTHList(params: any) { // 获取积分规则配置列表 export async function handleGetSCORESETTINGList(params: any) { - const data = await requestEncryption(`/MemberMarketing/GetSCORESETTINGList`, { + const data = await requestEncryption(`/Member/GetSCORESETTINGList`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -71,7 +71,7 @@ export async function handleGetSCORESETTINGList(params: any) { // 同步积分规则 export async function handleSynchroSCORESETTING(params: any) { - const data = await requestEncryption(`/MemberMarketing/SynchroSCORESETTING`, { + const data = await requestEncryption(`/Member/SynchroSCORESETTING`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -83,7 +83,7 @@ export async function handleSynchroSCORESETTING(params: any) { // 删除积分同步规则 export async function handleDeleteSCORESETTING(params: any) { - const data = await requestEncryption(`/MemberMarketing/DeleteSCORESETTING`, { + const data = await requestEncryption(`/Member/DeleteSCORESETTING`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -96,7 +96,7 @@ export async function handleDeleteSCORESETTING(params: any) { // 成长值配置的列表 export async function handleGetGROWTHSETTINGList(params: any) { - const data = await requestEncryption(`/MemberMarketing/GetGROWTHSETTINGList`, { + const data = await requestEncryption(`/Member/GetGROWTHSETTINGList`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -108,7 +108,7 @@ export async function handleGetGROWTHSETTINGList(params: any) { // 同步成长值的配置 export async function handleSynchroGROWTHSETTING(params: any) { - const data = await requestEncryption(`/MemberMarketing/SynchroGROWTHSETTING`, { + const data = await requestEncryption(`/Member/SynchroGROWTHSETTING`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -120,7 +120,7 @@ export async function handleSynchroGROWTHSETTING(params: any) { // 删除成长值配置 export async function handleDeleteGROWTHSETTING(params: any) { - const data = await requestEncryption(`/MemberMarketing/DeleteGROWTHSETTING`, { + const data = await requestEncryption(`/Member/DeleteGROWTHSETTING`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -132,7 +132,7 @@ export async function handleDeleteGROWTHSETTING(params: any) { // 拿到收货地址列表数据 export async function handleGetMEMBERADDRESSList(params: any) { - const data = await requestEncryption(`/MemberOrder/GetMEMBERADDRESSList`, { + const data = await requestEncryption(`/Member/GetMEMBERADDRESSList`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -144,7 +144,7 @@ export async function handleGetMEMBERADDRESSList(params: any) { // 同步收获地址 export async function handleSynchroMEMBERADDRESS(params: any) { - const data = await requestEncryption(`/MemberOrder/SynchroMEMBERADDRESS`, { + const data = await requestEncryption(`/Member/SynchroMEMBERADDRESS`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -156,7 +156,7 @@ export async function handleSynchroMEMBERADDRESS(params: any) { // 删除收获地址 export async function handleDeleteMEMBERADDRESS(params: any) { - const data = await requestEncryption(`/MemberOrder/DeleteMEMBERADDRESS`, { + const data = await requestEncryption(`/Member/DeleteMEMBERADDRESS`, { method: 'POST', data: { ...params, requestEncryption: true } }) @@ -264,6 +264,19 @@ export async function handeSynchroCOMMODITY(params: any) { return data } +// 获取商品详情 +export async function handeGetCOMMODITYDetail(params: any) { + const data = await requestEncryption(`/MallBasic/GetCOMMODITYDetail`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + // 删除商品管理 export async function handeDeleteCOMMODITY(params: any) { const data = await requestEncryption(`/MallBasic/DeleteCOMMODITY`, { @@ -274,4 +287,96 @@ export async function handeDeleteCOMMODITY(params: any) { return [] } return data -} \ No newline at end of file +} + +// 获取商品的多规格列表 +export async function handeGetCOMMODITY_MULTIList(params: any) { + const data = await requestEncryption(`/MallBasic/GetCOMMODITY_MULTIList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + + + +// 获取商户列表 +export async function handeGetMERCHANTSList(params: any) { + const data = await requestEncryption(`/MallBasic/GetMERCHANTSList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + +// 同步商户列表 +export async function handeSynchroMERCHANTS(params: any) { + const data = await requestEncryption(`/MallBasic/SynchroMERCHANTS`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + + +// 删除商户 +export async function handeDeleteMERCHANTS(params: any) { + const data = await requestEncryption(`/MallBasic/DeleteMERCHANTS`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + + + +// 获取商品自定义列表 +export async function handeGetUSERDEFINEDTYPEList(params: any) { + const data = await requestEncryption(`/MallBasic/GetUSERDEFINEDTYPEList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + + +// 获取订单列表 +export async function handeGetSALEDETAILList(params: any) { + const data = await requestEncryption(`/OnlineOrder/GetSALEDETAILList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + +// 获取线上订单表列表 +export async function handeGetSALEBILLList(params: any) { + const data = await requestEncryption(`/OnlineOrder/GetSALEBILLList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} +