<template>
    <div
        id="InvoiceDKGX"
        v-loading="loading"
        element-loading-text="拼命加载中......请稍等"
    >
        <div v-if="err">
            <el-card style="height: 300px">
                <div style="margin: 100px auto; text-align: center">
                    <p style="color: red; font-size: 1.2rem">
                        出现异常：{{ errMsg }}
                    </p>
                    <el-button
                        type="primary"
                        icon="el-icon-search"
                        round
                        style="margin-left: 50px"
                        @click="handleRefresh"
                    >
                        刷 新
                    </el-button>
                </div>
            </el-card>
        </div>
        <div v-else>
            <div class="search-panel">
                <div>
                    <span class="title"> 税款所属期： </span>
                    <span class="title font-color-red">
                        {{ periodYear }}年{{ periodMonth }}月
                    </span>
                    （当前可进行勾选操作的截止日期为：{{
                        fmtOperationDateEnd
                    }}）
                    <el-button
                        type="primary"
                        icon="el-icon-search"
                        round
                        style="margin-left: 50px"
                        @click="handleSearch"
                    >
                        查 询
                    </el-button>
                </div>
                <br />
                <el-form :inline="true">
                    <div>
                        <el-form-item label="发票代码：">
                            <el-input v-model="search.invoiceCode"></el-input>
                        </el-form-item>
                        <el-form-item label="发票号码：">
                            <el-input v-model="search.invoiceNumber"></el-input>
                        </el-form-item>
                        <el-form-item label="开票日期：">
                            <el-date-picker
                                v-model="search.beginDate"
                                type="date"
                                placeholder="起始日期"
                            >
                            </el-date-picker>
                            <span> - </span>
                            <el-date-picker
                                v-model="search.endDate"
                                type="date"
                                placeholder="结束日期"
                            >
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item label="销方税号：">
                            <el-input v-model="search.xfEntTaxId"></el-input>
                        </el-form-item>
                    </div>
                    <div>
                        <el-form-item label="勾选状态：">
                            <el-radio-group v-model="search.invoiceTickStatus">
                                <el-radio
                                    v-for="item in invoiceTickStatusOptions"
                                    :key="item.value"
                                    :label="item.value"
                                >
                                    {{ item.label }}
                                </el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </div>
                    <div>
                        <el-form-item label="发票类型：">
                            <el-radio-group
                                v-model="search.inputInvoiceCategory"
                            >
                                <el-radio
                                    v-for="item in inputInvoiceCategoryOptions"
                                    :key="item.value"
                                    :label="item.value"
                                >
                                    {{ item.label }}
                                </el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </div>
                    <div>
                        <el-form-item label="管理状态：">
                            <el-radio-group
                                v-model="search.invoiceManagementStatus"
                            >
                                <el-radio
                                    v-for="item in invoiceManagementStatusOptions"
                                    :key="item.value"
                                    :label="item.value"
                                >
                                    {{ item.label }}
                                </el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </div>
                    <div>
                        <el-form-item label="发票状态：">
                            <el-radio-group v-model="search.invoiceStatus">
                                <el-radio
                                    v-for="item in invoiceStatusOptions"
                                    :key="item.value"
                                    :label="item.value"
                                >
                                    {{ item.label }}
                                </el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </div>
                    <div>
                        <el-form-item label="撤销状态：">
                            <el-radio-group v-model="search.cancelStatus">
                                <el-radio
                                    v-for="item in cancelStatusOptions"
                                    :key="item.value"
                                    :label="item.value"
                                >
                                    {{ item.label }}
                                </el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </div>
                </el-form>
            </div>
            <br />
            <el-card>
                <div>
                    <span class="title">发票勾选</span>
                    <span>
                        （当前可勾选发票的开票日期范围为：
                        {{ fmtDateFrameBegin }}-{{ fmtDateFrameEnd }}）
                    </span>
                </div>
                <br />
                <el-table
                    ref="searchResultTable"
                    :data="search.resultList"
                    @select="handleSearchResultCancelSelect"
                    @selection-change="handleSearchResultCheckChange"
                    @select-all="handleSearchResultSelectAll"
                    border
                    stripe
                    max-height="500"
                    style="width: 100%"
                >
                    <el-table-column
                        type="selection"
                        :selectable="checkSelectable"
                        align="center"
                        width="50"
                    >
                    </el-table-column>
                    <el-table-column
                        type="index"
                        :index="pageIndex"
                        align="center"
                        label="序号"
                        width="80"
                    ></el-table-column>
                    <el-table-column
                        prop="invoiceCode"
                        label="发票代码"
                        align="center"
                        width="100"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="invoiceNumber"
                        label="发票号码"
                        align="center"
                        width="100"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="invoiceDate"
                        label="开票日期"
                        align="center"
                        width="100"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="checkStatusMemo"
                        label="勾选状态"
                        align="center"
                        width="200"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="commitCheckTime"
                        label="勾选时间"
                        align="center"
                        width="140"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="sellerName"
                        label="销方名称"
                        align="center"
                        width="260"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="totalAmount"
                        label="金额（元）"
                        align="right"
                        width="100"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="totalTaxes"
                        label="税额（元）"
                        align="right"
                        width="100"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="effectiveTaxes"
                        label="有效税额（元）"
                        align="right"
                        width="155"
                    >
                        <template slot-scope="scope">
                            <el-input-number
                                v-model="scope.row.effectiveTaxes"
                                :controls="false"
                                :precision="2"
                                :disabled="disabledEffectiveTaxes(scope.row)"
                            ></el-input-number>
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="statusMemo"
                        label="发票状态"
                        align="center"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="categoryMemo"
                        label="发票类型"
                        align="center"
                        width="155"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="manageStateMemo"
                        label="管理状态"
                        align="center"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="cancelStatusMemo"
                        label="撤销状态"
                        align="center"
                        width="140"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                    <el-table-column
                        prop="commitCancelTime"
                        label="撤销时间"
                        align="center"
                        width="140"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                </el-table>
                <br />
                <el-row type="flex" :gutter="20">
                    <el-col :span="12"></el-col>
                    <el-col :span="12">
                        <div style="text-align: right">
                            <el-pagination
                                layout="total, sizes, prev, pager, next"
                                :current-page="
                                    search.resultPagination.currentPage
                                "
                                :page-sizes="search.resultPagination.pageSizes"
                                :page-size="search.resultPagination.pageSize"
                                :total="search.resultPagination.total"
                                @size-change="handleSearchResultSizeChange"
                                @current-change="
                                    handleSearchResultCurrentChange
                                "
                            ></el-pagination>
                        </div>
                    </el-col>
                </el-row>
                <div style="text-align: center">
                    <el-button
                        type="primary"
                        icon="el-icon-check"
                        round
                        @click="handleSubmitTickInvoice"
                    >
                        提 交
                    </el-button>
                </div>
            </el-card>
            <el-dialog title="勾选认证信息" :visible.sync="isShow" width="30%">
                <div>
                    <span
                        >本次勾选：<span style="color: red">{{
                            this.checkNumber
                        }}</span
                        >份，金额合计<span style="color: red">{{
                            this.checkAmount
                        }}</span
                        >元，税额合计：<span style="color: red">{{
                            this.checkTax
                        }}</span
                        >元，有效税额合计：<span style="color: red">{{
                            this.checkEffectiveTax
                        }}</span
                        >元</span
                    >
                    <br />
                    <br />
                    <br />
                    <span style="color: #0b0e16; font-weight: bold"
                        >请确认是否提交？</span
                    >
                </div>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="isShow = false">取 消</el-button>
                    <el-button type="primary" @click="checkConfirm()"
                        >确 定</el-button
                    >
                </span>
            </el-dialog>
            <el-dialog
                title="抵扣提交结果"
                :visible.sync="submitDialog.visible"
                width="60%"
                center
            >
                <div>
                    <el-table
                        :data="submitDialog.tableList"
                        max-height="350"
                        border
                        style="width: 100%"
                    >
                        <el-table-column
                            prop="invoiceCode"
                            label="发票代码"
                            width="180"
                            align="center"
                        >
                        </el-table-column>
                        <el-table-column
                            prop="invoiceNumber"
                            label="发票号码"
                            width="180"
                            align="center"
                        >
                        </el-table-column>
                        <el-table-column
                            prop="statusMemo"
                            label="结果信息"
                            align="center"
                            show-overflow-tooltip
                        >
                        </el-table-column>
                    </el-table>
                </div>
                <span slot="footer" class="dialog-footer">
                    <el-button
                        type="primary"
                        @click="submitDialog.visible = false"
                        >确 定</el-button
                    >
                </span>
            </el-dialog>
        </div>
    </div>
