<template>
  <div class="app-container">
    <div v-if="showPage == 1">
      <!-- 筛选条件 -->
      <div>
        <Collapse :screen-form="screenForm">
          <template #right_btn>
            <el-button size="mini" @click="resetScreenForm">清空</el-button>
            <el-button size="mini" type="primary" @click="submitScreenForm">搜索</el-button>
          </template>
          <template #left_btn>
            <el-radio-group v-model="deduction" size="mini" @change="handleRadio">
              <el-radio-button label="全部" />
              <el-radio-button label="已退押" />
            </el-radio-group>
          </template>
          <template #search>
            <el-form ref="screenForm" :model="screenForm" label-width="140px" size="mini" label-position="left">
              <el-row :gutter="20">
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="工程登录编号" prop="refEnginRecordNo">
                    <el-input v-model="screenForm.refEnginRecordNo" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="经销商编码/名称" prop="customerKeyword">
                    <el-input v-model="screenForm.customerKeyword" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <!-- <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="经销商名称" prop="customerKeyword">
                    <el-input
                      v-model="screenForm.customerKeyword"
                      placeholder="请输入"
                    ></el-input>
                  </el-form-item>
                </el-col> -->
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="行业类别" prop="refTradeCategory">
                    <el-input v-model="screenForm.refTradeCategory" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="使用单位" prop="refUseUnit">
                    <el-input v-model="screenForm.refUseUnit" placeholder="请输入使用单位" />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="开始申请日期" prop="startSubmitTime">
                    <el-date-picker
                      v-model="screenForm.startSubmitTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="dateStyle"
                      type="datetime"
                      placeholder="选择日期"
                    />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="结束申请日期" prop="endSubmitTime">
                    <el-date-picker
                      v-model="screenForm.endSubmitTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="dateStyle"
                      type="datetime"
                      placeholder="选择日期"
                    />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="开始受理日期" prop="startConfirmTime">
                    <el-date-picker
                      v-model="screenForm.startConfirmTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="dateStyle"
                      type="datetime"
                      placeholder="选择日期"
                    />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="结束受理日期" prop="endConfirmTime">
                    <el-date-picker
                      v-model="screenForm.endConfirmTime"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      class="dateStyle"
                      type="datetime"
                      placeholder="选择日期"
                    />
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="是否退押 " prop="isRefundDeposit">
                    <el-select
                      v-model="screenForm.isRefundDeposit"
                      style="width: 100%"
                      clearable
                      placeholder="请选择是否退押 "
                    >
                      <el-option
                        v-for="item in refundDepositArr"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="状态 " prop="examineStatus">
                    <el-select
                      v-model="screenForm.examineStatus"
                      style="width: 100%"
                      clearable
                      placeholder="请选择状态 "
                    >
                      <el-option
                        v-for="item in examineStatusArr"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <!-- <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="产品名称" prop="">
                    <el-input placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="12" :lg="6">
                  <el-form-item label="规格型号" prop="">
                    <el-input placeholder="请输入"></el-input>
                  </el-form-item>
                </el-col> -->
                <template v-if="!isCustomer">
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="审核人" prop="confirmName">
                      <el-input v-model="screenForm.confirmName" placeholder="请输入审核人" />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="区域" prop="refRegionWork">
                      <el-input v-model="screenForm.refRegionWork" placeholder="请输入区域" />
                    </el-form-item>
                  </el-col>

                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="安装日期" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startInstallTime">
                          <el-date-picker
                            v-model="screenForm.startInstallTime"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endInstallTime">
                          <el-date-picker
                            v-model="screenForm.endInstallTime"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="规格型号" prop="specification">
                      <el-input v-model="screenForm.specification" placeholder="请输入规格型号" />
                    </el-form-item>
                  </el-col>
                  <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="特价编号" prop="specialNo">
                      <el-input v-model="screenForm.specialNo" placeholder="请输入特价编号" />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="跨区厂编号" prop="refFactoryNo">
                      <el-input v-model="screenForm.refFactoryNo" placeholder="请输入跨区厂编号" />
                    </el-form-item>
                  </el-col>
                  <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="格力内部备注" prop="geLiInerNote">
                      <el-input v-model="screenForm.geLiInerNote" placeholder="请输入格力内部备注" />
                    </el-form-item>
                  </el-col>
                  <!-- <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="厂编号" prop="factoryNo">
                      <el-input v-model="screenForm.factoryNo" placeholder="请输入厂编号"></el-input>
                    </el-form-item>
                  </el-col> -->
                  <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="厂编号" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startFactoryNo">
                          <el-input v-model="screenForm.startFactoryNo" placeholder="厂编号开始" />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endFactoryNo">
                          <el-input v-model="screenForm.endFactoryNo" placeholder="厂编号结束" />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="资料审核开始日期" prop="startAcceptTime">
                      <el-date-picker
                        v-model="screenForm.startAcceptTime"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        class="dateStyle"
                        type="datetime"
                        placeholder="选择日期"
                      />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="资料审核结束日期" prop="endAcceptTime">
                      <el-date-picker
                        v-model="screenForm.endAcceptTime"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        class="dateStyle"
                        type="datetime"
                        placeholder="选择日期"
                      />
                    </el-form-item>
                  </el-col>
                  <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="特价编号" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startSpecialNo">
                          <el-input v-model="screenForm.startSpecialNo" placeholder="开始" />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endSpecialNo">
                          <el-input v-model="screenForm.endSpecialNo" placeholder="结束" />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="交单编号" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startBillNo">
                          <el-input v-model="screenForm.startBillNo" placeholder="开始" />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endBillNo">
                          <el-input v-model="screenForm.endBillNo" placeholder="结束" />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="寄厂日期" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startMailFactoryDate">
                          <el-date-picker
                            v-model="screenForm.startMailFactoryDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endMailFactoryDate">
                          <el-date-picker
                            v-model="screenForm.endMailFactoryDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="寄厂年度" prop="mailFactoryYear">
                      <el-input v-model="screenForm.mailFactoryYear" placeholder="请输入寄厂年度" />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="确认日期" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startConfirmDate">
                          <el-date-picker
                            v-model="screenForm.startConfirmDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endConfirmDate">
                          <el-date-picker
                            v-model="screenForm.endConfirmDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col v-if="!isCustomer" :xs="24" :sm="12" :lg="6">
                    <el-form-item label="结算编号" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startSettlementNo">
                          <el-input v-model="screenForm.startSettlementNo" placeholder="开始" />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endSettlementNo">
                          <el-input v-model="screenForm.endSettlementNo" placeholder="结束" />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="结算日期" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startSettlementDate">

                          <el-date-picker
                            v-model="screenForm.startSettlementDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endSettlementDate">

                          <el-date-picker
                            v-model="screenForm.endSettlementDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="入厂日期" style="margin-bottom: 0">
                      <div class="fanwei">
                        <el-form-item prop="startInFactoryDate">

                          <el-date-picker
                            v-model="screenForm.startInFactoryDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                        <span>-</span>
                        <el-form-item prop="endInFactoryDate">

                          <el-date-picker
                            v-model="screenForm.endInFactoryDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            class="dateStyle"
                            type="datetime"
                            placeholder="选择日期"
                          />
                        </el-form-item>
                      </div>
                    </el-form-item>
                  </el-col>

                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="入厂类型" prop="inFactoryType">
                      <el-input v-model="screenForm.inFactoryType" placeholder="请输入入厂类型" />
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="结算日期 " prop="settlementStatus">
                      <el-select style="width: 100%" v-model="screenForm.settlementStatus" clearable placeholder="请选择">
                        <el-option label="为空" :value="1"></el-option>
                        <el-option label="不为空" :value="0"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :xs="24" :sm="12" :lg="6">
                    <el-form-item label="寄厂日期 " prop="mailFactoryStatus">
                      <el-select style="width: 100%" v-model="screenForm.mailFactoryStatus" clearable placeholder="请选择">
                        <el-option label="为空" :value="1"></el-option>
                        <el-option label="不为空" :value="0"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>

                </template>
              </el-row>
            </el-form>
          </template>
        </Collapse>
      </div>
      <!-- 按钮 -->
      <div class="btn-group clearfix" style="display: flex">
        <el-button type="primary" size="mini" @click="hanleDownloadFiles">导出</el-button>
        <!--       -->

        <el-upload
          class="import-btn"
          v-if="!isCustomer"
          :action="baseURL + 'student/import'"
          :http-request="handleImport"
          :file-list="importFileList"
          :show-file-list="false"
        >
          <el-button size="mini" type="primary">导入</el-button>
        </el-upload>
      </div>
      <!-- 列表 -->
      <div class="mymain-container">
        <div class="table">
          <el-table
            v-loading="listLoading"
            :data="dataList"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
            show-summary
            :summary-method="$getSummaries"
            @select-all="handleSelectionAllChange"
            @selection-change="handleSelectionAllChange"
          >
            <el-table-column align="left" type="selection" width="55" />
            <el-table-column
              align="left"
              label="工程登录编号"
              prop="refEnginRecordNo"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column v-if="!isCustomer" align="right" label="跨区厂编号" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.refFactoryNo" />
                <span>{{ scope.row.refFactoryNo }}</span>
              </template>
            </el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="right"
              label="特价项目编号"
              prop="specialItemNo"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              v-if="!isCustomer"
              align="right"
              label="特价编号"
              prop="specialNo"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              v-if="!isCustomer"
              align="right"
              label="交单编号"
              prop="billNo"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              v-if="!isCustomer"
              align="right"
              label="安装日期"
              prop="installDate"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              v-if="!isCustomer"
              align="right"
              label="厂编号"
              prop="factoryNo"
              min-width="160"
              show-overflow-tooltip
            />
