press.jsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. import React from 'react';
  2. import { Button, Input, Select, Spin, Table, message,DatePicker, Form ,Modal} from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import { getLiquidationStatus,getjiedian,getNewOrderStatus,getProjectStatus} from '@/tools.js';
  6. import './customer.less';
  7. const IntentionCustomer = Form.create()(React.createClass({
  8. loadData(pageNo) {
  9. this.setState({
  10. visitModul:false,
  11. loading: true,
  12. ispage:pageNo,
  13. modalVisible:false
  14. });
  15. $.ajax({
  16. method: "get",
  17. dataType: "json",
  18. crossDomain: false,
  19. url: globalConfig.context + "/api/admin/newOrder/dunOrderNewList",
  20. data: {
  21. pageNo: pageNo || 1,
  22. pageSize: this.state.pagination.pageSize,
  23. name: this.state.customerName, //名称
  24. orderNo: this.state.orderNo, //订单编号
  25. depId: this.state.departmenttSearch, //订单部门
  26. adminName: this.state.adminName, //责任人名称
  27. starTime: this.state.releaseDate[0], //开始时间
  28. endTime: this.state.releaseDate[1], //结束时间
  29. newStatus: this.state.newStatus
  30. },
  31. success: function(data) {
  32. let theArr = [];
  33. if (data.error.length || data.data.list == "") {
  34. if (data.error && data.error.length) {
  35. message.warning(data.error[0].message);
  36. }
  37. } else {
  38. for (let i = 0; i < data.data.list.length; i++) {
  39. let thisdata = data.data.list[i];
  40. theArr.push({
  41. key: i,
  42. id: thisdata.id, //ID
  43. orderNo: thisdata.orderNo, //订单编号
  44. totalAmount: thisdata.totalAmount, //签单金额
  45. settlementAmount: thisdata.settlementAmount, //已收款
  46. accountsReceivable: thisdata.accountsReceivable, //应收款
  47. uncollectedAmount: thisdata.uncollectedAmount, //应收款
  48. orderStatus: thisdata.orderStatus, //订单状态
  49. projectStatus: thisdata.projectStatus, //项目状态
  50. liquidationStatus: thisdata.liquidationStatus, //结算状态
  51. signDate: thisdata.signDate, //签单时间
  52. userName: thisdata.userName, //客户名称
  53. salesmanName: thisdata.salesmanName, //营销员名称
  54. dunSubject: thisdata.dunSubject, //催收科目
  55. startDate: thisdata.startDate, //催收启动时间
  56. depName: thisdata.depName, //部门名称
  57. contractNo: thisdata.contractNo,
  58. dunStatus: thisdata.dunStatus == 0 ? "未触发" : "已触发"
  59. });
  60. }
  61. this.state.pagination.total = data.data.totalCount;
  62. }
  63. if (data.data && data.data.list && !data.data.list.length) {
  64. this.state.pagination.total = 0;
  65. }
  66. this.setState({
  67. dataSource: theArr,
  68. pageNo: pageNo,
  69. pagination: this.state.pagination,
  70. selectedRowKeys: []
  71. });
  72. }.bind(this)
  73. }).always(
  74. function() {
  75. this.setState({
  76. loading: false
  77. });
  78. }.bind(this)
  79. );
  80. },
  81. loadDatas(dunId) {
  82. this.setState({
  83. loading: true,
  84. });
  85. $.ajax({
  86. method: "get",
  87. dataType: "json",
  88. crossDomain: false,
  89. url: globalConfig.context +"/api/admin/newOrder/selectDunLogList",
  90. data: {
  91. dunId:dunId,
  92. },
  93. success: function(data) {
  94. let theArr = [];
  95. if(data.error.length || data.data == "") {
  96. if(data.error && data.error.length) {
  97. message.warning(data.error[0].message);
  98. };
  99. } else {
  100. for(let i = 0; i < data.data.length; i++) {
  101. let thisdata = data.data[i];
  102. theArr.push({
  103. key: i,
  104. id:thisdata.id,//ID
  105. dunId: thisdata.dunId,//催款ID
  106. dumBy:thisdata.dumBy,//催款人
  107. dumTime:thisdata.dumDate,//催款时间
  108. remarks:thisdata.remarks,//备注
  109. });
  110. };
  111. };
  112. this.setState({
  113. dataSources: theArr,
  114. });
  115. }.bind(this),
  116. }).always(function() {
  117. this.setState({
  118. loading: false
  119. });
  120. }.bind(this));
  121. },
  122. getInitialState() {
  123. return {
  124. newStatus: 1,
  125. page: 1,
  126. releaseDate: [],
  127. selectedRowKeys: [],
  128. orgCodeUrl: [],
  129. departmentArr: [],
  130. paginations: false,
  131. pagination: {
  132. defaultCurrent: 1,
  133. defaultPageSize: 10,
  134. showQuickJumper: true,
  135. pageSize: 10,
  136. onChange: function(page) {
  137. this.loadData(page);
  138. }.bind(this),
  139. showTotal: function(total) {
  140. return "共" + total + "条数据";
  141. }
  142. },
  143. columns: [
  144. {
  145. title: "序号",
  146. dataIndex: "key",
  147. key: "key"
  148. },
  149. {
  150. title: "合同编号",
  151. dataIndex: "contractNo",
  152. key: "contractNo"
  153. },
  154. {
  155. title: "订单编号",
  156. dataIndex: "orderNo",
  157. key: "orderNo"
  158. },
  159. {
  160. title: "客户名称",
  161. dataIndex: "userName",
  162. key: "userName",
  163. render: text => {
  164. return text && text.length > 9 ? text.substr(0, 9) + "..." : text;
  165. }
  166. },
  167. {
  168. title: "订单负责人",
  169. dataIndex: "salesmanName",
  170. key: "salesmanName"
  171. },
  172. {
  173. title: "订单部门",
  174. dataIndex: "depName",
  175. key: "depName"
  176. },
  177. {
  178. title: "订单状态",
  179. dataIndex: "orderStatus",
  180. key: "orderStatus",
  181. render: text => {
  182. return getNewOrderStatus(text);
  183. }
  184. },
  185. {
  186. title: "项目状态",
  187. dataIndex: "projectStatus",
  188. key: "projectStatus",
  189. render: text => {
  190. return getProjectStatus(text);
  191. }
  192. },
  193. {
  194. title: "签单金额(万元)",
  195. dataIndex: "totalAmount",
  196. key: "totalAmount"
  197. },
  198. {
  199. title: "结算状态",
  200. dataIndex: "liquidationStatus",
  201. key: "liquidationStatus",
  202. render: text => {
  203. return getLiquidationStatus(text);
  204. }
  205. },
  206. {
  207. title: "应收款(万)",
  208. dataIndex: "accountsReceivable",
  209. key: "accountsReceivable"
  210. },
  211. {
  212. title: "已收款(万)",
  213. dataIndex: "settlementAmount",
  214. key: "settlementAmount"
  215. },
  216. {
  217. title: "未收款(万)",
  218. dataIndex: "uncollectedAmount",
  219. key: "uncollectedAmount"
  220. },
  221. {
  222. title: "催收科目",
  223. dataIndex: "dunSubject",
  224. key: "dunSubject"
  225. // render: text => {
  226. // return getjiedian(text);
  227. // }
  228. },
  229. {
  230. title: "催款状态",
  231. dataIndex: "dunStatus",
  232. key: "dunStatus"
  233. },
  234. {
  235. title: "催款启动日期",
  236. dataIndex: "startDate",
  237. key: "startDate"
  238. },
  239. {
  240. title: "签单时间",
  241. dataIndex: "signDate",
  242. key: "signDate"
  243. }
  244. // {
  245. // title: "催收操作",
  246. // dataIndex: "abc",
  247. // key: "abc",
  248. // render: (text, record) => {
  249. // return (
  250. // <div>
  251. // <Button
  252. // onClick={e => {
  253. // e.stopPropagation(), this.visit(record);
  254. // }}
  255. // type="primary"
  256. // >
  257. // 添加催款记录
  258. // </Button>
  259. // </div>
  260. // );
  261. // }
  262. // }
  263. ],
  264. data: [],
  265. dataSource: [],
  266. columnsX: [
  267. {
  268. title: "催款人",
  269. dataIndex: "dumBy",
  270. key: "dumBy"
  271. },
  272. {
  273. title: "催款时间",
  274. dataIndex: "dumTime",
  275. key: "dumTime"
  276. },
  277. {
  278. title: "催款情况",
  279. dataIndex: "remarks",
  280. key: "remarks"
  281. }
  282. ],
  283. dataSources: []
  284. };
  285. },
  286. //页面加载函数
  287. componentWillMount() {
  288. this.departmentList();
  289. this.loadData();
  290. },
  291. //进入新增拜访记录
  292. visit(record) {
  293. this.setState({
  294. visible:true,
  295. dunId:record.id
  296. })
  297. },
  298. // //整行点击
  299. tableRowClick(record) {
  300. this.setState({
  301. visibles:true,
  302. });
  303. this.loadDatas(record.id);
  304. },
  305. //新增催款记录
  306. examOk(){
  307. $.ajax({
  308. method: "post",
  309. dataType: "json",
  310. crossDomain: false,
  311. url: globalConfig.context +"/api/admin/newOrder/createDunLog",
  312. data: {
  313. dunId:this.state.dunId,
  314. dumTime:this.state.dumTime,
  315. remarks:this.state.remarks,
  316. },
  317. success: function(data) {
  318. if(data.error.length || data.data.list == "") {
  319. if(data.error && data.error.length) {
  320. message.warning(data.error[0].message);
  321. };
  322. } else {
  323. message.success("新增催款记录成功~");
  324. this.setState({
  325. visible:false,
  326. });
  327. this.loadData();
  328. this.resets();
  329. };
  330. }.bind(this),
  331. }).always(function() {
  332. this.setState({
  333. loading: false
  334. });
  335. }.bind(this));
  336. },
  337. //关闭输入理由框
  338. noCancel(){
  339. this.setState({
  340. visible:false
  341. })
  342. },
  343. //搜索
  344. search() {
  345. this.setState({
  346. //signBillVisible:false
  347. })
  348. this.loadData();
  349. },
  350. //重置
  351. reset() {
  352. this.setState({
  353. signBillVisible:false
  354. })
  355. this.state.orderNo='';
  356. this.state.customerName='';
  357. this.state.adminName='';
  358. this.state.departmenttSearch=undefined;
  359. this.state.releaseDate[0] = undefined;
  360. this.state.releaseDate[1] = undefined;
  361. this.loadData();
  362. },
  363. resets(){
  364. this.state.orderNo='';
  365. this.state.customerName='';
  366. this.state.adminName='';
  367. this.state.departmenttSearch=undefined;
  368. this.state.releaseDate[0] = undefined;
  369. this.state.releaseDate[1] = undefined;
  370. },
  371. getOrgCodeUrl(e) {
  372. this.setState({ orgCodeUrl: e });
  373. },
  374. //关闭详情
  375. visitCancel(){
  376. this.setState({
  377. visible:false
  378. })
  379. this.resets();
  380. },
  381. visitOk(){
  382. this.setState({
  383. visible:false
  384. })
  385. this.resets();
  386. },
  387. //关闭详情
  388. visitCancels(){
  389. this.setState({
  390. visibles:false
  391. })
  392. this.resets();
  393. },
  394. //导出
  395. exportExec(){
  396. var data = {
  397. name: this.state.customerName?this.state.customerName:undefined,//客户名称
  398. adminName:this.state.adminName?this.state.adminName:undefined,//订单负责人
  399. orderNo: this.state.orderNo?this.state.orderNo:undefined,//订单编号
  400. starTime: this.state.releaseDate[0]?this.state.releaseDate[0]:undefined,
  401. endTime: this.state.releaseDate[1]?this.state.releaseDate[1]:undefined,
  402. pageSize: 9999,
  403. newStatus: this.state.newStatus
  404. }
  405. window.location.href=(globalConfig.context+'/api/admin/newOrder/exportOrderDunData?'+$.param(data));
  406. },
  407. visitOks(){
  408. this.setState({
  409. visibles:false
  410. })
  411. this.resets();
  412. },
  413. //部门
  414. departmentList() {
  415. this.setState({
  416. loading: true
  417. });
  418. $.ajax({
  419. method: "get",
  420. dataType: "json",
  421. crossDomain: false,
  422. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  423. data: {
  424. },
  425. success: function(data) {
  426. let thedata = data.data;
  427. let theArr = [];
  428. if(!thedata) {
  429. if(data.error && data.error.length) {
  430. message.warning(data.error[0].message);
  431. };
  432. thedata = {};
  433. } else {
  434. thedata.map(function(item, index) {
  435. theArr.push({
  436. key: index,
  437. name: item.name,
  438. id: item.id,
  439. })
  440. })
  441. }
  442. this.setState({
  443. departmentArr: theArr,
  444. })
  445. }.bind(this),
  446. }).always(function() {
  447. this.setState({
  448. loading: false
  449. });
  450. }.bind(this));
  451. },
  452. render() {
  453. const formItemLayout = {
  454. labelCol: { span: 8 },
  455. wrapperCol: { span: 14 },
  456. };
  457. const FormItem = Form.Item;
  458. const { RangePicker } = DatePicker;
  459. const rowSelection = {
  460. selectedRowKeys: this.state.selectedRowKeys,
  461. onChange: (selectedRowKeys, selectedRows) => {
  462. this.setState({
  463. modalVisible:false,
  464. selectedRows: selectedRows.slice(-1),
  465. selectedRowKeys: selectedRowKeys.slice(-1)
  466. });
  467. },
  468. onSelect: (recordt) => {
  469. this.setState({
  470. modalVisible:false,
  471. recordt: recordt.id
  472. })
  473. },
  474. };
  475. let departmentArr = this.state.departmentArr || [];
  476. return (
  477. <div className="user-content">
  478. <div className="content-title">
  479. <span>催款节点统计</span>
  480. </div>
  481. <div className="user-search">
  482. <Input
  483. placeholder="客户名称"
  484. style={{ width: "150px", marginBottom: "10px" }}
  485. value={this.state.customerName}
  486. onChange={e => {
  487. this.setState({ customerName: e.target.value });
  488. }}
  489. />
  490. <Input
  491. placeholder="营销员名称"
  492. style={{ width: "150px", marginBottom: "10px" }}
  493. value={this.state.adminName}
  494. onChange={e => {
  495. this.setState({ adminName: e.target.value });
  496. }}
  497. />
  498. <Input
  499. placeholder="订单编号"
  500. style={{ width: "150px" }}
  501. value={this.state.orderNo}
  502. onChange={e => {
  503. this.setState({ orderNo: e.target.value });
  504. }}
  505. />
  506. <Select
  507. placeholder="选择部门"
  508. style={{ width: 150, marginRight: "10px" }}
  509. value={this.state.departmenttSearch}
  510. onChange={e => {
  511. this.setState({ departmenttSearch: e });
  512. }}
  513. >
  514. {departmentArr.map(function(item) {
  515. return <Select.Option key={item.id}>{item.name}</Select.Option>;
  516. })}
  517. </Select>
  518. <Select
  519. placeholder="选择催款节点类型"
  520. style={{ width: 150, marginRight: "10px" }}
  521. value={this.state.newStatus == 0 ? "旧催款节点" : "新催款节点"}
  522. onChange={e => {
  523. this.setState({ newStatus: e });
  524. }}
  525. >
  526. <Select.Option key={0}>{"旧催款节点"}</Select.Option>
  527. <Select.Option key={1}>{"新催款节点"}</Select.Option>
  528. </Select>
  529. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  530. <RangePicker
  531. value={[
  532. this.state.releaseDate[0]
  533. ? moment(this.state.releaseDate[0])
  534. : null,
  535. this.state.releaseDate[1]
  536. ? moment(this.state.releaseDate[1])
  537. : null
  538. ]}
  539. onChange={(data, dataString) => {
  540. this.setState({ releaseDate: dataString });
  541. }}
  542. />
  543. <Button
  544. type="primary"
  545. onClick={this.search}
  546. style={{ marginLeft: "10px" }}
  547. >
  548. 搜索
  549. </Button>
  550. <Button onClick={this.reset}>重置</Button>
  551. <Button type="primary" onClick={this.exportExec}>
  552. 导出催款列表
  553. </Button>
  554. <div className="patent-table">
  555. <Spin spinning={this.state.loading}>
  556. <Table
  557. columns={this.state.columns}
  558. dataSource={this.state.dataSource}
  559. pagination={this.state.pagination}
  560. onRowClick={this.tableRowClick}
  561. scroll={{ x: "max-content", y: 0 }}
  562. bordered
  563. size="small"
  564. />
  565. </Spin>
  566. </div>
  567. <Modal
  568. className="customeDetails"
  569. footer=""
  570. title="新增催款记录"
  571. width="500px"
  572. visible={this.state.visible}
  573. onOk={this.visitOk}
  574. onCancel={this.visitCancel}
  575. >
  576. <Form
  577. layout="horizontal"
  578. onSubmit={this.handleSubmit}
  579. id="demand-form"
  580. style={{ paddingBottom: "40px" }}
  581. >
  582. <Spin spinning={this.state.loading}>
  583. <div className="clearfix">
  584. <div className="clearfix">
  585. <FormItem
  586. className="half-item"
  587. {...formItemLayout}
  588. label="催款时间"
  589. >
  590. <DatePicker
  591. style={{
  592. marginTop: "2px",
  593. width: "240px",
  594. height: "32px"
  595. }}
  596. showTime
  597. format="YYYY-MM-DD"
  598. onOk={() => {}}
  599. value={
  600. this.state.dumTime ? moment(this.state.dumTime) : null
  601. }
  602. onChange={(data, dataString) => {
  603. this.setState({ dumTime: dataString });
  604. }}
  605. />
  606. </FormItem>
  607. </div>
  608. <div className="clearfix">
  609. <FormItem
  610. labelCol={{ span: 4 }}
  611. wrapperCol={{ span: 16 }}
  612. label="催款情况"
  613. >
  614. <Input
  615. type="textarea"
  616. placeholder="请输入催款情况"
  617. rows={4}
  618. value={this.state.remarks}
  619. onChange={e => {
  620. this.setState({ remarks: e.target.value });
  621. }}
  622. />
  623. </FormItem>
  624. </div>
  625. <div className="clearfix">
  626. <Button
  627. className="cancel"
  628. type="primary"
  629. onClick={this.examOk}
  630. style={{ marginLeft: "50px" }}
  631. htmlType="submit"
  632. >
  633. 添加
  634. </Button>
  635. <Button
  636. className="cancel"
  637. type="ghost"
  638. onClick={this.noCancel}
  639. style={{ marginLeft: "50px" }}
  640. >
  641. 取消
  642. </Button>
  643. </div>
  644. </div>
  645. </Spin>
  646. </Form>
  647. </Modal>
  648. <Modal
  649. className="customeDetails"
  650. footer=""
  651. title="催款记录查看"
  652. width="500px"
  653. visible={this.state.visibles}
  654. onOk={this.visitOks}
  655. onCancel={this.visitCancels}
  656. >
  657. <div className="user-content">
  658. <div className="patent-table">
  659. <Spin spinning={this.state.loading}>
  660. <Table
  661. columns={this.state.columnsX}
  662. dataSource={this.state.dataSources}
  663. rowSelection={rowSelection}
  664. pagination={this.state.paginations}
  665. // onRowClick={this.tableRowClick}
  666. />
  667. </Spin>
  668. </div>
  669. </div>
  670. </Modal>
  671. </div>
  672. </div>
  673. );
  674. }
  675. }));
  676. export default IntentionCustomer;