invoiceApplyList.jsx 20 KB

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