</template>

<script>
import DateHelper from "@/utils/date";
import {
    getDeductionSyncInputData,
    findDeductionUndeductedPage,
    invoiceDeductionApply,
    invoiceDeductionCancel,
} from "@/api/invoice-deduction";

// 进项发票种类类别
const inputInvoiceCategoryOptions = [
    {
        value: "",
        label: "全部",
    },
    {
        value: "01",
        label: "增值税专用发票",
    },
    {
        value: "02",
        label: "货运运输业增值税专用发票",
    },
    {
        value: "03",
        label: "机动车销售统一发票",
    },
    {
        value: "14",
        label: "增值税电子普通发票（通行费）",
    },
];

// 发票勾选状态列表
const invoiceTickStatusOptions = [
    {
        value: 0,
        label: "未勾选",
    },
    {
        value: 1,
        label: "已勾选",
    },
];

// 发票管理状态列表
const invoiceManagementStatusOptions = [
    {
        value: "",
        label: "全部",
    },
    {
        value: "0",
        label: "正常",
    },
    {
        value: "1",
        label: "非正常",
    },
];

// 发票状态列表
const invoiceStatusOptions = [
    {
        value: 0,
        label: "正常",
    },
    {
        value: 1,
        label: "已失控",
    },
    {
        value: 2,
        label: "已作废",
    },
    {
        value: 3,
        label: "已红冲",
    },
    {
        value: 4,
        label: "异常",
    },
];

