invoiceApplyList.jsx 20 KB

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