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