arrearsList.jsx 20 KB

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