pressList.jsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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. import DepartmentList from "../../../common/departmentList";
  10. const IntentionCustomer = Form.create()(React.createClass({
  11. loadData(pageNo) {
  12. this.setState({
  13. visitModul:false,
  14. loading: true,
  15. ispage:pageNo,
  16. modalVisible:false
  17. });
  18. $.ajax({
  19. method: "get",
  20. dataType: "json",
  21. crossDomain: false,
  22. url: globalConfig.context +"/api/admin/newOrder/dunOrderNewList",
  23. data: {
  24. pageNo: pageNo || 1,
  25. pageSize: this.state.pagination.pageSize,
  26. name: this.state.customerName,//名称
  27. orderNo: this.state.orderNo,//订单编号
  28. depId: this.state.departmenttSearch,//订单部门
  29. adminName:this.state.adminName,//责任人名称
  30. starTime: this.state.releaseDate[0],//开始时间
  31. endTime: this.state.releaseDate[1],//结束时间
  32. specially:1,
  33. newStatus: this.state.newStatus,
  34. },
  35. success: function(data) {
  36. let theArr = [];
  37. if(data.error.length || data.data.list == "") {
  38. if(data.error && data.error.length) {
  39. message.warning(data.error[0].message);
  40. };
  41. } else {
  42. for(let i = 0; i < data.data.list.length; i++) {
  43. let thisdata = data.data.list[i];
  44. theArr.push({
  45. key: i + 1,
  46. id:thisdata.id,//ID
  47. contractNo: thisdata.contractNo,
  48. orderNo: thisdata.orderNo,//订单编号
  49. totalAmount:thisdata.totalAmount,//签单金额
  50. settlementAmount:thisdata.settlementAmount,//已收款
  51. accountsReceivable:thisdata.accountsReceivable,//应收款
  52. uncollectedAmount:thisdata.uncollectedAmount,//应收款
  53. orderStatus:thisdata.orderStatus,//订单状态
  54. projectStatus:thisdata.projectStatus,//项目状态
  55. liquidationStatus:thisdata.liquidationStatus,//结算状态
  56. signDate:thisdata.signDate,//签单时间
  57. userName:thisdata.userName,//客户名称
  58. salesmanName:thisdata.salesmanName,//营销员名称
  59. dunSubject:thisdata.dunSubject,//催收科目
  60. startDate:thisdata.startDate,//催收启动时间
  61. depName:thisdata.depName,//部门名称
  62. contractNo:thisdata.contractNo,
  63. dunStatus: thisdata.dunStatus == 0 ? "未触发" : "已触发"
  64. });
  65. };
  66. this.state.pagination.total = data.data.totalCount;
  67. this.state.pagination.current = data.data.pageNo;
  68. };
  69. if(data.data&&data.data.list&&!data.data.list.length){
  70. this.state.pagination.total=0
  71. }
  72. this.setState({
  73. dataSource: theArr,
  74. pageNo: pageNo,
  75. pagination: this.state.pagination,
  76. selectedRowKeys:[]
  77. });
  78. }.bind(this),
  79. }).always(function() {
  80. this.setState({
  81. loading: false
  82. });
  83. }.bind(this));
  84. },
  85. loadDatas(dunId) {
  86. this.setState({
  87. loading: true,
  88. });
  89. $.ajax({
  90. method: "get",
  91. dataType: "json",
  92. crossDomain: false,
  93. url: globalConfig.context +"/api/admin/newOrder/selectDunLogList",
  94. data: {
  95. dunId:dunId,
  96. },
  97. success: function(data) {
  98. let theArr = [];
  99. if(data.error.length || data.data == "") {
  100. if(data.error && data.error.length) {
  101. message.warning(data.error[0].message);
  102. };
  103. } else {
  104. for(let i = 0; i < data.data.length; i++) {
  105. let thisdata = data.data[i];
  106. theArr.push({
  107. key: i,
  108. id:thisdata.id,//ID
  109. dunId: thisdata.dunId,//催款ID
  110. dumBy:thisdata.dumBy,//催款人
  111. dumTime:thisdata.dumDate,//催款时间
  112. remarks:thisdata.remarks,//备注
  113. });
  114. };
  115. };
  116. this.setState({
  117. dataSources: theArr,
  118. });
  119. }.bind(this),
  120. }).always(function() {
  121. this.setState({
  122. loading: false
  123. });
  124. }.bind(this));
  125. },
  126. getInitialState() {
  127. return {
  128. newStatus: 1,
  129. page: 1,
  130. releaseDate: [],
  131. selectedRowKeys: [],
  132. orgCodeUrl: [],
  133. paginations: false,
  134. pagination: {
  135. defaultCurrent: 1,
  136. defaultPageSize: 10,
  137. showQuickJumper: true,
  138. pageSize: 10,
  139. onChange: function(page) {
  140. this.loadData(page);
  141. }.bind(this),
  142. showTotal: function(total) {
  143. return "共" + total + "条数据";
  144. }
  145. },
  146. columns: [
  147. {
  148. title: "序号",
  149. dataIndex: "key",
  150. key: "key"
  151. },
  152. {
  153. title: "合同编号",
  154. dataIndex: "contractNo",
  155. key: "contractNo"
  156. },
  157. {
  158. title: "订单编号",
  159. dataIndex: "orderNo",
  160. key: "orderNo"
  161. },
  162. {
  163. title: "客户名称",
  164. dataIndex: "userName",
  165. key: "userName",
  166. render: text => {
  167. return text && text.length > 9 ? text.substr(0, 9) + "..." : text;
  168. }
  169. },
  170. {
  171. title: "订单负责人",
  172. dataIndex: "salesmanName",
  173. key: "salesmanName"
  174. },
  175. {
  176. title: "订单部门",
  177. dataIndex: "depName",
  178. key: "depName"
  179. },
  180. {
  181. title: "订单状态",
  182. dataIndex: "orderStatus",
  183. key: "orderStatus",
  184. render: text => {
  185. return getNewOrderStatus(text);
  186. }
  187. },
  188. {
  189. title: "项目状态",
  190. dataIndex: "projectStatus",
  191. key: "projectStatus",
  192. render: text => {
  193. return getProjectName(text);
  194. }
  195. },
  196. {
  197. title: "签单金额(万元)",
  198. dataIndex: "totalAmount",
  199. key: "totalAmount"
  200. },
  201. {
  202. title: "已收款(万元)",
  203. dataIndex: "settlementAmount",
  204. key: "settlementAmount"
  205. },
  206. {
  207. title: "未收款(万元)",
  208. dataIndex: "uncollectedAmount",
  209. key: "uncollectedAmount"
  210. },
  211. {
  212. title: "结算状态",
  213. dataIndex: "liquidationStatus",
  214. key: "liquidationStatus",
  215. render: text => {
  216. return getLiquidationStatus(text);
  217. }
  218. },
  219. {
  220. title: "催收科目",
  221. dataIndex: "dunSubject",
  222. key: "dunSubject"
  223. // render: text => {
  224. // return getjiedian(text);
  225. // }
  226. },
  227. {
  228. title: "应收款(万元)",
  229. dataIndex: "accountsReceivable",
  230. key: "accountsReceivable"
  231. },
  232. {
  233. title: "催款状态",
  234. dataIndex: "dunStatus",
  235. key: "dunStatus"
  236. },
  237. {
  238. title: "催款启动日期",
  239. dataIndex: "startDate",
  240. key: "startDate"
  241. },
  242. {
  243. title: "签单时间",
  244. dataIndex: "signDate",
  245. key: "signDate"
  246. },
  247. {
  248. title: "催收操作",
  249. dataIndex: "abc",
  250. key: "abc",
  251. render: (text, record) => {
  252. return (
  253. <div>
  254. <Button
  255. onClick={e => {
  256. e.stopPropagation(), this.visit(record);
  257. }}
  258. type="primary"
  259. >
  260. 添加催款记录
  261. </Button>
  262. </div>
  263. );
  264. }
  265. }
  266. ],
  267. data: [],
  268. dataSource: [],
  269. columnsX: [
  270. {
  271. title: "催款人",
  272. dataIndex: "dumBy",
  273. key: "dumBy"
  274. },
  275. {
  276. title: "催款时间",
  277. dataIndex: "dumTime",
  278. key: "dumTime"
  279. },
  280. {
  281. title: "催款情况",
  282. dataIndex: "remarks",
  283. key: "remarks"
  284. }
  285. ],
  286. dataSources: []
  287. };
  288. },
  289. //页面加载函数
  290. componentWillMount() {
  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. changeList(arr) {
  418. const newArr = [];
  419. this.state.columns.forEach(item => {
  420. arr.forEach(val => {
  421. if (val === item.title) {
  422. newArr.push(item);
  423. }
  424. });
  425. });
  426. this.setState({
  427. changeList: newArr
  428. });
  429. },
  430. render() {
  431. const formItemLayout = {
  432. labelCol: { span: 8 },
  433. wrapperCol: { span: 14 },
  434. };
  435. const FormItem = Form.Item;
  436. const { RangePicker } = DatePicker;
  437. const rowSelection = {
  438. selectedRowKeys: this.state.selectedRowKeys,
  439. onChange: (selectedRowKeys, selectedRows) => {
  440. this.setState({
  441. modalVisible:false,
  442. selectedRows: selectedRows.slice(-1),
  443. selectedRowKeys: selectedRowKeys.slice(-1)
  444. });
  445. },
  446. onSelect: (recordt) => {
  447. this.setState({
  448. modalVisible:false,
  449. recordt: recordt.id
  450. })
  451. },
  452. };
  453. const { TabPane } = Tabs;
  454. return (
  455. <div className="user-content">
  456. <div className="content-title">
  457. <span>催款节点统计</span>
  458. </div>
  459. <div className="user-search">
  460. <Tabs
  461. defaultActiveKey="1"
  462. onChange={this.callback}
  463. className="test">
  464. <TabPane tab="导出催款列表" key="2">
  465. <Button
  466. type="primary"
  467. onClick={this.exportExec}
  468. style={{ float: "left", marginTop: 10,marginBottom: 10,marginLeft:10,marginRight:10}}
  469. >
  470. 导出催款列表
  471. </Button>
  472. </TabPane>
  473. <TabPane tab="搜索" key="1">
  474. <Input
  475. placeholder="客户名称"
  476. style={{ width: "150px", marginBottom: "10px" ,marginRight:10,marginLeft:10}}
  477. value={this.state.customerName}
  478. onChange={e => {
  479. this.setState({ customerName: e.target.value });
  480. }}
  481. />
  482. <Input
  483. placeholder="营销员名称"
  484. style={{ width: "150px", marginBottom: "10px" }}
  485. value={this.state.adminName}
  486. onChange={e => {
  487. this.setState({ adminName: e.target.value });
  488. }}
  489. />
  490. <Input
  491. placeholder="订单编号"
  492. style={{ width: "150px" }}
  493. value={this.state.orderNo}
  494. onChange={e => {
  495. this.setState({ orderNo: e.target.value });
  496. }}
  497. />
  498. <DepartmentList
  499. value={this.state.departmenttSearch}
  500. onChange={e => {
  501. this.setState({ departmenttSearch: e });
  502. }}/>
  503. <Select
  504. placeholder="选择催款节点类型"
  505. style={{ width: 150, marginRight: "10px" }}
  506. value={this.state.newStatus == 0 ? "旧催款节点" : "新催款节点"}
  507. onChange={e => {
  508. this.setState({ newStatus: e });
  509. }}
  510. >
  511. <Select.Option key={0}>{"旧催款节点"}</Select.Option>
  512. <Select.Option key={1}>{"新催款节点"}</Select.Option>
  513. </Select>
  514. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  515. <RangePicker
  516. value={[
  517. this.state.releaseDate[0]
  518. ? moment(this.state.releaseDate[0])
  519. : null,
  520. this.state.releaseDate[1]
  521. ? moment(this.state.releaseDate[1])
  522. : null
  523. ]}
  524. onChange={(data, dataString) => {
  525. this.setState({ releaseDate: dataString });
  526. }}
  527. />
  528. <Button
  529. type="primary"
  530. onClick={this.search}
  531. style={{ marginLeft: "10px",marginRight: 10}}
  532. >
  533. 搜索
  534. </Button>
  535. <Button onClick={this.reset}>重置</Button>
  536. </TabPane>
  537. <TabPane tab="更改表格显示数据" key="3">
  538. <div style={{ marginLeft: 10 }}>
  539. <ChooseList
  540. columns={this.state.columns}
  541. changeFn={this.changeList}
  542. changeList={this.state.changeList}
  543. top={55}
  544. margin={11}
  545. />
  546. </div>
  547. </TabPane>
  548. </Tabs>
  549. </div>
  550. <div className="patent-table">
  551. <Spin spinning={this.state.loading}>
  552. <Table
  553. columns={
  554. this.state.changeList
  555. ? this.state.changeList
  556. : this.state.columns
  557. }
  558. dataSource={this.state.dataSource}
  559. pagination={this.state.pagination}
  560. scroll={{ x: "max-content", y: 0 }}
  561. onRowClick={this.tableRowClick}
  562. bordered
  563. size="small"
  564. />
  565. </Spin>
  566. <Modal
  567. maskClosable={false}
  568. className="customeDetails"
  569. footer=""
  570. title="新增催款记录"
  571. width="500px"
  572. visible={this.state.visible}
  573. onOk={this.visitOk}
  574. onCancel={this.visitCancel}
  575. >
  576. <Form
  577. layout="horizontal"
  578. onSubmit={this.handleSubmit}
  579. id="demand-form"
  580. style={{ paddingBottom: "40px" }}
  581. >
  582. <Spin spinning={this.state.loading}>
  583. <div className="clearfix">
  584. <div className="clearfix">
  585. <FormItem
  586. className="half-item"
  587. {...formItemLayout}
  588. label="催款时间"
  589. >
  590. <DatePicker
  591. style={{
  592. marginTop: "2px",
  593. width: "240px",
  594. height: "32px"
  595. }}
  596. showTime
  597. format="YYYY-MM-DD"
  598. onOk={() => {}}
  599. value={
  600. this.state.dumTime ? moment(this.state.dumTime) : null
  601. }
  602. onChange={(data, dataString) => {
  603. this.setState({ dumTime: dataString });
  604. }}
  605. />
  606. </FormItem>
  607. </div>
  608. <div className="clearfix">
  609. <FormItem
  610. labelCol={{ span: 4 }}
  611. wrapperCol={{ span: 16 }}
  612. label="催款情况"
  613. >
  614. <Input
  615. type="textarea"
  616. placeholder="请输入催款情况"
  617. rows={4}
  618. value={this.state.remarks}
  619. onChange={e => {
  620. this.setState({ remarks: e.target.value });
  621. }}
  622. />
  623. </FormItem>
  624. </div>
  625. <div className="clearfix">
  626. <Button
  627. className="cancel"
  628. type="primary"
  629. onClick={this.examOk}
  630. style={{ marginLeft: "50px" }}
  631. htmlType="submit"
  632. >
  633. 添加
  634. </Button>
  635. <Button
  636. className="cancel"
  637. type="ghost"
  638. onClick={this.visitCancel}
  639. style={{ marginLeft: "50px" }}
  640. >
  641. 取消
  642. </Button>
  643. </div>
  644. </div>
  645. </Spin>
  646. </Form>
  647. </Modal>
  648. <Modal
  649. maskClosable={false}
  650. className="customeDetails"
  651. footer=""
  652. title="催款记录查看"
  653. width="500px"
  654. visible={this.state.visibles}
  655. onOk={this.visitOks}
  656. onCancel={this.visitCancels}
  657. >
  658. <div className="user-content">
  659. <div className="patent-table">
  660. <Spin spinning={this.state.loading}>
  661. <Table
  662. columns={this.state.columnsX}
  663. dataSource={this.state.dataSources}
  664. rowSelection={rowSelection}
  665. pagination={this.state.paginations}
  666. // onRowClick={this.tableRowClick}
  667. />
  668. </Spin>
  669. </div>
  670. </div>
  671. </Modal>
  672. </div>
  673. </div>
  674. );
  675. }
  676. }));
  677. export default IntentionCustomer;