pressList.jsx 20 KB

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