From 242edb91e79de46ad8bd74d81af554dfa072f6ee Mon Sep 17 00:00:00 2001 From: xixi <123@qq.com> Date: Mon, 26 Aug 2024 18:03:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CorrectionModal/CorrectionModal.tsx | 304 +++++++++++ src/components/RefunModal/RefunModal.tsx | 13 +- src/components/menu/MenuWithTopButton.tsx | 46 +- src/route/Correction/Correction.tsx | 474 ++++++++++++++++++ src/route/Refun/Refun.tsx | 77 +-- src/route/index/Index.tsx | 78 ++- src/route/router.tsx | 6 +- src/static/correction.png | Bin 0 -> 1654 bytes src/store/index.ts | 10 +- 9 files changed, 927 insertions(+), 81 deletions(-) create mode 100644 src/components/CorrectionModal/CorrectionModal.tsx create mode 100644 src/route/Correction/Correction.tsx create mode 100644 src/static/correction.png diff --git a/src/components/CorrectionModal/CorrectionModal.tsx b/src/components/CorrectionModal/CorrectionModal.tsx new file mode 100644 index 0000000..4daa2b8 --- /dev/null +++ b/src/components/CorrectionModal/CorrectionModal.tsx @@ -0,0 +1,304 @@ +import React from 'react' +import { useEffect, useState } from 'react' +// import './RefunModal.css' +import { Form, Select, Button, Upload, message, Input } from 'antd'; +import { UploadOutlined } from '@ant-design/icons'; +import { uploadImageUrl, DevUserId, get, post } from "../../util/AjaxUtils.ts"; +import { getMenuActive } from '../../util/cache.ts' +import { useDispatch } from 'react-redux' +const { TextArea } = Input; +export default function CorrectionModal(props: any) { + const [messageApi, contextHolder] = message.useMessage(); + // 上传附件 + const [correctionArray, setCorrectionArray] = useState([]); + // const [selectedReason, setSelectedReason] = useState(''); //选择原因 + + // const handleReasonChange = (value: any) => { + // setSelectedReason(value); + // }; + // 获取当前选择类型 + const type = getMenuActive() == 'Correction-PENDING' ? 'PENDING' : getMenuActive() == 'Correction-APPROVED' ? 'APPROVED' : getMenuActive() == 'Correction-REJECTED' ? 'REJECTED' : getMenuActive() == 'Correction-CANCELED' ? 'CANCELED' : '' + const dispath = useDispatch() + const [correctionDataArray, setCorrectionDataArray] = useState([]) //未退款项目 + const [isDisabled,setIsDisabled] = useState(false) //提交按钮是否禁用 + // 提交表单 + const onFinish = (values: any) => { + // console.log('Form values:', values); + + // console.log(refunArray); + + + post({ + messageApi, + url: `/api/proj/correction/apply/save`, + body: { + projId: values.title, + correctionReason: values.other, + correctionVoucher: correctionArray.join(','), + correctionType:values.correctionType + }, + onBefore() { + setIsDisabled(true) + }, + onSuccess() { + messageApi.success('提交成功') + setIsDisabled(true) + setTimeout(() => { + props.closeModal() + + }, 500) + if (type === 'PENDING') { + getData() + + } + + }, + onFinally() { + setIsDisabled(false) + } + }) + }; + const getData = () => { + get({ + messageApi, + url: `/api/proj/correction/apply/listpage`, + // url: `/api/proj/refund/apply/listpage?applyStatus=${state.type}`, + config: { + params: { + page: 1, + rows: 20, + applyStatus: type + } + }, + onSuccess(data: any) { + // console.log('更新'); + + dispath({ + type: 'upCorrectionArray', + val: data.data.rows + }) + dispath({ + type: 'upCorrectionTotal', + val: data.data.total + }) + } + }) + } + // 获取未补正项目 + const getCorrectionData = () => { + get({ + messageApi, + url: `/api/proj/correction/apply/list-proj-unapply/self`, + // config: { + // params: { + + // } + // }, + onBefore() { + + + }, + onSuccess(data: any) { + // console.log(data); + const newArray = (data.data).map((item: { projId: any; projName: any; }) => ({ + value: item.projId, + label: item.projName + })) + setCorrectionDataArray(newArray) + + }, + onFinally() { + + + }, + }) + } + useEffect(() => { + getCorrectionData() + // console.log(type); + + }, []) + return ( +
+ {contextHolder} +
+
+
+ 补正软著* +
+ + + +
+ {/*
+
+ 退款原因* +
+ +