press.jsx 20 KB

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