/*
 * @Note:
 * @Author: 2058827620@qq.com
 * @Date: 2022-04-03 17:02:15
 */

import { Divider, Modal, Upload, Button, UploadProps, UploadFile } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { DownloadOutlined,UploadOutlined } from '@ant-design/icons';

export default ({ modalOpenState, onModalOpenState, onSubmit }) => {

  const [fileList, setFileList] = useState<UploadFile[]>([]);
  const [uploading, setUploading] = useState(false);

  const props: UploadProps = {
    onRemove: (file) => {
      const index = fileList.indexOf(file);
      const newFileList = fileList.slice();
      newFileList.splice(index, 1);
      setFileList(newFileList);
    },
    beforeUpload: (file) => {
      setFileList([...fileList, file]);

      return false;
    },
    fileList,
  };

  return (
    <>
      <Modal title="导入提现结果" open={modalOpenState} onOk={onSubmit} footer={(_, { OkBtn, CancelBtn }) => (
        <>
          <OkBtn />
        </>
      )}>
        <div className='flex'>
          <Upload className='mr-6' {...props}>
            <Button icon={<UploadOutlined />}>选择文件</Button>
          </Upload>
          <Button  icon={<DownloadOutlined />}>下载模板</Button>
        </div>
      </Modal>
    </>
  );
};

