invoiceApplyList.jsx 19 KB

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