<template>
  <div class="app-container">
    <div v-if="showPage == 1">
      <!-- 筛选条件 -->
      <div>
        <Collapse :screen-form="searchForm">
          <template #right_btn>
            <el-button size="mini" @click="cancelFn">清空</el-button>
            <el-button size="mini" type="primary" @click="searchFn">搜索</el-button>
          </template>
          <template #left_btn>
            <el-radio-group @change="changeRadioFn" v-model="searchForm.examineStatus" size="mini">
              <el-radio-button label="">全部</el-radio-button>
              <el-radio-button label="SAVE">保存</el-radio-button>
              <el-radio-button label="WAIT">待审核</el-radio-button>
              <el-radio-button label="OK_ONE">初审通过</el-radio-button>
              <el-radio-button label="FAIL_ONE">初审不通过</el-radio-button>
              <el-radio-button label="OK">复核通过</el-radio-button>
              <el-radio-button label="FAIL">复核不通过</el-radio-button>
              <el-radio-button label="CLOSE">已关闭</el-radio-button>
              <el-radio-button label="OK_ONE_AND_CONFIRM">已确认未复核</el-radio-button>
            </el-radio-group>
          </template>
          <template #search>
            <el-form ref="searchForm" :model="searchForm" label-width="100px" size="mini" label-position="left">
              <el-row :gutter="20">
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="经销商名称" prop="customerName">
                    <el-input v-model="searchForm.customerName" placeholder="请输入经销商名称"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="返利类型" prop="walletName">
                    <el-input v-model="searchForm.walletName" placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="经销商编码" prop="customerNumber">
                    <el-input v-model="searchForm.customerNumber" placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="返利单号" prop="id">
                    <el-input v-model="searchForm.id" placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="开始时间" prop="startTime">
                    <el-date-picker
                      class="selectStyle"
                      v-model="searchForm.startTime"
                      placeholder="选择日期"
                      type="datetime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="结束时间" prop="endTime">
                    <el-date-picker
                      class="selectStyle"
                      v-model="searchForm.endTime"
                      placeholder="选择日期"
                      type="datetime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6" >
                  <el-form-item label="制单人" prop="createBy">
                    <el-input v-model="searchForm.createBy" placeholder="请输入制单人"></el-input>
                  </el-form-item>
                </el-col><el-col :xs="24" :sm="12" :lg="6" >
                <el-form-item label="审核人" prop="examineBy">
                  <el-input v-model="searchForm.examineBy" placeholder="请输入审核人"></el-input>
                </el-form-item>
              </el-col>
                <el-col :xs="24" :sm="12" :lg="6" >
                  <el-form-item label="备注1" prop="remark1">
                    <el-input v-model="searchForm.remark1" placeholder="请输入备注1"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="商家已确认" prop="isConfirm">
                    <el-radio-group v-model="searchForm.isConfirm">
                      <el-radio-button label="">全部</el-radio-button>
                      <el-radio-button label="true">是</el-radio-button>
                      <el-radio-button label="false">否</el-radio-button>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </template>
        </Collapse>
      </div>
      <!-- 按钮 -->
      <div class="btn-group clearfix">
        <div class="fl">
          <el-popconfirm
            style="margin-right: 15px"
            v-if="$checkBtnRole('del', $route.meta.roles)"
            class="delClass"
            @onConfirm="deleFn"
            title="确定删除吗？"
          >
            <el-button :disabled="deleList.length < 1" slot="reference" type="danger" icon="el-icon-minus" size="mini"
              >批量删除</el-button
            >
          </el-popconfirm>
          <el-popconfirm
            style="margin-right: 15px"
            v-if="$checkBtnRole('apply', $route.meta.roles) && searchForm.examineStatus === 'SAVE'"
            class="delClass"
            @onConfirm="batchApplication"
            title="确定执行批量申请吗？"
          >
            <el-button
              :disabled="deleList.length < 1"
              slot="reference"
              type="warning"
              icon="el-icon-finished"
              size="mini"
              >批量申请</el-button
            >
          </el-popconfirm>
          <el-button
            @click="batchAudit('audit')"
            v-if="$checkBtnRole('examine', $route.meta.roles) && searchForm.examineStatus === 'WAIT'"
            :disabled="deleList.length < 1"
            slot="reference"
            type="warning"
            icon="el-icon-finished"
            size="mini"
            >批量审核</el-button
          >
          <el-button
            @click="batchReview('review')"
            v-if="$checkBtnRole('examine', $route.meta.roles) && searchForm.examineStatus === 'OK_ONE_AND_CONFIRM'"
            :disabled="deleList.length < 1"
            slot="reference"
            type="warning"
            icon="el-icon-finished"
            size="mini"
            >批量复核</el-button
          >
          <!-- <el-button @click="batchApplication" :disabled='deleList.length < 1' size="mini" type="warning" icon="el-icon-finished" v-if="$checkBtnRole('examine', $route.meta.roles) && searchForm.examineStatus ==='SAVE'">批量申请</el-button> -->
        </div>
        <div class="fr">
          <ExportButton :exUrl="'rebate/order/export'" :exParams="exParams" />
        </div>
      </div>
      <!-- 列表 -->
      <div class="mymain-container">
        <div class="table">
          <el-table
            @selection-change="selectionChangeFn"
            v-loading="listLoading"
            :data="dataList"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
            show-summary
            :summary-method="$getSummaries"
          >
            <el-table-column
              v-if="$checkBtnRole('del', $route.meta.roles)"
              :selectable="selectableFn"
              align="center"
              type="selection"
              width="51"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              label="状态"
              prop="examineStatus"
              min-width="160"
              show-overflow-tooltip
              v-if="!isCustomer"
            >
              <template slot-scope="scope">
                <el-tag size="mini" v-show="scope.row.examineStatus == 'SAVE'">保存</el-tag>
                <el-tag size="mini" v-show="scope.row.examineStatus == 'WAIT'" type="warning">待审核</el-tag>
                <el-tag size="mini" v-show="scope.row.examineStatus == 'OK_ONE'" type="success">初审通过</el-tag>
                <el-tag size="mini" v-show="scope.row.examineStatus == 'FAIL_ONE'" type="danger">初审不通过</el-tag>
                <el-tag size="mini" v-show="scope.row.examineStatus == 'OK'" type="success">复核通过</el-tag>
                <el-tag size="mini" v-show="scope.row.examineStatus == 'FAIL'" type="danger">不通过</el-tag>
                <el-tag size="mini" v-show="scope.row.examineStatus == 'CLOSE'" type="info">已关闭</el-tag>
              </template>
            </el-table-column>
            <el-table-column
              v-if="isCustomer"
              align="left"
              label="是否确认"
              prop="customerIsConfirm"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <el-tag size="mini" v-show="scope.row.customerIsConfirm == true">已确认</el-tag>
                <el-tag size="mini" v-show="scope.row.customerIsConfirm == false">未确认</el-tag>
              </template>
            </el-table-column>
            <el-table-column align="left" label="返利单号" prop="rebateOrderId" min-width="200" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copyText="scope.row.rebateOrderId" />
                <span>{{ scope.row.rebateOrderId }}</span>
              </template>
            </el-table-column>
            <el-table-column
              align="left"
              label="返利日期"
              prop="theTime"
              min-width="180"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="isCustomer"
              align="left"
              label="标题备注"
              prop="policyDocNo"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="经销商编码"
              prop="customerNumber"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <CopyButton :copyText="scope.row.customerNumber" />
                <span>{{ scope.row.customerNumber }}</span>
              </template>
            </el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="经销商名称"
              prop="customerName"
              min-width="260"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <CopyButton :copyText="scope.row.customerName" />
                <span>{{ scope.row.customerName }}</span>
              </template>
            </el-table-column>
            <el-table-column
              align="left"
              label="返利类型"
              prop="walletName"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column align="right" label="总返利金额" prop="amount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.amount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="right" label="返利金额" prop="rebateAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.rebateAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="right" label="暂扣返利" prop="withholdAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.withholdAmount | numToFixed }}
              </template>
            </el-table-column>
            <!--            <el-table-column-->
            <!--              align="right"-->
            <!--              label="折让金额"-->
            <!--              prop="allowanceAmount"-->
            <!--              min-width="160"-->
            <!--              show-overflow-tooltip-->
            <!--            >-->
            <!--              <template slot-scope="scope">-->
            <!--                {{ scope.row.allowanceAmount | numToFixed }}-->
            <!--              </template>-->
            <!--            </el-table-column>-->
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="折让编号"
              prop="allowanceCode"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="折让账号"
              prop="allowanceAccount"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="right"
              label="已办理折让金额"
              prop="handledAllowanceAmount"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.handledAllowanceAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="折让对应收款单号"
              prop="allowanceOrderNo"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="政策文件流水号"
              prop="policyFileNo"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="政策文号"
              prop="policyDocNo"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="政策年份"
              prop="policyYear"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="政策月份"
              prop="policyMonth"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="政策归属部门"
              prop="policyOrg"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              v-if="!isCustomer"
              label="客户区域"
              prop="customerArea"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="客户属性"
              prop="customerAttr"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              align="left"
              v-if="!isCustomer"
              label="奖励实际归属客户"
              prop="rewardActualCustomers"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="备注1"
              prop="remark1"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="备注2"
              prop="remark2"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="制单人"
              prop="createBy"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="制单时间"
              prop="createTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="审核人"
              prop="examineBy"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="审核时间"
              prop="examineTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="确认人"
              prop="customerName"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="确认时间"
              prop="customerConfirmTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="复核人"
              prop="secondExamineBy"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="复核时间"
              prop="secondExamineTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              v-if="isCustomer"
              align="left"
              label="确认时间"
              prop="customerConfirmTime"
              min-width="160"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column align="center" label="操作" min-width="240" show-overflow-tooltip fixed="right">
              <template slot-scope="scope">
                <el-button
                  type="text"
                  class="textColor"
                  v-if="
                    !isCustomer && $checkBtnRole('edit', $route.meta.roles) && scope.row.examineStatus != 'FAIL_ONE'
                  "
                  @click="editFn(scope.row.rebateOrderId)"
                  >编辑</el-button
                >
                <el-button
                  type="text"
                  class="textColor"
                  v-show="scope.row.examineStatus == 'SAVE' && !isCustomer && $checkBtnRole('apply', $route.meta.roles)"
                  @click="applyFn(scope.row.rebateOrderId)"
                  >申请</el-button
                >
                <el-button
                  type="text"
                  class="textColor"
                  v-show="
                    scope.row.examineStatus == 'WAIT' && !isCustomer && $checkBtnRole('examine', $route.meta.roles)
                  "
                  @click="examineFn(scope.row.rebateOrderId)"
                  >审核</el-button
                >
                <el-button
                  type="text"
                  class="textColor"
                  v-show="
                    (scope.row.examineStatus == 'OK_ONE' ||
                      scope.row.examineStatus == 'OK' ||
                      scope.row.examineStatus == 'FAIL') &&
                    !isCustomer &&
                    $checkBtnRole('examine', $route.meta.roles)
                  "
                  @click="reviewFn(scope.row.rebateOrderId)"
                  >{{ scope.row.examineStatus == 'OK' ? '取消复核' : '复核' }}</el-button
                >
                <el-button
                  type="text"
                  class="textColor"
                  v-show="(scope.row.examineStatus == 'WAIT' || scope.row.examineStatus == 'SAVE') && !isCustomer"
                  @click="infoFn(scope.row.rebateOrderId)"
                  >详情</el-button
                >
                <el-button
                  type="text"
                  class="textColor"
                  v-show="
                    (scope.row.examineStatus == 'OK_ONE' ||
                      scope.row.examineStatus == 'FAIL_ONE' ||
                      scope.row.examineStatus == 'FAIL' ||
                      scope.row.examineStatus == 'OK') &&
                    !isCustomer
                  "
                  @click="detail2(scope.row.rebateOrderId)"
                  >详情</el-button
                >
                <el-button
                  type="text"
                  class="textColor"
                  v-if="
                    isCustomer &&
                    scope.row.withholdAmount == 0 &&
                    (scope.row.examineStatus == 'OK_ONE' ||
                      scope.row.examineStatus == 'OK' ||
                      scope.row.examineStatus == 'FAIL')
                  "
                  @click="confirmFn(scope.row.rebateOrderId, scope.row.customerIsConfirm)"
                  >{{
                    scope.row.customerIsConfirm == true && scope.row.examineStatus == 'OK_ONE'
                      ? '编辑'
                      : scope.row.customerIsConfirm == false
                      ? '确定'
                      : '详情'
                  }}</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <!-- 分页 -->
        <div class="fr">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 50]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="listTotal"
          >
          </el-pagination>
        </div>
      </div>
    </div>

    <RebateListApply :detailId="detailId" v-else-if="showPage == 2" />
    <RebateListExamine @updateList="updateList" :detailId="detailId" v-else-if="showPage == 3" />
    <RebateListReview @updateList="updateList" :detailId="detailId" v-else-if="showPage == 4" />
    <!-- 详情 -->
    <RebateListDetail :detailId="detailId" v-else-if="showPage == 5" />
    <!-- 确定 -->
    <RebateListConfirm @updateList="updateList" :detailId="detailId" :isShow="isShow" v-else-if="showPage == 6" />
    <!-- 编辑 -->
    <RebateListEdit @updateList="updateList" :detailId="detailId" v-else-if="showPage == 7" />
    <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  </div>
