pressList.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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. const IntentionCustomer = Form.create()(React.createClass({
  9. loadData(pageNo) {
  10. this.setState({
  11. visitModul:false,
  12. loading: true,
  13. ispage:pageNo,
  14. modalVisible:false
  15. });
  16. $.ajax({
  17. method: "get",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context +"/api/admin/newOrder/dunOrderNewList",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. name: this.state.customerName,//名称
  25. orderNo: this.state.orderNo,//订单编号
  26. depId: this.state.departmenttSearch,//订单部门
  27. adminName:this.state.adminName,//责任人名称
  28. starTime: this.state.releaseDate[0],//开始时间
  29. endTime: this.state.releaseDate[1],//结束时间
  30. specially: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. contractNo: thisdata.contractNo,
  46. orderNo: thisdata.orderNo,//订单编号
  47. totalAmount:thisdata.totalAmount,//签单金额
  48. settlementAmount:thisdata.settlementAmount,//已收款
  49. accountsReceivable:thisdata.accountsReceivable,//应收款
  50. uncollectedAmount:thisdata.uncollectedAmount,//应收款
  51. orderStatus:thisdata.orderStatus,//订单状态
  52. projectStatus:thisdata.projectStatus,//项目状态
  53. liquidationStatus:thisdata.liquidationStatus,//结算状态
  54. signDate:thisdata.signDate,//签单时间
  55. userName:thisdata.userName,//客户名称
  56. salesmanName:thisdata.salesmanName,//营销员名称
  57. dunSubject:thisdata.dunSubject,//催收科目
  58. startDate:thisdata.startDate,//催收启动时间
  59. depName:thisdata.depName,//部门名称
  60. contractNo:thisdata.contractNo,
  61. dunStatus: thisdata.dunStatus == 0 ? "未触发" : "已触发"
  62. });
  63. };
  64. this.state.pagination.total = data.data.totalCount;
  65. this.state.pagination.current = data.data.pageNo;
  66. };
  67. if(data.data&&data.data.list&&!data.data.list.length){
  68. this.state.pagination.total=0
  69. }
  70. this.setState({
  71. dataSource: theArr,
  72. pageNo: pageNo,
  73. pagination: this.state.pagination,
  74. selectedRowKeys:[]
  75. });
  76. }.bind(this),
  77. }).always(function() {
  78. this.setState({
  79. loading: false
  80. });
  81. }.bind(this));
  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 getProjectStatus(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. noVisible: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. depId: this.state.departmenttSearch ? this.state.departmenttSearch : undefined,//订单部门
  405. specially:1,
  406. pageSize: 9999,
  407. newStatus: this.state.newStatus
  408. }
  409. window.location.href=(globalConfig.context+'/api/admin/newOrder/exportOrderDunData?'+$.param(data));
  410. },
  411. visitOks(){
  412. this.setState({
  413. visibles:false
  414. })
  415. this.resets();
  416. },
  417. //部门
  418. departmentList() {
  419. this.setState({
  420. loading: true
  421. });
  422. $.ajax({
  423. method: "get",
  424. dataType: "json",
  425. crossDomain: false,
  426. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  427. data: {
  428. },
  429. success: function(data) {
  430. let thedata = data.data;
  431. let theArr = [];
  432. if(!thedata) {
  433. if(data.error && data.error.length) {
  434. message.warning(data.error[0].message);
  435. };
  436. thedata = {};
  437. } else {
  438. thedata.map(function(item, index) {
  439. theArr.push({
  440. key: index,
  441. name: item.name,
  442. id: item.id,
  443. })
  444. })
  445. }
  446. this.setState({
  447. departmentArr: theArr,
  448. })
  449. }.bind(this),
  450. }).always(function() {
  451. this.setState({
  452. loading: false
  453. });
  454. }.bind(this));
  455. },
  456. changeList(arr) {
  457. const newArr = [];
  458. this.state.columns.forEach(item => {
  459. arr.forEach(val => {
  460. if (val === item.title) {
  461. newArr.push(item);
  462. }
  463. });
  464. });
  465. this.setState({
  466. changeList: newArr
  467. });
  468. },
  469. render() {
  470. const formItemLayout = {
  471. labelCol: { span: 8 },
  472. wrapperCol: { span: 14 },
  473. };
  474. const FormItem = Form.Item;
  475. const { RangePicker } = DatePicker;
  476. const rowSelection = {
  477. selectedRowKeys: this.state.selectedRowKeys,
  478. onChange: (selectedRowKeys, selectedRows) => {
  479. this.setState({
  480. modalVisible:false,
  481. selectedRows: selectedRows.slice(-1),
  482. selectedRowKeys: selectedRowKeys.slice(-1)
  483. });
  484. },
  485. onSelect: (recordt) => {
  486. this.setState({
  487. modalVisible:false,
  488. recordt: recordt.id
  489. })
  490. },
  491. };
  492. let departmentArr = this.state.departmentArr || [];
  493. const { TabPane } = Tabs;
  494. return (
  495. <div className="user-content">
  496. <div className="content-title">
  497. <span>催款节点统计</span>
  498. </div>
  499. <div className="user-search">
  500. <Tabs
  501. defaultActiveKey="1"
  502. onChange={this.callback}
  503. className="test">
  504. <TabPane tab="导出催款列表" key="2">
  505. <Button
  506. type="primary"
  507. onClick={this.exportExec}
  508. style={{ float: "left", marginTop: 10,marginBottom: 10,marginLeft:10,marginRight:10}}
  509. >
  510. 导出催款列表
  511. </Button>
  512. </TabPane>
  513. <TabPane tab="搜索" key="1">
  514. <Input
  515. placeholder="客户名称"
  516. style={{ width: "150px", marginBottom: "10px" ,marginRight:10,marginLeft:10}}
  517. value={this.state.customerName}
  518. onChange={e => {
  519. this.setState({ customerName: e.target.value });
  520. }}
  521. />
  522. <Input
  523. placeholder="营销员名称"
  524. style={{ width: "150px", marginBottom: "10px" }}
  525. value={this.state.adminName}
  526. onChange={e => {
  527. this.setState({ adminName: e.target.value });
  528. }}
  529. />
  530. <Input
  531. placeholder="订单编号"
  532. style={{ width: "150px" }}
  533. value={this.state.orderNo}
  534. onChange={e => {
  535. this.setState({ orderNo: e.target.value });
  536. }}
  537. />
  538. <Select
  539. placeholder="选择部门"
  540. style={{ width: 150, marginRight: "10px" }}
  541. value={this.state.departmenttSearch}
  542. onChange={e => {
  543. this.setState({ departmenttSearch: e });
  544. }}
  545. >
  546. {departmentArr.map(function(item) {
  547. return <Select.Option key={item.id}>{item.name}</Select.Option>;
  548. })}
  549. </Select>
  550. <Select
  551. placeholder="选择催款节点类型"
  552. style={{ width: 150, marginRight: "10px" }}
  553. value={this.state.newStatus == 0 ? "旧催款节点" : "新催款节点"}
  554. onChange={e => {
  555. this.setState({ newStatus: e });
  556. }}
  557. >
  558. <Select.Option key={0}>{"旧催款节点"}</Select.Option>
  559. <Select.Option key={1}>{"新催款节点"}</Select.Option>
  560. </Select>
  561. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  562. <RangePicker
  563. value={[
  564. this.state.releaseDate[0]
  565. ? moment(this.state.releaseDate[0])
  566. : null,
  567. this.state.releaseDate[1]
  568. ? moment(this.state.releaseDate[1])
  569. : null
  570. ]}
  571. onChange={(data, dataString) => {
  572. this.setState({ releaseDate: dataString });
  573. }}
  574. />
  575. <Button
  576. type="primary"
  577. onClick={this.search}
  578. style={{ marginLeft: "10px",marginRight: 10}}
  579. >
  580. 搜索
  581. </Button>
  582. <Button onClick={this.reset}>重置</Button>
  583. </TabPane>
  584. <TabPane tab="更改表格显示数据" key="3">
  585. <div style={{ marginLeft: 10 }}>
  586. <ChooseList
  587. columns={this.state.columns}
  588. changeFn={this.changeList}
  589. changeList={this.state.changeList}
  590. top={55}
  591. margin={11}
  592. />
  593. </div>
  594. </TabPane>
  595. </Tabs>
  596. </div>
  597. <div className="patent-table">
  598. <Spin spinning={this.state.loading}>
  599. <Table
  600. columns={
  601. this.state.changeList
  602. ? this.state.changeList
  603. : this.state.columns
  604. }
  605. dataSource={this.state.dataSource}
  606. pagination={this.state.pagination}
  607. scroll={{ x: "max-content", y: 0 }}
  608. onRowClick={this.tableRowClick}
  609. bordered
  610. size="small"
  611. />
  612. </Spin>
  613. <Modal
  614. className="customeDetails"
  615. footer=""
  616. title="新增催款记录"
  617. width="500px"
  618. visible={this.state.visible}
  619. onOk={this.visitOk}
  620. onCancel={this.visitCancel}
  621. >
  622. <Form
  623. layout="horizontal"
  624. onSubmit={this.handleSubmit}
  625. id="demand-form"
  626. style={{ paddingBottom: "40px" }}
  627. >
  628. <Spin spinning={this.state.loading}>
  629. <div className="clearfix">
  630. <div className="clearfix">
  631. <FormItem
  632. className="half-item"
  633. {...formItemLayout}
  634. label="催款时间"
  635. >
  636. <DatePicker
  637. style={{
  638. marginTop: "2px",
  639. width: "240px",
  640. height: "32px"
  641. }}
  642. showTime
  643. format="YYYY-MM-DD"
  644. onOk={() => {}}
  645. value={
  646. this.state.dumTime ? moment(this.state.dumTime) : null
  647. }
  648. onChange={(data, dataString) => {
  649. this.setState({ dumTime: dataString });
  650. }}
  651. />
  652. </FormItem>
  653. </div>
  654. <div className="clearfix">
  655. <FormItem
  656. labelCol={{ span: 4 }}
  657. wrapperCol={{ span: 16 }}
  658. label="催款情况"
  659. >
  660. <Input
  661. type="textarea"
  662. placeholder="请输入催款情况"
  663. rows={4}
  664. value={this.state.remarks}
  665. onChange={e => {
  666. this.setState({ remarks: e.target.value });
  667. }}
  668. />
  669. </FormItem>
  670. </div>
  671. <div className="clearfix">
  672. <Button
  673. className="cancel"
  674. type="primary"
  675. onClick={this.examOk}
  676. style={{ marginLeft: "50px" }}
  677. htmlType="submit"
  678. >
  679. 添加
  680. </Button>
  681. <Button
  682. className="cancel"
  683. type="ghost"
  684. onClick={this.visitCancel}
  685. style={{ marginLeft: "50px" }}
  686. >
  687. 取消
  688. </Button>
  689. </div>
  690. </div>
  691. </Spin>
  692. </Form>
  693. </Modal>
  694. <Modal
  695. className="customeDetails"
  696. footer=""
  697. title="催款记录查看"
  698. width="500px"
  699. visible={this.state.visibles}
  700. onOk={this.visitOks}
  701. onCancel={this.visitCancels}
  702. >
  703. <div className="user-content">
  704. <div className="patent-table">
  705. <Spin spinning={this.state.loading}>
  706. <Table
  707. columns={this.state.columnsX}
  708. dataSource={this.state.dataSources}
  709. rowSelection={rowSelection}
  710. pagination={this.state.paginations}
  711. // onRowClick={this.tableRowClick}
  712. />
  713. </Spin>
  714. </div>
  715. </div>
  716. </Modal>
  717. </div>
  718. </div>
  719. );
  720. }
  721. }));
  722. export default IntentionCustomer;