pressList.jsx 24 KB

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