From 89b5e5a985c2112c40589d8bdacc981131bfa0a4 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Mon, 30 Jun 2025 19:51:32 +0800 Subject: [PATCH] update --- src/layouts/BasicLayout.tsx | 63 +- .../MerchantInformation/index.tsx | 3 +- .../travelMember/MallBrandManage/index.tsx | 156 +- .../MallClassificationManage/index.tsx | 534 ++++-- .../travelMember/MallOrderManage/index.tsx | 199 ++- .../component/LeftSelectMallType.tsx | 232 +++ .../component/style.less | 29 + .../ProductListingManagement/index.tsx | 1587 +++++++---------- src/pages/travelMember/service.ts | 69 +- 9 files changed, 1691 insertions(+), 1181 deletions(-) create mode 100644 src/pages/travelMember/ProductListingManagement/component/LeftSelectMallType.tsx create mode 100644 src/pages/travelMember/ProductListingManagement/component/style.less diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index fdd818f..bcbb6e2 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -249,7 +249,52 @@ const BasicLayout: React.FC = (props) => { session.set('BRANDCATEGORYTree', BRANDCATEGORY); } }) - + + // 质量等级 + getFieldEnumTree({ FieldExplainField: 'COMMODITYGRADE' }).then((COMMODITYGRADE: any) => { + if (COMMODITYGRADE && COMMODITYGRADE.length > 0) { + const obj: any = {} + const list: any = [] + COMMODITYGRADE.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('COMMODITYGRADEList', list); + session.set('COMMODITYGRADEObj', obj); + session.set('COMMODITYGRADETree', COMMODITYGRADE); + } + }) + + + // 商品属性 + getFieldEnumTree({ FieldExplainField: 'COMMODITY_NATURE' }).then((COMMODITYNATURE: any) => { + if (COMMODITYNATURE && COMMODITYNATURE.length > 0) { + const obj: any = {} + const list: any = [] + COMMODITYNATURE.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('CCOMMODITYNATUREList', list); + session.set('COMMODITYNATUREObj', obj); + session.set('COMMODITYNATURETree', COMMODITYNATURE); + } + }) + + // 消费模式 + getFieldEnumTree({ FieldExplainField: 'PAY_METHOD' }).then((PAYMETHOD: any) => { + if (PAYMETHOD && PAYMETHOD.length > 0) { + const obj: any = {} + const list: any = [] + PAYMETHOD.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('PAYMETHODList', list); + session.set('PAYMETHODObj', obj); + session.set('PAYMETHODTree', PAYMETHOD); + } + }) // 消费类型 @@ -267,6 +312,22 @@ const BasicLayout: React.FC = (props) => { } }) + + // 商品税率 + getFieldEnumTree({ FieldExplainField: 'DUTY_PARAGRAPH' }).then((DUTYPARAGRAPH: any) => { + if (DUTYPARAGRAPH && DUTYPARAGRAPH.length > 0) { + const obj: any = {} + const list: any = [] + DUTYPARAGRAPH.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('DUTYPARAGRAPHList', list); + session.set('DUTYPARAGRAPHObj', obj); + session.set('DUTYPARAGRAPHTree', DUTYPARAGRAPH); + } + }) + // 会员类型的枚举 // const MEMBERSHIPTYPE = getFieldEnumTree({ FieldExplainField: 'MEMBERSHIP_TYPE' }).then((MEMBERSHIPTYPE: any) => { diff --git a/src/pages/operatingMerchants/MerchantInformation/index.tsx b/src/pages/operatingMerchants/MerchantInformation/index.tsx index 68450ae..5dd6e50 100644 --- a/src/pages/operatingMerchants/MerchantInformation/index.tsx +++ b/src/pages/operatingMerchants/MerchantInformation/index.tsx @@ -22,6 +22,7 @@ import type { FormInstance } from 'antd'; import { handleDeleteSERVERPARTSELLER, handleGetMEMBERADDRESSList, handleGetRelateShopToSeller, handleGetSERVERPARTSELLERDetail, handleGetSERVERPARTSHOPList, handleRemoveShopFromSeller, handleSynchroSERVERPARTSELLER } from '../service'; import LeftSelectTree from '@/pages/reports/settlementAccount/component/leftSelectTree'; import session from '@/utils/session'; +import PageTitleBox from '@/components/PageTitleBox'; @@ -512,7 +513,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = }} bordered formRef={formRef} - headerTitle="服务区商家信息列表" // 列表表头 + headerTitle={} // 列表表头 actionRef={actionRef} search={{ span: 6, labelWidth: 'auto' }} // 请求数据 diff --git a/src/pages/travelMember/MallBrandManage/index.tsx b/src/pages/travelMember/MallBrandManage/index.tsx index 9ec58e0..d47fa4f 100644 --- a/src/pages/travelMember/MallBrandManage/index.tsx +++ b/src/pages/travelMember/MallBrandManage/index.tsx @@ -16,8 +16,9 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele import { handlDeleteBRAND, handleGetBRANDList, handleSynchroBRAND } from "../service"; import session from "@/utils/session"; import Draggable from "react-draggable"; -import ProForm, { ProFormDatePicker, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form"; +import ProForm, { ProFormDatePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form"; import moment from 'moment' +import PageTitleBox from "@/components/PageTitleBox"; const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -50,7 +51,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { const [currentRow, setCurrentRow] = useState(); const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 - + const [selectBrandList, setSelectBrandList] = useState([]) const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -78,7 +79,6 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { title: '品牌名称', align: 'center', width: 150, - hideInSearch: true, ellipsis: true, }, { @@ -88,7 +88,8 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { valueType: 'select', align: 'center', ellipsis: true, - valueEnum: BRANDCATEGORYObj + valueEnum: BRANDCATEGORYObj, + hideInSearch: true, // request: async () => { // return await getFieldEnumTree({ FieldExplainField: 'BRAND_CATEGORY', sessionName: 'BRAND_CATEGORY' }); // }, @@ -98,23 +99,15 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { // // }, }, - { - dataIndex: 'BRAND_TYPE', - title: '品牌类型', - valueType: 'select', - align: 'center', - width: 120, - ellipsis: true, - valueEnum: brandObj - // request: async () => { - // return await getFieldEnumTree({ FieldExplainField: 'BRAND_TYPE', sessionName: 'BRAND_TYPE' }); - // }, - // render: (_, record) => { - // return - // {getFieldEnumName('BRAND_TYPE', record?.BRAND_TYPE)} - // - // }, - }, + // { + // dataIndex: 'BRAND_TYPE', + // title: '品牌类型', + // valueType: 'select', + // align: 'center', + // width: 120, + // ellipsis: true, + // valueEnum: brandObj + // }, { dataIndex: 'BRAND_STATE', title: '有效状态', @@ -157,7 +150,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { { - // await handelDelete(record.BRAND_ID); + await handelDelete(record.BRAND_ID); }}> 删除 @@ -171,7 +164,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { const handelDelete = async (id: number) => { console.log('fjsdfsdflksa', id); const req: any = { - SERVERPARTSELLERId: id + BRANDId: id } const result = await handlDeleteBRAND(req) if (result.Result_Code !== 100) { @@ -188,27 +181,29 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { req = { ...currentRow, ...res, - UPDATE_STAFF_ID: currentUser?.ID, - UPDATE_STAFF_NAME: currentUser?.Name, - UPDATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + BRAND_CATEGORY: 2000, + 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, + BRAND_CATEGORY: 2000, PROVINCE_CODE: currentUser?.ProvinceCode, - ISVALID: 1, - CREATE_STAFF_ID: currentUser?.ID, - CREATE_STAFF_NAME: currentUser?.Name, - CREATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), } } const data = await handleSynchroBRAND(req) handleConfirmLoading(false) if (data.Result_Code === 100) { - message.success(data.Result_Desc) - formRef?.current?.resetFields() + message.success("新增成功!") setCurrentRow(undefined) + formRef?.current?.resetFields() handleModalVisible(false) actionRef.current?.reload() } else { @@ -240,23 +235,38 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { expandable={{ expandRowByClick: true }} - headerTitle={单品销售排行统计} search={{ span: 6 }} + rowKey={(record: any) => { + return `${record.BRAND_PID}-${record.BRAND_ID}` + }} + scroll={{ x: "100%", y: "calc(100vh - 410px)" }} + headerTitle={} // 列表表头 request={async (params) => { - setSearchParams(params) const req: any = { searchParameter: { OWNERUNIT_ID: currentUser?.OwnerUnitId, PROVINCE_CODE: currentUser?.ProvinceCode, + BRAND_TYPE: params?.BRAND_TYPE, + BRAND_STATE: 1, BRAND_CATEGORY: 2000 }, + keyWord: { + key: "BRAND_NAME", + value: params?.BRAND_NAME + }, PageIndex: 1, PageSize: 999999, + SortStr: "BRAND_INDEX,OPERATE_DATE" } const data = await handleGetBRANDList(req) console.log('datadatadatadatadata', data); if (data.List && data.List.length > 0) { + let brandSelectList: any = [] + data.List.forEach((item: any) => { + brandSelectList.push({ label: item.BRAND_NAME, value: item.BRAND_ID }) + }) + setSelectBrandList(brandSelectList) return { data: data.List, success: true, total: data.TotalCount } } return { data: [], success: true } @@ -303,7 +313,7 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { } destroyOnClose={true} - width={900} + width={500} visible={modalVisible} confirmLoading={confirmLoading} afterClose={() => { @@ -337,58 +347,82 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => { autoFocusFirstInput submitter={false} preserve={false} - initialValues={currentRow} + initialValues={currentRow ? currentRow : { + BRAND_PID: -1, // 默认上级内码为-1 + BRAND_STATE: 1, // 默认有效状态为1 + }} onFinish={async (values) => { let newValue: any = { ...values }; if (currentRow) { // 编辑数据 newValue = { ...values, BRAND_ID: currentRow.BRAND_ID }; } + + + console.log('newValuenewValue', newValue); + // 如果有开关,要把开关的代码写进去 await handleAddUpdate(newValue); handleConfirmLoading(false) }} > - + { + if (selectBrandList && selectBrandList.length > 0) { + let list: any = [{ label: "默认类别", value: -1 }, ...selectBrandList] + return list + } else { + const req: any = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + BRAND_CATEGORY: 2000 + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handleGetBRANDList(req) + if (data.List && data.List.length > 0) { + let brandSelectList: any = [] + data.List.forEach((item: any) => { + brandSelectList.push({ label: item.BRAND_NAME, value: item.BRAND_ID }) + }) + setSelectBrandList(brandSelectList) + brandSelectList.unshirft({ label: "默认类别", value: -1 }) + return brandSelectList + } else { + return [{ label: "默认类别", value: -1 }] + } + } + }} + fieldProps={{ + showSearch: true, + filterOption: (input, option) => + (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) + }} /> - - + - + - - - - - - - - - - + { + 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 MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { const { currentUser } = props + const { confirm } = Modal; const actionRef = useRef(); const formRef = useRef(); const [currentRow, setCurrentRow] = useState(); @@ -33,12 +50,20 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined 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(); @@ -55,43 +80,107 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined // 拖动结束 // 定义列表字段内容 - const columns = [ + 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: '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: 'SCANCODE_ORDER', + title: '上架状态', + align: 'center', + width: 120, + ellipsis: true, hideInSearch: true, + valueType: "select", + valueEnum: { + "1": "上架", + "0": "下架" + } + }, + { + dataIndex: "PRESALE_TYPE", + title: "是否预售", + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "0": "否", + "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 ( - { + console.log('recordrecordrecord', record); + if (record?.USERDEFINEDTYPE_ICO) { + setFileList([{ + name: "", + url: record?.USERDEFINEDTYPE_ICO + }]) + } + setCurrentRow({ ...record }); handleModalVisible(true); }} @@ -102,7 +191,6 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined title="确认删除该商品自定义类别列表信息吗?" onConfirm={async () => { handelDelete(record.USERDEFINEDTYPE_ID); - }} > 删除 @@ -113,6 +201,74 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined }, ]; + // 预览上传后的图片 + 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: 4000, + 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: 4000, + 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_ID}` + return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}` }} formRef={formRef} - headerTitle="商品自定义类别列表" // 列表表头 + headerTitle={} // 列表表头 actionRef={actionRef} search={{ span: 6, labelWidth: 'auto' }} + bordered // 请求数据 request={async (params, sorter) => { - const req = { - searchParameter: { - - }, - PageIndex: 1, - PageSize: 999999 + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 4000, + USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE + // SearchKey: "" } const data = await handlGetUSERDEFINEDTYPEList(req); console.log('datadatadatadatadata', data); - if (data.List && data.List.length > 0) { - return { data: data.List, success: true, total: data.TotalCount } + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } } return { data: [], success: true } }} @@ -161,9 +318,24 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined , ], }} - pagination={{ defaultPageSize: 10 }} /> + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + { handleConfirmLoading(false) handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) }} onOk={async () => { // 提交框内的数据 @@ -221,109 +395,214 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined autoFocusFirstInput submitter={false} preserve={false} - initialValues={currentRow} + initialValues={currentRow ? currentRow : { + USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + OWNERUNIT_NAME: currentUser?.OwnerUnitName + }} onFinish={async (values) => { let newValue = { ...values }; if (currentRow) { // 编辑数据 newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID }; } + + + console.log('fileListfileList', fileList); + console.log('newValuenewValuenewValue', newValue); + // 如果有开关,要把开关的代码写进去 - handleAddUpdate(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: 4000, + } + 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: "请选择上级类别" + } + ]} /> - - - - - - - - - - - - - - - - - - - - - - + + + { + setFormPRESALE_TYPE(e) + } + }} + /> + + { + formPRESALE_TYPE ? + + + + : "" + } + + { + const formData = new FormData(); + formData.append('files', info.file); + formData.append('TableType', '1215'); + 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("您上传的图片不存在.") + } + }, + onChange: async (info: any) => { + if (info.file.status === 'removed') { + confirm({ + title: '确认删除该图片吗?', + icon: , + async onOk() { + setFileList([]) + + // const deleteLoading = message.loading('正在删除...') + // try { + + // const deleteIndex = fileList?.findIndex((n: any) => n.uid === info.file.uid) + // const success = await deletePicture(info.file?.ImagePath, info.file?.ImageId, '1208') + // if (deleteIndex !== -1) { + // const files = [...fileList] + // files.splice(deleteIndex, 1) + // setFileList(files) + // } + // deleteLoading() + // return true + // } catch (error) { + // deleteLoading() + // return false + // } + } + }); + } + } + }} /> - @@ -332,102 +611,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined label="备注" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/pages/travelMember/MallOrderManage/index.tsx b/src/pages/travelMember/MallOrderManage/index.tsx index edb6282..5d70dc0 100644 --- a/src/pages/travelMember/MallOrderManage/index.tsx +++ b/src/pages/travelMember/MallOrderManage/index.tsx @@ -1,15 +1,206 @@ // 商城订单管理 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import type { FormInstance } from "antd"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import PageTitleBox from "@/components/PageTitleBox"; +import moment from 'moment' + + +const MallOrderManage: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + + + // 查询的条件 + const [searchParams, setSearchParams] = useState() + + const columns: any = [ + { + title: "查询时间", + dataIndex: "searchTime", + valueType: "dateRange", + hideInTable: true, + initialValue: [moment().subtract(1, 'day'), moment().subtract(1, 'day').startOf('M')], + search: { + transform: (value) => { + return { + StartDate: moment(value[0]).format('YYYY-MM-DD'), + EndDate: moment(value[1]).format('YYYY-MM-DD'), + }; + }, + }, + fieldProps: { + picker: "month", + format: 'YYYY-MM', + } + }, + { + title: "订单状态", + dataIndex: "orderStatus", + valueType: "select", + valueEnum: {}, + hideInTable: true, + }, + { + title: "订单类型", + dataIndex: "orderType", + valueType: "select", + valueEnum: {}, + hideInTable: true, + }, + { + title: "支付方式", + dataIndex: "paymentMethod", + valueType: "select", + valueEnum: {}, + hideInTable: true, + }, + { + title: "序号", + dataIndex: "index", + valueType: "index", + hideInSearch: true, + align: "center", + width: 60, + }, + { + title: "供货商", + dataIndex: "", + width: 200, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "收货人员", + dataIndex: "", + width: 150, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "联系电话", + dataIndex: "", + width: 150, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "购买的商品", + dataIndex: "", + width: 300, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "订单金额", + dataIndex: "", + width: 120, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "实付金额", + dataIndex: "", + width: 120, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "订单类型", + dataIndex: "", + width: 120, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "支付方式", + dataIndex: "", + width: 120, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "订单时间", + dataIndex: "", + width: 180, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "订单编号", + dataIndex: "", + width: 150, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "订单状态", + dataIndex: "", + width: 120, + hideInSearch: true, + ellipsis: true, + align: "center", + }, + { + title: "备注说明", + dataIndex: "", + width: 180, + hideInSearch: true, + ellipsis: true, + align: "center", + } + ] + -const MallOrderManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { return (
+ +
+
+ } // 列表表头 + search={{ span: 6 }} + request={async (params) => { + setSearchParams(params) + }} + toolbar={{ + }} + /> +
+
) } export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser -}))(MallOrderManage); \ No newline at end of file +}))(MallOrderManage); diff --git a/src/pages/travelMember/ProductListingManagement/component/LeftSelectMallType.tsx b/src/pages/travelMember/ProductListingManagement/component/LeftSelectMallType.tsx new file mode 100644 index 0000000..4051edb --- /dev/null +++ b/src/pages/travelMember/ProductListingManagement/component/LeftSelectMallType.tsx @@ -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 { 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 req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 4000, + USERDEFINEDTYPE_STATE: 1 + } + const data = await handlGetUSERDEFINEDTYPEList(req); + setTreeView(data) + setData(data) + return data + }) + // 显示服务区树搜索框 + 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/ProductListingManagement/component/style.less b/src/pages/travelMember/ProductListingManagement/component/style.less new file mode 100644 index 0000000..2b979a6 --- /dev/null +++ b/src/pages/travelMember/ProductListingManagement/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/ProductListingManagement/index.tsx b/src/pages/travelMember/ProductListingManagement/index.tsx index ad15570..135a63f 100644 --- a/src/pages/travelMember/ProductListingManagement/index.tsx +++ b/src/pages/travelMember/ProductListingManagement/index.tsx @@ -8,10 +8,10 @@ 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, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form'; +import ProForm, { ProFormDatePicker, ProFormDateRangePicker, ProFormDateTimePicker, 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 { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect, Divider } from 'antd'; import type { CurrentUser } from "umi"; import type { ConnectState } from '@/models/connect'; @@ -23,6 +23,9 @@ import type { COMMODITYModel } from './data'; 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 session from '@/utils/session'; const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { @@ -34,11 +37,30 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop const [modalVisible, handleModalVisible] = useState(); const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 const [searchParams, setSearchParams] = useState(); - + const [collapsible, setCollapsible] = useState(false) // 弹出框拖动效果 const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 const [disabled, setDraggleDisabled] = useState() // 是否拖动 const draggleRef = React.createRef() + // 商品属性 + const COMMODITYNATUREObj = session.get('COMMODITYNATUREObj') + const COMMODITYNATUREList = session.get('COMMODITYNATUREList') + // 消费模式 + const PAYMETHODObj = session.get('PAYMETHODObj') + const PAYMETHODList = session.get('PAYMETHODList') + // 税率 + const DUTYPARAGRAPHObj = session.get('DUTYPARAGRAPHObj') + const DUTYPARAGRAPHList = session.get('DUTYPARAGRAPHList') + // 质量等级 + const COMMODITYGRADEList = session.get('COMMODITYGRADEList') + // 在proform里面的品牌查询列表 + const [BRAND_NAMEList, setBRAND_NAMEList] = useState() + // 拿到左侧树的数据 + const [leftTreeData, setLeftTreeData] = useState() + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -57,352 +79,132 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop // 定义列表字段内容 - const columns: ProColumns[] = [ + const columns: any = [ { - dataIndex: 'PROVINCE_CODE', - title: '省份编码', + dataIndex: 'index', + title: '序号', align: 'center', + width: 70, + ellipsis: true, + valueType: 'index', hideInSearch: true, }, { - dataIndex: 'BRAND_NAME', + dataIndex: 'USERDEFINEDTYPE_NAME', + title: '商城类别', + align: 'center', + hideInSearch: true, + width: 120, + ellipsis: true, + }, + { + dataIndex: 'BRAND_NAME', title: '品牌名称', align: 'center', hideInSearch: true, + width: 120, + ellipsis: true, }, { - dataIndex: 'MERCHANTS_NAME', - title: '商户名称', + dataIndex: 'COMMODITY_INDEX', + title: '商品索引', align: 'center', hideInSearch: true, + width: 120, + ellipsis: true, }, { - dataIndex: 'SERVERPARTCODE', - title: '服务区编码', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'SHOPCODE', - title: '门店编码', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'SERVERPART_NAME', - title: '服务区名称', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'SHOPNAME', - title: '门店名称', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_TYPE', - title: '商品类型', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_CODE', - title: '商品编码', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_NAME', + dataIndex: 'COMMODITY_NAME', title: '商品名称', align: 'center', hideInSearch: true, hideInDescriptions: true, + width: 300, + ellipsis: true, }, { - dataIndex: 'COMMODITY_BARCODE', - title: '商品条码', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_UNIT', - title: '商品单位', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_RULE', - title: '商品规格', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_EN', - title: '商品简称', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_ORI', - title: '商品产地', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_GRADE', - title: '质量等级', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_RETAILPRICE', - title: '零售价格', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_PURCHASEPRICE', - title: '进货价格', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_MEMBERPRICE', - title: '会员价格', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_TAG', - title: '商品标签', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_STOCK', - title: '商品库存', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_NATURE', + dataIndex: 'COMMODITY_NATURE', title: '商品属性', align: 'center', hideInSearch: true, + width: 120, + ellipsis: true, + valueType: 'select', + valueEnum: COMMODITYNATUREObj }, + { - dataIndex: 'BUSINESSTYPE', - title: '商品业态', + dataIndex: 'PAY_METHOD', + title: '消费模式', align: 'center', hideInSearch: true, + width: 120, + ellipsis: true, + valueType: 'select', + valueEnum: PAYMETHODObj }, { - dataIndex: 'ISBULK', - title: '是否散称', + dataIndex: 'COMMODITY_MEMBERPRICE', + title: '会员价格', align: 'center', hideInSearch: true, + width: 120, + ellipsis: true, }, { - dataIndex: 'METERINGMETHOD', - title: '称重方式', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'GUARANTEE_DAY', - title: '保质期限', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'REMINDER_DAY', - title: '提醒期限', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_HOTKEY', - title: '快捷键', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'USERDEFINEDTYPE_NAME', - title: '自定义名称', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'UPPER_STATE', - title: '上架状态', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_STATE', - title: '商品状态', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'OPERATE_DATE', - title: '修改时间', - valueType: 'fromNow', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'TRANSFER_STATE', - title: '传输状态', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'OPERATE_PERSON', - title: '操作人员', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'OPERATE_TIME', - title: '操作时间', - valueType: 'date', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_DESC', - title: '备注说明', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_INDEX', - title: '商品索引', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMENT_COUNT', - title: '评价次数', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMENT_SCORE', - title: '商品评分', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'PAY_METHOD', - title: '消费模式【1000:余额消费,2000:积分兑换】', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_POINT', + dataIndex: 'COMMODITY_POINT', title: '商品积分', align: 'center', hideInSearch: true, + width: 120, + ellipsis: true, }, { - dataIndex: 'ISDISTRIBUTION', - title: '是否是分销商品', + dataIndex: 'DUTY_PARAGRAPH', + title: '税率(%)', + align: 'center', + width: 120, + ellipsis: true, + valueEnum: { + "-1": "全部", + ...DUTYPARAGRAPHObj, + }, + initialValue: "-1" + }, + { + dataIndex: 'UPPER_STATE', + title: '上架状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "0": "未上架", + "1": "已上架", + "2": "已驳回" + }, + initialValue: "1" + }, + { + dataIndex: 'MERCHANTS_NAME', + title: '商户名称', align: 'center', hideInSearch: true, + width: 200, + ellipsis: true, }, { - dataIndex: 'OWNERUNIT_NAME', - title: '业主单位', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'WECHATAPPSIGN_NAME', - title: '小程序名字', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'WECHATAPP_APPID', - title: '小程序APPID', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'DATAFORMAT', - title: '数据形式', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'UPPER_DATE', - title: '上架时间', - valueType: 'date', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'OFF_DATE', - title: '下架时间', - valueType: 'date', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'SEND_MODE', - title: '发货模式', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'DELIVER_AREA', - title: '配送区域', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'LIMIT_TOTALCOUNT', - title: '限购总数', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'LIMIT_DAILYCOUNT', - title: '每日限购', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_INTRO', - title: '产品介绍', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'AFTERSALE_NATRUE', - title: '售后性质', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'option', + dataIndex: 'option', title: '操作', valueType: 'option', + align: 'center', hideInSearch: true, + width: 120, + fixed: "right", + ellipsis: true, render: (_, record) => { return ( - { - setCurrentRow(record); - setShowDetail(true); - }} - > - 查看 - { setCurrentRow({ ...record }); @@ -426,7 +228,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop ]; const handelDelete = async (commodityid: number) => { - const result = await delcommodity({commodityid:commodityid}); + const result = await handeDeleteCOMMODITY({ COMMODITYId: commodityid }); if (result.Result_Code !== 100) { message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); @@ -436,652 +238,567 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop } }; - const handleAddUpdate = async (fields: COMMODITYModel) => { - const hide = message.loading('正在提交...'); - - const result = await updatecommodity(fields); - hide(); - if (result.Result_Code !== 100) { - message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`); - return false; + 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 handeSynchroCOMMODITY(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 result.Result_Data ? result.Result_Data : true; }; return (
-
- - style={{height:'calc(100vh - 135px)',background:'#fff'}} - scroll={{y:'calc(100vh - 410px)'}} - rowKey={(record) => { - return `${record?.COMMODITY_ID}` - }} - formRef={formRef} - headerTitle={} // 列表表头 - actionRef={actionRef} - search={{ span: 6, labelWidth: 'auto' }} - // 请求数据 - request={async (params, sorter) => { - if (!selectedId){ - return - } - // 排序字段 - const sortstr = Object.keys(sorter).map(n => { - const value = sorter[n] - return value ? `${n} ${value.replace('end', '')}` : '' - }) - const searchWholeParams = { - searchParameter: { ...params }, - sortstr: sortstr.length ? sortstr.toString() : "", - pagesize: 999999 - } - setSearchParams(searchWholeParams) - searchWholeParams.pagesize = params.pageSize - const data = await getList(searchWholeParams); - return data; - }} - columns={columns} - toolbar={{ - actions: [ - // 新增按钮 - , - ], - }} - 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, +
+ +
+ + scroll={{ x: "100%", y: 'calc(100vh - 370px)' }} + rowKey={(record) => { + return `${record?.COMMODITY_ID}` }} - columns={columns as ProDescriptionsItemProps[]} + formRef={formRef} + bordered + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + // 请求数据 + request={async (params, sorter) => { + if (!selectedId) { + return + } + const req = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + USERDEFINEDTYPE_IDS: selectedId, + UPPER_STATE: params?.UPPER_STATE, + DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handeGetCOMMODITYList(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: [ + // 新增按钮 + , + , + + ], + }} + pagination={{ defaultPageSize: 10 }} /> - )} - - { - 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) - }} - onOk={async () => { // 提交框内的数据 - formRef?.current?.validateFields().then(()=>{ - handleConfirmLoading(true) - formRef?.current?.submit() - }) - }} - modalRender={(modal) => { - return onDraggaleStart(event, uiData)} - > -
{modal}
-
- }} - > - - layout={'horizontal'} - wrapperCol={{ span: 16 }} // 表单项 填写部分所占的栅格数 - labelCol={{ span: 6 }} // 表单项 标题所占的栅格数 - formRef={formRef} - autoFocusFirstInput - submitter={false} - preserve={false} - initialValues={currentRow} - onFinish={async (values) => { - let newValue: COMMODITYModel = { ...values }; - if (currentRow) { - // 编辑数据 - newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID }; - } - // 如果有开关,要把开关的代码写进去 - const success = await handleAddUpdate(newValue as COMMODITYModel); + { + 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[]} + /> + )} + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新商品管理' : '新建商品管理'} +
+ } + destroyOnClose={true} + width={'70%'} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { handleConfirmLoading(false) - if (success) { - if (actionRef.current) { - actionRef.current.reload(); - } - handleModalVisible(false); - } + handleModalVisible(false) + setBRAND_NAMEList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + > +
{modal}
+
}} > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + { + let newValue: COMMODITYModel = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID }; + } + // 如果有开关,要把开关的代码写进去 + const success = await handleAddUpdate(newValue as COMMODITYModel); + + handleConfirmLoading(false) + if (success) { + if (actionRef.current) { + actionRef.current.reload(); + } + handleModalVisible(false); + } + }} + > + + 基本信息 + + + + + + + + { + if (BRAND_NAMEList && BRAND_NAMEList.length > 0) { + return BRAND_NAMEList + } else { + const req: any = { + searchParameter: { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode, + BRAND_STATE: 1, + BRAND_CATEGORY: 2000 + }, + PageIndex: 1, + PageSize: 999999, + SortStr: "BRAND_INDEX,OPERATE_DATE" + } + const data = await handleGetBRANDList(req) + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + setBRAND_NAMEList(data.List) + return data.List + } + setBRAND_NAMEList([]) + return [] + } + }} + fieldProps={{ + fieldNames: { + label: 'BRAND_NAME', + value: 'BRAND_ID' + }, + showSearch: true, + filterOption: (input, node) => + (node.BRAND_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择商品品牌!" + } + ]} + /> + + + { + return leftTreeData + }} + fieldProps={{ + fieldNames: { + label: "USERDEFINEDTYPE_NAME", + value: "USERDEFINEDTYPE_ID" + }, + showSearch: true, + multiple: true, // 支持多选 + filterTreeNode: (input, node) => + (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + /> + + + + + 商品信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 商品价值 + + + + + + + + + + + + + + + + + + + + 配送信息 + + + + + + + + + + + + + 上架信息 + + + + + + + + + + + + + + + + + + + + + + + +
); diff --git a/src/pages/travelMember/service.ts b/src/pages/travelMember/service.ts index abda542..604cd81 100644 --- a/src/pages/travelMember/service.ts +++ b/src/pages/travelMember/service.ts @@ -1,4 +1,5 @@ // import request from '@/utils/request'; +import { wrapTreeNode } from '@/utils/format'; import requestEncryption from '@/utils/requestEncryption'; @@ -168,14 +169,14 @@ export async function handleDeleteMEMBERADDRESS(params: any) { // 获取品牌管理列表 export async function handleGetBRANDList(params: any) { - const data = await requestEncryption(`/BaseInfo/GetBRANDList`, { + const data = await requestEncryption(`/MallBasic/GetBRANDList`, { method: 'POST', data: { ...params, requestEncryption: true } }) if (data.Result_Code !== 100) { return [] } - return data + return data.Result_Data } // 同步品牌信息 @@ -203,9 +204,69 @@ export async function handlDeleteBRAND(params: any) { } -// 获取商城分类管理 +// 获取商城分类管理(自定义类别的那个) 树形 export async function handlGetUSERDEFINEDTYPEList(params: any) { - const data = await requestEncryption(`/MemberBasic/GetUSERDEFINEDTYPEList`, { + const data = await requestEncryption(`/MallBasic/GetNestingUSERDEFINEDTYPEList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return wrapTreeNode(data.Result_Data.List) +} + +// 同步商城分类管理 +export async function handlSynchroUSERDEFINEDTYPE(params: any) { + const data = await requestEncryption(`/MallBasic/SynchroUSERDEFINEDTYPE`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 删除商城分类管理 +export async function handlDeleteUSERDEFINEDTYPE(params: any) { + const data = await requestEncryption(`/MallBasic/DeleteUSERDEFINEDTYPE`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 获取商品管理列表 +export async function handeGetCOMMODITYList(params: any) { + const data = await requestEncryption(`/MallBasic/GetCOMMODITYList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data.Result_Data +} + +// 同步商品管理 +export async function handeSynchroCOMMODITY(params: any) { + const data = await requestEncryption(`/MallBasic/SynchroCOMMODITY`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 删除商品管理 +export async function handeDeleteCOMMODITY(params: any) { + const data = await requestEncryption(`/MallBasic/DeleteCOMMODITY`, { method: 'POST', data: { ...params, requestEncryption: true } })