update
This commit is contained in:
parent
89b5e5a985
commit
ae1f3a5b42
@ -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'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -209,6 +209,9 @@ const compareList: React.FC<{
|
||||
const [previewIndex, setPreviewIndex] = useState<number>(0)
|
||||
// 预览的附件
|
||||
const [showImgList, setShowImgList] = useState<any>()
|
||||
// 重新申请加载效果
|
||||
const [reapply, setReapply] = useState<boolean>(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 ? <Button type='primary' style={{ marginBottom: '8px' }} onClick={async () => {
|
||||
compareCurrent?.Approvalstate > 0 && compareCurrent?.PEND_STATE === 0 ? <Button loading={reapply} type='primary' style={{ marginBottom: '8px' }} onClick={async () => {
|
||||
setReapply(true)
|
||||
const res = editFormRef.current?.getFieldValue()
|
||||
if (!clickCalibration) {
|
||||
await getCalibrationTableData(res?.MobilePayCorrect, res?.CashPayCorrect)
|
||||
}
|
||||
console.log('clickCalibration', clickCalibration);
|
||||
|
||||
// if (!clickCalibration) {
|
||||
await getCalibrationTableData(res?.MobilePayCorrect, res?.CashPayCorrect)
|
||||
// }
|
||||
console.log('compareCurrent', compareCurrent)
|
||||
console.log('firstTableData[1]', firstTableData)
|
||||
console.log('resresres', res)
|
||||
setModalFormValue(res)
|
||||
setSettlementModal(true)
|
||||
setReapply(false)
|
||||
}}>
|
||||
重新申请
|
||||
</Button> :
|
||||
|
||||
@ -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<any>()
|
||||
const actionRef = useRef<ActionType>();
|
||||
const formRef = useRef<FormInstance>();
|
||||
// 树相关的属性和方法
|
||||
const [selectedId, setSelectedId] = useState<string>()
|
||||
const [collapsible, setCollapsible] = useState<boolean>(false)
|
||||
// 拿到左侧树的数据
|
||||
const [leftTreeData, setLeftTreeData] = useState<any>()
|
||||
const [modalVisible, handleModalVisible] = useState<boolean>();
|
||||
// 弹出框拖动效果
|
||||
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
||||
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
||||
const [currentRow, setCurrentRow] = useState<any>();
|
||||
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
||||
|
||||
const onDraggaleStart = (event, uiData) => {
|
||||
const { clientWidth, clientHeight } = window.document.documentElement;
|
||||
const targetRect = draggleRef.current?.getBoundingClientRect();
|
||||
if (!targetRect) {
|
||||
return;
|
||||
}
|
||||
setBounds({
|
||||
left: -targetRect.left + uiData.x,
|
||||
right: clientWidth - (targetRect.right - uiData.x),
|
||||
top: -targetRect.top + uiData.y,
|
||||
bottom: clientHeight - (targetRect.bottom - uiData.y),
|
||||
});
|
||||
};
|
||||
|
||||
const columns: any = [
|
||||
{
|
||||
dataIndex: "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 (
|
||||
<Space>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentRow({ ...record });
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</a>
|
||||
<Popconfirm
|
||||
title="确认删除该商品管理列表信息吗?"
|
||||
onConfirm={async () => {
|
||||
await handelDelete(record.MERCHANTS_ID);
|
||||
}}
|
||||
>
|
||||
<a>删除</a>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
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 (
|
||||
<div>
|
||||
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
|
||||
<div style={{
|
||||
width: '100%',
|
||||
paddingTop: 0,
|
||||
paddingBottom: 0,
|
||||
paddingRight: 0
|
||||
}}>
|
||||
<ProTable
|
||||
scroll={{ x: "100%", y: 'calc(100vh - 370px)' }}
|
||||
rowKey={(record) => {
|
||||
return `${record?.COMMODITY_ID}`
|
||||
}}
|
||||
formRef={formRef}
|
||||
bordered
|
||||
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||
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: [
|
||||
// 新增按钮
|
||||
<Button
|
||||
key="new"
|
||||
icon={<PlusOutlined />}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
新增商户
|
||||
</Button>
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
cursor: 'move',
|
||||
}}
|
||||
onMouseOver={() => {
|
||||
if (disabled) {
|
||||
setDraggleDisabled(false)
|
||||
}
|
||||
}}
|
||||
onMouseOut={() => {
|
||||
setDraggleDisabled(true)
|
||||
}}
|
||||
|
||||
onFocus={() => { }}
|
||||
onBlur={() => { }}
|
||||
>
|
||||
{currentRow ? '更新商品管理' : '新建商品管理'}
|
||||
</div>
|
||||
}
|
||||
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 <Draggable
|
||||
disabled={disabled}
|
||||
bounds={bounds}
|
||||
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
|
||||
>
|
||||
<div ref={draggleRef}>{modal}</div>
|
||||
</Draggable>
|
||||
}}
|
||||
>
|
||||
<ProForm
|
||||
layout={'horizontal'}
|
||||
formRef={formRef}
|
||||
autoFocusFirstInput
|
||||
submitter={false}
|
||||
preserve={false}
|
||||
initialValues={currentRow ? {
|
||||
...currentRow
|
||||
} : {
|
||||
OWNERUNIT_NAME: currentUser?.OwnerUnitName
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
let newValue: any = { ...values };
|
||||
if (currentRow) {
|
||||
// 编辑数据
|
||||
newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID };
|
||||
}
|
||||
// 如果有开关,要把开关的代码写进去
|
||||
await handleAddUpdate(newValue);
|
||||
|
||||
handleConfirmLoading(false)
|
||||
handleModalVisible(false);
|
||||
}}
|
||||
>
|
||||
<Row gutter={8}>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="OWNERUNIT_NAME"
|
||||
label="业主单位"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入业主单位!"
|
||||
}
|
||||
]}
|
||||
disabled
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="MERCHANTS_TYPE"
|
||||
label="商户类型"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请选择商户类型!"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="MERCHANTS_AUTOTYPE"
|
||||
label="商户性质"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请选择商户性质!"
|
||||
}
|
||||
]}
|
||||
options={[{ label: "企业公司", value: 1000 }, { label: "个体", value: 2000 }, { label: "自然人", value: 3000 }]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_NAME"
|
||||
label="商户名称"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入商户名称!"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_EN"
|
||||
label="商户简称"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="TAXPAYER_IDENTIFYCODE"
|
||||
label="统一信用代码"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入统一信用代码!"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_LINKMAN"
|
||||
label="联系人员"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_TELEPHONE"
|
||||
label="手机号码"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="MERCHANTS_STATE"
|
||||
label="商户状态"
|
||||
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
<Col span={24}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_ADDRESS "
|
||||
label="商户地址"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<ProFormTextArea
|
||||
name="MERCHANTS_DESC"
|
||||
label="商户简介"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
476
src/pages/travelMember/HomepageAds/index.tsx
Normal file
476
src/pages/travelMember/HomepageAds/index.tsx
Normal file
@ -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<ActionType>();
|
||||
const formRef = useRef<FormInstance>();
|
||||
const [currentRow, setCurrentRow] = useState<any>();
|
||||
const [modalVisible, handleModalVisible] = useState<boolean>();
|
||||
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
||||
// 弹出框拖动效果
|
||||
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
||||
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
||||
const draggleRef = React.createRef<any>()
|
||||
const [province, setProvince] = useState<string>('');
|
||||
const [city, setCity] = useState<string>('');
|
||||
const [county, setCounty] = useState<string>('');
|
||||
// tab选择框 判断是查看 首页大图的内容 还是小图的内容
|
||||
const tabList: any = [{ label: "首页大图", key: "1" }, { label: "轮播图", key: "2" }]
|
||||
const [selectTab, setSelectTab] = useState<string>("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<any>([])
|
||||
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(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 <img style={{ width: '50px', height: '50px', borderRadius: '50%', cursor: 'pointer' }} src={record?.USERDEFINEDTYPE_ICO} onClick={() => {
|
||||
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 (
|
||||
<Space>
|
||||
<a
|
||||
onClick={() => {
|
||||
console.log('record', record);
|
||||
setFileList(record?.USERDEFINEDTYPE_ICO ? [{ url: record?.USERDEFINEDTYPE_ICO }] : [])
|
||||
setCurrentRow({ ...record });
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</a>
|
||||
<Popconfirm
|
||||
title="确认删除该广告吗?"
|
||||
onConfirm={async () => {
|
||||
await handelDelete(record.USERDEFINEDTYPE_ID);
|
||||
}}
|
||||
>
|
||||
<a>删除</a>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// 预览上传后的图片
|
||||
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 (
|
||||
<div style={{ backgroundColor: "#fff" }}>
|
||||
<div style={{ width: '100%', boxSizing: 'border-box', padding: '24px' }}>
|
||||
<Tabs activeKey={selectTab} items={tabList} onChange={(e: any) => {
|
||||
setSelectTab(e)
|
||||
}} />
|
||||
</div>
|
||||
|
||||
{
|
||||
selectTab === "1" ?
|
||||
<ProTable
|
||||
scroll={{ x: "100%" }}
|
||||
formRef={formRef}
|
||||
actionRef={actionRef}
|
||||
search={false}
|
||||
bordered
|
||||
request={async (params, sorter) => {
|
||||
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: [
|
||||
<Button type={'primary'} onClick={() => {
|
||||
handleModalVisible(true)
|
||||
}}>
|
||||
新增大图
|
||||
</Button>
|
||||
]
|
||||
}}
|
||||
/> : ""
|
||||
}
|
||||
|
||||
{
|
||||
selectTab === "2" ?
|
||||
<ProTable
|
||||
scroll={{ x: "100%" }}
|
||||
formRef={formRef}
|
||||
actionRef={actionRef}
|
||||
search={false}
|
||||
bordered
|
||||
request={async (params, sorter) => {
|
||||
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: [
|
||||
<Button type={'primary'} onClick={() => {
|
||||
handleModalVisible(true)
|
||||
}}>
|
||||
新增轮播图
|
||||
</Button>
|
||||
]
|
||||
}}
|
||||
/> : ""
|
||||
}
|
||||
|
||||
{/* 图片预览组件 */}
|
||||
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
|
||||
<Image.PreviewGroup
|
||||
preview={{
|
||||
visible: imagePreviewVisible,
|
||||
onVisibleChange: vis => {
|
||||
handleChangePreview(vis)
|
||||
}
|
||||
}}>
|
||||
{
|
||||
fileList.map((n) => <Image src={n.url} key={n.url} />)
|
||||
}
|
||||
</Image.PreviewGroup>
|
||||
</div>}
|
||||
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
cursor: 'move',
|
||||
}}
|
||||
onMouseOver={() => {
|
||||
if (disabled) {
|
||||
setDraggleDisabled(false)
|
||||
}
|
||||
}}
|
||||
onMouseOut={() => {
|
||||
setDraggleDisabled(true)
|
||||
}}
|
||||
|
||||
onFocus={() => { }}
|
||||
onBlur={() => { }}
|
||||
>
|
||||
{currentRow ? '更新会员收货地址' : '新建会员收货地址'}
|
||||
</div>
|
||||
}
|
||||
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 <Draggable
|
||||
disabled={disabled}
|
||||
bounds={bounds}
|
||||
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
|
||||
>
|
||||
<div ref={draggleRef}>{modal}</div>
|
||||
</Draggable>
|
||||
}}
|
||||
>
|
||||
<ProForm
|
||||
layout={'horizontal'}
|
||||
labelCol={{ style: { width: '80px' } }}
|
||||
formRef={formRef}
|
||||
autoFocusFirstInput
|
||||
submitter={false}
|
||||
preserve={false}
|
||||
initialValues={currentRow ? {
|
||||
...currentRow,
|
||||
PRESALE_TIME: [currentRow?.PRESALE_STARTTIME, currentRow?.PRESALE_ENDTIME,]
|
||||
} : {
|
||||
USERDEFINEDTYPE_NAME: selectTab === "1" ? "小程序海报" : "小程序轮播图",
|
||||
USERDEFINEDTYPE_STATE: 1
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
let newValue: any = { ...values };
|
||||
if (currentRow) {
|
||||
// 编辑数据
|
||||
newValue = { ...values, MEMBERADDRESS_ID: currentRow.MEMBERADDRESS_ID };
|
||||
}
|
||||
await handleAddUpdate(newValue);
|
||||
|
||||
handleConfirmLoading(false)
|
||||
}}
|
||||
>
|
||||
<Row gutter={8}>
|
||||
<Col span={12}>
|
||||
<ProFormText
|
||||
name="USERDEFINEDTYPE_NAME"
|
||||
label="图片类型"
|
||||
disabled
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormSelect
|
||||
name="USERDEFINEDTYPE_STATE"
|
||||
label="有效状态"
|
||||
options={[
|
||||
{ label: "有效", value: 1 },
|
||||
{ label: "无效", value: 0 },
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormDateTimeRangePicker
|
||||
name="PRESALE_TIME"
|
||||
label="显示时间"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormUploadButton
|
||||
name="USERDEFINEDTYPE_ICO"
|
||||
label="上传附件"
|
||||
fileList={fileList}
|
||||
listType="picture-card"
|
||||
accept="image/*"
|
||||
fieldProps={{
|
||||
beforeUpload,
|
||||
maxCount: 1,
|
||||
onPreview: handlePreview,
|
||||
customRequest: async (info) => {
|
||||
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("您上传的图片不存在.")
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default connect(({ user }: ConnectState) => ({
|
||||
currentUser: user.currentUser
|
||||
}))(HomepageAds);
|
||||
@ -141,8 +141,8 @@ const MallBrandManage: React.FC<{ currentUser: CurrentUser }> = (props) => {
|
||||
<Space>
|
||||
<a
|
||||
onClick={() => {
|
||||
// setCurrentRow({ ...record });
|
||||
// handleModalVisible(true);
|
||||
setCurrentRow({ ...record });
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
|
||||
@ -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={<PageTitleBox props={props} />} // 列表表头
|
||||
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={{
|
||||
}}
|
||||
|
||||
@ -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<any>()
|
||||
// 拿到左侧树的数据
|
||||
const [leftTreeData, setLeftTreeData] = useState<any>()
|
||||
// 多规格
|
||||
const [showMoreSpecs, setShowMoreSpecs] = useState<boolean>(false)
|
||||
// 新增规格的 悬浮框
|
||||
const [showAddSpecsModal, setShowAddSpecsModal] = useState<boolean>(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
|
||||
}}>
|
||||
{/* 最外层的列表 */}
|
||||
<ProTable<COMMODITYModel>
|
||||
scroll={{ x: "100%", y: 'calc(100vh - 370px)' }}
|
||||
rowKey={(record) => {
|
||||
@ -351,32 +449,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
||||
pagination={{ defaultPageSize: 10 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<Drawer
|
||||
width={600}
|
||||
visible={showDetail}
|
||||
onClose={() => {
|
||||
setCurrentRow(undefined);
|
||||
setShowDetail(false);
|
||||
}}
|
||||
closable={false}
|
||||
>
|
||||
{currentRow?.COMMODITY_ID && (
|
||||
<ProDescriptions<COMMODITYModel>
|
||||
column={2}
|
||||
title={currentRow?.COMMODITY_NAME}
|
||||
request={async () => ({
|
||||
data: currentRow || {},
|
||||
})}
|
||||
params={{
|
||||
id: currentRow?.COMMODITY_ID,
|
||||
}}
|
||||
columns={columns as ProDescriptionsItemProps<COMMODITYModel>[]}
|
||||
/>
|
||||
)}
|
||||
</Drawer>
|
||||
{/* 添加商品的悬浮框 */}
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
@ -413,6 +486,31 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
||||
setBRAND_NAMEList([])
|
||||
}}
|
||||
|
||||
footer={<div style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<div>
|
||||
{
|
||||
currentRow ?
|
||||
<Button type={"primary"} onClick={() => {
|
||||
console.log('currentRow', currentRow);
|
||||
|
||||
setShowMoreSpecs(true)
|
||||
}}>多规格管理</Button> : ""
|
||||
}
|
||||
</div>
|
||||
<div>
|
||||
<Button onClick={() => {
|
||||
handleConfirmLoading(false)
|
||||
handleModalVisible(false)
|
||||
setBRAND_NAMEList([])
|
||||
}}>取 消</Button>
|
||||
<Button type={"primary"} onClick={() => {
|
||||
formRef?.current?.validateFields().then(() => {
|
||||
handleConfirmLoading(true)
|
||||
formRef?.current?.submit()
|
||||
})
|
||||
}}>确 定</Button>
|
||||
</div>
|
||||
</div>}
|
||||
onOk={async () => { // 提交框内的数据
|
||||
formRef?.current?.validateFields().then(() => {
|
||||
handleConfirmLoading(true)
|
||||
@ -799,6 +897,80 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
|
||||
</Row>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
|
||||
{/* 多规格配置的悬浮框 */}
|
||||
<Modal
|
||||
title={"多规格管理"}
|
||||
destroyOnClose={true}
|
||||
width={900}
|
||||
visible={showMoreSpecs}
|
||||
onCancel={() => {
|
||||
setShowMoreSpecs(false)
|
||||
}}
|
||||
onOk={async () => { // 提交框内的数据
|
||||
|
||||
}}
|
||||
>
|
||||
<ProTable
|
||||
search={false}
|
||||
pagination={false}
|
||||
options={false}
|
||||
columns={specsColumns}
|
||||
scroll={{ x: "100%" }}
|
||||
toolbar={{
|
||||
actions: [
|
||||
<Button type={"primary"} onClick={() => {
|
||||
setShowAddSpecsModal(true)
|
||||
}}>新增规格</Button>
|
||||
]
|
||||
}}
|
||||
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);
|
||||
|
||||
}}
|
||||
/>
|
||||
|
||||
</Modal>
|
||||
|
||||
{/* 添加多规格的悬浮框 */}
|
||||
<Modal
|
||||
title={"新增规格管理"}
|
||||
destroyOnClose={true}
|
||||
width={800}
|
||||
visible={showAddSpecsModal}
|
||||
onCancel={() => {
|
||||
setShowAddSpecsModal(false)
|
||||
}}
|
||||
onOk={async () => { // 提交框内的数据
|
||||
|
||||
}}
|
||||
>
|
||||
<ProTable
|
||||
search={false}
|
||||
pagination={false}
|
||||
options={false}
|
||||
columns={addSpecsCoumns}
|
||||
scroll={{ x: "100%" }}
|
||||
rowSelection={{
|
||||
type: 'checkbox', // 多选,单选用 'radio'
|
||||
onChange: (selectedRowKeys, selectedRows) => {
|
||||
console.log(selectedRowKeys, selectedRows);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
</Modal>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -1,15 +1,528 @@
|
||||
// 供货商户分类
|
||||
import { ConnectState } from "@/models/connect";
|
||||
import { connect, CurrentUser } from "umi";
|
||||
// 供应商分类
|
||||
|
||||
const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => {
|
||||
return (
|
||||
<div>
|
||||
import React, { useRef, useState, Suspense } from 'react';
|
||||
import moment from 'moment'; // 时间相关引用,没有使用可以删除
|
||||
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
|
||||
import { connect } from 'umi';
|
||||
|
||||
</div>
|
||||
)
|
||||
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
|
||||
import Draggable from 'react-draggable';
|
||||
import SubMenu from "antd/lib/menu/SubMenu";
|
||||
import ProTable from '@ant-design/pro-table';
|
||||
import ProDescriptions from '@ant-design/pro-descriptions';
|
||||
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form';
|
||||
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd';
|
||||
|
||||
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<ActionType>();
|
||||
const formRef = useRef<FormInstance>();
|
||||
const [currentRow, setCurrentRow] = useState<any>();
|
||||
const [showDetail, setShowDetail] = useState<boolean>();
|
||||
const [modalVisible, handleModalVisible] = useState<boolean>();
|
||||
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
||||
const [searchParams, setSearchParams] = useState<any>();
|
||||
// 分类的树形结构数据
|
||||
const [typeTreeData, setTypeTreeData] = useState<any>()
|
||||
// 表单里面的是否预售
|
||||
const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState<boolean>(false)
|
||||
|
||||
// 弹出框拖动效果
|
||||
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
||||
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
||||
const draggleRef = React.createRef<any>()
|
||||
|
||||
// 文件列表
|
||||
const [fileList, setFileList] = useState<any>([])
|
||||
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
|
||||
|
||||
const onDraggaleStart = (event, uiData) => {
|
||||
const { clientWidth, clientHeight } = window.document.documentElement;
|
||||
const targetRect = draggleRef.current?.getBoundingClientRect();
|
||||
if (!targetRect) {
|
||||
return;
|
||||
}
|
||||
setBounds({
|
||||
left: -targetRect.left + uiData.x,
|
||||
right: clientWidth - (targetRect.right - uiData.x),
|
||||
top: -targetRect.top + uiData.y,
|
||||
bottom: clientHeight - (targetRect.bottom - uiData.y),
|
||||
});
|
||||
};
|
||||
|
||||
// 定义列表字段内容
|
||||
const columns: any = [
|
||||
// {
|
||||
// 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 <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-start' }}>
|
||||
<img style={{ width: '30px', height: '30px', marginRight: '5px', borderRadius: '50%' }} src={record?.USERDEFINEDTYPE_ICO || defaultIcon} />
|
||||
<span style={{ width: '240px', display: "inline-block", whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'left' }}>{record?.USERDEFINEDTYPE_NAME}</span>
|
||||
</div>
|
||||
}
|
||||
},
|
||||
{
|
||||
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 (
|
||||
<Space>
|
||||
<a
|
||||
onClick={() => {
|
||||
console.log('recordrecordrecord', record);
|
||||
if (record?.USERDEFINEDTYPE_ICO) {
|
||||
setFileList([{
|
||||
name: "",
|
||||
url: record?.USERDEFINEDTYPE_ICO
|
||||
}])
|
||||
}
|
||||
|
||||
setCurrentRow({ ...record });
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</a>
|
||||
<Popconfirm
|
||||
title="确认删除该商品自定义类别列表信息吗?"
|
||||
onConfirm={async () => {
|
||||
handelDelete(record.USERDEFINEDTYPE_ID);
|
||||
}}
|
||||
>
|
||||
<a>删除</a>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// 预览上传后的图片
|
||||
const handlePreview = async () => {
|
||||
setFileList(fileList)
|
||||
setImagePreviewVisible(true)
|
||||
};
|
||||
const handleChangePreview = (val: any) => {
|
||||
setImagePreviewVisible(val)
|
||||
}
|
||||
|
||||
// 删除商品类别
|
||||
const handelDelete = async (id: any) => {
|
||||
const req: any = {
|
||||
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 (
|
||||
<PageContainer header={{
|
||||
title: '',
|
||||
breadcrumb: {}
|
||||
}}>
|
||||
<ProTable
|
||||
style={{ height: 'calc(100vh - 135px)', background: '#fff' }}
|
||||
scroll={{ y: 'calc(100vh - 410px)' }}
|
||||
rowKey={(record) => {
|
||||
return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}`
|
||||
}}
|
||||
formRef={formRef}
|
||||
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||
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: [
|
||||
// 新增按钮
|
||||
<Button
|
||||
key="new"
|
||||
icon={<PlusOutlined />}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
供应商类别
|
||||
</Button>,
|
||||
],
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 图片预览组件 */}
|
||||
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
|
||||
<Image.PreviewGroup
|
||||
preview={{
|
||||
visible: imagePreviewVisible,
|
||||
onVisibleChange: vis => {
|
||||
handleChangePreview(vis)
|
||||
}
|
||||
}}>
|
||||
{
|
||||
fileList.map((n) => <Image src={n.url} key={n.url} />)
|
||||
}
|
||||
</Image.PreviewGroup>
|
||||
</div>}
|
||||
|
||||
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
cursor: 'move',
|
||||
}}
|
||||
onMouseOver={() => {
|
||||
if (disabled) {
|
||||
setDraggleDisabled(false)
|
||||
}
|
||||
}}
|
||||
onMouseOut={() => {
|
||||
setDraggleDisabled(true)
|
||||
}}
|
||||
|
||||
onFocus={() => { }}
|
||||
onBlur={() => { }}
|
||||
>
|
||||
{currentRow ? '更新供应商类别' : '新建供应商类别'}
|
||||
</div>
|
||||
}
|
||||
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 <Draggable
|
||||
disabled={disabled}
|
||||
bounds={bounds}
|
||||
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
|
||||
>
|
||||
<div ref={draggleRef}>{modal}</div>
|
||||
</Draggable>
|
||||
}}
|
||||
>
|
||||
<ProForm
|
||||
layout={'horizontal'}
|
||||
formRef={formRef}
|
||||
autoFocusFirstInput
|
||||
submitter={false}
|
||||
preserve={false}
|
||||
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);
|
||||
|
||||
// 如果有开关,要把开关的代码写进去
|
||||
await handleAddUpdate(newValue);
|
||||
|
||||
handleConfirmLoading(false)
|
||||
setFormPRESALE_TYPE(false)
|
||||
}}
|
||||
>
|
||||
<Row gutter={8}>
|
||||
<Col span={12}>
|
||||
<ProFormTreeSelect
|
||||
name="USERDEFINEDTYPE_PID"
|
||||
label="上级类别"
|
||||
request={async () => {
|
||||
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: "请选择上级类别"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormText
|
||||
name="USERDEFINEDTYPE_NAME"
|
||||
label="类别名称"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入类别名称"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormDigit
|
||||
name="USERDEFINEDTYPE_INDEX"
|
||||
label="类别索引"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入类别索引"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormSelect
|
||||
name="USERDEFINEDTYPE_STATE"
|
||||
label="有效状态"
|
||||
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请选择有效状态"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
<Col span={12}>
|
||||
<ProFormText
|
||||
name="USERDEFINEDTYPE_DATE"
|
||||
label="添加时间"
|
||||
disabled
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormText
|
||||
name="OWNERUNIT_NAME"
|
||||
label="业主单位"
|
||||
disabled
|
||||
/>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<ProFormTextArea
|
||||
name="USERDEFINEDTYPE_DESC"
|
||||
label="备注"
|
||||
/>
|
||||
</Col>
|
||||
|
||||
</Row>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
export default connect(({ user }: ConnectState) => ({
|
||||
currentUser: user.currentUser
|
||||
}))(SupplierClassification);
|
||||
|
||||
|
||||
|
||||
@ -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<FormInstance>();
|
||||
// 默认的服务区树
|
||||
const [allTreeViews, setAllTreeViews] = useState<any>()
|
||||
// 是否要显示全部
|
||||
const [isShowAllInTree, setIsShowAllInTree] = useState<boolean>(false)
|
||||
// 加载服务区树
|
||||
const { loading: treeLoading, data: treeViews } = useRequest(async () => {
|
||||
|
||||
})
|
||||
// 显示服务区树搜索框
|
||||
const [showServiceSearchBox, setShowServiceSearchBox] = useState<boolean>(false)
|
||||
// 实际显示在左侧的服务区树
|
||||
const [treeView, setTreeView] = useState<any>()
|
||||
// 树要展开的行
|
||||
const [treeShowRow, setTreeShowRow] = useState<any>()
|
||||
// 筛选左侧的服务区树
|
||||
const handleFilterServiceTree = async (value?: string) => {
|
||||
const resList: any = JSON.parse(JSON.stringify(allTreeViews))
|
||||
setSelectedId('')
|
||||
if (resList && resList.length > 0 && value) {
|
||||
setTreeView([])
|
||||
const list: any = []
|
||||
resList.forEach((item: any) => {
|
||||
if (item.label.indexOf(value) !== -1) {
|
||||
list.push(item)
|
||||
} else {
|
||||
if (item.children && item.children.length > 0) {
|
||||
const childrenList: any = []
|
||||
item.children.forEach((subItem: any) => {
|
||||
if (subItem.label.indexOf(value) !== -1) {
|
||||
childrenList.push(subItem)
|
||||
}
|
||||
})
|
||||
item.children = childrenList
|
||||
if (childrenList && childrenList.length > 0) {
|
||||
list.push(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
if (list && list.length > 0) {
|
||||
const keyList: any = ['0-0']
|
||||
list.forEach((item: any) => {
|
||||
keyList.push(item.key)
|
||||
})
|
||||
setTreeShowRow(keyList)
|
||||
}
|
||||
setTimeout(() => {
|
||||
setTreeView(list)
|
||||
}, 100)
|
||||
} else {
|
||||
setTreeView([])
|
||||
setTreeShowRow([])
|
||||
setTreeView(allTreeViews)
|
||||
}
|
||||
}
|
||||
// 根据传入的服务区id筛选剔除掉这个服务区
|
||||
const handleFilterList = (list: any, id: any) => {
|
||||
let res: any = []
|
||||
list.forEach((item: any) => {
|
||||
if (item.value === id) {
|
||||
|
||||
} else {
|
||||
res.push(item)
|
||||
}
|
||||
})
|
||||
console.log('res', res);
|
||||
return res
|
||||
}
|
||||
|
||||
// 仅支持单选一个服务区的时候 调用的方法
|
||||
const convertTreeForSelectOnly = (treeData: any[]): any[] => {
|
||||
return treeData.map(item => {
|
||||
const newItem = {
|
||||
...item,
|
||||
disabled: item.type !== 1,
|
||||
};
|
||||
if (item.children) {
|
||||
newItem.children = convertTreeForSelectOnly(item.children);
|
||||
}
|
||||
return newItem;
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ProCard
|
||||
style={{ width: !collapsible ? width ? `${width}px` : "300px" : "60px" }}
|
||||
className="pageTable-leftnav"
|
||||
bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20, width: !collapsible ? width ? `${width}px` : "300px" : "60px" }}
|
||||
extra={<div className="leftSelectBox">
|
||||
{/* <img className="searchIcon" src={searchIcon} onClick={() => {
|
||||
setShowServiceSearchBox(true)
|
||||
}} /> */}
|
||||
<MenuFoldOutlined onClick={() => {
|
||||
setCollapsible(!collapsible);
|
||||
}} />
|
||||
<div className="fixedBox" style={{ display: showServiceSearchBox ? 'flex' : 'none', width: width ? `${width}px` : '275px' }}>
|
||||
<ProForm
|
||||
formRef={searchTreeRef}
|
||||
layout={'horizontal'}
|
||||
submitter={{
|
||||
render: () => {
|
||||
return []
|
||||
}
|
||||
}}
|
||||
isKeyPressSubmit
|
||||
onFinish={(values: any) => {
|
||||
return handleFilterServiceTree(values?.searchValue || '')
|
||||
}}
|
||||
>
|
||||
<Row>
|
||||
<Col span={15} className={'noBottom'}>
|
||||
<ProFormText
|
||||
name={'searchValue'}
|
||||
fieldProps={{
|
||||
placeholder: '请输入服务区名称'
|
||||
}}
|
||||
allowClear
|
||||
/>
|
||||
</Col>
|
||||
<Col span={2}></Col>
|
||||
<Col span={5}>
|
||||
<Button type={'primary'} onClick={() => {
|
||||
searchTreeRef.current?.submit()
|
||||
}}>查询</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
</ProForm>
|
||||
<img style={{ width: '20px', height: '20px', cursor: 'pointer', marginLeft: '5px' }} src={close} onClick={() => {
|
||||
setShowServiceSearchBox(false)
|
||||
}} />
|
||||
</div>
|
||||
</div>}
|
||||
colSpan={!collapsible ? "300px" : "60px"}
|
||||
title={!collapsible ? "请选择商城分类" : ""}
|
||||
headerBordered
|
||||
collapsed={collapsible}
|
||||
>
|
||||
{treeView && treeView.length > 0 ? <Tree
|
||||
checkable
|
||||
treeData={selectOnly
|
||||
? (isShowAllInTree
|
||||
? [{
|
||||
label: '全部',
|
||||
value: 0,
|
||||
key: '0-0',
|
||||
children: convertTreeForSelectOnly(treeView)
|
||||
}]
|
||||
: convertTreeForSelectOnly(treeView))
|
||||
: (isShowAllInTree
|
||||
? [{
|
||||
label: '全部',
|
||||
value: 0,
|
||||
key: '0-0',
|
||||
children: treeView
|
||||
}]
|
||||
: treeView)}
|
||||
blockNode
|
||||
// defaultExpandAll={isShowAllInTree ? false : true}
|
||||
// defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 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"
|
||||
}}
|
||||
/> : ''}
|
||||
</ProCard>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default connect(({ user }: ConnectState) => ({
|
||||
currentUser: user.currentUser,
|
||||
}))(LeftSelectMallType);
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<any>()
|
||||
const actionRef = useRef<ActionType>();
|
||||
const formRef = useRef<FormInstance>();
|
||||
// 树相关的属性和方法
|
||||
const [selectedId, setSelectedId] = useState<string>()
|
||||
const [collapsible, setCollapsible] = useState<boolean>(false)
|
||||
// 拿到左侧树的数据
|
||||
const [leftTreeData, setLeftTreeData] = useState<any>()
|
||||
const [modalVisible, handleModalVisible] = useState<boolean>();
|
||||
// 弹出框拖动效果
|
||||
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
|
||||
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
|
||||
const [currentRow, setCurrentRow] = useState<any>();
|
||||
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
|
||||
|
||||
const onDraggaleStart = (event, uiData) => {
|
||||
const { clientWidth, clientHeight } = window.document.documentElement;
|
||||
const targetRect = draggleRef.current?.getBoundingClientRect();
|
||||
if (!targetRect) {
|
||||
return;
|
||||
}
|
||||
setBounds({
|
||||
left: -targetRect.left + uiData.x,
|
||||
right: clientWidth - (targetRect.right - uiData.x),
|
||||
top: -targetRect.top + uiData.y,
|
||||
bottom: clientHeight - (targetRect.bottom - uiData.y),
|
||||
});
|
||||
};
|
||||
|
||||
const columns: any = [
|
||||
{
|
||||
dataIndex: "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 (
|
||||
<Space>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentRow({ ...record });
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</a>
|
||||
<Popconfirm
|
||||
title="确认删除该商品管理列表信息吗?"
|
||||
onConfirm={async () => {
|
||||
await handelDelete(record.MERCHANTS_ID);
|
||||
}}
|
||||
>
|
||||
<a>删除</a>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
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 (
|
||||
<div>
|
||||
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
|
||||
<LeftSelectMerchantType setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} setData={setLeftTreeData} />
|
||||
<div style={{
|
||||
width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
|
||||
paddingTop: 0,
|
||||
paddingBottom: 0,
|
||||
paddingRight: 0
|
||||
}}>
|
||||
<ProTable
|
||||
scroll={{ x: "100%", y: 'calc(100vh - 370px)' }}
|
||||
rowKey={(record) => {
|
||||
return `${record?.COMMODITY_ID}`
|
||||
}}
|
||||
formRef={formRef}
|
||||
bordered
|
||||
headerTitle={<PageTitleBox props={props} />} // 列表表头
|
||||
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: [
|
||||
// 新增按钮
|
||||
<Button
|
||||
key="new"
|
||||
icon={<PlusOutlined />}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
handleModalVisible(true);
|
||||
}}
|
||||
>
|
||||
新增商户
|
||||
</Button>
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
cursor: 'move',
|
||||
}}
|
||||
onMouseOver={() => {
|
||||
if (disabled) {
|
||||
setDraggleDisabled(false)
|
||||
}
|
||||
}}
|
||||
onMouseOut={() => {
|
||||
setDraggleDisabled(true)
|
||||
}}
|
||||
|
||||
onFocus={() => { }}
|
||||
onBlur={() => { }}
|
||||
>
|
||||
{currentRow ? '更新商品管理' : '新建商品管理'}
|
||||
</div>
|
||||
}
|
||||
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 <Draggable
|
||||
disabled={disabled}
|
||||
bounds={bounds}
|
||||
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
|
||||
>
|
||||
<div ref={draggleRef}>{modal}</div>
|
||||
</Draggable>
|
||||
}}
|
||||
>
|
||||
<ProForm
|
||||
layout={'horizontal'}
|
||||
formRef={formRef}
|
||||
autoFocusFirstInput
|
||||
submitter={false}
|
||||
preserve={false}
|
||||
initialValues={currentRow ? {
|
||||
...currentRow
|
||||
} : {
|
||||
OWNERUNIT_NAME: currentUser?.OwnerUnitName
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
let newValue: any = { ...values };
|
||||
if (currentRow) {
|
||||
// 编辑数据
|
||||
newValue = { ...values, COMMODITY_ID: currentRow.COMMODITY_ID };
|
||||
}
|
||||
// 如果有开关,要把开关的代码写进去
|
||||
await handleAddUpdate(newValue);
|
||||
|
||||
handleConfirmLoading(false)
|
||||
handleModalVisible(false);
|
||||
}}
|
||||
>
|
||||
<Row gutter={8}>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="OWNERUNIT_NAME"
|
||||
label="业主单位"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入业主单位!"
|
||||
}
|
||||
]}
|
||||
disabled
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="MERCHANTS_TYPE"
|
||||
label="商户类型"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请选择商户类型!"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="MERCHANTS_AUTOTYPE"
|
||||
label="商户性质"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请选择商户性质!"
|
||||
}
|
||||
]}
|
||||
options={[{ label: "企业公司", value: 1000 }, { label: "个体", value: 2000 }, { label: "自然人", value: 3000 }]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_NAME"
|
||||
label="商户名称"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入商户名称!"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_EN"
|
||||
label="商户简称"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="TAXPAYER_IDENTIFYCODE"
|
||||
label="统一信用代码"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: "请输入统一信用代码!"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_LINKMAN"
|
||||
label="联系人员"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_TELEPHONE"
|
||||
label="手机号码"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
name="MERCHANTS_STATE"
|
||||
label="商户状态"
|
||||
options={[{ label: "有效", value: 1 }, { label: "无效", value: 0 }]}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
<Col span={24}>
|
||||
<ProFormText
|
||||
name="MERCHANTS_ADDRESS "
|
||||
label="商户地址"
|
||||
/>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<ProFormTextArea
|
||||
name="MERCHANTS_DESC"
|
||||
label="商户简介"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -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`, {
|
||||
@ -275,3 +288,95 @@ export async function handeDeleteCOMMODITY(params: any) {
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// 获取商品的多规格列表
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user