invoiceApplyList.jsx 20 KB

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