adminCustomerStatistics.2.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. "use strict";
  2. import React from 'react';
  3. import ReactDom from 'react-dom';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. import { Form, Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload, Popconfirm } from 'antd';
  7. import ManagementDetaile from "../../order/settlementOrder/settlementManage/managementDetaile.2.jsx";
  8. import moment from 'moment';
  9. import '../../order/userMangagement.less';
  10. import { orderState, orderChannel, orderType } from '../../../dataDic.js';
  11. import { getProjectState, getOrderChannel, getOrderType, getOrderState, getPaymentState, getApprovedState } from '../../../tools.js';
  12. const AdminCustomerStatistics = Form.create()(React.createClass({
  13. loadData(pageNo) {
  14. this.state.data = [];
  15. this.setState({
  16. loading: true
  17. });
  18. $.ajax({
  19. method: "get",
  20. dataType: "json",
  21. crossDomain: false,
  22. url: globalConfig.context + '/api/admin/customer/selectAdminCustomerStatistics',
  23. data: {
  24. pageNo: pageNo || 1,
  25. pageSize: this.state.pagination.pageSize,
  26. buyerName: this.state.buyerNameSearch,
  27. depId: this.state.departmenttSearch, //部门
  28. salesmanName: this.state.salesmanNameSearch, //负责人
  29. startTime: this.state.releaseDate[0],
  30. endTime: this.state.releaseDate[1],
  31. liquidationStatus: this.state.liquidationStatusSearch, //结算
  32. orderStatus: this.state.orderStatusSearch,
  33. orderChannel: this.state.orderChannelSearch,
  34. financeName: this.state.financeNameSearchs,
  35. orderType: this.state.orderTypeSearch,
  36. orderNo: this.state.orderNoSearch,
  37. isDistributionFinance: this.state.isDistributionFinance
  38. },
  39. success: function(data) {
  40. let theArr = [];
  41. if(!data.data) {
  42. if(data.error && data.error.length) {
  43. message.warning(data.error[0].message);
  44. };
  45. } else {
  46. for(let i = 0; i < data.data.list.length; i++) {
  47. let thisdata = data.data.list[i];
  48. theArr.push({
  49. key: i+1,
  50. aid:thisdata.aid,
  51. aName:thisdata.aName,
  52. depName:thisdata.depName,
  53. userCount:thisdata.userCount,
  54. timeCount:thisdata.timeCount,
  55. // key: i,
  56. // id: thisdata.id,
  57. // orderNo: thisdata.orderNo, //订单编号
  58. // orderType: thisdata.orderType, //订单类型
  59. // orderStatus: thisdata.orderStatus,
  60. // liquidationStatus: thisdata.liquidationStatus,
  61. // createTime: thisdata.createTime,
  62. // buyerName: thisdata.buyerName,
  63. // signTotalAmount: thisdata.signTotalAmount,
  64. // projectStage: thisdata.projectStage,
  65. // approval: thisdata.approval,
  66. // orderChannel: thisdata.orderChannel,
  67. // salesmanName: thisdata.salesmanName,
  68. // active: thisdata.active,
  69. // departmentName: thisdata.departmentName,
  70. // salesmanName: thisdata.salesmanName,
  71. // financeName: thisdata.financeName,
  72. // technicianName: thisdata.technicianName,
  73. });
  74. };
  75. this.state.pagination.current = data.data.pageNo;
  76. this.state.pagination.total = data.data.totalCount;
  77. };
  78. if(!data.data.list.length) {
  79. this.state.pagination.current = 0
  80. this.state.pagination.total = 0
  81. }
  82. this.setState({
  83. pageNo: pageNo,
  84. dataSource: theArr,
  85. pagination: this.state.pagination,
  86. selectedRowKeys: [],
  87. signBillVisible: false
  88. });
  89. }.bind(this),
  90. }).always(function() {
  91. this.setState({
  92. loading: false
  93. });
  94. }.bind(this));
  95. },
  96. //部门
  97. departmentList() {
  98. this.setState({
  99. loading: true
  100. });
  101. $.ajax({
  102. method: "get",
  103. dataType: "json",
  104. crossDomain: false,
  105. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  106. data: {
  107. },
  108. success: function(data) {
  109. let thedata = data.data;
  110. let theArr = [];
  111. if(!thedata) {
  112. if(data.error && data.error.length) {
  113. message.warning(data.error[0].message);
  114. };
  115. thedata = {};
  116. } else {
  117. thedata.map(function(item, index) {
  118. theArr.push({
  119. key: index,
  120. name: item.name,
  121. id: item.id,
  122. })
  123. })
  124. }
  125. this.setState({
  126. departmentArr: theArr,
  127. })
  128. }.bind(this),
  129. }).always(function() {
  130. this.setState({
  131. loading: false
  132. });
  133. }.bind(this));
  134. },
  135. getInitialState() {
  136. return {
  137. datauser: {},
  138. selectedRowKeys: [],
  139. releaseDate: [],
  140. selectedRows: [],
  141. departmentArr: [],
  142. searchMore: true,
  143. loading: false,
  144. distributionVisible: false,
  145. visible: false,
  146. showDesc: false,
  147. pagination: {
  148. defaultCurrent: 1,
  149. defaultPageSize: 10,
  150. showQuickJumper: true,
  151. pageSize: 10,
  152. onChange: function(page) {
  153. this.loadData(page);
  154. }.bind(this),
  155. showTotal: function(total) {
  156. return '共' + total + '条数据';
  157. }
  158. },
  159. columns: [{
  160. title: 'id',
  161. dataIndex: 'aid',
  162. key: 'aid'
  163. },{
  164. title: '编号',
  165. dataIndex: 'key',
  166. key: 'key'
  167. }, {
  168. title: '营销员名称',
  169. dataIndex: 'aName',
  170. key: 'aName',
  171. }, {
  172. title: '部门名称',
  173. dataIndex: 'depName',
  174. key: 'depName',
  175. }, {
  176. title: '客户数',
  177. dataIndex: 'userCount',
  178. key: 'userCount',
  179. }, {
  180. title: '时间内客户数',
  181. dataIndex: 'timeCount',
  182. key: 'timeCount'
  183. }],
  184. columnsX: [{
  185. title: '客户ID',
  186. dataIndex: 'id',
  187. key: 'id'
  188. }, {
  189. title: '客户名称',
  190. dataIndex: 'name',
  191. key: 'name'
  192. }, {
  193. title: '来源',
  194. dataIndex: 'sourceName',
  195. key: 'sourceName'
  196. }, {
  197. title: '联系人',
  198. dataIndex: 'contacts',
  199. key: 'contacts'
  200. }, {
  201. title: '联系人电话',
  202. dataIndex: 'contactMobile',
  203. key: 'contactMobile'
  204. }, {
  205. title: '创建时间',
  206. dataIndex: 'createTime',
  207. key: 'createTime',
  208. }, {
  209. title: '跟进时间',
  210. dataIndex: 'followTime',
  211. key: 'followTime',
  212. }],
  213. dataSource: [],
  214. };
  215. },
  216. //操作分配
  217. confirmDelet(index) {
  218. this.setState({
  219. orderNot: index.orderNo,
  220. userDetaile: false,
  221. distributionVisible: true
  222. });
  223. },
  224. distributionCancel() {
  225. this.setState({
  226. distributionVisible: false
  227. })
  228. },
  229. distributionOk() {
  230. this.setState({
  231. distributionVisible: false
  232. })
  233. },
  234. //分配对象列表
  235. contactList() {
  236. $.ajax({
  237. method: "get",
  238. dataType: "json",
  239. crossDomain: false,
  240. url: globalConfig.context + '/api/admin/superviser/adminList',
  241. data: {
  242. pageNo: 1,
  243. pageSize: 99,
  244. departmentId: this.state.departmenttList,
  245. name: this.state.financeNameSearch,
  246. },
  247. success: function(data) {
  248. let theArr = [];
  249. if(!data.data) {
  250. if(data.error && data.error.length) {
  251. message.warning(data.error[0].message);
  252. };
  253. } else {
  254. for(let i = 0; i < data.data.list.length; i++) {
  255. let thisdata = data.data.list[i];
  256. theArr.push({
  257. key: i,
  258. id: thisdata.id,
  259. userNo: thisdata.userNo,
  260. name: thisdata.name,
  261. departmentName: thisdata.departmentName,
  262. departmentId: thisdata.departmentId,
  263. position: thisdata.position,
  264. mobile: thisdata.mobile,
  265. });
  266. };
  267. };
  268. this.setState({
  269. distributionList: theArr,
  270. });
  271. }.bind(this),
  272. }).always(function() {
  273. this.setState({
  274. loading: false
  275. });
  276. }.bind(this));
  277. },
  278. //选定对象
  279. confirmSelect(record) {
  280. this.setState({
  281. loading: true
  282. });
  283. $.ajax({
  284. method: "POST",
  285. dataType: "json",
  286. crossDomain: false,
  287. url: globalConfig.context + "/api/admin/order/distributionOrder",
  288. data: {
  289. orderNo: this.state.orderNot,
  290. financeId: record.id
  291. }
  292. }).done(function(data) {
  293. if(!data.error.length) {
  294. message.success('分派成功!');
  295. this.setState({
  296. loading: false,
  297. });
  298. this.distributionOk();
  299. } else {
  300. message.warning(data.error[0].message);
  301. };
  302. this.loadData(this.state.pageNo);
  303. }.bind(this));
  304. },
  305. componentWillMount() {
  306. this.departmentList();
  307. this.loadData();
  308. },
  309. tableRowClick(record, index) {
  310. this.state.RowData = record;
  311. this.setState({
  312. visible: true,
  313. });
  314. this.xiangmu(record.aid);
  315. },
  316. xiangmu(aids) {
  317. $.ajax({
  318. method: "get",
  319. dataType: "json",
  320. crossDomain: false,
  321. url: globalConfig.context +"/api/admin/customer/selectAdminCustomerList",
  322. data: {
  323. aid:aids
  324. },
  325. success: function(data) {
  326. let theArr = [];
  327. if(data.error.length || data.data.list == "") {
  328. if(data.error && data.error.length) {
  329. message.warning(data.error[0].message);
  330. };
  331. } else {
  332. for (let i = 0; i < data.data.length; i++) {
  333. let thisdata = data.data[i];
  334. theArr.push({
  335. key: i,
  336. id:thisdata.id,
  337. orderNo:thisdata.orderNo,//订单编号
  338. commodityId:thisdata.commodityId,//项目ID
  339. commodityName:thisdata.commodityName,//项目名称
  340. cname:thisdata.cname,//项目类别
  341. commodityPrice:thisdata.commodityPrice,//项目价格
  342. commodityQuantity:thisdata.commodityQuantity,//项目数量
  343. main:thisdata.main,//是否为主要任务
  344. taskComment:thisdata.taskComment,//任务说明
  345. contacts:thisdata.contacts,//联系人
  346. contactsMobile:thisdata.contactsMobile,//联系人电话
  347. taskStatus:thisdata.taskStatus,//是否分配
  348. });
  349. };
  350. };
  351. this.setState({
  352. dataSourceX: theArr,
  353. });
  354. }.bind(this),
  355. }).always(function() {
  356. this.setState({
  357. loading: false
  358. });
  359. }.bind(this));
  360. },
  361. closeDesc(e, s) {
  362. this.state.userDetaile = false;
  363. this.state.showDesc = e;
  364. if(s) {
  365. this.loadData(this.state.pageNo);
  366. };
  367. },
  368. searchSwitch() {
  369. this.setState({
  370. searchMore: !this.state.searchMore
  371. });
  372. },
  373. search() {
  374. this.loadData();
  375. },
  376. //分配时搜索
  377. searchOrder() {
  378. this.contactList();
  379. },
  380. //分配时重置
  381. resetOrder() {
  382. this.setState({
  383. departmenttList: undefined,
  384. financeNameSearch: ''
  385. })
  386. },
  387. reset() {
  388. this.state.buyerNameSearch = '';
  389. this.state.financeNameSearchs = '';
  390. this.state.orderNoSearch = '';
  391. this.state.releaseDate[0] = undefined;
  392. this.state.releaseDate[1] = undefined;
  393. this.state.orderChannelSearch = undefined;
  394. this.state.liquidationStatusSearch = undefined;
  395. this.state.orderStatusSearch = undefined;
  396. this.state.salesmanNameSearch = undefined;
  397. this.state.departmenttSearch = undefined;
  398. this.state.approved = undefined;
  399. this.state.orderChannelSearch = undefined;
  400. this.state.orderTypeSearch = undefined;
  401. this.state.isDistributionFinance = undefined;
  402. this.loadData();
  403. },
  404. render() {
  405. const rowSelection = {
  406. selectedRowKeys: this.state.selectedRowKeys,
  407. onChange: (selectedRowKeys, selectedRows) => {
  408. this.setState({
  409. selectedRows: selectedRows.slice(-1),
  410. selectedRowKeys: selectedRowKeys.slice(-1)
  411. });
  412. },
  413. onSelectAll: (selected, selectedRows, changeRows) => {
  414. this.setState({
  415. selectedRowKeys: []
  416. })
  417. },
  418. };
  419. let departmentArr = this.state.departmentArr || [];
  420. const hasSelected = this.state.selectedRowKeys.length > 0;
  421. const {
  422. RangePicker
  423. } = DatePicker;
  424. return(
  425. <div className="user-content" >
  426. <div className="content-title">
  427. <span style={{fontSize:'16px'}}>结算订单管理</span>
  428. <div className="user-search">
  429. {/*<Input placeholder="客户名称" style={{width:'150px'}}
  430. value={this.state.buyerNameSearch}
  431. onChange={(e) => { this.setState({ buyerNameSearch: e.target.value }); }} />
  432. */}
  433. <RangePicker
  434. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  435. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  436. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  437. <Select placeholder="订单部门"
  438. style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
  439. value={this.state.departmenttSearch}
  440. onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
  441. {
  442. departmentArr.map(function (item) {
  443. return <Select.Option key={item.id} >{item.name}</Select.Option>
  444. })
  445. }
  446. </Select>
  447. <Button type="primary" onClick={this.search} style={{marginLeft:'10px'}}>搜索</Button>
  448. <Button onClick={this.reset}>重置</Button>
  449. {/*<span style={{marginLeft:'10px',marginRight:'20px'}}>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  450. */}
  451. </div>
  452. {<div className="patent-table">
  453. <Spin spinning={this.state.loading}>
  454. <Table columns={this.state.columns}
  455. dataSource={this.state.dataSource}
  456. rowSelection={rowSelection}
  457. pagination={this.state.pagination}
  458. onRowClick={this.tableRowClick} />
  459. </Spin>
  460. </div>}
  461. {<div>
  462. <Modal maskClosable={false} visible={this.state.visible}
  463. onOk={this.handleOk} onCancel={this.handleCancel}
  464. width='1000px'
  465. title='订单详情'
  466. footer=''
  467. className="admin-desc-content">
  468. <div className="patent-table">
  469. <Spin spinning={this.state.loading}>
  470. <Table columns={this.state.columnsX}
  471. dataSource={this.state.dataSourceX}
  472. pagination={this.state.paginations}
  473. onRowClick={this.tableRowClickX} />
  474. </Spin>
  475. </div>
  476. </Modal>
  477. </div>}
  478. </div >
  479. </div>
  480. );
  481. }
  482. }));
  483. export default AdminCustomerStatistics;