import React, { PureComponent, useState, useEffect } from 'react'
import { Modal, Row, Col, Table, Pagination, Button, Form, Input,message } from 'antd'
import EnDash from '../EnDash'
import AuthButton from '@/components/AuthButton';

import Style from './style.less'
import HotBlock from '../HotBlock'
import apis from '../../../../../../services/apis';
import request from '../../../../../../utils/request';

const BatchDel = props => {
  const taRaiseRecords = props.houseIds;
  function handleSubmit (e) {
    e.preventDefault();
    props.form.validateFields((err, values) => {
      if (!err){
        request({ ...apis.house.batchDeleteRaiseRecord, data: { ...values,taRaiseRecords }, }).then((data) => {
          message.info("保存成功")
          props.onSuccess(false);
        }).catch((err) => {
          message.info(err.msg || err.message)
        })
      }
    });
  }

  const { getFieldDecorator } = props.form;

  return (
    <>
      <Modal footer={null} title="批量删除" visible={props.visible} onCancel={props.onCancel} width={600}>
        <span style={{textAlign:'center'}}>将所选{taRaiseRecords.length}条认筹记录批量删除？</span>
        <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
          <Form.Item wrapperCol={{ span: 15, offset: 10 }}>
            <Button type="primary" htmlType="submit" >
              提交
            </Button>
          </Form.Item>
        </Form>
        <div>
          <font>警告：</font><br/>
          <font>1.删除功能建议仅用于删除测试数据，正常业务数据使用作废功能。</font><br/>
          <font>2.删除前请确认缴退费业务是否全部处理完成。</font><br/>
          <font>3.若认筹单中含认筹人锁定的房源，删除认筹单后会解锁此房源。</font><br/>
          <font>4.请优先使用作废操作。删除数据可能会导致关联业务异常。</font>
        </div>
        
      </Modal>
    </>
  );
}

const WrappedBase = Form.create({ name: 'BatchDel' })(BatchDel);

export default WrappedBase