arrearsList.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. const ArrearsList = Form.create()(
  29. React.createClass({
  30. loadData(pageNo) {
  31. this.setState({
  32. visitModul: false,
  33. loading: true,
  34. ispage: pageNo,
  35. modalVisible: false,
  36. });
  37. $.ajax({
  38. method: "get",
  39. dataType: "json",
  40. crossDomain: false,
  41. url: globalConfig.context + "/api/admin/newOrder/arrearsDunList",
  42. data: {
  43. pageNo: pageNo || 1,
  44. pageSize: this.state.pagination.pageSize,
  45. name: this.state.customerName, //名称
  46. orderNo: this.state.orderNo, //订单编号
  47. contractNo: this.state.contractNo,
  48. depId: this.state.departmenttSearch, //订单部门
  49. starTime: this.state.releaseDate[0], //开始时间
  50. endTime: this.state.releaseDate[1], //结束时间
  51. tStarTime: this.state.chufaDate[0], //开始时间
  52. tEndTime: this.state.chufaDate[1], //结束时间
  53. adminName: this.state.adminName,
  54. },
  55. success: function (data) {
  56. ShowModal(this);
  57. let theArr = [];
  58. if (data.error.length || data.data.list == "") {
  59. if (data.error && data.error.length) {
  60. message.warning(data.error[0].message);
  61. }
  62. } else {
  63. for (let i = 0; i < data.data.list.length; i++) {
  64. let thisdata = data.data.list[i];
  65. let obj = thisdata;
  66. obj.key = i + 1;
  67. theArr.push(obj);
  68. }
  69. this.state.pagination.total = data.data.totalCount;
  70. this.state.pagination.current = data.data.pageNo;
  71. }
  72. if (data.data && data.data.list && !data.data.list.length) {
  73. this.state.pagination.total = 0;
  74. }
  75. this.setState({
  76. dataSource: theArr,
  77. pageNo: pageNo,
  78. pagination: this.state.pagination,
  79. selectedRowKeys: [],
  80. });
  81. }.bind(this),
  82. }).always(
  83. function () {
  84. this.setState({
  85. loading: false,
  86. });
  87. }.bind(this)
  88. );
  89. },
  90. getInitialState() {
  91. return {
  92. releaseDate: [],
  93. chufaDate: [],
  94. pagination: {
  95. defaultCurrent: 1,
  96. defaultPageSize: 10,
  97. showQuickJumper: true,
  98. pageSize: 10,
  99. onChange: function (page) {
  100. this.loadData(page);
  101. }.bind(this),
  102. showTotal: function (total) {
  103. return "共" + total + "条数据";
  104. },
  105. },
  106. columns: [
  107. {
  108. title: "序号",
  109. dataIndex: "key",
  110. key: "key",
  111. },
  112. {
  113. title: "合同编号",
  114. dataIndex: "contractNo",
  115. key: "contractNo",
  116. },
  117. {
  118. title: "订单编号",
  119. dataIndex: "orderNo",
  120. key: "orderNo",
  121. },
  122. {
  123. title: "客户名称",
  124. dataIndex: "userName",
  125. key: "userName",
  126. render: text => {
  127. return (
  128. <Tooltip title={text}>
  129. <div style={{
  130. maxWidth:'150px',
  131. overflow:'hidden',
  132. textOverflow: "ellipsis",
  133. whiteSpace:'nowrap',
  134. }}>{text}</div>
  135. </Tooltip>
  136. )
  137. }
  138. },
  139. {
  140. title: "订单负责人",
  141. dataIndex: "salesmanName",
  142. key: "salesmanName",
  143. },
  144. {
  145. title: "订单部门",
  146. dataIndex: "depName",
  147. key: "depName",
  148. },
  149. {
  150. title: "订单状态",
  151. dataIndex: "orderStatus",
  152. key: "orderStatus",
  153. render: (text) => {
  154. return getNewOrderStatus(text);
  155. },
  156. },
  157. {
  158. title: "项目状态",
  159. dataIndex: "projectStatus",
  160. key: "projectStatus",
  161. render: (text) => {
  162. return getProjectName(text);
  163. },
  164. },
  165. {
  166. title: "签单金额(万元)",
  167. dataIndex: "totalAmount",
  168. key: "totalAmount",
  169. },
  170. {
  171. title: "已收款(万元)",
  172. dataIndex: "settlementAmount",
  173. key: "settlementAmount",
  174. },
  175. {
  176. title: "应收款(万元)",
  177. dataIndex: "orderReceivables",
  178. key: "orderReceivables",
  179. },
  180. {
  181. title: "欠款(万元)",
  182. dataIndex: "orderArrears",
  183. key: "orderArrears",
  184. },
  185. {
  186. title: "结算状态",
  187. dataIndex: "liquidationStatus",
  188. key: "liquidationStatus",
  189. render: (text) => {
  190. return getLiquidationStatus(text);
  191. },
  192. },
  193. {
  194. title: "催收科目",
  195. dataIndex: "type",
  196. key: "type",
  197. render: text => {
  198. if(text == 0) {
  199. return "按时触发应收欠款"
  200. }
  201. }
  202. },
  203. {
  204. title: "催款状态",
  205. dataIndex: "dunStatus",
  206. key: "dunStatus",
  207. render: (text) => {
  208. if (text == 0) {
  209. return "未启动";
  210. } else if (text == 1) {
  211. return "催款中";
  212. } else if (text == 2) {
  213. return "已完成";
  214. } else if (text == 3) {
  215. return "已停止";
  216. }
  217. },
  218. },
  219. {
  220. title: "催款启动日期",
  221. dataIndex: "startDate",
  222. key: "startDate",
  223. },
  224. {
  225. title: "下单时间",
  226. dataIndex: "signDate",
  227. key: "signDate",
  228. },
  229. ],
  230. dataSource: [],
  231. };
  232. },
  233. //页面加载函数
  234. componentWillMount() {
  235. this.loadData();
  236. },
  237. //搜索
  238. search() {
  239. this.setState({
  240. //signBillVisible:false
  241. });
  242. this.loadData();
  243. },
  244. //导出
  245. exportExec() {
  246. var data = {
  247. name: this.state.customerName ? this.state.customerName : undefined, //客户名称
  248. adminName: this.state.adminName ? this.state.adminName : undefined, //订单负责人
  249. orderNo: this.state.orderNo ? this.state.orderNo : undefined, //订单编号
  250. contractNo: this.state.contractNo ? this.state.contractNo : undefined,
  251. starTime: this.state.releaseDate[0]
  252. ? this.state.releaseDate[0]
  253. : undefined,
  254. endTime: this.state.releaseDate[1]
  255. ? this.state.releaseDate[1]
  256. : undefined,
  257. tStarTime: this.state.chufaDate[0]
  258. ? this.state.chufaDate[0]
  259. : undefined,
  260. tEndTime: this.state.chufaDate[1] ? this.state.chufaDate[1] : undefined,
  261. depId: this.state.departmenttSearch,
  262. pageSize: 9999999,
  263. };
  264. window.location.href =
  265. globalConfig.context +
  266. "/api/admin/newOrder/exportArrearsDunListData?" +
  267. $.param(data);
  268. },
  269. //重置
  270. reset() {
  271. this.state.orderNo = "";
  272. this.state.contractNo = '';
  273. this.state.customerName = "";
  274. this.state.adminName = "";
  275. this.state.departmenttSearch = undefined;
  276. this.state.releaseDate[0] = undefined;
  277. this.state.releaseDate[1] = undefined;
  278. this.state.chufaDate[1] = undefined;
  279. this.state.chufaDate[0] = undefined;
  280. this.loadData();
  281. },
  282. changeList(arr) {
  283. const newArr = [];
  284. this.state.columns.forEach(item => {
  285. arr.forEach(val => {
  286. if (val === item.title) {
  287. newArr.push(item);
  288. }
  289. });
  290. });
  291. this.setState({
  292. changeList: newArr
  293. });
  294. },
  295. render() {
  296. const formItemLayout = {
  297. labelCol: { span: 8 },
  298. wrapperCol: { span: 14 },
  299. };
  300. const FormItem = Form.Item;
  301. const { RangePicker } = DatePicker;
  302. const rowSelection = {
  303. selectedRowKeys: this.state.selectedRowKeys,
  304. onChange: (selectedRowKeys, selectedRows) => {
  305. this.setState({
  306. modalVisible: false,
  307. selectedRows: selectedRows.slice(-1),
  308. selectedRowKeys: selectedRowKeys.slice(-1),
  309. });
  310. },
  311. onSelect: (recordt) => {
  312. this.setState({
  313. modalVisible: false,
  314. recordt: recordt.id,
  315. });
  316. },
  317. };
  318. const { TabPane } = Tabs;
  319. return (
  320. <div className="user-content">
  321. <ShowModalDiv ShowModal={this.state.showModal} />
  322. <div className="content-title" style={{ marginBottom: 10 }}>
  323. <span style={{ fontWeight: 900, fontSize: 16 }}>欠款催收列表</span>
  324. </div>
  325. <div className="user-search">
  326. <Tabs
  327. defaultActiveKey="1"
  328. onChange={this.callback}
  329. className="test"
  330. >
  331. <TabPane tab="搜索" key="1">
  332. <Input
  333. placeholder="客户名称"
  334. style={{
  335. width: "150px",
  336. marginBottom: "10px",
  337. marginLeft: 10,
  338. marginRight: 10,
  339. }}
  340. value={this.state.customerName}
  341. onChange={(e) => {
  342. this.setState({ customerName: e.target.value });
  343. }}
  344. />
  345. <Input
  346. placeholder="订单编号"
  347. style={{ width: "150px", marginRight: 10 }}
  348. value={this.state.orderNo}
  349. onChange={(e) => {
  350. this.setState({ orderNo: e.target.value });
  351. }}
  352. />
  353. <Input
  354. placeholder="合同编号"
  355. style={{ width: "150px", marginRight: 10 }}
  356. value={this.state.contractNo}
  357. onChange={(e) => {
  358. this.setState({ contractNo: e.target.value });
  359. }}
  360. />
  361. <Input
  362. placeholder="营销员名称"
  363. style={{
  364. width: "150px",
  365. marginBottom: "10px",
  366. marginRight: 10,
  367. }}
  368. value={this.state.adminName}
  369. onChange={(e) => {
  370. this.setState({ adminName: e.target.value });
  371. }}
  372. />
  373. <DepartmentList
  374. value={this.state.departmenttSearch}
  375. onChange={e => {
  376. this.setState({ departmenttSearch: e });
  377. }}/>
  378. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  379. <RangePicker
  380. value={[
  381. this.state.releaseDate[0]
  382. ? moment(this.state.releaseDate[0])
  383. : null,
  384. this.state.releaseDate[1]
  385. ? moment(this.state.releaseDate[1])
  386. : null,
  387. ]}
  388. onChange={(data, dataString) => {
  389. this.setState({ releaseDate: dataString });
  390. }}
  391. />
  392. <span style={{ marginRight: "10px", marginLeft: 10 }}>触发时间 :</span>
  393. <RangePicker
  394. value={[
  395. this.state.chufaDate[0]
  396. ? moment(this.state.chufaDate[0])
  397. : null,
  398. this.state.chufaDate[1]
  399. ? moment(this.state.chufaDate[1])
  400. : null,
  401. ]}
  402. onChange={(data, dataString) => {
  403. this.setState({ chufaDate: dataString });
  404. }}
  405. />
  406. <Button
  407. type="primary"
  408. onClick={this.search}
  409. style={{ marginLeft: "10px", marginRight: 10 }}
  410. >
  411. 搜索
  412. </Button>
  413. <Button onClick={this.reset}>重置</Button>
  414. </TabPane>
  415. <TabPane tab="导出催款列表" key="2">
  416. <Button
  417. type="primary"
  418. onClick={this.exportExec}
  419. style={{ marginBottom: 10, marginTop: 10, marginLeft: 10 }}
  420. >
  421. 导出催款列表
  422. </Button>
  423. </TabPane>
  424. <TabPane tab="更改表格显示数据" key="3">
  425. <div style={{ marginLeft: 10 }}>
  426. <ChooseList
  427. columns={this.state.columns}
  428. changeFn={this.changeList}
  429. changeList={this.state.changeList}
  430. top={55}
  431. margin={11}
  432. />
  433. </div>
  434. </TabPane>
  435. </Tabs>
  436. <div className="patent-table">
  437. <Spin spinning={this.state.loading}>
  438. <Table
  439. columns={
  440. this.state.changeList
  441. ? this.state.changeList
  442. : this.state.columns
  443. }
  444. dataSource={this.state.dataSource}
  445. pagination={this.state.pagination}
  446. scroll={{ x: "max-content", y: 0 }}
  447. bordered
  448. size="small"
  449. />
  450. </Spin>
  451. </div>
  452. </div>
  453. </div>
  454. );
  455. },
  456. })
  457. );
  458. export default ArrearsList;