Audit.js 3.56 KB
import React, { Component } from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { Tabs, Toast } from 'antd-mobile';
import MemberList from '../../components/MemberList/MemberList';
import { dataFilter } from '../../utils/dataFilter';
import shareHide from "../../utils/shareHide";

import css from './css.less';
const stateName = ['未提交','已提交','已提交','已提交','已成单','已上传','跟进中','停止跟进']
class Audit extends Component{
  constructor(props) {
    super(props);
    this.state = {
      clientList: [],
      cientListed: [],
      storeclientList: [],
      storecientListed: [],
      isShowPassedInfo: false,
      infoList: {},
      show: false,
      show1: false
    }
  }

  componentDidMount() {
    document.title = '我的客户';
    shareHide();
    // Toast.loading('loading...', 88);
    this.getClientUnpassList();
    // this.getClientPassedList();
  }

  getClientPassedList() {
    Toast.loading('loading...',88);
    const _this = this;
    this.props.dispatch({
      type: 'governortraining/getClientList',
      payload: {
        id: window.localStorage.getItem("id"),
        auditedState: 1
      },
      callback(res) {
        if (res.status) {
          _this.setState({
            cientListed: res.data,
            storecientListed: res.data,
            show: true
          }, () => {
            Toast.hide();
          })
        }
      }
    })
  }

  getClientUnpassList() {
    const _this = this;
    this.props.dispatch({
      type: 'governortraining/getClientList',
      payload: {
        id: window.localStorage.getItem("id"),
        // auditedState: 0
      },
      callback(res) {
        if (res.status) {
          _this.setState({
            clientList: res.data,
            storeclientList: res.data,
            show1: true
          }, () => {
              Toast.hide();
          })
        }
      }
    });
  }

  chooseClient(pass, item) {
    localStorage.setItem('auditClientInfo', JSON.stringify({ ...item, isShowPassedInfo: pass }));
    // this.props.dispatch(routerRedux.push({
    //   pathname: '/governortraining/auditinfo'
    // }));
    this.props.history.push({pathname: '/governortraining/auditinfo'})
  }



  render() {
    return <div className={css.auditWrap}>
      <div>
          {
            this.state.clientList.length === 0 && this.state.show1 && (
                <div>
                  <div className={css.splitline}></div>
                  <div className={css.noData}>
                    <div className={css.img}></div>
                    当前无数据
                  </div>
                </div>
              )
          }

          { this.state.clientList.length>0 && this.state.show1 &&  <MemberList
            id="audit"
            height='86vh'
            dataList={this.state.storeclientList}
            renderType={['name']}
            filterData={(keywords) => {
              this.setState({
                storeclientList: dataFilter(this.state.clientList, ['name'], keywords)
              })

            }}
            renderItem={item => {
              return <div className={css.clientItem}>
                <span className={css.name}>{item.name}</span>
                <span className={css.time}>{item.commitTime ? item.commitTime.substr(0,16) : ""}</span>
                <span className={css.status}>{stateName[item.currentState]}</span>
              </div>
            }}
            chooseClient={this.chooseClient.bind(this,false)}
            pTitle='客户' />}
      </div>
    </div>
  }
}

export default connect()(Audit);