<!--            <el-table-column-->
<!--              v-if="!isCustomer"-->
<!--              align="right"-->
<!--              label="特价编号"-->
<!--              prop="specialNo"-->
<!--              min-width="160"-->
<!--              show-overflow-tooltip-->
<!--            />-->
            <el-table-column
              align="left"
              label="行业类别"
              prop="refTradeCategory"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.refTradeCategory" />
                <span>{{ scope.row.refTradeCategory }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="使用单位" prop="refUseUnit" min-width="160" show-overflow-tooltip />
            <el-table-column align="left" label="区域" prop="refRegionWork" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.refRegionWork" />
                <span>{{ scope.row.refRegionWork }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="申请日期" prop="submitTime" min-width="160" show-overflow-tooltip />
            <el-table-column align="left" label="受理日期" prop="checkDate" min-width="160" show-overflow-tooltip />
            <el-table-column
              align="left"
              label="经销商编码"
              prop="customerNumber"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.customerNumber" />
                <span>{{ scope.row.customerNumber }}</span>
              </template>
            </el-table-column>

            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="寄厂日期"
              prop="mailFactoryDate"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="寄厂年度"
              prop="mailFactoryYear"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              align="left"
              v-if="!isCustomer"
              label="确认日期"
              prop="confirmDate"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              align="left"
              v-if="!isCustomer"
              label="结算编号"
              prop="settlementNo"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="结算日期"
              prop="settlementDate"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              align="left"
              v-if="!isCustomer"
              label="入厂日期"
              prop="inFactoryDate"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column
              align="left"
              label="入厂类型"
              v-if="!isCustomer"
              prop="inFactoryType"
              min-width="160"
              show-overflow-tooltip
            />

            <el-table-column align="left" label="经销商名称" prop="customerName" min-width="300" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.customerName" />
                <span>{{ scope.row.customerName }}</span>
              </template>
            </el-table-column>
            <el-table-column
              v-if="!isCustomer"
              align="left"
              label="格力内部备注"
              prop="geLiInerNote"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span>{{ scope.row.geLiInerNote }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="规格型号" prop="specification" min-width="300" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.specification" />
                <span>{{ scope.row.specification }}</span>
              </template>
            </el-table-column>
            <el-table-column
              align="left"
              label="实装规格型号"
              prop="realSpecification"
              min-width="300"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div :style="scope.row.realSpecification != scope.row.specification ? { color: 'blue' } : ''">
                  {{ scope.row.realSpecification }}
                </div>
              </template>
            </el-table-column>
            <el-table-column
              align="left"
              label="实装物料编号"
              prop="realMaterialNumber"
              min-width="150"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div :style="scope.row.realMaterialNumber != scope.row.materialNumber ? { color: 'blue' } : ''">
                  {{ scope.row.realMaterialNumber }}
                </div>
              </template>
            </el-table-column>
            <el-table-column
              align="left"
              label="实装厂产品编码"
              prop="realMaterialOldNumber"
              min-width="200"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <div :style="scope.row.realMaterialOldNumber != scope.row.materialOldNumber ? { color: 'blue' } : ''">
                  {{ scope.row.realMaterialOldNumber }}
                </div>
              </template>
            </el-table-column>
            <el-table-column align="left" label="是否退押" prop="isRefundDeposit" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag v-if="scope.row.isRefundDeposit" type="success" size="small">是</el-tag>
                <el-tag v-else type="warning" size="small">否</el-tag>
              </template>
            </el-table-column>
            <!-- <el-table-column
              align="left"
              label="押金比例"
              prop=""
              min-width="160"
              show-overflow-tooltip
            ></el-table-column> -->
            <el-table-column
              align="right"
              label="押金金额"
              prop="itemDepositAmount"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.itemDepositAmount | numToFixed }}
              </template>
            </el-table-column>

            <el-table-column align="left" label="状态" prop="examineStatus" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag v-if="scope.row.examineStatus == 'SAVE'" type="success" size="small">保存</el-tag>
                <el-tag v-if="scope.row.examineStatus == 'WAIT'" type="warning" size="small">待审核</el-tag>
                <el-tag v-if="scope.row.examineStatus == 'OK'" type="warning" size="mini">通过</el-tag>
                <el-tag v-if="scope.row.examineStatus == 'FAIL'" type="warning" size="small">不通过</el-tag>
                <el-tag v-if="scope.row.examineStatus == 'CLOSE'" type="warning" size="small">关闭</el-tag>
              </template>
            </el-table-column>
            <el-table-column align="right" label="订单数量" prop="itemQty" min-width="160" show-overflow-tooltip />
            <!-- <el-table-column
              align="right"
              label="合同数量"
              prop="itemContractQty"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.itemContractQty || 0}}
              </template>
            </el-table-column>
            <el-table-column
              align="right"
              label="合同单价"
              prop="itemContractPrice"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.itemContractPrice | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column
              align="right"
              label="合同金额"
              prop="itemContractAmount"
              min-width="160"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.itemContractAmount | numToFixed }}
              </template>
            </el-table-column> -->
            <el-table-column
              align="left"
              label="资料审核日期"
              prop="refDatumAcceptDate"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column align="right" label="金额" prop="totalPrice" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.totalPrice | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column
              align="right"
              label="发货数量"
              prop="orderHasSendQty"
              min-width="160"
              show-overflow-tooltip
            />

            <el-table-column align="right" label="上交资料" prop="itemDataQty" min-width="160" show-overflow-tooltip />
            <el-table-column align="center" label="操作" min-width="160" fixed="right" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-button type="text" class="textColor" size="mini" @click="detailFn(scope.row)">详情</el-button>
                <el-button
                  v-if="scope.row.examineStatus == 'SAVE' && $checkBtnRole('apply', $route.meta.roles)"
                  type="text"
                  class="textColor"
                  @click="surrenderFn(scope.row)"
                >申请退押
                </el-button>
                <!-- <el-button type="text" class="textColor" slot="reference"
                  >免扣退押</el-button
                > -->
              </template>
            </el-table-column>
          </el-table>
        </div>
        <!-- 分页 -->
        <div class="fr">
          <el-pagination
            :current-page="currentPage"
            :page-sizes="[10, 50, 100, 500]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="listTotal"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </div>
    </div>
    <DepositListDetail v-else-if="showPage == 2" />
    <DepositApplyDeduction v-else-if="showPage == 3" />
    <DepositApplySurrender v-else-if="showPage == 4" />
    <!-- <refund-replenish v-else-if="(showSurrender==2)" :detail-id="detailId" @updateList="updateList"/>
    <refund-reexamine v-else-if="(showSurrender==3)" :detail-id="detailId" @updateList="updateList"/> -->
  </div>
