From 79cc9055472e6062e0eba20dc6bf59abb8bc9c28 Mon Sep 17 00:00:00 2001 From: xixi <123@qq.com> Date: Thu, 22 Aug 2024 18:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RefunModal/RefunModal.tsx | 87 ++++++-- src/route/Refun/Refun.tsx | 261 ++++++++--------------- src/route/Refun/refun.css | 6 +- 3 files changed, 156 insertions(+), 198 deletions(-) diff --git a/src/components/RefunModal/RefunModal.tsx b/src/components/RefunModal/RefunModal.tsx index 41cbc9f..346aa3b 100644 --- a/src/components/RefunModal/RefunModal.tsx +++ b/src/components/RefunModal/RefunModal.tsx @@ -2,10 +2,10 @@ 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 } from "../../util/AjaxUtils.ts"; +import { uploadImageUrl, DevUserId, get,post } from "../../util/AjaxUtils.ts"; const { TextArea } = Input; -export default function RefunModal(props:any) { +export default function RefunModal(props: any) { const [messageApi, contextHolder] = message.useMessage(); // 上传附件 const [refunArray, setRefunArray] = useState([]); @@ -14,27 +14,64 @@ export default function RefunModal(props:any) { const handleReasonChange = (value: any) => { setSelectedReason(value); }; - // const [refunDataArray,setRefunDataArray] = useState([]) //未退款项目 + const [refunDataArray, setRefunDataArray] = useState([]) //未退款项目 // 提交表单 const onFinish = (values: any) => { console.log('Form values:', values); - props.closeModal() + // props.closeModal() + console.log(refunArray); + post({ + messageApi, + url: `/api/proj/refund/apply/save`, + body: { + projId: values.title, + refundReason: values.other, + refundVoucher: refunArray.join(', ') + }, + onBefore() { + + }, + onSuccess() { + messageApi.success('提交成功') + + }, + onFinally() { + + } + }) }; // 获取未退款项目 const getRefunData = () => { get({ messageApi, url: `/api/proj/refund/apply/list-proj-unapply/self`, - // url: `/api/proj/refund/apply/listpage?applyStatus=${state.type}`, - onSuccess({data}) { + // 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 + })) + setRefunDataArray(newArray) + + }, + onFinally() { + + + }, }) } - useEffect(()=>{ + useEffect(() => { getRefunData() - },[]) + }, []) return (
{contextHolder} @@ -59,13 +96,7 @@ export default function RefunModal(props:any) { filterOption={(input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) } - options={[ - { value: '嘻嘻系统', label: '嘻嘻系统' }, - { value: '呵呵系统', label: '呵呵系统' }, - { value: '哈哈系统', label: '哈哈系统' }, - { value: '哈嘎嘎系统', label: '哈嘎嘎系统' }, - { value: '哈嘻嘻嘎嘎系统', label: '哈嘻嘻嘎嘎系统' }, - ]} + options={refunDataArray} style={{ width: 405, height: 46, @@ -73,7 +104,7 @@ export default function RefunModal(props:any) { />
-
+ {/*
退款原因*
@@ -96,8 +127,8 @@ export default function RefunModal(props:any) { onChange={handleReasonChange} /> -
- {selectedReason === '其他' && ( +
*/} + {/* {selectedReason === '其他' && (
其他* @@ -112,7 +143,21 @@ export default function RefunModal(props:any) { />
- )} + )} */} +
+
+ 退款原因* +
+ +