press.jsx 21 KB

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