arrearsList.jsx 15 KB

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