press.jsx 21 KB

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