123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903 |
- import React from "react";
- import $ from "jquery/src/ajax";
- import "./public.less";
- import {
- Form,
- Button,
- Input,
- Select,
- Spin,
- Table,
- message,
- Modal,
- Popconfirm,
- Tabs,
- DatePicker,
- Tooltip,
- } from "antd";
- import {
- getProvinceA,
- getInvoiceStatus,
- getprovince,
- getStatus,
- getPeople,
- splitUrl,
- ShowModal,
- getProcessStatus,
- } 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 KaiPiaoModal from "./kaiPiaoModal";
- 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 invoiceApplyList = 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,
- 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,
- examineName: thisdata.examineName,
- 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,
- });
- }
- 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;
- let obj = {
- examineName: thisdata.examineName,
- 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"
- )
- : [],
- };
- this.setState({
- modalData: obj,
- });
- }.bind(this),
- }).done(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- },
- getInitialState() {
- return {
- Loading: false,
- 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 (
- <Tooltip title={text}>
- <div style={{
- }}>{text}</div>
- </Tooltip>
- )
- }
- },
- {
- title: "开票单位名称",
- dataIndex: "unitName",
- key: "unitName",
- render: text => {
- return (
- <Tooltip title={text}>
- <div style={{
- }}>{text}</div>
- </Tooltip>
- )
- }
- },
- {
- 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) => {
- return getProjectName(text);
- },
- },
- {
- 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 (
- <div>
- {
- <Button
- type="primary"
- onClick={(e) => {
- e.stopPropagation(), this.visit(index);
- }}
- style={{ background: "deepskyblue", border: "none" }}
- >
- 申请内容
- </Button>
- }
- {record.status !== 2 ? (
- <Popconfirm
- placement="top"
- title="确定要通过吗?"
- onConfirm={(e) => {
- e.stopPropagation();
- this.setState({ examine: 2 }, () => {
- this.sende(record);
- });
- }}
- okText="确定"
- cancelText="取消"
- >
- <Button
- type="primary"
- style={{ marginLeft: "10px" }}
- onClick={(e) => {
- e.stopPropagation();
- }}
- >
- 通过
- </Button>
- </Popconfirm>
- ) : (
- ""
- )}
- {record.status !== 2 ? (
- <Popconfirm
- placement="top"
- title="确定要拒绝吗?"
- onConfirm={(e) => {
- e.stopPropagation();
- this.setState({ examine: 3 }, () => {
- this.reject(record);
- });
- }}
- okText="确定"
- cancelText="取消"
- >
- <Button
- type="danger"
- onClick={(e) => {
- e.stopPropagation();
- }}
- style={{ marginLeft: "10px" }}
- >
- 拒绝
- </Button>
- </Popconfirm>
- ) : (
- ""
- )}
- {record.status === 2 ? (
- <Button
- style={{ marginLeft: "10px", color: "black" }}
- disabled={true}
- >
- 已通过
- </Button>
- ) : (
- ""
- )}
- {
- <Button
- type="primary"
- style={{
- marginLeft: "10px",
- background: "orangered",
- border: "none",
- }}
- onClick={(e) => {
- e.stopPropagation(), this.inRecord(record, index);
- }}
- >
- 开票记录
- </Button>
- }
- </div>
- );
- },
- },
- ],
- 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 (
- <div>
- {getInvoiceStatus(text, record)} <LogPopup id={record.id} />
- </div>
- );
- },
- },
- ],
- 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)
- );
- },
- //重置拒绝理由
- 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,
- });
- }
- }
- 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();
- },
- 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,
- 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;
- },
- reset() {
- 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 (
- <div className="user-content">
- <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
- <div className="content-title" style={{ marginBottom: 10 }}>
- <span style={{ fontWeight: 900, fontSize: 16 }}>省内开票审核</span>
- </div>
- <Tabs defaultActiveKey="1" className="test">
- <TabPane tab="搜索" key="1">
- <div className="user-search" style={{ marginLeft: 10 }}>
- <Input
- placeholder="订单编号"
- value={this.state.orderNoSearch}
- onChange={(e) => {
- this.setState({ orderNoSearch: e.target.value });
- }}
- />
- <Input
- placeholder="合同编号"
- value={this.state.contractNo}
- onChange={e => {
- this.setState({ contractNo: e.target.value });
- }}
- />
- <Input
- placeholder="客户名称"
- value={this.state.userName}
- onChange={e => {
- this.setState({ userName: e.target.value });
- }}
- />
- <Input
- placeholder="营销员名称"
- value={this.state.nameSearch}
- onChange={e => {
- this.setState({ nameSearch: e.target.value });
- }}
- />
- <Select placeholder="开票状态"
- style={{ width: 120, }}
- value={this.state.invoiceType}
- onChange={(e) => { this.setState({ invoiceType: e }) }}
- >
- <Select.Option value="1" >处理中</Select.Option>
- <Select.Option value="2" >通过</Select.Option>
- <Select.Option value="3" >驳回</Select.Option>
- </Select>
- <Cascaders
- ref={node => this.Cascaders = node}
- placeholder="订单部门"
- id="id"
- name="name"
- children="list"
- height={28}
- onSel={(e) => {
- this.setState({
- departmenttList: JSON.stringify(e),
- });
- }}
- />
- <span style={{ marginRight: "10px" }}>申请时间 :</span>
- <RangePicker
- value={[
- this.state.releaseDate[0]
- ? moment(this.state.releaseDate[0])
- : null,
- this.state.releaseDate[1]
- ? moment(this.state.releaseDate[1])
- : null,
- ]}
- onChange={(data, dataString) => {
- this.setState({ releaseDate: dataString });
- }}
- />
- {/* <DepartmentList
- value={this.state.departmenttList}
- onChange={(e) => {
- this.setState({ departmenttList: e });
- }}
- /> */}
- <Button
- type="primary"
- onClick={this.search}
- style={{ marginLeft: 10 }}
- >
- 搜索
- </Button>
- <Button onClick={this.reset}>重置</Button>
- </div>
- </TabPane>
- <TabPane tab="更改表格数据" key="2">
- <div style={{ marginTop: 10, marginLeft: 10 }}>
- <ChooseList
- columns={this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- />
- </div>
- </TabPane>
- {/* 管理员才能导出 */}
- <TabPane tab="导出" key="3" disabled={!newShiroList.includes("99")}>
- <div>
- <Button
- loading={this.state.exportPendingLoading}
- onClick={() => { this.exportExec() }}
- style={{ margin: 10 }}
- >
- 导出excel
- </Button>
- </div>
- </TabPane>
- </Tabs>
- <div className="patent-table">
- <Spin spinning={this.state.listLoading}>
- <Table
- columns={
- this.state.changeList == undefined
- ? this.state.columns
- : this.state.changeList
- }
- scroll={{ x: 1500, y: 0 }}
- onRowClick={this.tableRowClick}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- bordered
- size="small"
- />
- </Spin>
- </div>
- <Modal
- visible={this.state.visibleR}
- className="admin-desc-content"
- footer=""
- title="拒绝理由"
- width="400px"
- onCancel={this.rejectCancels}
- >
- <Input.TextArea
- placeholder="请输入拒绝理由"
- rows={4}
- value={this.state.reason}
- onChange={(e) => {
- this.setState({ reason: e.target.value });
- }}
- ></Input.TextArea>
- <div className="clearfix" style={{ marginTop: "20px" }}>
- <Button
- type="primary"
- loading={this.state.loading}
- onClick={(e) => {
- e.stopPropagation(),
- this.commit();
- }}
- style={{ float: "right" }}
- >
- 提交
- </Button>
- </div>
- </Modal>
- <KaiPiaoModal
- visible={this.state.avisible}
- data={this.state.modalData}
- onCancel={this.visitCancels}
- loading={this.state.loading}
- />
- <Modal
- visible={this.state.bvisible}
- footer=""
- title="开票历史记录"
- className="admin-desc-content"
- width="1200px"
- onCancel={this.inRecordCanl}
- >
- <Spin spinning={this.state.loading}>
- <div className="patent-table">
- <Table
- columns={this.state.columnsDate}
- dataSource={this.state.recordData}
- pagination={false}
- bordered
- size="small"
- />
- <div className="clearfix" style={{ marginTop: "20px" }}>
- <FormItem
- className="half-item"
- {...formItemLayout}
- label={<span style={{ fontSize: "14px" }}>开票总计</span>}
- >
- <span>{this.state.sum + "(万元)"}</span>
- </FormItem>
- </div>
- </div>
- </Spin>
- </Modal>
- <OrderDesc
- data={this.state.RowData}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc.bind(this)}
- />
- </div>
- );
- },
- });
- export default invoiceApplyList;
|