pressList.jsx 23 KB

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