press.jsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  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. 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. dunStatus: thisdata.dunStatus == 0 ? "未触发" : "已触发"
  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(
  74. function() {
  75. this.setState({
  76. loading: false
  77. });
  78. }.bind(this)
  79. );
  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: "settlementAmount",
  201. key: "settlementAmount"
  202. },
  203. {
  204. title: "未收款(万元)",
  205. dataIndex: "uncollectedAmount",
  206. key: "uncollectedAmount"
  207. },
  208. {
  209. title: "结算状态",
  210. dataIndex: "liquidationStatus",
  211. key: "liquidationStatus",
  212. render: text => {
  213. return getLiquidationStatus(text);
  214. }
  215. },
  216. {
  217. title: "催收科目",
  218. dataIndex: "dunSubject",
  219. key: "dunSubject"
  220. // render: text => {
  221. // return getjiedian(text);
  222. // }
  223. },
  224. {
  225. title: "应收款(万元)",
  226. dataIndex: "accountsReceivable",
  227. key: "accountsReceivable"
  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. visible: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. pageSize: 9999,
  403. newStatus: this.state.newStatus
  404. }
  405. window.location.href=(globalConfig.context+'/api/admin/newOrder/exportOrderDunData?'+$.param(data));
  406. },
  407. visitOks(){
  408. this.setState({
  409. visibles:false
  410. })
  411. this.resets();
  412. },
  413. //部门
  414. departmentList() {
  415. this.setState({
  416. loading: true
  417. });
  418. $.ajax({
  419. method: "get",
  420. dataType: "json",
  421. crossDomain: false,
  422. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  423. data: {
  424. },
  425. success: function(data) {
  426. let thedata = data.data;
  427. let theArr = [];
  428. if(!thedata) {
  429. if(data.error && data.error.length) {
  430. message.warning(data.error[0].message);
  431. };
  432. thedata = {};
  433. } else {
  434. thedata.map(function(item, index) {
  435. theArr.push({
  436. key: index,
  437. name: item.name,
  438. id: item.id,
  439. })
  440. })
  441. }
  442. this.setState({
  443. departmentArr: theArr,
  444. })
  445. }.bind(this),
  446. }).always(function() {
  447. this.setState({
  448. loading: false
  449. });
  450. }.bind(this));
  451. },
  452. render() {
  453. const formItemLayout = {
  454. labelCol: { span: 8 },
  455. wrapperCol: { span: 14 },
  456. };
  457. const FormItem = Form.Item;
  458. const { RangePicker } = DatePicker;
  459. const rowSelection = {
  460. selectedRowKeys: this.state.selectedRowKeys,
  461. onChange: (selectedRowKeys, selectedRows) => {
  462. this.setState({
  463. modalVisible:false,
  464. selectedRows: selectedRows.slice(-1),
  465. selectedRowKeys: selectedRowKeys.slice(-1)
  466. });
  467. },
  468. onSelect: (recordt) => {
  469. this.setState({
  470. modalVisible:false,
  471. recordt: recordt.id
  472. })
  473. },
  474. };
  475. let departmentArr = this.state.departmentArr || [];
  476. const { TabPane } = Tabs;
  477. return (
  478. <div className="user-content">
  479. <div className="content-title">
  480. <span>催款节点统计</span>
  481. </div>
  482. <div className="user-search">
  483. <Tabs
  484. defaultActiveKey="1"
  485. onChange={this.callback}
  486. className="test">
  487. <TabPane tab="搜索" key="1">
  488. <Input
  489. placeholder="客户名称"
  490. style={{ width: "150px", marginBottom: "10px" ,marginLeft: 10}}
  491. value={this.state.customerName}
  492. onChange={e => {
  493. this.setState({ customerName: e.target.value });
  494. }}
  495. />
  496. <Input
  497. placeholder="营销员名称"
  498. style={{ width: "150px", marginBottom: "10px" }}
  499. value={this.state.adminName}
  500. onChange={e => {
  501. this.setState({ adminName: e.target.value });
  502. }}
  503. />
  504. <Input
  505. placeholder="订单编号"
  506. style={{ width: "150px" }}
  507. value={this.state.orderNo}
  508. onChange={e => {
  509. this.setState({ orderNo: e.target.value });
  510. }}
  511. />
  512. <Select
  513. placeholder="选择部门"
  514. style={{ width: 150, marginRight: "10px" }}
  515. value={this.state.departmenttSearch}
  516. onChange={e => {
  517. this.setState({ departmenttSearch: e });
  518. }}
  519. >
  520. {departmentArr.map(function(item) {
  521. return <Select.Option key={item.id}>{item.name}</Select.Option>;
  522. })}
  523. </Select>
  524. <Select
  525. placeholder="选择催款节点类型"
  526. style={{ width: 150, marginRight: "10px" }}
  527. value={this.state.newStatus == 0 ? "旧催款节点" : "新催款节点"}
  528. onChange={e => {
  529. this.setState({ newStatus: e });
  530. }}
  531. >
  532. <Select.Option key={0}>{"旧催款节点"}</Select.Option>
  533. <Select.Option key={1}>{"新催款节点"}</Select.Option>
  534. </Select>
  535. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  536. <RangePicker
  537. value={[
  538. this.state.releaseDate[0]
  539. ? moment(this.state.releaseDate[0])
  540. : null,
  541. this.state.releaseDate[1]
  542. ? moment(this.state.releaseDate[1])
  543. : null
  544. ]}
  545. onChange={(data, dataString) => {
  546. this.setState({ releaseDate: dataString });
  547. }}
  548. />
  549. <Button
  550. type="primary"
  551. onClick={this.search}
  552. style={{ marginLeft: "10px" }}
  553. >
  554. 搜索
  555. </Button>
  556. <Button onClick={this.reset}>重置</Button>
  557. </TabPane>
  558. <TabPane tab="导出催款列表" key="2">
  559. <Button type="primary" onClick={this.exportExec} style={{marginBottom: 10,marginTop: 10,marginLeft: 10}}>
  560. 导出催款列表
  561. </Button>
  562. </TabPane>
  563. </Tabs>
  564. <div className="patent-table">
  565. <Spin spinning={this.state.loading}>
  566. <Table
  567. columns={this.state.columns}
  568. dataSource={this.state.dataSource}
  569. pagination={this.state.pagination}
  570. onRowClick={this.tableRowClick}
  571. scroll={{ x: "max-content", y: 0 }}
  572. bordered
  573. size="small"
  574. />
  575. </Spin>
  576. </div>
  577. <Modal
  578. className="customeDetails"
  579. footer=""
  580. title="新增催款记录"
  581. width="500px"
  582. visible={this.state.visible}
  583. onOk={this.visitOk}
  584. onCancel={this.visitCancel}
  585. >
  586. <Form
  587. layout="horizontal"
  588. onSubmit={this.handleSubmit}
  589. id="demand-form"
  590. style={{ paddingBottom: "40px" }}
  591. >
  592. <Spin spinning={this.state.loading}>
  593. <div className="clearfix">
  594. <div className="clearfix">
  595. <FormItem
  596. className="half-item"
  597. {...formItemLayout}
  598. label="催款时间"
  599. >
  600. <DatePicker
  601. style={{
  602. marginTop: "2px",
  603. width: "240px",
  604. height: "32px"
  605. }}
  606. showTime
  607. format="YYYY-MM-DD"
  608. onOk={() => {}}
  609. value={
  610. this.state.dumTime ? moment(this.state.dumTime) : null
  611. }
  612. onChange={(data, dataString) => {
  613. this.setState({ dumTime: dataString });
  614. }}
  615. />
  616. </FormItem>
  617. </div>
  618. <div className="clearfix">
  619. <FormItem
  620. labelCol={{ span: 4 }}
  621. wrapperCol={{ span: 16 }}
  622. label="催款情况"
  623. >
  624. <Input
  625. type="textarea"
  626. placeholder="请输入催款情况"
  627. rows={4}
  628. value={this.state.remarks}
  629. onChange={e => {
  630. this.setState({ remarks: e.target.value });
  631. }}
  632. />
  633. </FormItem>
  634. </div>
  635. <div className="clearfix">
  636. <Button
  637. className="cancel"
  638. type="primary"
  639. onClick={this.examOk}
  640. style={{ marginLeft: "50px" }}
  641. htmlType="submit"
  642. >
  643. 添加
  644. </Button>
  645. <Button
  646. className="cancel"
  647. type="ghost"
  648. onClick={this.noCancel}
  649. style={{ marginLeft: "50px" }}
  650. >
  651. 取消
  652. </Button>
  653. </div>
  654. </div>
  655. </Spin>
  656. </Form>
  657. </Modal>
  658. <Modal
  659. className="customeDetails"
  660. footer=""
  661. title="催款记录查看"
  662. width="500px"
  663. visible={this.state.visibles}
  664. onOk={this.visitOks}
  665. onCancel={this.visitCancels}
  666. >
  667. <div className="user-content">
  668. <div className="patent-table">
  669. <Spin spinning={this.state.loading}>
  670. <Table
  671. columns={this.state.columnsX}
  672. dataSource={this.state.dataSources}
  673. rowSelection={rowSelection}
  674. pagination={this.state.paginations}
  675. // onRowClick={this.tableRowClick}
  676. />
  677. </Spin>
  678. </div>
  679. </div>
  680. </Modal>
  681. </div>
  682. </div>
  683. );
  684. }
  685. }));
  686. export default IntentionCustomer;