import React from 'react';
import {
  Tooltip,
  Button,
  AutoComplete,
  Input,
  Select,
  Spin,
  Popconfirm,
  Table,
  message,
  DatePicker,
  Upload,
  Form,
  Modal,
  Col,
  Tag,
  Tabs,
  Radio
} from 'antd';
import $ from 'jquery/src/ajax';
import moment from 'moment';
import {boutique ,tepi,jiedian} from '@/dataDic.js';
import {
  getLiquidationStatus,
  getProcessStatus,
  splitUrl,
  getCuikuan,
  moneyVerify,
  ShowModal
} from "@/tools.js";
import './customer.less';
import ShowModalDiv from "@/showModal.jsx"
import OrderRiZi from "@/orderRiZi.jsx";
import { cuiJieDian } from "@/dataDic.js";
import ResolutionDetail from "@/resolutionDetail";
import ImgList from "../../../common/imgList";
import {ChooseList} from "./chooseList";
import OrderItemStatus from "../../../common/orderItemStatus";
import EnterpriseNameChange from "../../../common/enterpriseNameChange";
import ProjectOperation from "../../../common/projectOperation";
//图片组件
const PicturesWall = React.createClass({
	getInitialState() {
		return {
			fileList: [],
		}
	},
	handleChange(info) {
		let fileList = info.fileList;
		this.setState({
			fileList
		});
		this.props.fileList(fileList);
	},
	componentWillReceiveProps(nextProps) {
		this.state.fileList = nextProps.pictureUrl;
		this.state.pojectApplicationUrl = undefined;
	},
	render() {
		const {fileList} = this.state;
		return(
			
              {
                    this.handleChange(infor)
                  }}
                  fileList={fileList}
              />
             
		);
	}
});
const IntentionCustomer = Form.create()(
  React.createClass({
    loadData(pageNo) {
      this.setState({
        visitModul: false,
        loading: true,
        ispage: pageNo,
        modalVisible: false,
      });
      $.ajax({
        method: "get",
        dataType: "json",
        crossDomain: false,
        url: globalConfig.context + "/api/admin/newOrder/orderNewList",
        data: {
          pageNo: pageNo || 1,
          pageSize: this.state.pagination.pageSize,
          specially: 2, //审核列表
          name: this.state.customerName, //名称
          orderNo: this.state.orderNoSearch, //订单编号
          starTime: this.state.releaseDate[0], //开始时间
          endTime: this.state.releaseDate[1], //结束时间
        },
        success: function (data) {
          ShowModal(this);
          let theArr = [];
          if (data.error.length || data.data.list == "") {
            if (data.error && data.error.length) {
              message.warning(data.error[0].message);
            }
          } else {
            for (let i = 0; i < data.data.list.length; i++) {
              let thisdata = data.data.list[i];
              thisdata.key = i;
              thisdata.totalAmount = thisdata.totalAmount + ""; //签单金额
              theArr.push(thisdata);
            }
            this.state.pagination.total = data.data.totalCount;
            this.state.pagination.current = data.data.pageNo;
          }
          if (data.data && data.data.list && !data.data.list.length) {
            this.state.pagination.total = 0;
          }
          this.setState({
            dataSource: theArr,
            pageNo: pageNo,
            pagination: this.state.pagination,
            selectedRowKeys: [],
          });
        }.bind(this),
      }).always(
        function () {
          this.setState({
            loading: false,
          });
        }.bind(this)
      );
    },
    getInitialState() {
      return {
        page: 1,
        patentTypeList:[],
        releaseDate: [],
        selectedRowKeys: [],
        orgCodeUrl: [],
        replenishUrl: [],
        customerArr: [],
        resVisible: false,
        pagination: {
          defaultCurrent: 1,
          defaultPageSize: 10,
          showQuickJumper: true,
          pageSize: 10,
          onChange: function (page) {
            this.loadData(page);
          }.bind(this),
          showTotal: function (total) {
            return "共" + total + "条数据";
          },
        },
        columns: [
          {
            title: "驳回编号",
            dataIndex: "backId",
            key: "backId",
          },
          {
            title: "驳回日期",
            dataIndex: "backDate",
            key: "backDate",
          },
          {
            title: "下单时间",
            dataIndex: "createDate",
            key: "createDate",
          },
          {
            title: "订单编号",
            dataIndex: "orderNo",
            key: "orderNo",
          },
          {
            title: "客户名称",
            dataIndex: "userName",
            key: "userName",
            render: (text) => {
              return (
                  
                    {text}
                  
              )
            },
          },
          {
            title: "驳回人",
            dataIndex: "initiateName",
            key: "initiateName",
          },
          {
            title: "驳回原因",
            dataIndex: "reason",
            key: "reason",
            render: (text) => {
              return text && text.length > 24
                ? text.substr(0, 24) + "..."
                : text;
            },
          },
        ],
        columnsrizhi: [
          {
            title: "流程",
            dataIndex: "processName",
            key: "processName",
          },
          {
            title: "操作人",
            dataIndex: "adminName",
            key: "adminName",
          },
          {
            title: "时间",
            dataIndex: "createDate",
            key: "createDate",
          },
        ],
        data: [],
        dataSource: [],
        columnsX: [
          {
            title: "业务项目名称",
            dataIndex: "commodityName",
            key: "commodityName",
            render: (text, record) => {
              return text + "-" + record.id
            }
          },
          {
            title: "项目类别",
            dataIndex: "cname",
            key: "cname",
          },
          {
            title: "项目数量",
            dataIndex: "commodityQuantity",
            key: "commodityQuantity",
            render: (text, record) => {
              if (record.splitStatus == 1) {
                return (
                  
                    {text}{" "}
                     {
                        e.stopPropagation();
                        this.showRes(record);
                      }}
                    >
                      已拆
                    
                  
                );
              } else {
                return text;
              }
            },
          },
          {
            title: "金额(万元)",
            dataIndex: "commodityPrice",
            key: "commodityPrice",
          },
          {
            title: "负责人",
            dataIndex: "contacts",
            key: "contacts",
          },
          {
            title: "负责人电话",
            dataIndex: "contactsMobile",
            key: "contactsMobile",
          },
          {
            title: "主要项目",
            dataIndex: "main",
            key: "main",
            render: (text) => {
              return text ? "是" : "否";
            },
          },
          {
            title: "项目说明",
            dataIndex: "taskComment",
            key: "taskComment",
            render: (text) => {
              return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
            },
          },
          {
            title: "操作",
            dataIndex: "ABC",
            key: "ABC",
            render: (text, record) => {
              return (
                
                  {this.state.processStatus == 0 ? (
                    
 {
                        this.delectRow(record);
                      }}
                      okText="是"
                      cancelText="否"
                    >
                      
                    
                  ) : (
                    ""
                  )}
                
                  
                  {record.dunType == 0 ? (
                       {
                          record.customizeName = e.target.value;
                          this.setState({
                            contactList: this.state.contactList,
                          });
                        }}
                        style={{ width: "120px" }}
                      />
                    ) : (
                      ""
                    )}
                    
                );
              } else {
                return (
                  
                );
              }
            },
          },
          {
            title: "收款时间(特批需选择时间)",
            dataIndex: "waitDay",
            key: "waitDay",
            render: (text, record) => {
              if (record.dunTypeName) {
                if (record.customizeTimes) {
                  return record.customizeTimes;
                }
                if (text == 0) {
                  var str = "当天";
                } else if (!text) {
                  var str = "";
                } else {
                  var str = text + "天";
                }
                return {str};
              }
              return (
                
                  {record.dunType == 0 ? (
                     {
                        record.customizeTimes = t;
                      }}
                    />
                  ) : (
                    
                  )}
                
              );
            },
          },
          {
            title: "金额(万元)",
            dataIndex: "money",
            key: "money",
            render: (text, record) => {
              if (record.dunTypeName) {
                if (record.appropriationRatio) {
                  return {record.appropriationRatio}(拨款比例);
                } else {
                  return {text};
                }
              }
              if (this.state.boFlag) {
                return (
                  
                );
              } else {
                return (
                  
                     {
                        record.money = e.target.value;
                        this.setState({ contactList: this.state.contactList });
                      }}
                      style={{ width: "120px" }}
                    />
                  
                );
              }
            },
          },
          {
            title: "服务年限",
            dataIndex: "startDate",
            key: "startDate",
            render: (text, record) => {
              if (record.dunTypeName) {
                return {text};
              }
              return (
                  
                    {
                      record.dunType != 0 ?
                          
 : 
                    }
                  
                  {this.state.processStatus == 0 ? (
                    
 {
                        this.confirmDeletNew(record);
                      }}
                      okText="删除"
                      cancelText="不删除"
                    >
                      
                    
                  ) : (
                    ""
                  )}
                  {record.isSave ? (
                    
                  ) : (
                    ""
                  )}
                
                  {
                    
 {
                        this.confirmDelet(record.key);
                      }}
                      okText="删除"
                      cancelText="不删除"
                    >
                      
                    
                  }
                  {record.id ? (
                    ""
                  ) : (
                    
                  )}
                
          {this.state.resVisible ? (
            
          ) : (
            ""
          )}
          
          
            订单审核
          
          
            
              
                
                  
                
              
              
                 {
                    this.setState({ customerName: e.target.value });
                  }}
                />
                 {
                    this.setState({ orderNoSearch: e.target.value });
                  }}
                />
                下单时间 :
                 {
                    this.setState({ releaseDate: dataString });
                  }}
                />
                
                
              
            
            
            {this.state.visible ? 
              
             : 
}
            {/* 
            
           */}
            
           
          {this.state.projectOperationVisible ? 
 0 && this.state.processStatus !== 0}
              orderNo={this.state.orderNo}
              visible={this.state.projectOperationVisible}
              dataInfor={this.state.dataInfor}
              onCancel={this.nextCancel}
          /> : null}