invoiceApplyList.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import "./public.less";
  4. import {
  5. Form,
  6. Button,
  7. Input,
  8. Select,
  9. Spin,
  10. Table,
  11. message,
  12. Modal,
  13. Popconfirm,
  14. Tabs,
  15. Tooltip,
  16. } from "antd";
  17. import {
  18. getProvinceA,
  19. getInvoiceStatus,
  20. getprovince,
  21. getStatus,
  22. getPeople,
  23. splitUrl,
  24. ShowModal,
  25. getProcessStatus,
  26. } from "@/tools";
  27. import { ChooseList } from "../../../../component/manageCenter/order/orderNew/chooseList";
  28. import ShowModalDiv from "@/showModal.jsx";
  29. import OrderDesc from "../orderDetail/orderDesc";
  30. import KaiPiaoModal from "./kaiPiaoModal";
  31. import { getProjectName } from "../../../tools";
  32. import DepartmentList from "../../../common/departmentList";
  33. import LogPopup from "../../../common/logPopup";
  34. import Cascaders from "../../../common/cascaders";
  35. const FormItem = Form.Item;
  36. const { TabPane } = Tabs;
  37. const invoiceApplyList = React.createClass({
  38. loadData(pageNo) {
  39. this.state.data = [];
  40. this.setState({
  41. listLoading: true,
  42. });
  43. $.ajax({
  44. method: "get",
  45. dataType: "json",
  46. crossDomain: false,
  47. url:
  48. globalConfig.context +
  49. "/api/admin/orderInvoice/financeOrderInvoiceList",
  50. data: {
  51. pageNo: pageNo || 1,
  52. pageSize: this.state.pagination.pageSize,
  53. name: this.state.nameSearch, //客户名称
  54. orderNo: this.state.orderNoSearch,
  55. deps: this.state.departmenttList,
  56. status: this.state.statusSearch,
  57. type: 0,
  58. approval: this.state.processStatus,
  59. },
  60. success: function (data) {
  61. ShowModal(this);
  62. let theArr = [];
  63. if (!data.data || !data.data.list) {
  64. if (data.error && data.error.length) {
  65. message.warning(data.error[0].message);
  66. }
  67. } else {
  68. for (let i = 0; i < data.data.list.length; i++) {
  69. let thisdata = data.data.list[i];
  70. theArr.push({
  71. key: i,
  72. id: thisdata.id,
  73. status: thisdata.status,
  74. unitName: thisdata.unitName,
  75. orderNo: thisdata.orderno,
  76. name: thisdata.name,
  77. processStatus: thisdata.processStatus,
  78. projectStatus: thisdata.projectStatus,
  79. amount: thisdata.amount,
  80. sumAmount: thisdata.sumAmount,
  81. createTime: thisdata.createTime
  82. ? new Date(thisdata.createTime).toLocaleString()
  83. : "",
  84. settlementAmount: thisdata.settlementAmount,
  85. notAmount: thisdata.notAmount,
  86. });
  87. }
  88. this.state.pagination.current = data.data.pageNo;
  89. this.state.pagination.total = data.data.totalCount;
  90. if (data.data && data.data.list && !data.data.list.length) {
  91. this.state.pagination.current = 0;
  92. this.state.pagination.total = 0;
  93. }
  94. this.setState({
  95. totalPage: data.data.totalPage,
  96. dataSource: theArr,
  97. pagination: this.state.pagination,
  98. });
  99. }
  100. }.bind(this),
  101. }).always(
  102. function () {
  103. this.setState({
  104. listLoading: false,
  105. });
  106. }.bind(this)
  107. );
  108. },
  109. invoiceData() {
  110. this.setState({
  111. loading: true,
  112. });
  113. $.ajax({
  114. method: "get",
  115. dataType: "json",
  116. crossDomain: false,
  117. url:
  118. globalConfig.context + "/api/admin/orderInvoice/selectByIdOrderInvoice",
  119. data: {
  120. id: this.state.id,
  121. },
  122. success: function (data) {
  123. let thisdata = data.data;
  124. let obj = {
  125. contractNo: thisdata.contractNo,
  126. orderNo: thisdata.orderNo,
  127. approval: thisdata.approval,
  128. type: thisdata.type,
  129. status: thisdata.status,
  130. remarks: thisdata.remarks,
  131. invoiceType: thisdata.invoiceType,
  132. unitName: thisdata.unitName,
  133. taxNumber: thisdata.taxNumber,
  134. amount: thisdata.amount,
  135. banks: thisdata.banks,
  136. content: thisdata.content,
  137. unitAddress: thisdata.unitAddress,
  138. invoiceRemarks: thisdata.invoiceRemarks,
  139. unitMobile: thisdata.unitMobile,
  140. post: thisdata.post,
  141. addressee: thisdata.addressee,
  142. addresseeMobile: thisdata.addresseeMobile,
  143. addresseeProvince: thisdata.addresseeProvince,
  144. addresseeCity: thisdata.addresseeCity,
  145. addresseeArea: thisdata.addresseeArea,
  146. alreadyAmount: thisdata.alreadyAmount,
  147. recipientAddress: thisdata.recipientAddress,
  148. orgCodeUrl: thisdata.voucherUrl
  149. ? splitUrl(
  150. thisdata.voucherUrl,
  151. ",",
  152. globalConfig.avatarHost + "/upload"
  153. )
  154. : [],
  155. };
  156. this.setState({
  157. modalData: obj,
  158. });
  159. }.bind(this),
  160. }).done(
  161. function () {
  162. this.setState({
  163. loading: false,
  164. });
  165. }.bind(this)
  166. );
  167. },
  168. getInitialState() {
  169. return {
  170. Loading: false,
  171. searchMore: true,
  172. assignVisible: false,
  173. releaseDate: [],
  174. totalPage: 0,
  175. boHuivisible: false,
  176. selectedRowKeys: [],
  177. // 子组件改变的表格title数组
  178. changeList: undefined,
  179. selectedRows: [],
  180. loading: false,
  181. reason: "",
  182. foo: 0,
  183. pagination: {
  184. defaultCurrent: 1,
  185. defaultPageSize: 10,
  186. showQuickJumper: true,
  187. pageSize: 10,
  188. onChange: function (page) {
  189. this.loadData(page);
  190. }.bind(this),
  191. showTotal: function (total) {
  192. return "共" + total + "条数据";
  193. },
  194. },
  195. columns: [
  196. {
  197. title: "编号",
  198. dataIndex: "id",
  199. key: "id",
  200. // fixed: "left"
  201. },
  202. {
  203. title: "客户",
  204. dataIndex: "unitName",
  205. key: "unitName",
  206. width: 100,
  207. render: (text) => {
  208. return (
  209. <Tooltip title={text}>
  210. <div
  211. style={{
  212. maxWidth: "100px",
  213. overflow: "hidden",
  214. textOverflow: "ellipsis",
  215. whiteSpace: "nowrap",
  216. }}
  217. >
  218. {text}
  219. </div>
  220. </Tooltip>
  221. );
  222. },
  223. },
  224. {
  225. title: "跟单人/签单人",
  226. dataIndex: "name",
  227. key: "name",
  228. },
  229. {
  230. title: "开票状态",
  231. dataIndex: "status",
  232. key: "status",
  233. render: (text, record) => {
  234. // return getStatus(text);
  235. return getInvoiceStatus(text, record);
  236. },
  237. },
  238. {
  239. title: "流程状态",
  240. dataIndex: "processStatus",
  241. key: "processStatus",
  242. render: (text) => {
  243. return getProcessStatus(text);
  244. },
  245. },
  246. {
  247. title: "项目状态",
  248. dataIndex: "projectStatus",
  249. key: "projectStatus",
  250. render: (text) => {
  251. return getProjectName(text);
  252. },
  253. },
  254. {
  255. title: "申请开票(万)",
  256. dataIndex: "amount",
  257. key: "amount",
  258. },
  259. {
  260. title: "已开票(万)",
  261. dataIndex: "sumAmount",
  262. key: "sumAmount",
  263. },
  264. {
  265. title: "已收款",
  266. dataIndex: "settlementAmount",
  267. key: "settlementAmount",
  268. },
  269. {
  270. title: "未收款",
  271. dataIndex: "notAmount",
  272. key: "notAmount",
  273. },
  274. {
  275. title: "申请时间",
  276. dataIndex: "createTime",
  277. key: "createTime",
  278. },
  279. {
  280. title: "操作",
  281. dataIndex: "caozuo",
  282. key: "caouzo",
  283. render: (text, record, index) => {
  284. return (
  285. <div>
  286. {
  287. <Button
  288. type="primary"
  289. onClick={(e) => {
  290. e.stopPropagation(), this.visit(index);
  291. }}
  292. style={{ background: "deepskyblue", border: "none" }}
  293. >
  294. 申请内容
  295. </Button>
  296. }
  297. {record.status !== 2 ? (
  298. <Popconfirm
  299. placement="top"
  300. title="确定要通过吗?"
  301. onConfirm={(e) => {
  302. e.stopPropagation();
  303. this.setState({ examine: 2 }, () => {
  304. this.sende(record);
  305. });
  306. }}
  307. okText="确定"
  308. cancelText="取消"
  309. >
  310. <Button
  311. type="primary"
  312. style={{ marginLeft: "10px" }}
  313. onClick={(e) => {
  314. e.stopPropagation();
  315. }}
  316. >
  317. 通过
  318. </Button>
  319. </Popconfirm>
  320. ) : (
  321. ""
  322. )}
  323. {record.status !== 2 ? (
  324. <Popconfirm
  325. placement="top"
  326. title="确定要拒绝吗?"
  327. onConfirm={(e) => {
  328. e.stopPropagation();
  329. this.setState({ examine: 3 }, () => {
  330. this.reject(record);
  331. });
  332. }}
  333. okText="确定"
  334. cancelText="取消"
  335. >
  336. <Button
  337. type="danger"
  338. onClick={(e) => {
  339. e.stopPropagation();
  340. }}
  341. style={{ marginLeft: "10px" }}
  342. >
  343. 拒绝
  344. </Button>
  345. </Popconfirm>
  346. ) : (
  347. ""
  348. )}
  349. {record.status === 2 ? (
  350. <Button
  351. style={{ marginLeft: "10px", color: "black" }}
  352. disabled={true}
  353. >
  354. 已通过
  355. </Button>
  356. ) : (
  357. ""
  358. )}
  359. {
  360. <Button
  361. type="primary"
  362. style={{
  363. marginLeft: "10px",
  364. background: "orangered",
  365. border: "none",
  366. }}
  367. onClick={(e) => {
  368. e.stopPropagation(), this.inRecord(record, index);
  369. }}
  370. >
  371. 开票记录
  372. </Button>
  373. }
  374. </div>
  375. );
  376. },
  377. },
  378. ],
  379. columnsDate: [
  380. {
  381. title: "编号",
  382. dataIndex: "id",
  383. key: "id",
  384. },
  385. {
  386. title: "订单编号",
  387. dataIndex: "orderno",
  388. key: "orderno",
  389. },
  390. {
  391. title: "开票金额(万元)",
  392. dataIndex: "amount",
  393. key: "amount",
  394. },
  395. {
  396. title: "申请时间",
  397. dataIndex: "createTime",
  398. key: "createTime",
  399. },
  400. {
  401. title: "开票状态",
  402. dataIndex: "status",
  403. key: "status",
  404. render: (text, record) => {
  405. return (
  406. <div>
  407. {getInvoiceStatus(text, record)} <LogPopup id={record.id} />
  408. </div>
  409. );
  410. },
  411. },
  412. ],
  413. dataSource: [],
  414. searchTime: [,],
  415. };
  416. },
  417. loadSend(record) {
  418. this.setState({
  419. loading: true,
  420. });
  421. if (this.state.examine === 3 && this.state.reason === "") {
  422. message.warning("拒绝理由不能为空!");
  423. return;
  424. }
  425. $.ajax({
  426. method: "post",
  427. dataType: "json",
  428. crossDomain: false,
  429. url: globalConfig.context + "/api/admin/orderInvoice/financeExamine",
  430. data: {
  431. id: this.state.examine === 2 ? record.id : this.state.id,
  432. examine: this.state.examine,
  433. reason: this.state.reason,
  434. },
  435. success: function () { }.bind(this),
  436. }).done(
  437. function () {
  438. this.setState({
  439. loading: false,
  440. });
  441. if (this.state.examine === 2) {
  442. message.success("通过成功!");
  443. this.loadData();
  444. } else {
  445. message.success("拒绝成功!");
  446. this.resetReason();
  447. this.rejectCancels();
  448. this.loadData();
  449. }
  450. }.bind(this)
  451. );
  452. },
  453. //重置拒绝理由
  454. resetReason() {
  455. this.setState({
  456. reason: "",
  457. });
  458. },
  459. sende(record) {
  460. this.loadSend(record);
  461. },
  462. commit() {
  463. this.loadSend();
  464. this.setState({
  465. avisible: false,
  466. });
  467. },
  468. visit(index) {
  469. this.setState(
  470. {
  471. id: this.state.dataSource[index].id,
  472. avisible: true,
  473. },
  474. () => {
  475. this.invoiceData();
  476. }
  477. );
  478. },
  479. visitCancels() {
  480. this.setState({
  481. avisible: false,
  482. });
  483. },
  484. reject(record) {
  485. this.setState({
  486. visibleR: true,
  487. id: record.id,
  488. });
  489. },
  490. rejectCancels() {
  491. this.setState({
  492. visibleR: false,
  493. });
  494. },
  495. inRecordData() {
  496. this.setState({
  497. loading: true,
  498. });
  499. $.ajax({
  500. method: "get",
  501. dataType: "json",
  502. crossDomain: false,
  503. url:
  504. globalConfig.context +
  505. "/api/admin/orderInvoice/salesmanOrderInvoiceList",
  506. data: {
  507. orderNo: this.state.orderNo2,
  508. },
  509. success: function (data) {
  510. let theArr = [];
  511. let sum = 0;
  512. if (!data.data) {
  513. if (data.error && data.error.length) {
  514. message.warning(data.error[0].message);
  515. }
  516. } else {
  517. for (let i = 0; i < data.data.list.length; i++) {
  518. let thisdata = data.data.list[i];
  519. sum += parseFloat(thisdata.amount);
  520. theArr.push({
  521. id: thisdata.id,
  522. orderno: thisdata.orderno, //订单编号
  523. amount: thisdata.amount, //签单金额
  524. createTime: thisdata.createTime, //流程状态
  525. status: thisdata.status, //结算状态
  526. rejectReason: thisdata.rejectReason,
  527. approval: thisdata.approval, //0非特批 1待审核 2审核通过
  528. });
  529. }
  530. }
  531. this.setState({
  532. recordData: theArr,
  533. sum: sum.toFixed(6),
  534. });
  535. }.bind(this),
  536. }).done(
  537. function () {
  538. this.setState({
  539. loading: false,
  540. });
  541. }.bind(this)
  542. );
  543. },
  544. inRecord(record) {
  545. this.setState(
  546. {
  547. bvisible: true,
  548. orderNo2: record.orderNo,
  549. },
  550. () => {
  551. this.inRecordData();
  552. }
  553. );
  554. },
  555. inRecordCanl() {
  556. this.setState({
  557. bvisible: false,
  558. });
  559. },
  560. search() {
  561. this.loadData();
  562. },
  563. componentWillMount() {
  564. this.loadData();
  565. },
  566. reset() {
  567. this.state.nameSearch = "";
  568. this.state.releaseDate = [];
  569. this.state.orderNoSearch = "";
  570. this.state.processStatus = [];
  571. this.state.departmenttList = undefined;
  572. this.state.statusSearch = [];
  573. this.Cascaders.empty();
  574. this.loadData();
  575. },
  576. changeList(arr) {
  577. const newArr = [];
  578. this.state.columns.forEach((item) => {
  579. arr.forEach((val) => {
  580. if (val === item.title) {
  581. newArr.push(item);
  582. }
  583. });
  584. });
  585. this.setState({
  586. changeList: newArr,
  587. });
  588. },
  589. tableRowClick(record) {
  590. this.state.RowData = record;
  591. this.setState({
  592. showDesc: true,
  593. });
  594. },
  595. closeDesc(e, s) {
  596. this.state.showDesc = e;
  597. if (s) {
  598. this.loadData(this.state.page);
  599. }
  600. },
  601. render() {
  602. const formItemLayout = {
  603. labelCol: { span: 8 },
  604. wrapperCol: { span: 14 },
  605. };
  606. return (
  607. <div className="user-content">
  608. <ShowModalDiv ShowModal={this.state.showModal} />
  609. <div className="content-title" style={{ marginBottom: 10 }}>
  610. <span style={{ fontWeight: 900, fontSize: 16 }}>省内开票审核</span>
  611. </div>
  612. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  613. <TabPane tab="搜索" key="1">
  614. <div className="user-search">
  615. <Input
  616. placeholder="营销员名称"
  617. value={this.state.nameSearch}
  618. style={{ marginLeft: 10 }}
  619. onChange={(e) => {
  620. this.setState({ nameSearch: e.target.value });
  621. }}
  622. />
  623. <Input
  624. placeholder="订单编号"
  625. value={this.state.orderNoSearch}
  626. onChange={(e) => {
  627. this.setState({ orderNoSearch: e.target.value });
  628. }}
  629. />
  630. <Cascaders
  631. ref={node => this.Cascaders = node}
  632. placeholder="订单部门"
  633. id="id"
  634. name="name"
  635. children="list"
  636. height={28}
  637. onSel={(e) => {
  638. this.setState({
  639. departmenttList: JSON.stringify(e),
  640. });
  641. }}
  642. />
  643. {/* <DepartmentList
  644. value={this.state.departmenttList}
  645. onChange={(e) => {
  646. this.setState({ departmenttList: e });
  647. }}
  648. /> */}
  649. <Button
  650. type="primary"
  651. onClick={this.search}
  652. style={{ marginLeft: 10 }}
  653. >
  654. 搜索
  655. </Button>
  656. <Button onClick={this.reset}>重置</Button>
  657. </div>
  658. </TabPane>
  659. <TabPane tab="更改表格数据" key="2">
  660. <div style={{ marginTop: 10, marginLeft: 10 }}>
  661. <ChooseList
  662. columns={this.state.columns}
  663. changeFn={this.changeList}
  664. changeList={this.state.changeList}
  665. top={55}
  666. />
  667. </div>
  668. </TabPane>
  669. </Tabs>
  670. <div className="patent-table">
  671. <Spin spinning={this.state.listLoading}>
  672. <Table
  673. columns={
  674. this.state.changeList == undefined
  675. ? this.state.columns
  676. : this.state.changeList
  677. }
  678. scroll={{ x: 1500, y: 0 }}
  679. onRowClick={this.tableRowClick}
  680. dataSource={this.state.dataSource}
  681. pagination={this.state.pagination}
  682. bordered
  683. size="small"
  684. />
  685. </Spin>
  686. </div>
  687. <Modal
  688. visible={this.state.visibleR}
  689. className="admin-desc-content"
  690. footer=""
  691. title="拒绝理由"
  692. width="400px"
  693. onCancel={this.rejectCancels}
  694. >
  695. <Input.TextArea
  696. placeholder="请输入拒绝理由"
  697. rows={4}
  698. value={this.state.reason}
  699. onChange={(e) => {
  700. this.setState({ reason: e.target.value });
  701. }}
  702. ></Input.TextArea>
  703. <div className="clearfix" style={{ marginTop: "20px" }}>
  704. <Button
  705. type="primary"
  706. loading={this.state.loading}
  707. onClick={(e) => {
  708. e.stopPropagation(),
  709. this.commit();
  710. }}
  711. style={{ float: "right" }}
  712. >
  713. 提交
  714. </Button>
  715. </div>
  716. </Modal>
  717. <KaiPiaoModal
  718. visible={this.state.avisible}
  719. data={this.state.modalData}
  720. onCancel={this.visitCancels}
  721. loading={this.state.loading}
  722. />
  723. <Modal
  724. visible={this.state.bvisible}
  725. footer=""
  726. title="开票历史记录"
  727. className="admin-desc-content"
  728. width="1200px"
  729. onCancel={this.inRecordCanl}
  730. >
  731. <Spin spinning={this.state.loading}>
  732. <div className="patent-table">
  733. <Table
  734. columns={this.state.columnsDate}
  735. dataSource={this.state.recordData}
  736. pagination={false}
  737. bordered
  738. size="small"
  739. />
  740. <div className="clearfix" style={{ marginTop: "20px" }}>
  741. <FormItem
  742. className="half-item"
  743. {...formItemLayout}
  744. label={<span style={{ fontSize: "14px" }}>开票总计</span>}
  745. >
  746. <span>{this.state.sum + "(万元)"}</span>
  747. </FormItem>
  748. </div>
  749. </div>
  750. </Spin>
  751. </Modal>
  752. <OrderDesc
  753. data={this.state.RowData}
  754. showDesc={this.state.showDesc}
  755. closeDesc={this.closeDesc.bind(this)}
  756. />
  757. </div>
  758. );
  759. },
  760. });
  761. export default invoiceApplyList;