// 申请撤销状态列表
const cancelStatusOptions = [
    {
        value: "",
        label: "全部",
    },
    {
        value: 1,
        label: "未申请撤销",
    },
    {
        value: 2,
        label: "申请撤销中",
    },
    // {
    //     value: 3,
    //     label: "申请撤销成功",
    // },
    {
        value: 4,
        label: "申请撤销失败",
    },
];

export default {
    name: "InvoiceDKGX",
    components: {},
    data() {
        return {
            loading: false,
            err: true, // 获取税期是否成功
            errMsg: "", // 错误原因
            periodYear: "-", // 当前税款所属期年份
            periodMonth: "-", // 当前税款所属期月份
            dateFrameEnd: "-", // 税控期操作截止时间，一般是1个月
            dateFrameBegin: "-", // 税控期操作起始时间，一般是1个月
            operationDateEnd: "-", // 勾选的发票的截止时间
            inputInvoiceCategoryOptions: inputInvoiceCategoryOptions,
            invoiceTickStatusOptions: invoiceTickStatusOptions,
            invoiceManagementStatusOptions: invoiceManagementStatusOptions,
            invoiceStatusOptions: invoiceStatusOptions,
            cancelStatusOptions: cancelStatusOptions,
            search: {
                invoiceCode: "", // 发票代码
                invoiceNumber: "", // 发票号码
                beginDate: DateHelper.LocalCurrentMonthStart(), // 开票日期 起始日期，默认当月份第一天
                endDate: DateHelper.LocalCurrentMonthEnd(), // 开票日期 结束日期，默认当前月份最后一天
                inputInvoiceCategory: "", // 进项发票种类,默认全部
                xfEntTaxId: "", // 销方企业税号
                invoiceTickStatus: 0, // 发票勾选状态，默认未勾选
                invoiceManagementStatus: "", // 发票管理状态，默认全部
                invoiceStatus: 0, // 发票状态，默认正常
                cancelStatus: "", // 请撤销状态,默认全部
                // 查询结果信息属于
                resultIs: {
                    invoiceTickStatus: "", // 默认无勾选状态
                },
                resultList: [],
                resultMultipleSelection: [],
                resultMultipleCancelSelection: [], // 取消选择数据列表
                resultPagination: {
                    currentPage: 1,
                    pageSizes: [10, 30, 50, 100],
                    pageSize: 10,
                    total: 0,
                },
            },
            isShow: false,
            checkNumber: 0.0,
            checkAmount: 0.0,
            checkTax: 0.0,
            checkEffectiveTax: 0.0,
            submitDialog: {
                visible: false,
                tableList: [],
            },
        };
    },
    computed: {
        fmtOperationDateEnd: function () {
            return DateHelper.Format(
                new Date(this.operationDateEnd),
                "yyyy年MM月dd日"
            );
        },
        fmtDateFrameEnd: function () {
            return DateHelper.Format(
                new Date(this.dateFrameEnd),
                "yyyy年MM月dd日"
            );
        },
        fmtDateFrameBegin: function () {
            return DateHelper.Format(
                new Date(this.dateFrameBegin),
                "yyyy年MM月dd日"
            );
        },
    },
    created() {
        this.callGetDeductionSyncInputData();
    },
    methods: {
        // 序号
        pageIndex(index) {
            let currentPage = this.search.resultPagination.currentPage; //当前页码，具体看组件取值
            let pageSize = this.search.resultPagination.pageSize; //每页条数，具体是组件取值
            return index + 1 + (currentPage - 1) * pageSize;
        },
        // 表格数据不可用户选中，
        // true可选中，否则不可选中
        checkSelectable(row) {
            // 1.勾选状态：2-勾选中
            if (row.checkStatus === 2) return false;

            // 2.撤销状态：2-撤销中
            // if (row.cancelStatus === 2) return false;

            // 3.发票状态：非 0-正常
            if (row.status !== "0") return false;

            // 4.管理状态：非正常
            // 暂无

            // 5.负数发票禁止选中
            if (row.totalAmount < 0) return false;

            return true;
        },
        // 是否禁止编辑有效税额
        // true禁止编辑，否则可以编辑
        disabledEffectiveTaxes(row) {
            // 1.已勾选，禁止编辑
            if (row.checkStatus == 3) return true;

            // 2.不可选中，则不可编辑
            return !this.checkSelectable(row);
        },
        // 税期获取失败，刷新
        handleRefresh() {
            this.callGetDeductionSyncInputData();
        },
        // 获取税期
        callGetDeductionSyncInputData() {
            let _this = this;
            _this.loading = true;
            getDeductionSyncInputData()
                .then((val) => {
                    _this.periodYear = val.data.periodYear;
                    _this.periodMonth = val.data.periodMonth;
                    _this.dateFrameEnd = val.data.dateFrameEnd;
                    _this.dateFrameBegin = val.data.dateFrameBegin;
                    _this.selectMonth = val.data.periodMonth;
                    _this.operationDateEnd = val.data.operationDateEnd;

                    _this.search.beginDate = new Date(val.data.dateFrameBegin);
                    _this.search.endDate = new Date(val.data.dateFrameEnd);

                    _this.err = false;
                    _this.errMsg = "";
                    _this.loading = false;
                })
                .catch((err) => {
                    _this.err = true;
                    _this.errMsg = err;
                    _this.loading = false;
                });
        },
        // 查询
        handleSearch() {
            this.callFindDeductionUndeductedPage(
                1,
                this.search.resultPagination.pageSize
            );
        },
        // 取消勾选数据
        handleSearchResultCancelSelect(rows, row) {
            // 取差集
            this.search.resultMultipleCancelSelection = this.search.resultList.filter(
                function (v) {
                    return rows.indexOf(v) == -1;
                }
            );
            if (this.search.resultMultipleCancelSelection.length === 0) {
                this.search.resultMultipleCancelSelection = this.search.resultList;
            }
            console.log("取消数据：");
            console.log(this.search.resultMultipleCancelSelection);
        },
        // 勾选表格数据
        handleSearchResultCheckChange(val) {
            this.search.resultMultipleSelection = val;

            console.log("选中数据：");
            console.log(this.search.resultMultipleSelection);
        },
        // 全选改变时
        handleSearchResultSelectAll(rows) {
            this.search.resultMultipleSelection = rows;
            if (rows.length === 0) {
                this.search.resultMultipleCancelSelection = this.search.resultList;
            } else {
                this.search.resultMultipleCancelSelection = [];
            }
            console.log("全选取消数据：");
            console.log(this.search.resultMultipleCancelSelection);
            console.log("全选选中数据：");
            console.log(this.search.resultMultipleSelection);
        },
        // 表格每页大小改变时触发
        handleSearchResultSizeChange(val) {
            this.callFindDeductionUndeductedPage(1, val);
        },
        // 翻页时触发
        handleSearchResultCurrentChange(val) {
            this.callFindDeductionUndeductedPage(
                val,
                this.search.resultPagination.pageSize
            );
        },
        callFindDeductionUndeductedPage(pageNum, pageSize) {
            let beginTime = this.search.beginDate;
            let endTime = this.search.endDate;
            if (beginTime) {
                beginTime = DateHelper.Format(
                    new Date(beginTime),
                    "yyyy-MM-dd HH:mm:ss"
                );
            }

            if (endTime) {
                let endTimeObj = new Date(endTime);
                endTime = DateHelper.Format(
                    new Date(
                        endTimeObj.getFullYear(),
                        endTimeObj.getMonth(),
                        endTimeObj.getDate(),
                        "23",
                        "59",
                        "59"
                    ),
                    "yyyy-MM-dd HH:mm:ss"
                );
            }
            if (beginTime && endTime) {
                if (DateHelper.ValidateDateRange(beginTime, endTime) == false) {
                    this.$message.error(
                        "起始日期与结束日期不合法，请确定后重试！"
                    );
                    return false;
                }
            }

            let _this = this;
            _this.loading = true;
            let args = {
                deductible: _this.search.invoiceTickStatus,
                invoiceDateBegin: beginTime,
                invoiceDateEnd: endTime,
                invoiceNumber: _this.search.invoiceNumber,
                invoiceCode: _this.search.invoiceCode,
                inputInvoiceCategory: _this.search.inputInvoiceCategory,
                status: _this.search.invoiceStatus,
                sellerName: _this.search.xfEntTaxId,
                cancelStatus: _this.search.cancelStatus,
                manageState: _this.search.invoiceManagementStatus,
                pageNum: pageNum,
                pageSize: pageSize,
            };
            // 1-已勾选 设置查询认证类型 1-抵扣
            if (_this.search.invoiceTickStatus === 1) {
                args.certificationType = "1";
            }
            findDeductionUndeductedPage(args)
                .then((val) => {
                    _this.search.resultPagination.total = val.data.total;
                    _this.search.resultPagination.pageSize = val.data.size;
                    _this.search.resultPagination.currentPage =
                        val.data.current;
                    _this.search.resultList = val.data.records;

                    for (const item of _this.search.resultList) {
                        if (
                            item.effectiveTaxes == null ||
                            item.effectiveTaxes == ""
                        ) {
                            item.effectiveTaxes = item.totalTaxes;
                        }
                    }

                    // 取消所有勾选
                    _this.$refs.searchResultTable.clearSelection();

                    // 1-已勾选，默认全部勾选
                    if (
                        _this.search.invoiceTickStatus === 1 &&
                        _this.search.resultList
                    ) {
                        let tempTask = function () {
                            _this.search.resultList.forEach((row) => {
                                _this.$refs.searchResultTable.toggleRowSelection(
                                    row,
                                    true
                                );
                            });
                        };
                        _this.$nextTick(tempTask);
                    }

                    _this.search.resultIs.invoiceTickStatus =
                        _this.search.invoiceTickStatus;
                    _this.loading = false;
                })
                .catch((err) => {
                    _this.$message.error(err);
                    _this.loading = false;
                });
        },
        // 发票勾选确认
        checkConfirm() {
            this.isShow = false;
            this.submitApplyTickInvoice();
        },
        // 提交勾选发票
        handleSubmitTickInvoice() {
            let invoiceTickStatus = this.search.invoiceTickStatus;
            if (invoiceTickStatus === 0) {
                if (this.search.resultMultipleSelection.length > 0) {
                    this.checkNumber = this.search.resultMultipleSelection.length;
                    let amount = 0.0;
                    let tax = 0.0;
                    let effectiveTax = 0.0;
                    this.search.resultMultipleSelection.map((item) => {
                        amount += item.totalAmount;
                        tax += item.totalTaxes;
                        effectiveTax += item.effectiveTaxes;
                    });
                    this.checkAmount = amount;
                    this.checkTax = tax;
                    this.checkEffectiveTax = effectiveTax;
                    // 0-未勾选
                    this.isShow = true;
                } else {
                    this.$message.error("请选择需要勾选的发票！");
                }
            } else if (invoiceTickStatus === 1) {
                // 1-已勾选
                this.submitCancelTickInvoice();
            } else {
                this.$message.error("发票数据勾选状态异常，不能提交！");
            }
        },
        // 勾选提交
        submitApplyTickInvoice() {
            let _this = this;
            const submitList = this.search.resultMultipleSelection;
            if (submitList && submitList.length > 0) {
                console.log("打印提交数据：");
                console.log(submitList);

                let period =
                    _this.periodYear +
                    _this.periodMonth.toString().padStart(2, "0");

                let tempList = new Array();
                for (let index = 0; index < submitList.length; index++) {
                    const element = submitList[index];
                    tempList[index] = {
                        invoiceCode: element.invoiceCode,
                        invoiceNumber: element.invoiceNumber,
                        buyerEntTaxId: element.buyerEntTaxId,
                        certificationWay: "0", // 认证方式 1扫描认证,0勾选认证
                        certificationType: "1", // 1-抵扣
                        effectiveTaxes: element.effectiveTaxes,
                    };
                }

                _this.loading = true;
                invoiceDeductionApply(period, 0, tempList)
                    .then((val) => {
                        _this.loading = false;
                        _this.search.resultMultipleSelection = [];
                        // _this.$message.success(val.msg);

                        // 提交结果信息处理
                        _this.submitDialog.visible = true;
                        _this.submitDialog.tableList = val.data;

                        _this.callFindDeductionUndeductedPage(
                            _this.search.resultPagination.currentPage,
                            _this.search.resultPagination.pageSize
                        );

                        // _this.$alert(
                        //     "增值税发票勾选中，请确认发票勾选成功后再进行抵扣勾选统计操作！",
                        //     "提示",
                        //     {
                        //         confirmButtonText: "确定",
                        //         callback: (action) => {
                        //             // 无
                        //         },
                        //     }
                        // );
                    })
                    .catch((err) => {
                        _this.loading = false;
                        _this.$message.error(err);
                    });
            } else {
                _this.$message.warning("请选择发票后重试！");
            }
        },
        // 取消勾选提交
        submitCancelTickInvoice() {
            let _this = this;
            const submitList = this.search.resultMultipleCancelSelection;
            if (submitList && submitList.length > 0) {
                console.log("打印取消勾选提交数据：");
                console.log(submitList);

                let period =
                    _this.periodYear +
                    _this.periodMonth.toString().padStart(2, "0");

                _this.loading = true;

                let tempList = new Array();
                for (let index = 0; index < submitList.length; index++) {
                    const element = submitList[index];
                    tempList[index] = {
                        invoiceCode: element.invoiceCode,
                        invoiceNumber: element.invoiceNumber,
                        buyerEntTaxId: element.buyerEntTaxId,
                        certificationType: "5", // 5-撤销抵扣
                        certificationWay: "0", // 认证方式 1扫描认证,0勾选认证
                        effectiveTaxes: element.effectiveTaxes,
                    };
                }

                invoiceDeductionCancel(period, 0, tempList)
                    .then((val) => {
                        _this.loading = false;
                        _this.search.resultMultipleCancelSelection = [];
                        _this.$message.success(val.msg);

                        // 提交结果信息处理
                        // _this.submitDialog.visible = true;
                        // _this.submitDialog.tableList = val.data;
                        
                        _this.callFindDeductionUndeductedPage(
                            _this.search.resultPagination.currentPage,
                            _this.search.resultPagination.pageSize
                        );
                    })
                    .catch((err) => {
                        _this.loading = false;
                        _this.$message.error(err);
                    });
            } else {
                _this.$message.warning("请选择发票后重试！");
            }
        },
    },
};
</script>

<style scoped>
.search-panel {
    background: #f7f9fa;
    padding-left: 20px;
    padding-top: 20px;
}

.title {
    font-weight: bold;
    font-size: 1.2em;
}

.font-color-red {
    color: red;
}
</style>