</template>

<script>
import {
  getRebateOrderList,
  getRebateOrderApply,
  getRebateOrderBatchDel,
  getRebateOrderApplyBatch,
  getRebateOrderExamineBatch,
  getRebateOrderExamine2Batch
} from '@/api/finance/rebate_list'
import RebateListApply from './components/rebate_list-apply.vue'
import RebateListExamine from './components/rebate_list-examine.vue'
import RebateListReview from './components/rebate_list-review.vue'
import RebateListDetail from './components/rebate_list-detail'
import RebateListConfirm from './components/rebate_list-confirm'
import RebateListEdit from './components/rebate_list-edit.vue'
import ExamineDialog from '@/components/Common/examine-dialog'

export default {
  name: 'rebate_list',
  components: {
    RebateListDetail,
    RebateListApply,
    RebateListExamine,
    RebateListReview,
    RebateListConfirm,
    RebateListEdit,
    ExamineDialog
  },
  data() {
    return {
      deleList: [],
      currentPage: 1, // 当前页码
      pageSize: 10, // 每页数量
      listTotal: 0, // 列表总数
      dataList: [], // 列表数据
      searchForm: {
        id: '',
        customerName: '',
        walletName: '',
        customerNumber: '',
        startTime: '',
        endTime: '',
        examineStatus: '',
        isConfirm: '',
        remark1:'',
        examineBy:'',
        createBy:''
      }, //搜索表单
      listLoading: false, // 列表加载loading
      showPage: 1,
      detailId: null,
      isCustomer: null,
      secondId: null,
      isShow: null,
      isCollapse: true,
      isShowExamineDialog: false,
      examineForm: {
        status: '',
        remark: ''
      },
      state: ''
    }
  },
  computed: {
    exParams() {
      return {
        ...this.searchForm,
        pageSize: this.pageSize,
        pageNum: this.currentPage
      }
    },
    isCustomer() {
      return this.$store.getters.customerId && this.$store.getters.customerNumber
    }
  },
  created() {
    this.getDataList()
    const res = JSON.parse(localStorage.getItem('supply_user'))

    this.isCustomer = res.isCustomer
    if (this.$route.query.id) {
      if (this.isCustomer) {
        this.confirmFn(this.$route.query.id, false)
      } else {
        this.examineFn(this.$route.query.id)
      }
    }
  },
  methods: {
    //批量复核
    batchReview(value) {
      this.state = value
      this.isShowExamineDialog = true
    },

    //批量审核
    batchAudit(value) {
      this.state = value
      this.isShowExamineDialog = true
    },
    //提交批量审核
    async submitExamineForm() {
      let res = this.deleList.toString()
      if (this.state === 'audit') {
        await getRebateOrderExamineBatch({
          ids: res,
          examineStatus: this.examineForm.status,
          examineRemark: this.examineForm.remark
        })
        this.$message.success('批量审核成功')
      } else {
        await getRebateOrderExamine2Batch({
          ids: res,
          examineStatus: this.examineForm.status,
          examineRemark: this.examineForm.remark
        })
        this.$message.success('批量复核成功')
      }

      this.deleList = []
      this.isShowExamineDialog = false
      this.getDataList()
    },
    //批量申请
    async batchApplication() {
      let res = this.deleList.toString()
      await getRebateOrderApplyBatch({ ids: res })
      this.getDataList()
      this.$message.success('批量申请成功')
      this.deleList = []
    },
    // 批量删除
    selectionChangeFn(value) {
      const res = value.map(v => v.rebateOrderId)
      this.deleList = res
    },
    //删除
    async deleFn() {
      let res = this.deleList.toString()
      // console.log(res);
      await getRebateOrderBatchDel({ ids: res })
      this.getDataList()
      this.$message.success('删除成功')
      this.deleList = []
    },

    selectableFn(row, index) {
      // console.log(row, index, 444);
      // if (row.examineStatus !== "SAVE") {
      //   return false;
      // } else {
      //   return true;
      // }

      return true
    },
    //切换radio获取数据
    changeRadioFn(v) {
      this.currentPage = 1
      this.getDataList()
    },
    //清除
    cancelFn() {
      this.$refs.searchForm.resetFields()
    },
    //搜索
    searchFn() {
      this.currentPage = 1
      this.getDataList()
    },
    // 更改每页数量
    handleSizeChange(val) {
      this.pageSize = val
      this.getDataList()
    },
    // 更改当前页
    handleCurrentChange(val) {
      this.currentPage = val
      this.getDataList()
    },
    //更新列表数据
    updateList() {
      this.getDataList()
    },
    //获取列表数据
    async getDataList() {
      let params = {
        pageSize: this.pageSize,
        pageNum: this.currentPage,
        customerName: this.searchForm.customerName,
        customerNumber: this.searchForm.customerNumber,
        endTime: this.searchForm.endTime,
        remark1: this.searchForm.remark1,
        examineBy:this.searchForm.examineBy,
        createBy:this.searchForm.createBy,
        examineStatus: this.searchForm.examineStatus,
        id: this.searchForm.id,
        isConfirm: this.searchForm.isConfirm,
        isSecondExamine: '',
        startTime: this.searchForm.startTime,
        walletName: this.searchForm.walletName
      }
      const res = await getRebateOrderList(params)
      this.listTotal = res.data.total
      this.dataList = res.data.records
      this.dataList.forEach(value => {
        value.sums1 = []
        value.sums2 = ['amount', 'rebateAmount', 'withholdAmount', 'allowanceAmount', 'handledAllowanceAmount']
      })
      // if (this.isCustomer) {
      //   let arr2 = arr.filter(v => {
      //     if (
      //       (v.examineStatus == 'OK_ONE' || v.examineStatus == 'OK' || v.examineStatus == 'FAIL') &&
      //       v.withholdAmount == 0
      //     ) {
      //       return v
      //     }
      //   })
      //   this.dataList = arr2
      //   this.listTotal = arr2.length
      // } else {
      //   this.dataList = arr
      //   this.listTotal = res.data.total
      // }
    },
    //确认
    confirmFn(id, isShow) {
      this.isShow = isShow
      this.detailId = id
      this.showPage = 6
    },
    //复核
    reviewFn(id) {
      this.detailId = id
      this.showPage = 4
    },
    //审核
    examineFn(id) {
      this.detailId = id
      this.showPage = 3
    },
    //申请
    async applyFn(id) {
      await getRebateOrderApply({ id })

      this.getDataList()
      this.$message.success('申请成功')
    },
    //详情2
    detail2(id) {
      this.detailId = id
      this.showPage = 2
    },
    //详情
    infoFn(id) {
      this.detailId = id
      this.showPage = 5
    },
    //编辑
    editFn(id) {
      this.detailId = id
      this.showPage = 7
    }
  }
}
</script>
<style lang="scss" scoped>
.selectStyle {
  width: 100%;
}
</style>
