123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- import React from 'react';
- import { Radio, Icon, Button, Cascader, Input, Select, Spin, Popconfirm, Table, Switch, message, DatePicker, Modal, Upload, Form, Row, Col,Tabs } from 'antd';
- import ajax from 'jquery/src/ajax/xhr.js';
- import $ from 'jquery/src/ajax';
- import moment from 'moment';
- import './myClient.less';
- import QueryCustomer from './myRejectOne.jsx';
- import { citySelect, provinceList, areaSelect } from '../../../areaList';
- import {getProvinceList} from '../../../addressList';
- const { Column, ColumnGroup } = Table;
- const TabPane = Tabs.TabPane;
- const monthFormat = 'YYYY/MM';
- import CustomerDetail from './myClientDesc.jsx';
- import { socialAttribute, industry, auditStatusL, newFollow, lvl, currentMember, statuslist, customerStatus, intentionalService } from '../../../dataDic.js';
- import {
- getSocialAttribute,
- splitUrl,
- getAuditStatus,
- getCompanyIntention,
- getStatuslist,
- getContactType,
- getIndustryType,
- getfllowSituation,
- beforeUploadFile,
- getWhether,
- getcustomerStatue,
- getfllowSituationOn,
- getCertification,
- getcustomerTyp,
- getLvl,
- getCurrentMember,
- getprovince,
- ShowModal
- } from "../../../tools.js";
- import ShowModalDiv from "@/showModal.jsx";
- import {ChooseList} from "../../order/orderNew/chooseList";
- const PublicCustomer = Form.create()(React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- loading: true
- });
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/customer/findEnteringAuditIsNo',
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- name: this.state.nameSearch,//客户名称
- adminName:this.state.adminName,//营销员名称
- },
- success: function(data) {
- ShowModal(this);
- let theArr = [];
- let thisdata;
- 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++) {
- thisdata = data.data.list[i];
- theArr.push({
- key: i,
- id: thisdata.uid,
- name: thisdata.name,
- createTime: thisdata.createTime,
- adminName: thisdata.adminName,
- contactMobile: thisdata.contactMobile,
- auditOpinion:thisdata.auditOpinion,
- societyTag:thisdata.societyTag,
- });
- };
- this.state.pagination.current = data.data.pageNo;
- this.state.pagination.total = data.data.totalCount;
- };
- if(data.data&&data.data.list&&!data.data.list.length){
- this.state.pagination.current=0;
- this.state.pagination.total=0;
- }
- this.setState({
- dataSource: theArr,
- pagination: this.state.pagination,
- selectedRowKeys:[]
- });
- }.bind(this),
- }).always(function() {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- //点击出现函数
- setModal2VisibleOk(e) {
- this.setState({
- modal2Visible: true
- });
- },
- //点击消失函数
- setModal2Visiblecancel(e) {
- this.setState({
- modal2Visible: false
- });
- },
- getPictureUrl(e) {
- this.setState({ pictureUrl: e });
- },
- handleOk(e) {
- this.setState({
- visible: false,
- });
- },
- handleCancel(e) {
- this.setState({
- visible: false,
- });
- },
- getInitialState() {
- return {
- addressSearch: [],
- orgCodeUrl: [],
- companyLogoUrl: [],
- visible: false,
- searchMore: true,
- releaseDate: [],
- releaseDate: [],
- selectedRowKeys: [],
- selectedRowKey: [],
- selectedRows: [],
- loading: 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: 'name',
- key: 'name',
- }, {
- title: '联系电话',
- dataIndex: 'contactMobile',
- key: 'contactMobile',
- },
- {
- title: '营销员',
- dataIndex: 'adminName',
- key: 'adminName',
- },
- {
- title: '创建时间',
- dataIndex: 'createTime',
- key: 'createTime',
- },
- {
- title: '拒绝原因',
- dataIndex: 'auditOpinion',
- key: 'auditOpinion',
- }
- ],
- dataSource: [],
- };
- },
- //审核通过
- examineCancel(record){
- let api=0;
- this.examine(api,record);
- },
- //审核不通过
- examineOK(record){
- let api=1;
- this.examine(api,record);
- },
- examine(api,record) {
- this.setState({
- selectedRowKeys: [],
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/customer/updateEnteringAudit',
- data: {
- id:record.id,
- auditStatus:api,
- auditOpinion:this.state.auditOpinion,
- }
- }).done(function (data) {
- if (!data.error.length) {
- message.success('操作成功');
- this.setState({
- loading: false,
- });
- } else {
- message.warning(data.error[0].message);
- };
- this.loadData();
- }.bind(this));
- },
- componentWillMount() {
- this.loadData();
- },
- //审核实名认证不通过功能
- auditRows(e) {
- e.preventDefault();
- $.ajax({
- url: globalConfig.context + '/api/admin/customer/updateEnteringAudit',
- method: 'post',
- data: {
- id:this.state.id,
- auditOpinion:this.state.auditOpinion,
- auditStatus:2,
- }
- }).done(function(data) {
- this.setState({
- loading: false
- });
- if(!data.error.length) {
- message.success('操作成功!');
- this.detailsModal()
- this.loadData();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- },
- //修改信息提交
- submit(e) {
- e.preventDefault();
- this.props.form.validateFields((err, values) => {
- if(!this.state.societyTag){
- message.warning('社会属性不能为空')
- return false;
- };
- if(this.state.mobile.length>13){
- message.warning('电话号码字数不超过13个')
- return false;
- };
- if (!err) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/customer/updateRefusedCustomer',
- data: {
- nickname:this.state.nickname,
- societyTag:this.state.societyTag,
- mobile: this.state.mobile,
- id: this.state.id,
- }
- }).done(function (data) {
- this.setState({
- loading: false
- });
- if (!data.error.length) {
- message.success('提交成功!');
- this.detailsModal();
- this.loadData();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- }
- });
- },
- //审核实名认证通过功能
- auditRowse(e) {
- e.preventDefault();
- $.ajax({
- url: globalConfig.context + '/api/admin/customer/updateEnteringAudit',
- method: 'post',
- data: {
- id:this.state.id,
- auditOpinion:this.state.auditOpinion,
- auditStatus:1,
- }
- }).done(function(data) {
- this.setState({
- loading: false
- });
- if(!data.error.length) {
- message.success('操作成功!');
- this.detailsModal()
- this.loadData();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- },
- search() {
- this.loadData();
- },
- reset() {
- this.state.nameSearch = '';
- this.state.adminName=''
- this.loadData();
- },
- searchSwitch() {
- this.setState({
- searchMore: !this.state.searchMore
- });
- },
- //整行点击
- tableRowClick(record, index) {
- this.state.RowData = record;
- this.detailsModalOk(record);
- this.setState({
- nickname:record.name,
- mobile:record.contactMobile,
- societyTag:record.societyTag,
- id:record.id,
- })
- },
- detailsModalOk(e) {
- this.setState({
- modal5Visible: true
- }); //需要一个请求数据
- },
- detailsModal(e){
- this.setState({
- modal5Visible: false
- });
- },
- componentWillReceiveProps(nextProps) {
- if(!this.props.visible && nextProps.visible) {
- if(nextProps.data && nextProps.data.id) {
- this.loadData(nextProps.data.id, nextProps.detailApiUrl);
- };
- this.state.data = {};
- this.state.companyLogoUrl = [];
- this.state.orgCodeUrl = [];
- this.loadData(null);
- };
- },
- changeList(arr) {
- const newArr = [];
- this.state.columns.forEach(item => {
- arr.forEach(val => {
- if (val === item.title) {
- newArr.push(item);
- }
- });
- });
- this.setState({
- changeList: newArr
- });
- },
- render() {
- const FormItem = Form.Item
- const rowSelection = {
- selectedRowKeys: this.state.selectedRowKeys,
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- selectedRows: selectedRows.slice(-1),
- selectedRowKeys: selectedRowKeys.slice(-1)
- });
- },
- onSelect: (recordt, selected, selectedRows) => {
- this.setState({
- recordt: recordt.id
- })
- },
- };
- const rowSelections = {
- selectedRowKeys: this.state.selectedRowKey,
- onChange: (selectedRowKey, selectedRow) => {
- this.setState({
- selectedRow: selectedRow.slice(-1),
- selectedRowKey: selectedRowKey.slice(-1)
- });
- },
- onSelect: (records, selected, selectedRow) => {
- this.setState({
- selectedRow: selectedRow.slice(-1),
- records: records.id,
- })
- },
- };
- const hasSelected = this.state.selectedRowKeys.length > 0;
- const { RangePicker } = DatePicker;
- const { getFieldDecorator } = this.props.form;
- const formItemLayout = {
- labelCol: { span: 6 },
- wrapperCol: { span: 14 },
- };
- //const theDatak = this.state.datak || {};
- const theInformation = this.state.dataInformation || {}
- const contactsOption = "";
- const formItemLayput = {
- labelCol: { span: 10 },
- wrapperCol: { span: 14 },
- };
- const contacts = this.state.contacts || '';
- return (
- <div className="user-content">
- <ShowModalDiv ShowModal={this.state.showModal} />
- <div className="content-title">
- <span>我的被拒绝客户</span>
- </div>
- <Tabs
- defaultActiveKey="1"
- onChange={this.callback}
- className="test">
- <TabPane tab="搜索" key="1">
- <div className="user-search">
- <Input
- placeholder="客户名称"
- value={this.state.nameSearch}
- onChange={e => {
- this.setState({ nameSearch: e.target.value });
- }}
- />
- <Input
- placeholder="营销员"
- value={this.state.adminName}
- onChange={e => {
- this.setState({ adminName: e.target.value });
- }}
- />
- <Button type="primary" onClick={this.search}>
- 搜索
- </Button>
- <Button onClick={this.reset}>重置</Button>
- </div>
- </TabPane>
- <TabPane tab="更改表格显示数据" key="2">
- <div style={{ marginLeft: 10 }}>
- <ChooseList
- columns={this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- margin={11}
- />
- </div>
- </TabPane>
- </Tabs>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- size="middle"
- columns={
- this.state.changeList
- ? this.state.changeList
- : this.state.columns
- }
- dataSource={this.state.dataSource}
- rowSelection={rowSelection}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick}
- />
- </Spin>
- </div>
- <Modal
- className="customeDetails"
- title="被拒绝客户详情"
- width="500px"
- visible={this.state.modal5Visible}
- onOk={this.detailsModal}
- onCancel={this.detailsModal}
- footer=""
- >
- <Form horizontal onSubmit={this.submit} id="add-form">
- <Spin spinning={this.state.loading}>
- <div className="clearfix">
- <FormItem {...formItemLayout} label="客户姓名">
- {getFieldDecorator("nickname", {
- rules: [{ required: true, message: "此项为必填项!" }],
- initialValue: this.state.nickname
- })(
- <Input
- placeholder="客户姓名"
- onChange={e => {
- this.setState({ nickname: e.target.value });
- }}
- />
- )}
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem {...formItemLayout} label="联系电话">
- {getFieldDecorator("mobile", {
- rules: [{ required: true, message: "此项为必填项!" }],
- initialValue: this.state.mobile
- })(
- <Input
- placeholder="联系电话"
- onChange={e => {
- this.setState({ mobile: e.target.value });
- }}
- />
- )}
- </FormItem>
- </div>
- <div className="clearfix">
- <FormItem {...formItemLayout} label="社会属性">
- <Select
- placeholder="客户社会属性"
- value={this.state.societyTag}
- onChange={e => {
- this.setState({ societyTag: e });
- }}
- >
- {socialAttribute.map(function(item) {
- return (
- <Select.Option key={item.value}>
- {item.key}
- </Select.Option>
- );
- })}
- </Select>
- </FormItem>
- </div>
- <FormItem wrapperCol={{ span: 18, offset: 6 }}>
- <Button type="primary" htmlType="submit">
- 提交审核
- </Button>
- <Button
- type="ghost"
- onClick={this.detailsModal}
- style={{ marginLeft: "40px" }}
- >
- 取消
- </Button>
- </FormItem>
- </Spin>
- </Form>
- </Modal>
- </div>
- );
- }
- }));
- export default PublicCustomer;
|