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