import React from "react"; import $ from "jquery/src/ajax"; import "./public.less"; import { Form, Button, Input, Select, Spin, Table, message, Modal, Upload, DatePicker, Tabs, Tooltip } from "antd"; import { getProvinceA, getInvoiceStatus, getProcessStatus, getprovince, getStatus, getPeople, splitUrl, ShowModal, getApproval } from "@/tools"; import moment from 'moment'; import { ChooseList } from "../../../../component/manageCenter/order/orderNew/chooseList"; import ShowModalDiv from "@/showModal.jsx"; import OrderDesc from "../orderDetail/orderDesc"; import { getProjectName } from "../../../tools"; import DepartmentList from '../../../common/departmentList'; import LogPopup from "../../../common/logPopup"; import Cascaders from "../../../common/cascaders"; const FormItem = Form.Item; const { TabPane } = Tabs const { RangePicker } = DatePicker; const invoiceApplyListQuery = React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ listLoading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderInvoice/financeOrderInvoiceList", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, name: this.state.nameSearch, // 营销员名称 orderNo: this.state.orderNoSearch, deps: this.state.departmenttList, status: this.state.statusSearch, type: 0, approval: this.state.processStatus, all: 1, contractNo: this.state.contractNo, // 合同编号 userName: this.state.userName, // 客户名称 invoiceType: this.state.invoiceType, // 开票状态 1处理中 2通过 3驳回 startTime: this.state.releaseDate[0], endTime: this.state.releaseDate[1], }, success: function (data) { ShowModal(this); let theArr = []; if (!data.data || !data.data.list) { if (data.error && data.error.length) { message.warning(data.error[0].message); } } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; theArr.push({ userName: thisdata.userName, contractNo: thisdata.contractNo, key: i, id: thisdata.id, status: thisdata.status, unitName: thisdata.unitName, orderNo: thisdata.orderNo, name: thisdata.name, processStatus: thisdata.processStatus, projectStatus: thisdata.projectStatus, amount: thisdata.amount, sumAmount: thisdata.sumAmount, createTime: thisdata.createTime ? new Date(thisdata.createTime).toLocaleString() : "", settlementAmount: thisdata.settlementAmount, notAmount: thisdata.notAmount, approval: thisdata.approval, examineName: !thisdata.examineName ? undefined : thisdata.examineName, }); } } this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; if (data.data && data.data.list && !data.data.list.length) { this.state.pagination.current = 0; this.state.pagination.total = 0; } this.setState({ totalPage: data.data.totalPage, dataSource: theArr, pagination: this.state.pagination }); }.bind(this) }).always( function () { this.setState({ listLoading: false }); }.bind(this) ); }, invoiceData() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderInvoice/selectByIdOrderInvoice", data: { id: this.state.id }, success: function (data) { let thisdata = data.data; this.setState({ contractNo: thisdata.contractNo, orderNo: thisdata.orderNo, approval: thisdata.approval, type: thisdata.type, status: thisdata.status, remarks: thisdata.remarks, invoiceType: thisdata.invoiceType, unitName: thisdata.unitName, taxNumber: thisdata.taxNumber, amount: thisdata.amount, banks: thisdata.banks, content: thisdata.content, unitAddress: thisdata.unitAddress, invoiceRemarks: thisdata.invoiceRemarks, unitMobile: thisdata.unitMobile, post: thisdata.post, addressee: thisdata.addressee, addresseeMobile: thisdata.addresseeMobile, addresseeProvince: thisdata.addresseeProvince, addresseeCity: thisdata.addresseeCity, addresseeArea: thisdata.addresseeArea, alreadyAmount: thisdata.alreadyAmount, recipientAddress: thisdata.recipientAddress, orgCodeUrl: thisdata.voucherUrl ? splitUrl( thisdata.voucherUrl, ",", globalConfig.avatarHost + "/upload" ) : [] }); }.bind(this) }).done( function () { this.setState({ loading: false }); }.bind(this) ); }, getInitialState() { return { searchMore: true, assignVisible: false, releaseDate: [], totalPage: 0, boHuivisible: false, selectedRowKeys: [], // 子组件改变的表格title数组 changeList: undefined, selectedRows: [], loading: false, reason: "", foo: 0, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return "共" + total + "条数据"; } }, columns: [ { title: "编号", dataIndex: "id", key: "id" // fixed: "left" }, { title: "客户名称", dataIndex: "userName", key: "userName", render: text => { return (
{text}
) } }, { title: "开票单位名称", dataIndex: "unitName", key: "unitName", render: text => { return (
{text}
) } }, { title: "合同编号", dataIndex: "contractNo", key: "contractNo" }, { title: "跟单人/签单人", dataIndex: "name", key: "name" }, { title: "开票状态", dataIndex: "status", key: "status", render: (text, record) => { // return getStatus(text); return getInvoiceStatus(text, record); } }, { title: "流程状态", dataIndex: "processStatus", key: "processStatus", render: (text, record) => { return getProcessStatus(text, record.examineName, record.approval); }, }, { title: "项目状态", dataIndex: "projectStatus", key: "projectStatus", render: (text, record) => { return getProcessStatus(text, record.examineName, record.approval); }, }, // { // title: "特批状态", // dataIndex: "approval", // key: "approval", // render: text => { // return getApproval(text); // } // }, { title: "审核状态", dataIndex: "status", key: "statusA", render: text => { return text === 1 ? "待审核" : "审核通过"; } }, { title: "申请开票(万)", dataIndex: "amount", key: "amount" }, { title: "已开票(万)", dataIndex: "sumAmount", key: "sumAmount" }, { title: "已收款", dataIndex: "settlementAmount", key: "settlementAmount" }, { title: "未收款", dataIndex: "notAmount", key: "notAmount" }, { title: "申请时间", dataIndex: "createTime", key: "createTime" }, { title: "操作", dataIndex: "caozuo", key: "caouzo", render: (text, record, index) => { return (
{ } {/* {record.status === 2 ? ( ) : ( "" )} */} { }
); } } ], columnsDate: [ { title: "编号", dataIndex: "id", key: "id" }, { title: "订单编号", dataIndex: "orderNo", key: "orderNo" }, { title: "开票金额(万元)", dataIndex: "amount", key: "amount" }, { title: "申请时间", dataIndex: "createTime", key: "createTime" }, { title: "开票状态", dataIndex: "status", key: "status", render: (text, record) => { return
{getInvoiceStatus(text, record)}
; }, } ], dataSource: [], searchTime: [,] }; }, loadSend(record) { this.setState({ loading: true }); if (this.state.examine === 3 && this.state.reason === "") { message.warning("拒绝理由不能为空!"); return; } $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderInvoice/financeExamine", data: { id: this.state.examine === 2 ? record.id : this.state.id, examine: this.state.examine, reason: this.state.reason }, success: function () { }.bind(this) }).done( function () { this.setState({ loading: false }); if (this.state.examine === 2) { message.success("通过成功!"); this.loadData(); } else { message.success("拒绝成功!"); this.resetReason(); this.rejectCancels(); this.loadData(); } }.bind(this) ); }, exportExec() { message.config({ duration: 20, }); let loading = message.loading("下载中..."); this.setState({ exportPendingLoading: true, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: "/api/admin/orderInvoice/financeOrderInvoiceList/export", data: { name: this.state.nameSearch, // 营销员名称 orderNo: this.state.orderNoSearch, deps: this.state.departmenttList, status: this.state.statusSearch, type: 0, approval: this.state.processStatus, all: 1, contractNo: this.state.contractNo, // 合同编号 userName: this.state.userName, // 客户名称 invoiceType: this.state.invoiceType, // 开票状态 1处理中 2通过 3驳回 startTime: this.state.releaseDate[0], endTime: this.state.releaseDate[1], }, success: function (data) { if (data.error.length === 0) { this.download(data.data); } else { message.warning(data.error[0].message); } }.bind(this), }).always( function () { loading(); this.setState({ exportPendingLoading: false, }); }.bind(this) ); }, download(fileName) { window.location.href = globalConfig.context + "/open/download?fileName=" + fileName; }, //重置拒绝理由 resetReason() { this.setState({ reason: "" }); }, sende(record) { this.loadSend(record); }, commit() { this.loadSend(); this.setState({ avisible: false }); }, visit(index) { this.setState( { id: this.state.dataSource[index].id, avisible: true }, () => { this.invoiceData(); } ); }, visitCancels() { this.setState({ avisible: false }); }, reject(record) { this.setState({ visibleR: true, id: record.id }); }, rejectCancels() { this.setState({ visibleR: false }); }, inRecordData() { this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderInvoice/salesmanOrderInvoiceList", data: { orderNo: this.state.orderNo2 }, success: function (data) { let theArr = []; let sum = 0; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } } else { for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; sum += parseFloat(thisdata.amount); theArr.push({ id: thisdata.id, orderNo: thisdata.orderNo, //订单编号 amount: thisdata.amount, //签单金额 createTime: thisdata.createTime, //流程状态 status: thisdata.status, //结算状态 rejectReason: thisdata.rejectReason, approval: thisdata.approval,//0非特批 1待审核 2审核通过 examineName: !thisdata.examineName ? undefined : thisdata.examineName, }); } } this.setState({ recordData: theArr, sum: sum.toFixed(6) }); }.bind(this) }).done( function () { this.setState({ loading: false }); }.bind(this) ); }, inRecord(record) { this.setState( { bvisible: true, orderNo2: record.orderNo }, () => { this.inRecordData(); } ); }, inRecordCanl() { this.setState({ bvisible: false }); }, search() { this.loadData(); }, componentWillMount() { this.loadData(); }, reset() { // this.state.releaseDate[0] = undefined; // this.state.releaseDate[1] = undefined; this.state.invoiceType = undefined; this.state.userName = undefined; this.state.contractNo = undefined; this.state.nameSearch = undefined; this.state.releaseDate = []; this.state.orderNoSearch = undefined; this.state.processStatus = []; this.state.departmenttList = undefined; this.state.statusSearch = []; this.Cascaders.empty(); this.loadData(); }, changeList(arr) { const newArr = []; this.state.columns.forEach(item => { arr.forEach(val => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr }); }, tableRowClick(record) { this.state.RowData = record; this.setState({ showDesc: true }); }, closeDesc(e, s) { this.state.showDesc = e; if (s) { this.loadData(this.state.page); } }, render() { const newShiroList = window.adminData.shiroList == "" ? [] : window.adminData.shiroList.split(","); const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 } }; return (
{ this.setState({ showModal: false }) }} />
省内开票查询
{ this.setState({ orderNoSearch: e.target.value }); }} /> { this.setState({ contractNo: e.target.value }); }} /> { this.setState({ userName: e.target.value }); }} /> { this.setState({ nameSearch: e.target.value }); }} /> this.Cascaders = node} placeholder="订单部门" id="id" name="name" children="list" height={28} onSel={(e) => { this.setState({ departmenttList: JSON.stringify(e), }); }} /> 申请时间 : { this.setState({ releaseDate: dataString }); }} />
{/* 管理员才能导出 */}
{ this.setState({ reason: e.target.value }); }} >
{this.state.contractNo} {this.state.remarks}
*省内/外 } > {getProvinceA(this.state.type)} *特批 } > {this.state.approval === 0 ? "否" : "是"}

发票内容
*发票类型 } > {this.state.invoiceType === 0 ? "增值税专用发票" : this.state.invoiceType === 1 ? "增值税普通发票" : "其他"}
*单位名称 } > {this.state.unitName} *税号 } > {this.state.taxNumber} * 开票金额(万元) } > {this.state.amount} * 开户行银行账号 } > {this.state.banks} * 开票内容及说明 } > {this.state.content} *单位地址 } > {this.state.unitAddress} {this.state.invoiceRemarks} *单位电话 } > {this.state.unitMobile}
*附件 } > { this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true }); }} > { this.setState({ previewVisible: false }); }} >

{this.state.post === 0 ? "是" : "否"}
{this.state.post === 0 ? (
{this.state.addressee} {this.state.addresseeMobile}
{getprovince(this.state.addresseeProvince)}/ {getprovince(this.state.addresseeCity)}/ {getprovince(this.state.addresseeArea)}
{this.state.recipientAddress}
) : ( "" )} {/* *开票金额总计 } > {this.state.alreadyAmount}万元 */}
开票总计} > {this.state.sum + "(万元)"}
); } }); export default invoiceApplyListQuery;