pressList.jsx 18 KB

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