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


import { useEffect, useRef } from 'react';
import { Select, Space, Image, Divider } from 'antd';
import { ProForm, ModalForm, ProFormRadio, ProFormText, ProFormTextArea } from '@ant-design/pro-components';

export default ({ values, modalOpenState, onModalOpenState, onSubmit }) => {
  const restFormRef = useRef();

  useEffect(() => {
    restFormRef.current?.setFieldsValue(values);
  }, [values]);

  return (
    <>
      <ModalForm
        title="线下充值-审核"
        formRef={restFormRef}
        submitter={{
          searchConfig: {
            resetText: '重置',
          },
          resetButtonProps: {
            onClick: () => {
              restFormRef.current?.resetFields();
            },
          },
        }}
        initialValues={values}
        onFinish={onSubmit}
        open={modalOpenState}
        onOpenChange={onModalOpenState}
      >
        <ProFormText hidden={true} width="md" name="id" />
        <div>付款凭证</div>
        <Image src={values?.proof} width={100} />
        <Divider />
        <ProForm.Group>
          <ProFormRadio.Group
            rules={[{ required: true, message: '请选择' }]}
            name="success"
            radioType="button"
            label="审核结果"
            options={[
              {
                label: '充值成功',
                value: 1,
              },
              {
                label: '充值失败',
                value: 0,
              },
            ]}
          />

        </ProForm.Group>
        <ProFormTextArea
          name="admin_note"
          label="备注"
          placeholder="请输入"
        />
      </ModalForm>
    </>
  );
};

