press.jsx 19 KB

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