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