invoiceApplyList.jsx 19 KB

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