invoiceApplyList.jsx 20 KB

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