import './refun.css'; import { useState, useEffect } from 'react'; import { Table, // Pagination, Modal, Tag, message } from 'antd'; import { get,put } from '../../util/AjaxUtils' import type { TableProps } from 'antd'; interface DataType { projName: string; projPayment: string; refundReason: string; gmtCreate: string; refundVoucherFileKVs: string; projRefundApplyId: string; gmtReview: string; applyStatus: string; reviewReason: string; } import revokeImg from '../../static/revoke.png' import { useLocation } from 'react-router-dom' export default function Refun() { const height = window.innerHeight - 180; const [messageApi, contextHolder] = message.useMessage(); const [page, setPage] = useState(1) // 分页 const [total, setTotal] = useState(50) // 数据总数 const [data, setData] = useState([]) const [revokeModal, setRevokeModal] = useState(false) //撤销弹窗 const [projRefundApplyId, setprojRefundApplyId] = useState('') //要撤销的id const { state } = useLocation() // {state.type} const columns: TableProps['columns'] = state.type == 'CANCELED' ? [ { title: '序号', dataIndex: 'index', align: 'center', width: 80, render: (_text, _record, index) => (page - 1) * 10 + index + 1, // 显示序号,从1开始 }, { title: '系统名称', dataIndex: 'projName', align: 'center', key: 'projName', render: (text) =>
{text}
, }, { title: '金额', dataIndex: 'projPayment', key: 'projPayment', align: 'center', width: 150, }, { title: '退款原因', dataIndex: 'refundReason', key: 'refundReason', align: 'center', render: (text) =>
{text}
, }, { title: '申请退款时间', dataIndex: 'gmtCreate', key: 'gmtCreate', align: 'center', width: 200, }, { title: '审核时间', dataIndex: 'gmtReview', key: 'gmtReview', align: 'center', width: 200, }, { title: '审核状态', dataIndex: 'applyStatus', key: 'applyStatus', align: 'center', width: 100, render: (text) => {text == "PASS" ? '通过' : text == "NOPASS" ? '未通过' : text == "WAIT" ? '待审核' : '未知'}, }, { title: '审核意见', dataIndex: 'reviewReason', key: 'reviewReason', align: 'center', // width: 150, render: (text) =>
{text}
, }, { title: '退款凭证', dataIndex: 'refundVoucherFileKVs', key: 'refundVoucherFileKVs', width: 100, align: 'center', render: (_, record) => ( // {record.name}
{ // console.log(record.img); }}> 预览
), }, ] : [ { title: '序号', dataIndex: 'index', align: 'center', width: 80, render: (_text, _record, index) => (page - 1) * 10 + index + 1, // 显示序号,从1开始 }, { title: '系统名称', dataIndex: 'projName', align: 'center', key: 'projName', render: (text) =>
{text}
, }, { title: '金额', dataIndex: 'projPayment', key: 'projPayment', align: 'center', width: 150, }, { title: '退款原因', dataIndex: 'refundReason', key: 'refundReason', align: 'center', render: (text) =>
{text}
, }, { title: '申请退款时间', dataIndex: 'gmtCreate', key: 'gmtCreate', align: 'center', width: 200, }, { title: '审核时间', dataIndex: 'gmtReview', key: 'gmtReview', align: 'center', width: 200, }, { title: '审核状态', dataIndex: 'applyStatus', key: 'applyStatus', align: 'center', width: 100, render: (text) => {text == "PASS" ? '通过' : text == "NOPASS" ? '未通过' : text == "WAIT" ? '待审核' : '未知'}, }, { title: '审核意见', dataIndex: 'reviewReason', key: 'reviewReason', align: 'center', // width: 150, render: (text) =>
{text}
, }, { title: '退款凭证', dataIndex: 'refundVoucherFileKVs', key: 'refundVoucherFileKVs', width: 100, align: 'center', render: (_, record) => ( // {record.name}
{ // console.log(record.img); }}> 预览
), }, { title: '操作', align: 'center', width: 100, render: (_, record) => ( // {record.name}
{ console.log(record.projRefundApplyId); setRevokeModal(true) setprojRefundApplyId(record.projRefundApplyId) }}> 撤销
), }, ]; const getData = (page: number) => { get({ messageApi, url: `/api/proj/refund/apply/listpage`, // url: `/api/proj/refund/apply/listpage?applyStatus=${state.type}`, config: { params: { page: page, rows: 10, applyStatus: state.type } }, onSuccess(data: any) { console.log(data.data.rows); setData(data.data.rows) } }) } // 撤销退款 const projRefund = () => { put({ messageApi, url: `/api/proj/refund/apply/cancel/self/${projRefundApplyId}`, onBefore() { }, onSuccess() { setRevokeModal(false) messageApi.success('已撤销'); }, onFinally() { // setIsProjIntroductionLoading(false) // renderData() } }) } // useEffect(()=>{ // getData(page) // },[]) useEffect(() => { // getData(1) setPage(1) getData(1) }, [state.type]) return (
{contextHolder}
{/* {state.type} */} { setPage(currentPage); getData(currentPage) }, showSizeChanger: false, current: page } } scroll={{ y: height - 128 }} rowKey="projId" /> {/*
{ setPage(page) // getData(page) }} />
*/} { // setRevokeModal(false) projRefund() }} onCancel={() => { setRevokeModal(false) }} okButtonProps={{ style: { background: 'red', color: 'white' } }} style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: `${height}px`, }}>
是否撤销该条退款申请
) }