pressList.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. import React from 'react';
  2. import {Button, Input, Select, Spin, Table, message, DatePicker, Form, Modal, Tabs, Tooltip} 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. contractNo: this.state.contractNo,
  29. depId: this.state.departmenttSearch,//订单部门
  30. adminName:this.state.adminName,//责任人名称
  31. starTime: this.state.releaseDate[0],//开始时间
  32. endTime: this.state.releaseDate[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. appropriationRatio:thisdata.appropriationRatio,//拨款比例
  54. orderStatus:thisdata.orderStatus,//订单状态
  55. projectStatus:thisdata.projectStatus,//项目状态
  56. liquidationStatus:thisdata.liquidationStatus,//结算状态
  57. signDate:thisdata.signDate,//签单时间
  58. userName:thisdata.userName,//客户名称
  59. salesmanName:thisdata.salesmanName,//营销员名称
  60. dunSubject:thisdata.dunSubject,//催收科目
  61. startDate:thisdata.startDate,//催收启动时间
  62. depName:thisdata.depName,//部门名称
  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. width: 150,
  167. render: (text) => {
  168. return (
  169. <Tooltip title={text}>
  170. <div style={{
  171. maxWidth:'150px',
  172. overflow:'hidden',
  173. textOverflow: "ellipsis",
  174. whiteSpace:'nowrap',
  175. }}>{text}</div>
  176. </Tooltip>
  177. )
  178. },
  179. },
  180. {
  181. title: "订单负责人",
  182. dataIndex: "salesmanName",
  183. key: "salesmanName"
  184. },
  185. {
  186. title: "订单部门",
  187. dataIndex: "depName",
  188. key: "depName"
  189. },
  190. {
  191. title: "订单状态",
  192. dataIndex: "orderStatus",
  193. key: "orderStatus",
  194. render: text => {
  195. return getNewOrderStatus(text);
  196. }
  197. },
  198. {
  199. title: "项目状态",
  200. dataIndex: "projectStatus",
  201. key: "projectStatus",
  202. render: text => {
  203. return getProjectName(text);
  204. }
  205. },
  206. {
  207. title: "签单金额(万元)",
  208. dataIndex: "totalAmount",
  209. key: "totalAmount"
  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: "appropriationRatio",
  224. key: "appropriationRatio"
  225. },
  226. {
  227. title: "结算状态",
  228. dataIndex: "liquidationStatus",
  229. key: "liquidationStatus",
  230. render: text => {
  231. return getLiquidationStatus(text);
  232. }
  233. },
  234. {
  235. title: "催收科目",
  236. dataIndex: "dunSubject",
  237. key: "dunSubject"
  238. // render: text => {
  239. // return getjiedian(text);
  240. // }
  241. },
  242. {
  243. title: "应收款(万元)",
  244. dataIndex: "accountsReceivable",
  245. key: "accountsReceivable"
  246. },
  247. {
  248. title: "催款状态",
  249. dataIndex: "dunStatus",
  250. key: "dunStatus"
  251. },
  252. {
  253. title: "催款启动日期",
  254. dataIndex: "startDate",
  255. key: "startDate"
  256. },
  257. {
  258. title: "签单时间",
  259. dataIndex: "signDate",
  260. key: "signDate"
  261. },
  262. {
  263. title: "催收操作",
  264. dataIndex: "abc",
  265. key: "abc",
  266. render: (text, record) => {
  267. return (
  268. <div>
  269. <Button
  270. onClick={e => {
  271. e.stopPropagation(), this.visit(record);
  272. }}
  273. type="primary"
  274. >
  275. 添加催款记录
  276. </Button>
  277. </div>
  278. );
  279. }
  280. }
  281. ],
  282. data: [],
  283. dataSource: [],
  284. columnsX: [
  285. {
  286. title: "催款人",
  287. dataIndex: "dumBy",
  288. key: "dumBy"
  289. },
  290. {
  291. title: "催款时间",
  292. dataIndex: "dumTime",
  293. key: "dumTime"
  294. },
  295. {
  296. title: "催款情况",
  297. dataIndex: "remarks",
  298. key: "remarks"
  299. }
  300. ],
  301. dataSources: []
  302. };
  303. },
  304. //页面加载函数
  305. componentWillMount() {
  306. this.loadData();
  307. },
  308. //进入新增拜访记录
  309. visit(record) {
  310. this.setState({
  311. visible:true,
  312. dunId:record.id
  313. })
  314. },
  315. // //整行点击
  316. tableRowClick(record) {
  317. this.setState({
  318. visibles:true,
  319. });
  320. this.loadDatas(record.id);
  321. },
  322. //新增催款记录
  323. examOk(){
  324. $.ajax({
  325. method: "post",
  326. dataType: "json",
  327. crossDomain: false,
  328. url: globalConfig.context +"/api/admin/newOrder/createDunLog",
  329. data: {
  330. dunId:this.state.dunId,
  331. dumTime:this.state.dumTime,
  332. remarks:this.state.remarks,
  333. },
  334. success: function(data) {
  335. if(data.error.length || data.data.list == "") {
  336. if(data.error && data.error.length) {
  337. message.warning(data.error[0].message);
  338. };
  339. } else {
  340. message.success("新增催款记录成功~");
  341. this.setState({
  342. visible:false,
  343. });
  344. this.loadData();
  345. this.resets();
  346. };
  347. }.bind(this),
  348. }).always(function() {
  349. this.setState({
  350. loading: false
  351. });
  352. }.bind(this));
  353. },
  354. //关闭输入理由框
  355. noCancel(){
  356. this.setState({
  357. noVisible:false
  358. })
  359. },
  360. //搜索
  361. search() {
  362. this.setState({
  363. //signBillVisible:false
  364. })
  365. this.loadData();
  366. },
  367. //重置
  368. reset() {
  369. this.setState({
  370. signBillVisible:false
  371. })
  372. this.state.orderNo='';
  373. this.state.contractNo='';
  374. this.state.customerName='';
  375. this.state.adminName='';
  376. this.state.departmenttSearch=undefined;
  377. this.state.releaseDate[0] = undefined;
  378. this.state.releaseDate[1] = undefined;
  379. this.loadData();
  380. },
  381. resets(){
  382. this.state.orderNo='';
  383. this.state.contractNo='';
  384. this.state.customerName='';
  385. this.state.adminName='';
  386. this.state.departmenttSearch=undefined;
  387. this.state.releaseDate[0] = undefined;
  388. this.state.releaseDate[1] = undefined;
  389. },
  390. getOrgCodeUrl(e) {
  391. this.setState({ orgCodeUrl: e });
  392. },
  393. //关闭详情
  394. visitCancel(){
  395. this.setState({
  396. visible:false
  397. })
  398. this.resets();
  399. },
  400. visitOk(){
  401. this.setState({
  402. visible:false
  403. })
  404. this.resets();
  405. },
  406. //关闭详情
  407. visitCancels(){
  408. this.setState({
  409. visibles:false
  410. })
  411. this.resets();
  412. },
  413. //导出
  414. exportExec(){
  415. var data = {
  416. name: this.state.customerName?this.state.customerName:undefined,//客户名称
  417. adminName:this.state.adminName?this.state.adminName:undefined,//订单负责人
  418. orderNo: this.state.orderNo?this.state.orderNo:undefined,//订单编号
  419. contractNo: this.state.contractNo?this.state.contractNo:undefined,
  420. starTime: this.state.releaseDate[0]?this.state.releaseDate[0]:undefined,
  421. endTime: this.state.releaseDate[1]?this.state.releaseDate[1]:undefined,
  422. depId: this.state.departmenttSearch ? this.state.departmenttSearch : undefined,//订单部门
  423. pageSize: 9999999,
  424. newStatus: this.state.newStatus
  425. }
  426. window.location.href=(globalConfig.context+'/api/admin/newOrder/exportOrderDunData?'+$.param(data));
  427. },
  428. visitOks(){
  429. this.setState({
  430. visibles:false
  431. })
  432. this.resets();
  433. },
  434. changeList(arr) {
  435. const newArr = [];
  436. this.state.columns.forEach(item => {
  437. arr.forEach(val => {
  438. if (val === item.title) {
  439. newArr.push(item);
  440. }
  441. });
  442. });
  443. this.setState({
  444. changeList: newArr
  445. });
  446. },
  447. render() {
  448. const formItemLayout = {
  449. labelCol: { span: 8 },
  450. wrapperCol: { span: 14 },
  451. };
  452. const FormItem = Form.Item;
  453. const { RangePicker } = DatePicker;
  454. const rowSelection = {
  455. selectedRowKeys: this.state.selectedRowKeys,
  456. onChange: (selectedRowKeys, selectedRows) => {
  457. this.setState({
  458. modalVisible:false,
  459. selectedRows: selectedRows.slice(-1),
  460. selectedRowKeys: selectedRowKeys.slice(-1)
  461. });
  462. },
  463. onSelect: (recordt) => {
  464. this.setState({
  465. modalVisible:false,
  466. recordt: recordt.id
  467. })
  468. },
  469. };
  470. const { TabPane } = Tabs;
  471. return (
  472. <div className="user-content">
  473. <div className="content-title">
  474. <span>催款节点统计</span>
  475. </div>
  476. <div className="user-search">
  477. <Tabs
  478. defaultActiveKey="1"
  479. onChange={this.callback}
  480. className="test">
  481. <TabPane tab="导出催款列表" key="2">
  482. <Button
  483. type="primary"
  484. onClick={this.exportExec}
  485. style={{ float: "left", marginTop: 10,marginBottom: 10,marginLeft:10,marginRight:10}}
  486. >
  487. 导出催款列表
  488. </Button>
  489. </TabPane>
  490. <TabPane tab="搜索" key="1">
  491. <Input
  492. placeholder="客户名称"
  493. style={{ width: "150px", marginBottom: "10px" ,marginRight:10,marginLeft:10}}
  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" ,marginRight:10 }}
  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",marginBottom: "10px" ,marginRight:10 }}
  510. value={this.state.orderNo}
  511. onChange={e => {
  512. this.setState({ orderNo: e.target.value });
  513. }}
  514. />
  515. <Input
  516. placeholder="合同编号"
  517. style={{ width: "150px",marginBottom: "10px" ,marginRight:10 }}
  518. value={this.state.contractNo}
  519. onChange={e => {
  520. this.setState({ contractNo: e.target.value });
  521. }}
  522. />
  523. <DepartmentList
  524. value={this.state.departmenttSearch}
  525. onChange={e => {
  526. this.setState({ departmenttSearch: e });
  527. }}/>
  528. <Select
  529. placeholder="选择催款节点类型"
  530. style={{ width: 150, marginRight: "10px" }}
  531. value={this.state.newStatus == 0 ? "旧催款节点" : "新催款节点"}
  532. onChange={e => {
  533. this.setState({ newStatus: e });
  534. }}
  535. >
  536. <Select.Option key={0}>{"旧催款节点"}</Select.Option>
  537. <Select.Option key={1}>{"新催款节点"}</Select.Option>
  538. </Select>
  539. <span style={{ marginRight: "10px" }}>下单时间 :</span>
  540. <RangePicker
  541. value={[
  542. this.state.releaseDate[0]
  543. ? moment(this.state.releaseDate[0])
  544. : null,
  545. this.state.releaseDate[1]
  546. ? moment(this.state.releaseDate[1])
  547. : null
  548. ]}
  549. onChange={(data, dataString) => {
  550. this.setState({ releaseDate: dataString });
  551. }}
  552. />
  553. <Button
  554. type="primary"
  555. onClick={this.search}
  556. style={{ marginLeft: "10px",marginRight: 10}}
  557. >
  558. 搜索
  559. </Button>
  560. <Button onClick={this.reset}>重置</Button>
  561. </TabPane>
  562. <TabPane tab="更改表格显示数据" key="3">
  563. <div style={{ marginLeft: 10 }}>
  564. <ChooseList
  565. columns={this.state.columns}
  566. changeFn={this.changeList}
  567. changeList={this.state.changeList}
  568. top={55}
  569. margin={11}
  570. />
  571. </div>
  572. </TabPane>
  573. </Tabs>
  574. </div>
  575. <div className="patent-table">
  576. <Spin spinning={this.state.loading}>
  577. <Table
  578. columns={
  579. this.state.changeList
  580. ? this.state.changeList
  581. : this.state.columns
  582. }
  583. dataSource={this.state.dataSource}
  584. pagination={this.state.pagination}
  585. scroll={{ x: "max-content", y: 0 }}
  586. onRowClick={this.tableRowClick}
  587. bordered
  588. size="small"
  589. />
  590. </Spin>
  591. <Modal
  592. maskClosable={false}
  593. className="customeDetails"
  594. footer=""
  595. title="新增催款记录"
  596. width="500px"
  597. visible={this.state.visible}
  598. onOk={this.visitOk}
  599. onCancel={this.visitCancel}
  600. >
  601. <Form
  602. layout="horizontal"
  603. onSubmit={this.handleSubmit}
  604. id="demand-form"
  605. style={{ paddingBottom: "40px" }}
  606. >
  607. <Spin spinning={this.state.loading}>
  608. <div className="clearfix">
  609. <div className="clearfix">
  610. <FormItem
  611. className="half-item"
  612. {...formItemLayout}
  613. label="催款时间"
  614. >
  615. <DatePicker
  616. style={{
  617. marginTop: "2px",
  618. width: "240px",
  619. height: "32px"
  620. }}
  621. showTime
  622. format="YYYY-MM-DD"
  623. onOk={() => {}}
  624. value={
  625. this.state.dumTime ? moment(this.state.dumTime) : null
  626. }
  627. onChange={(data, dataString) => {
  628. this.setState({ dumTime: dataString });
  629. }}
  630. />
  631. </FormItem>
  632. </div>
  633. <div className="clearfix">
  634. <FormItem
  635. labelCol={{ span: 4 }}
  636. wrapperCol={{ span: 16 }}
  637. label="催款情况"
  638. >
  639. <Input
  640. type="textarea"
  641. placeholder="请输入催款情况"
  642. rows={4}
  643. value={this.state.remarks}
  644. onChange={e => {
  645. this.setState({ remarks: e.target.value });
  646. }}
  647. />
  648. </FormItem>
  649. </div>
  650. <div className="clearfix">
  651. <Button
  652. className="cancel"
  653. type="primary"
  654. onClick={this.examOk}
  655. style={{ marginLeft: "50px" }}
  656. htmlType="submit"
  657. >
  658. 添加
  659. </Button>
  660. <Button
  661. className="cancel"
  662. type="ghost"
  663. onClick={this.visitCancel}
  664. style={{ marginLeft: "50px" }}
  665. >
  666. 取消
  667. </Button>
  668. </div>
  669. </div>
  670. </Spin>
  671. </Form>
  672. </Modal>
  673. <Modal
  674. maskClosable={false}
  675. className="customeDetails"
  676. footer=""
  677. title="催款记录查看"
  678. width="500px"
  679. visible={this.state.visibles}
  680. onOk={this.visitOks}
  681. onCancel={this.visitCancels}
  682. >
  683. <div className="user-content">
  684. <div className="patent-table">
  685. <Spin spinning={this.state.loading}>
  686. <Table
  687. columns={this.state.columnsX}
  688. dataSource={this.state.dataSources}
  689. rowSelection={rowSelection}
  690. pagination={this.state.paginations}
  691. // onRowClick={this.tableRowClick}
  692. />
  693. </Spin>
  694. </div>
  695. </div>
  696. </Modal>
  697. </div>
  698. </div>
  699. );
  700. }
  701. }));
  702. export default IntentionCustomer;