press.jsx 20 KB

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