pressList.jsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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. specially:1,
  30. newStatus: this.state.newStatus,
  31. },
  32. success: function(data) {
  33. let theArr = [];
  34. if(data.error.length || data.data.list == "") {
  35. if(data.error && data.error.length) {
  36. message.warning(data.error[0].message);
  37. };
  38. } else {
  39. for(let i = 0; i < data.data.list.length; i++) {
  40. let thisdata = data.data.list[i];
  41. theArr.push({
  42. key: i + 1,
  43. id:thisdata.id,//ID
  44. contractNo: thisdata.contractNo,
  45. orderNo: thisdata.orderNo,//订单编号
  46. totalAmount:thisdata.totalAmount,//签单金额
  47. settlementAmount:thisdata.settlementAmount,//已收款
  48. accountsReceivable:thisdata.accountsReceivable,//应收款
  49. uncollectedAmount:thisdata.uncollectedAmount,//应收款
  50. orderStatus:thisdata.orderStatus,//订单状态
  51. projectStatus:thisdata.projectStatus,//项目状态
  52. liquidationStatus:thisdata.liquidationStatus,//结算状态
  53. signDate:thisdata.signDate,//签单时间
  54. userName:thisdata.userName,//客户名称
  55. salesmanName:thisdata.salesmanName,//营销员名称
  56. dunSubject:thisdata.dunSubject,//催收科目
  57. startDate:thisdata.startDate,//催收启动时间
  58. depName:thisdata.depName,//部门名称
  59. contractNo:thisdata.contractNo
  60. });
  61. };
  62. this.state.pagination.total = data.data.totalCount;
  63. };
  64. if(data.data&&data.data.list&&!data.data.list.length){
  65. this.state.pagination.total=0
  66. }
  67. this.setState({
  68. dataSource: theArr,
  69. pageNo: pageNo,
  70. pagination: this.state.pagination,
  71. selectedRowKeys:[]
  72. });
  73. }.bind(this),
  74. }).always(function() {
  75. this.setState({
  76. loading: false
  77. });
  78. }.bind(this));
  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. noVisible: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. depId: this.state.departmenttSearch ? this.state.departmenttSearch : undefined,//订单部门
  397. specially:1,
  398. pageSize: 9999,
  399. newStatus: this.state.newStatus
  400. }
  401. window.location.href=(globalConfig.context+'/api/admin/newOrder/exportOrderDunData?'+$.param(data));
  402. },
  403. visitOks(){
  404. this.setState({
  405. visibles:false
  406. })
  407. this.resets();
  408. },
  409. //部门
  410. departmentList() {
  411. this.setState({
  412. loading: true
  413. });
  414. $.ajax({
  415. method: "get",
  416. dataType: "json",
  417. crossDomain: false,
  418. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  419. data: {
  420. },
  421. success: function(data) {
  422. let thedata = data.data;
  423. let theArr = [];
  424. if(!thedata) {
  425. if(data.error && data.error.length) {
  426. message.warning(data.error[0].message);
  427. };
  428. thedata = {};
  429. } else {
  430. thedata.map(function(item, index) {
  431. theArr.push({
  432. key: index,
  433. name: item.name,
  434. id: item.id,
  435. })
  436. })
  437. }
  438. this.setState({
  439. departmentArr: theArr,
  440. })
  441. }.bind(this),
  442. }).always(function() {
  443. this.setState({
  444. loading: false
  445. });
  446. }.bind(this));
  447. },
  448. render() {
  449. const formItemLayout = {
  450. labelCol: { span: 8 },
  451. wrapperCol: { span: 14 },
  452. };
  453. const FormItem = Form.Item;
  454. const { RangePicker } = DatePicker;
  455. const rowSelection = {
  456. selectedRowKeys: this.state.selectedRowKeys,
  457. onChange: (selectedRowKeys, selectedRows) => {
  458. this.setState({
  459. modalVisible:false,
  460. selectedRows: selectedRows.slice(-1),
  461. selectedRowKeys: selectedRowKeys.slice(-1)
  462. });
  463. },
  464. onSelect: (recordt) => {
  465. this.setState({
  466. modalVisible:false,
  467. recordt: recordt.id
  468. })
  469. },
  470. };
  471. let departmentArr = this.state.departmentArr || [];
  472. return (
  473. <div className="user-content">
  474. <div className="content-title">
  475. <span>催款节点统计</span>
  476. </div>
  477. <div className="user-search">
  478. <Button
  479. type="primary"
  480. onClick={this.exportExec}
  481. style={{ float: "right" }}
  482. >
  483. 导出催款列表
  484. </Button>
  485. <Input
  486. placeholder="客户名称"
  487. style={{ width: "150px", marginBottom: "10px" }}
  488. value={this.state.customerName}
  489. onChange={e => {
  490. this.setState({ customerName: e.target.value });
  491. }}
  492. />
  493. <Input
  494. placeholder="营销员名称"
  495. style={{ width: "150px", marginBottom: "10px" }}
  496. value={this.state.adminName}
  497. onChange={e => {
  498. this.setState({ adminName: e.target.value });
  499. }}
  500. />
  501. <Input
  502. placeholder="订单编号"
  503. style={{ width: "150px" }}
  504. value={this.state.orderNo}
  505. onChange={e => {
  506. this.setState({ orderNo: e.target.value });
  507. }}
  508. />
  509. <Select
  510. placeholder="选择部门"
  511. style={{ width: 150, marginRight: "10px" }}
  512. value={this.state.departmenttSearch}
  513. onChange={e => {
  514. this.setState({ departmenttSearch: e });
  515. }}
  516. >
  517. {departmentArr.map(function(item) {
  518. return <Select.Option key={item.id}>{item.name}</Select.Option>;
  519. })}
  520. </Select>
  521. <Select
  522. placeholder="选择催款节点类型"
  523. style={{ width: 150, marginRight: "10px" }}
  524. value={this.state.newStatus == 0 ? "旧催款节点" : "新催款节点"}
  525. onChange={e => {
  526. this.setState({ newStatus: e });
  527. }}
  528. >
  529. <Select.Option key={0}>{"旧催款节点"}</Select.Option>
  530. <Select.Option key={1}>{"新催款节点"}</Select.Option>
  531. </Select>
  532. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  533. <RangePicker
  534. value={[
  535. this.state.releaseDate[0]
  536. ? moment(this.state.releaseDate[0])
  537. : null,
  538. this.state.releaseDate[1]
  539. ? moment(this.state.releaseDate[1])
  540. : null
  541. ]}
  542. onChange={(data, dataString) => {
  543. this.setState({ releaseDate: dataString });
  544. }}
  545. />
  546. <Button
  547. type="primary"
  548. onClick={this.search}
  549. style={{ marginLeft: "10px" }}
  550. >
  551. 搜索
  552. </Button>
  553. <Button onClick={this.reset}>重置</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. scroll={{ x: "max-content", y: 0 }}
  561. onRowClick={this.tableRowClick}
  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.visitCancel}
  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;