import React, { Component } from "react";
import {Form, Upload, Modal, Button, message, Input, Select, Table, Tooltip} from "antd";
import AgreeButton from "./agreeButton.js";
import Rizhi from "./rizhi.js";
import { getProcessStatusNew, changeColor } from "@/tools.js";
import { shenghePeo } from "@/tools.js";
import $ from "jquery/src/ajax";
import "../../../../../../css/changeDetail.less"
import quxiao from "../../../../../../image/quxiao.png";
import tongguo from "../../../../../../image/tongguo.png";
import ProAndCuiList from "./proAndCuiList.jsx";
import "./xButton.less";
// import ReactToPrint from "react-to-print";
const FormItem = Form.Item;
import Refund from "./refund.js"
import ImgList from "../../../../common/imgList";
import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
const { TextArea } = Input;
const formItemLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 14 }
};
const changeType = [
  {
    value: "0",
    key: "退单退款"
  },
  {
    value: "1",
    key: "项目及金额变更"
  },
  {
    value: "2",
    key: "仅项目变更"
  },
  {
    value: "3",
    key: "仅金额变更"
  },
  {
    value: "4",
    key: "重报"
  },
  {
    value: "5",
    key: "赠送"
  }
];
const getChangeType = function (e) {
  if (e || e == 0) {
    let str = e.toString();
    let theType = "";
    changeType.map(function (item) {
      if (item.value == str) {
        theType = item.key;
      }
    });
    return theType;
  }
};
class Itemlist extends Component {
  constructor(props) {
    super(props);
  }
  render() {
    let pageData = this.props.pageData;
    return (
      
        
          {pageData.labelA ===  '变更原因' ? 
            {pageData.dataA}
          : pageData.dataA}
          {pageData.labelA === '客户名称' ?  : null}
        
        
          {pageData.dataB}
        
       
    );
  }
}
class ChangeDetail extends Component {
  constructor(props) {
    super(props);
    this.state = {
      previewVisible: false,
      buttonStatus: true,
      dataSource: [],
      reason: "",
      rejectState: 0,
      rotateDeg: 0,
      contactList: [],
      ContactsLists: [
        {
          title: "金额(万元)",
          dataIndex: "amount",
          key: "amount",
          render: (text, record) => {
            return (
              
                实际回收退票(万元)
                 {
                    record.amount = e.target.value;
                    this.setState({ contactList: this.state.contactList });
                  }}
                  style={{ width: "120px" }}
                />
              
            );
          }
        },
        {
          title: "时间",
          dataIndex: "createTimes",
          key: "createTimes",
          render: (text, record) => {
            return (
              
                {/*  {
                    record.time = v._d;
                    this.setState({ contactList: this.state.contactList });
                  }}
                  onOk={v => {
                    record.time = v._d;
                    this.setState({ contactList: this.state.contactList });
                    console.log(this.state);
                  }}
                /> */}
                {record.createTimes}
              
            );
          }
        }
        // {
        //   title: "操作",
        //   dataIndex: "dels",
        //   key: "dels",
        //   render: (text, record, index) => {
        //     return (
        //       
        //         
 {
        //             this.confirmDelet(record);
        //           }}
        //           okText="删除"
        //           cancelText="不删除"
        //         >
        //           
        //         
        //         {record.load != true ? (
        //           
        //         ) : (
        //           ""
        //         )}
        //       
         {
            this.refs = e;
          }}
        >
          
            {/* 
              通过
             */}
            
 
          
            合同变更记录
          
          {pageData.map((item, index) => {
            return 
;
          })}
          
            {/* {*/}
            {/*    this.setState({*/}
            {/*      previewImage: file.url || file.thumbUrl,*/}
            {/*      previewVisible: true,*/}
            {/*    });*/}
            {/*  }}*/}
            {/*/>*/}
            
             {
                this.setState({ previewVisible: false }, () => {});
              }}
            >
               
              
              
              
            
            
          
          {/* 
变更日志
 */}
          
            {/* 操作人: */}
            {this.props.dataSource.map((item, index) => {
              if (item.status == 0) {
                item.status = "发起";
              } else if (item.status == 1) {
                item.status = "审核中";
              } else if (item.status == 2) {
                item.status = "通过";
              } else if (item.status == 3) {
                item.status = "驳回";
              } else if (item.status == 4) {
                item.status = "完成";
              }
              return (
                - 
                  {item.aname + ":" + "(" + item.status + ")" + item.remarks}
                );
            })}
{/* 收款情况 */}
          
            
              收款情况
            
            
              
                {(this.props.proceedsData.bill || []).map((item, index) => (
                  - 
                    {item.payTime +
                      " " +
                      item.aName +
                      " 收款:" +
                      item.transactionAmount +
                      "万元"}
                  ))}
收款总计:{this.props.proceedsTotal}万元
             
            
            
              
                {(this.props.proceedsData.invoice || []).map((item, index) => (
                  - 
                    {item.createTime + " " + " 开票:" + item.amount + "万元"}
                  ))}
开票总计:{this.props.invoiceTotal}万元
             
            
              系统预估 产生成本(万元):
              {this.props.data.estimateCost
                ? this.props.data.estimateCost
                : "0"}{" "}
               应退金额(万元):
              {this.props.data.estimateRefundable
                ? this.props.data.estimateRefundable
                : "0"}
            
           
          {/* 当前财务状态 */}
          {this.props.data.processState > 5 &&
        (this.props.data.status == 1 || this.props.data.status == 3)&&
        this.props.processState == this.props.data.processState ? (
          // this.state.buttonStatus ? (
          
            
              
                
                  
                    当前财务状态(财务填写)
                  
                  {financeData.map((item, index) => {
                    return ;
                  })}
                
               
              
                
                   {
                      this.setState({
                        reason: e.target.value,
                      });
                    }}
                  />
                
              
             
            
              {buttonData.map((item, index) => {
                return (
                  
                );
              })}
            
 
        ) : (
          
            
              当前财务状态(财务填写)
            
            {financeData.map((item, index) => {
              return ;
            })}
          
        )}
{/* 回收退票 */}
          
            
              回收退票
            
            {/* {this.state.processStatus == 0 ? ( */}
            
            {/* ) : (
              ""
            )} */}
            
           
{/* 完成审核,上传附件 */}
            
          
              完成审核,上传附件{" "}
              
                (注:由营销员上传变更后附件,全变更流程完成。)
              
            
            
            
            
             { attachment.length > 0  ? 
 :'无附件'}
             {/*  */}
              
              
              
            
            {/*  */}
          
             
             
          {/* {this.props.data.type === 0 && this.props.data.processState >= 4 ? (
            
              
                当前项目进度(咨询师经理填写)
              
              {planData.map((item, index) => {
                return ;
              })}
            
          ) : (
            ""
          )} */}
          {/* {this.props.data.type === 0 ? (
            this.props.data.processState >= 5 ? (
              
                
                  当前财务状态(财务填写)
                
                {financeData.map((item, index) => {
                  return ;
                })}
              
            ) : (
              ""
            )
          ) : this.props.data.status === 4 ? (
            
              
                当前财务状态(财务填写)
              
              {financeData.map((item, index) => {
                return ;
              })}
            
          ) : (
            ""
          )} */}
        
          
        
        {/* 
 (
            
              
            
          )}
          content={() => this.refs}
        /> */}
       
    );
  }
}
export { ChangeDetail };