pressList.jsx 19 KB

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