</template>

<script>
import DepositListDetail from './components/deposit_list-detail'
import { getDepositManageDate } from '@/api/engin_deposit/refund_list'
import DepositApplyDeduction from './components/deposit-apply-deduction.vue'
import DepositApplySurrender from './components/deposit-apply-surrender.vue'
import { downloadFiles, handleImport } from '@/utils/util'
import { getList } from '@/api/engin_deposit.js'
import Mixin from '@/mixin'
import refund_reexamine from './components/refund_reexamine.vue'
import refund_replenish from './components/refund_replenish.vue'
export default {
  components: {
    DepositListDetail,
    DepositApplyDeduction,
    DepositApplySurrender,
    refund_reexamine,
    refund_replenish
  },
  mixins: [Mixin],
  data() {
    return {
      currentPage: 1, // 当前页码
      pageSize: 10, // 每页数量
      listTotal: 0, // 列表总数
      dataList: [], // 列表数据
      screenForm: {
        confirmName: '', // 审核人
        createName: '', // 创建人
        customerKeyword: '', // 客户编码/客户名称
        endDeliverTime: '', // 发货申请日期-结束
        enginOrderNo: '', // 工程订单编号
        enginOrderType: 'HOME', // 工程订单类型
        examineStatus: '', // 状态
        refEnginRecordNo: '', // 登录单号
        refProjectName: '', // 项目名称
        refTradeCategory: '',
        refUseUnit: '', // 使用单位
        startDeliverTime: '', // 发货申请日期-开始
        startSubmitTime: '',
        startConfirmTime: '',
        isRefundDeposit: null,
        endConfirmTime: '',
        startInstallTime: '',
        endInstallTime: '',
        specification: '',
        refFactoryNo: '',
        factoryNo: '',
        specialNo: '',
        refRegionWork: '',
        endSubmitTime: '',
        startAcceptTime: '',
        endAcceptTime: '',
        geLiInerNote: '',
        startFactoryNo: '',
        endFactoryNo: '',
        startSpecialNo: '',
        endSpecialNo: '',
        startBillNo: '',
        endBillNo: '',
        mailFactoryYear: '',
        startConfirmDate: '',
        endConfirmDate: '',
        settlementNo: '',
        startSettlementDate: '',
        endSettlementDate: '',
        startInFactoryDate:'',
        endInFactoryDate: '',
        startSettlementNo: '',
        endSettlementNo:'',
        inFactoryType: '',
        endMailFactoryDate:'',startMailFactoryDate:'',
        settlementStatus:'',mailFactoryStatus:''
      }, // 搜索表单
      listLoading: false, // 列表加载loading
      deduction: '全部',
      showPage: 1,
      importFileList: [],
      selectData: [],
      baseURL: '',
      isCollapse: true,
      refundDepositArr: [
        {
          label: '是',
          value: true
        },
        {
          label: '否',
          value: false
        }
      ],
      mailFactoryStatus:''  ,
      settlementStatus:'',
      examineStatusArr: [
        {
          label: '保存',
          value: 'SAVE'
        },
        {
          label: '待审核',
          value: 'WAIT'
        },
        {
          label: '通过',
          value: 'OK'
        },
        {
          label: '关闭',
          value: 'CLOSE'
        }
      ]
    }
  },
  computed: {
    isCustomer() {
      return this.$store.getters.customerId && this.$store.getters.customerNumber
    }
  },
  methods: {
    replenishClick(id){
      this.detailId = id
      this.showSurrender = 2
    },
    reexamineClick(id){
      this.detailId = id
      this.showSurrender = 3
    },
    // 同步资料日期
    async syncDateFn() {
      await getDepositManageDate()
      this.$message.success('同步资料日期成功')
    },
    // 免扣申请
    deductionFn() {
      this.showPage = 3
    },
    // 申请退押
    surrenderFn(row) {
      this.depositManageId = row.depositManageId
      this.showPage = 4
    },
    detailFn(row) {
      this.depositManageId = row.depositManageId
      this.refEnginRecordNo = row.refEnginRecordNo
      this.showPage = 2
    },
    getList() {
      this.listLoading = true

      const params = {
        pageSize: this.pageSize,
        pageNum: this.currentPage,
        isRefundDeposit: '',
        ...this.screenForm
      }
      params.isRefundDeposit = this.deduction === '已退押' ? true : ''
      if (this.screenForm.isRefundDeposit == true || this.screenForm.isRefundDeposit == false) {
        params.isRefundDeposit = this.screenForm.isRefundDeposit
      }
      getList(params).then(res => {
        this.dataList = res.data.records
        res.data.records.forEach(item => {
          item.totalPrice = item.itemPrice * item.itemQty

          // item.number = (item.qty*100 - item.directTransferQty*100 - item.retiredQty*100) / 100;
          item.sums1 = ['qty', 'orderHasSendQty', 'itemDataQty', 'itemContractQty']
          item.sums2 = [
            'itemDepositAmount',
            'diffAmount',
            'price',
            'totalAmount',
            'depositAmount',
            'totalPrice',
            'itemContractPrice',
            'itemContractAmount'
          ]
        })
        this.listLoading = false
        this.listTotal = res.data.total
      })
    },
    handleRadio() {
      this.getList()
    },
    hanleDownloadFiles() {
      let isRefundDeposit = this.deduction === '已退押' ? true : ''
      if (this.screenForm.isRefundDeposit == true || this.screenForm.isRefundDeposit == false) {
        isRefundDeposit = this.screenForm.isRefundDeposit
      }
      downloadFiles('deposit-manage/export', {
        ...this.screenForm,
        isRefundDeposit,
        orderType: 'HOME'
      })
    },
    // 导入
    async handleImport(param) {
      this.importLoading = true
      const file = param.file
      const formData = new FormData()
      formData.append('file', file)
      // formData.append("policyId", this.screenForm.code);
      const result = await handleImport('deposit-manage/import', formData)
      this.importLoading = false
      this.importFileList = []
      if (result.code == 200) {
        this.$alert(result.message, '导入成功', {
          confirmButtonText: '确定'
        })

        this.getList()
      } else {
        this.$alert(result.message, '导入失败', {
          confirmButtonText: '确定'
        })
      }
    },
    handleSelectionAllChange(e) {
      this.selectData = e
    }
  }
}
</script>

<style lang="scss" scoped>
.app-container {
  padding: 40px 20px;
}

.fanwei {
  display: flex;

  span {
    margin: 0 20px;
    line-height: 28px;
  }

  div {
    width: 100%;
  }
}

.dateStyle {
  width: 100%;
}

.import-btn {
  margin-left: 10px;
}

span {
  line-height: 28px;
}
</style>
