<template>
  <div>
    <div class="sty">
      <el-page-header content="补充资料" @back="goBack" />
    </div>
    <el-divider />

    <h3>工程项目信息</h3>
    <el-divider />
    <div class="diy-table-1">
      <el-row :gutter="0">
        <el-col :xs="12" :sm="24" :lg="8" class="item">
          <div class="label">
            {{ detailList.enginOrderType == 'HOME' ? '工程登录编号' : '工程信息编号' }}
          </div>
          <div class="value">
            <CopyButton :copy-text="detailList.refEnginRecordNo" />
            {{ detailList.refEnginRecordNo }}
          </div>
        </el-col>
        <!-- <el-col :xs="12" :sm="24" :lg="8" class="item">
            <div class="label">工程信息编号</div>
            <div class="value">{{ detailList.refEnginRecordNo }}</div>
          </el-col> -->
        <el-col :xs="12" :sm="24" :lg="8" class="item">
          <div class="label">项目类别</div>
          <div class="value">{{ detailList.refProjectCategory }}</div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="8" class="item">
          <div class="label">行业类别</div>
          <div class="value">
            {{ detailList.refTradeCategory }}
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">跨区厂编号</div>
          <div class="value">{{ detailList.refFactoryNo }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">使用单位</div>
          <div class="value">{{ detailList.refUseUnit }}</div>
        </el-col>
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">经销商二级代码</div>
            <div class="value">{{detailList.}}</div>
          </el-col> -->
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">业务员</div>
          <div class="value">{{ detailList.serviceName }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">联系人</div>
          <div class="value">{{ detailList.refLinkman }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">固定电话</div>
          <div class="value">{{ detailList.refTel }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">移动电话</div>
          <div class="value">{{ detailList.refPhone }}</div>
        </el-col>
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">移动电话</div>
            <div class="value">
              <el-input
                :readonly="title == '详情'"
                placeholder="请输入"
                v-model="detailList.refPhone"
              ></el-input>
            </div>
          </el-col> -->
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">押金比例</div>
            <div class="value">{{detailList.}}</div>
          </el-col> -->

        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">单据状态</div>
          <div class="value">
            {{
              detailList.examineStatus == 'SAVE'
                ? '保存'
                : detailList.examineStatus == 'WAIT'
                ? '待审核'
                : detailList.examineStatus == 'OK'
                ? '通过'
                : detailList.examineStatus == 'FAIL'
                ? '不通过'
                : '关闭'
            }}
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">销售类型</div>
          <div class="value">{{ detailList.saleTypeName }}</div>
        </el-col>
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">不扣押金</div>
            <div class="value">{{ detailList.customerName }}</div>
          </el-col> -->
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">第几申报</div>
          <div class="value">{{ detailList.refDeclareNo }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">项目类型</div>
          <div class="value">{{ detailList.refProjectType }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">经销商编码</div>
          <div class="value">{{ detailList.customerNumber }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">押金总额</div>
          <div class="value">{{ detailList.depositAmount }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">安装时间</div>
          <div class="value">
            <el-date-picker
              v-model="detailList.installDate"
              prefix-icon="''"
              placeholder="请选择安装时间"
              :readonly="title == '详情'"
              class="selectStyle"
              type="datetime"
              default-time="00:00:00"
              value-format="yyyy-MM-dd HH:mm:ss"
            />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="16" class="item">
          <div class="label">安装地址</div>
          <div class="value">{{ detailList.refInstallAddress }}</div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
              <div class="label">登录有效期</div>
              <div class="value">
                {{ detailList.refBillsExpireDate }}
              </div>
            </el-col>
            <el-col :xs="24" :sm="24" :lg="8" class="item">
              <div class="label">实际使用单位</div>
              <div class="value">
                {{ detailList.realUseUnit }}
              </div>
            </el-col>
            <el-col :xs="24" :sm="24" :lg="8" class="item">
              <div class="label">实际安装地址</div>
              <div class="value">
                {{ detailList.realInstallAddress }}
              </div>
            </el-col>
            <el-col :xs="24" :sm="24" :lg="8" class="item">
              <div class="label">项目编号</div>
              <div class="value">
                {{ detailList.refProjectNo }}
              </div>
            </el-col>
            <el-col :xs="24" :sm="24" :lg="8" class="item">
              <div class="label">购买单位</div>
              <div class="value">
                {{ detailList.refBuyUnitName }}
              </div>
            </el-col>
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">工程订单号</div>
            <div class="value">{{ detailList.customerName }}</div>
          </el-col> -->
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">经销商名称</div>
          <div class="value">{{ detailList.customerName }}</div>
        </el-col>

        <el-col :xs="24" :sm="24" :lg="24" class="item">
          <div class="label">项目说明</div>
          <div class="value">{{ detailList.refProjectNote }}</div>
        </el-col>
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">订单日期</div>
            <div class="value">{{ detailList.customerName }}</div>
          </el-col> -->

        <!-- <el-col :xs="24" :sm="24" :lg="16" class="item">
            <div class="label">格力内部备注</div>
            <div class="value">{{ detailList.customerName }}</div>
          </el-col> -->
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">文件编码</div>
            <div class="value">{{ detailList.customerName }}</div>
          </el-col> -->
        <el-col :xs="24" :sm="24" :lg="24" class="item">
          <div class="label">备注</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input
              v-model="detailList.remark"
              :readonly="detailList.examineStatus !== 'WAIT'"
              placeholder="请输入内容"
            />
          </div>
        </el-col>
        <el-col v-if="!isCustomer" :xs="24" :sm="24" :lg="24" class="item">
          <div class="label">格力内部备注</div>
          <!-- <div class="value">{{  detailList.geLiInerNote}}</div> -->
          <div class="value">
            <el-input
              v-model="detailList.geLiInerNote"
              :readonly="detailList.examineStatus !== 'WAIT'"
              placeholder="请输入内容"
            />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="24" class="item">
              <div class="label">格力内部资料备注</div>
              <div class="value">{{ detailList.geLiInnerDataNote }}</div>
            </el-col>
            <el-col :xs="24" :sm="24" :lg="24" class="item">
              <div class="label">订单格力内部备注</div>
              <div class="value">{{ detailList. orderGeLiInnerNote }}</div>
            </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">提交保证函</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refPromiseProvide" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">跟进函备注</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refFollowAcceptRemark" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">资料提交日期</div>
          <div class="value">{{ detailList.refDatumProvideDate }}</div>
          <!-- <div class="value">
              <el-date-picker
                prefix-icon="''"
                placeholder="请选择安装时间"
                class="selectStyle"
                v-model="detailList.refDatumProvideDate"
                type="datetime"
                default-time="00:00:00"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </div> -->
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">大额工程</div>
          <div class="value">{{ detailList.refIsBigAmounts }}</div>
          <!-- <div class="value">
              <el-select
                v-model="detailList.refIsBigAmounts"
                v
                clearable
                filterable
              >
                <el-option label="是" value="是"> </el-option>
                <el-option label="否" value="否"> </el-option>
              </el-select>
            </div> -->
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">合同变更批复结果</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refContractResult" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">工程机转零售批复结果</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refToRetailResult" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">资料延期批复结果</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refDataDelayResult" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">其他附件批复结果</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refOtherAnnexResult" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">保证函受理状态</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refPromiseAcceptStatus" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">保证函备注</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refPromisePriceRemark" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">附件备注</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refFjShenPiRemark" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">资料状态</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refDatumProvide" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">资料审核结果</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refDatumAcceptStatus" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">合同变更批复意见</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refContractIdea" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">工程机转零售批复意见</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refToRetailIdea" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">资料延期批复意见</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refDataDelayIdea" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">其他附件审批</div>
          <!-- <div class="value">{{ detailList.remark }}</div> -->
          <div class="value">
            <el-input v-model="detailList.refOtherAnnexIdea" readonly />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="8" class="item">
          <div class="label">资料审核日期</div>
          <div class="value">{{ detailList.refDatumAcceptDate }}</div>
          <!-- <div class="value">
              <el-date-picker
              readonly
                prefix-icon="''"
                placeholder="请选择安装时间"
                class="selectStyle"
                v-model="detailList.refDatumAcceptDate"
                type="datetime"
                default-time="00:00:00"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </div> -->
        </el-col>
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">寄厂日期</div>
            <div class="value">
              <el-date-picker
                :readonly="title == '详情'"
                class="selectStyle"
                v-model="detailList.sendFactoryDate"
                type="datetime"
                prefix-icon="''"
                placeholder="请选择寄厂日期"
                default-time="00:00:00"
                value-format="yyyy-MM-dd HH:mm:ss"
              >
              </el-date-picker>
            </div>
          </el-col> -->
        <!-- <el-col :xs="24" :sm="24" :lg="8" class="item">
            <div class="label">提货日期</div>
            <div class="value">{{detailList.}}</div>
          </el-col> -->
      </el-row>
    </div>
    <h3>货品信息</h3>
    <el-divider />
    <!-- 列表 -->
    <div class="mymain-container">
      <div class="table">
        <div class="table">
          <el-table
            v-loading="listLoading"
            :data="detailList.items"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
            show-summary
            :summary-method="$getSummaries"
          >
            <template v-if="!isCustomer">
              <el-table-column align="left" label="厂编号" prop="factoryNo" min-width="160" show-overflow-tooltip>
                <template slot-scope="scope">
                  <CopyButton :copy-text="scope.row.factoryNo" />
                  <span>{{ scope.row.factoryNo }}</span>
                </template>
              </el-table-column>
              <el-table-column
                align="left"
                label="物料编码"
                prop="materialNumber"
                min-width="130"
                show-overflow-tooltip
              >
                <template slot-scope="scope">
                  <CopyButton :copy-text="scope.row.materialNumber" />
                  <span>{{ scope.row.materialNumber }}</span>
                </template>
              </el-table-column>
            </template>

            <el-table-column
              align="left"
              label="产品编码"
              prop="materialOldNumber"
              min-width="130"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.materialOldNumber" />
                <span>{{ scope.row.materialOldNumber }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.materialName" />
                <span>{{ scope.row.materialName }}</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="right" label="单价" prop="price" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.price | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="right" label="数量" prop="qty" min-width="160" show-overflow-tooltip />
            <el-table-column align="right" label="金额" prop="totalAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.totalAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="right" label="销售数量" prop="salesQty" min-width="160" show-overflow-tooltip />
            <el-table-column align="right" label="销售金额" prop="salesAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.salesAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="right" label="押金数量" prop="hasSendQty" min-width="160" show-overflow-tooltip />
            <el-table-column
              align="right"
              label="发货数量"
              prop="orderHasSendQty"
              min-width="160"
              show-overflow-tooltip
            />
            <el-table-column align="right" label="押金金额" prop="depositAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.depositAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="right" label="合同数量" prop="contractQty" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-input
                  v-if="title !== '详情'"
                  v-model.number="scope.row.contractQty"
                  class="inpt"
                  size="mini"
                  clearable
                />
                <div v-else>
                  {{ scope.row.contractQty }}
                </div>
              </template>
            </el-table-column>
            <el-table-column align="right" label="合同单价" prop="contractPrice" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-input
                  v-if="title !== '详情'"
                  v-model.number="scope.row.contractPrice"
                  class="inpt"
                  size="mini"
                  clearable
                />
                <div v-else>
                  {{ scope.row.contractPrice }}
                </div>
              </template>
            </el-table-column>
            <el-table-column align="right" label="合同金额" prop="contractAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <div>
                  {{ comTotal(scope.row.contractQty, scope.row.contractPrice) }}
                </div>
              </template>
            </el-table-column>
            <el-table-column align="right" label="上交资料" prop="dataQty" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-input
                  v-if="title !== '详情'"
                  v-model.number.trim="scope.row.dataQty"
                  class="inpt"
                  size="mini"
                  @blur="setDataQty($event, scope.row)"
                />
                <div v-else>
                  {{ scope.row.dataQty }}
                </div>
              </template>
            </el-table-column>
            <el-table-column align="right" label="收差金额" prop="diffAmount" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.diffAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column
              align="right"
              label="收差政策价格"
              prop="diffPolicyPrice"
              min-width="200"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.diffPolicyPrice | numToFixed }}
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
    <h3>押金货品信息</h3>
      <el-divider />
      <!-- 列表 -->
      <div class="mymain-container">
        <div class="table">
          <el-table
            v-loading="listLoading"
            :data="detailList.collectList"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
            show-summary
            :summary-method="$getSummaries"
          >
            <el-table-column align="left" label="工程登录单号" prop="refEnginRecordNo" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.refEnginRecordNo" />
                <span>{{ scope.row.refEnginRecordNo }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="规格型号" prop="specification" min-width="130" 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="unit" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.unit" />
                <span>{{ scope.row.unit }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="现金钱包" prop="customerWalletName" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.customerWalletName" />
                <span>{{ scope.row.customerWalletName }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="现金钱包编码" prop="customerWalletNumber" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.customerWalletNumber" />
                <span>{{ scope.row.customerWalletNumber }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="金蝶物料类型名称" prop="k3CategoryName" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.k3CategoryName" />
                <span>{{ scope.row.k3CategoryName }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="金蝶物料类型编码" prop="k3CategoryNumber" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.k3CategoryNumber" />
                <span>{{ scope.row.k3CategoryNumber }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="金蝶物料名称" prop="materialName" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.materialName" />
                <span>{{ scope.row.materialName }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="金蝶物料编码" prop="materialNumber" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.materialNumber" />
                <span>{{ scope.row.materialNumber }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="金蝶物料旧编码" prop="materialOldNumber" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                <CopyButton :copy-text="scope.row.materialOldNumber" />
                <span>{{ scope.row.materialOldNumber }}</span>
              </template>
            </el-table-column>

            <el-table-column align="left" label="已发押金数量" prop="hasSendQty" min-width="130" show-overflow-tooltip />
            <el-table-column align="left" label="单价" prop="price" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.price | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="left" label="已退押金金额" prop="refundDepositAmount" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.refundDepositAmount | numToFixed }}
              </template>
            </el-table-column>
            <el-table-column align="left" label="押金金额" prop="depositAmount" min-width="130" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.depositAmount | numToFixed }}
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    <h3 class="gdzl">工程资料</h3>
    <!--    <el-button :readonly="isDis" class="batchDownload" type="primary" size="small" @click="batchDownloadFn"-->
    <!--      >批量下载</el-button-->
    <!--    >-->

    <el-divider />

    <!-- 列表 -->
    <div class="mymain-container">
      <div class="table">
        <el-table
          v-loading="listLoading"
          :data="original"
          element-loading-text="Loading"
          border
          fit
          highlight-current-row
          stripe
        >
          <el-table-column align="left" label="资料描述" prop="dataDescribe" min-width="160" show-overflow-tooltip />
          <el-table-column align="left" label="原文件名" prop="fileName" min-width="160" show-overflow-tooltip />
          <el-table-column align="left" label="缩略图" prop="fileUrl" min-width="160" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-image
                v-if="checkFileType(scope.row.fileUrl) == 'image'"
                ref="img"
                :src="imageURL + scope.row.fileUrl"
                style="width: 120px; height: 120px"
                fit="cover"
                :preview-src-list="[imageURL + scope.row.fileUrl]"
              />
              <img v-if="checkFileType(scope.row.fileUrl) == 'word'" class="file" src="@/assets/common/word.png" />
              <img v-if="checkFileType(scope.row.fileUrl) == 'excel'" class="file" src="@/assets/common/excel.png" />
              <img v-if="checkFileType(scope.row.fileUrl) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
              <img v-if="checkFileType(scope.row.fileUrl) == 'pdf'" class="file" src="@/assets/common/pdf.png" />
              <img v-if="checkFileType(scope.row.fileUrl) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg" />
            </template>
          </el-table-column>
          <el-table-column align="left" label="下载文件名称" prop="fileName" min-width="160" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ '资料_' + scope.row.fileName }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" min-width="160" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-button type="text" class="textColor" @click="downLoadFn(scope.row.fileUrl, scope.row.fileName)"
                >下载</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <el-divider />
    <div class="diy-table-1">
      <el-row :gutter="0">
        <el-col :xs="12" :sm="12" :lg="12" class="item">
          <div class="label">申请人</div>
          <div class="value">
            <div class="flex">
              <div>
                {{ detailList.submitName }}
              </div>
              <el-button :readonly="isDis" type="primary" size="mini" @click="batchDownloadFn">批量下载</el-button>
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="12" class="item">
          <div class="label">申请日期</div>
          <div class="value">{{ detailList.submitTime }}</div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="24" class="item">
          <div class="label">申请退押金</div>
          <div class="value">{{ detailList.applyNote }}</div>
        </el-col>
      </el-row>
    </div>

    <h3>记录</h3>
    <el-divider />
    <!-- 列表 -->
    <div class="mymain-container">
      <div class="table">
        <el-table
          v-loading="listLoading"
          :data="detailList.checkRecordItems"
          element-loading-text="Loading"
          border
          fit
          highlight-current-row
          stripe
        >
          <el-table-column align="left" label="申请人" prop="submitName" min-width="160" show-overflow-tooltip />
          <el-table-column align="left" label="申请日期" prop="submitTime" min-width="160" show-overflow-tooltip />
          <el-table-column align="left" label="申请说明" prop="applyNote" min-width="160" show-overflow-tooltip />
          <el-table-column align="left" label="验收人" prop="checkName" 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="checkNote" min-width="160" show-overflow-tooltip />
          <el-table-column align="left" label="审批结果" prop="isRefundDeposit" min-width="160" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.isRefundDeposit == false ? '否' : '是' }}
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>

    <h3
      v-if="
        detailList.examineStatus == 'WAIT' || detailList.examineStatus == 'FAIL' || detailList.examineStatus == 'OK'
      "
    >
      审批
    </h3>
    <el-divider
      v-if="
        detailList.examineStatus == 'WAIT' || detailList.examineStatus == 'FAIL' || detailList.examineStatus == 'OK'
      "
    />
    <div v-if="detailList.examineStatus == 'WAIT'" class="diy-table-1">
      <el-row :gutter="0">
        <el-col :xs="12" :sm="12" :lg="12" class="item">
          <div class="label">验收人</div>
          <div class="value">{{ this.checkBy }}</div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="12" class="item dateS">
          <div class="label">受理日期</div>
          <div class="value">
            <el-date-picker
              readonly
              prefix-icon="''"
              class="selectStyle"
              type="datetime"
              placeholder="系统自动生成"
              default-time="00:00:00"
              value-format="yyyy-MM-dd HH:mm:ss"
            />
          </div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="24" class="item">
          <div class="label">是否退押</div>
          <div class="value">
            <el-radio-group v-model="isRefundDeposit">
              <el-radio :label="true">是</el-radio>
              <el-radio :label="false">否</el-radio>
            </el-radio-group>
          </div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="24" class="item">
          <div class="label">验收说明</div>
          <div class="value">
            <el-input v-model="checkNote" placeholder="请输入内容" />
          </div>
        </el-col>
      </el-row>
    </div>

    <div v-if="detailList.examineStatus == 'OK' || detailList.examineStatus == 'FAIL'" class="diy-table-1">
      <el-row :gutter="0">
        <el-col :xs="12" :sm="12" :lg="12" class="item">
          <div class="label">验收人</div>
          <div class="value">{{ detailList.checkBy }}</div>
        </el-col>
        <el-col :xs="12" :sm="12" :lg="12" class="item dateS">
          <div class="label">受理日期</div>
          <div class="value">
            <el-date-picker
              v-model="detailList.checkDate"
              readonly
              prefix-icon="''"
              class="selectStyle"
              type="datetime"
              placeholder=""
              default-time="00:00:00"
              value-format="yyyy-MM-dd HH:mm:ss"
            />
          </div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="24" class="item">
          <div class="label">是否退押</div>
          <div class="value">
            <el-radio-group v-model="detailList.isRefundDeposit" disabled>
              <el-radio readonly :label="true">是</el-radio>
              <el-radio readonly :label="false">否</el-radio>
            </el-radio-group>
          </div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="24" class="item dateS">
          <div class="label">验收说明</div>
          <div class="value">
            <el-input v-model="detailList.checkNote" readonly placeholder="请输入内容" />
          </div>
        </el-col>
        <el-col :xs="12" :sm="24" :lg="24" class="item dateS">
          <div class="label">审批通过后备注</div>
          <div class="value">
            <el-input v-model="detailList.examineAfterRemark" readonly placeholder="请输入内容" />
          </div>
        </el-col>
      </el-row>
    </div>
    <div>
      <h3 class="gdzl">补充资料</h3>
      <el-divider />
      <!-- 列表 -->
      <div class="mymain-container">
        <div class="table">
          <el-table
            v-loading="listLoading"
            :data="amendData"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            stripe
          >
            <el-table-column align="left" label="资料描述" prop="dataDescribe" min-width="160" show-overflow-tooltip />
            <el-table-column align="left" label="原文件名" prop="fileName" min-width="160" show-overflow-tooltip />
            <el-table-column align="left" label="缩略图" prop="fileUrl" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-image
                  v-if="checkFileType(scope.row.fileUrl) == 'image'"
                  ref="img"
                  :src="imageURL + scope.row.fileUrl"
                  style="width: 120px; height: 120px"
                  fit="cover"
                  :preview-src-list="[imageURL + scope.row.fileUrl]"
                />
                <img v-if="checkFileType(scope.row.fileUrl) == 'word'" class="file" src="@/assets/common/word.png" />
                <img v-if="checkFileType(scope.row.fileUrl) == 'excel'" class="file" src="@/assets/common/excel.png" />
                <img v-if="checkFileType(scope.row.fileUrl) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
                <img v-if="checkFileType(scope.row.fileUrl) == 'pdf'" class="file" src="@/assets/common/pdf.png" />
                <img
                  v-if="checkFileType(scope.row.fileUrl) == 'file'"
                  class="file aaa"
                  src="@/assets/common/zip.jpeg"
                />
              </template>
            </el-table-column>
            <el-table-column align="left" label="下载文件名称" prop="fileName" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ '资料_' + scope.row.fileName }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作" min-width="160" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-button type="text" class="textColor" @click="downLoadFn(scope.row.fileUrl, scope.row.fileName)"
                  >下载</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="diy-table-1">
          <el-row :gutter="0">
            <el-col :xs="12" :sm="12" :lg="12" class="item">
              <div class="label">上传人</div>
              <div class="value">
                {{ detailList.amendBy }}
              </div>
            </el-col>
            <el-col :xs="12" :sm="12" :lg="12" class="item">
              <div class="label">上传时间</div>
              <div class="value">
                {{ detailList.amendTime }}
              </div>
            </el-col>
            <el-col :xs="12" :sm="24" :lg="24" class="item">
              <div class="label">补充说明</div>
              <div class="value">
                {{ detailList.amendRemark }}
              </div>
            </el-col>
          </el-row>
        </div>
        <div v-if="detailList.examineStatus == 'AMEND'">
          <h3 class="gdzl">复核</h3>
          <el-divider />
          <div class="diy-table-1">
            <el-row :gutter="0">
              <el-col :xs="12" :sm="12" :lg="12" class="item">
                <div class="label">复核人</div>
                <div class="value">
                  <el-input v-model="detailList.reviewBy" placeholder="请输入" />
                </div>
              </el-col>
              <el-col :xs="12" :sm="12" :lg="12" class="item">
                <div class="label">复核时间</div>
                <div class="value">
                  <el-date-picker
                    v-model="detailList.reviewTime"
                    class="dateStyle"
                    type="datetime"
                    placeholder="选择日期"
                    default-time="00:00:00"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  />
                </div>
              </el-col>
              <el-col :xs="12" :sm="24" :lg="24" class="item">
                <div class="label">复核说明</div>
                <div class="value">
                  <input v-model="detailList.reviewRemark" type="text" />
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </div>
    </div>
    <div v-if="detailList.examineStatus == 'OK' || detailList.examineStatus == 'AMEND'">
      <div>
        <h3>上传资料</h3>
        <el-divider />
        <!-- 筛选条件 -->
        <div>
          <el-form ref="form" :model="detailList" label-width="100px" size="small" label-position="left">
            <el-row :gutter="20">
              <el-col :xs="24" :sm="12" :lg="24">
                <el-form-item label="工程验收资料" prop="">
                  <imageUpload
                    :file-list="fileList"
                    :multiple="true"
                    :start-restricting="true"
                    :restrict-filename="restrictFilename"
                  />
                </el-form-item>
              </el-col>

              <el-col :xs="24" :sm="12" :lg="6">
                <el-form-item label="上传人" prop="amendBy">
                  <el-input v-model="detailList.amendBy" placeholder="请输入" />
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="12" :lg="6">
                <el-form-item label="上传时间" prop="amendTime">
                  <el-date-picker
                    v-model="detailList.amendTime"
                    class="dateStyle"
                    type="datetime"
                    placeholder="选择日期"
                    default-time="00:00:00"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  />
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="12" :lg="18">
                <el-form-item label="补充说明" prop="amendRemark">
                  <el-input
                    v-model="detailList.amendRemark"
                    type="textarea"
                    placeholder="请输入"
                    class="textareaStyle"
                  />
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="">
                  <el-button type="primary" size="small" @click="replenishClick">保存</el-button>
                  <el-button type="primary" size="small" @clikc="resetClick">重置</el-button>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </div>
    </div>
    <br />

    <!-- 按钮 -->
    <!-- detailList.examineStatus != 'OK' || detailList.examineStatus != 'FAIL' -->
    <div class="btn-group clearfix">
      <!-- <div class="fl">
        <el-button v-if="detailList.examineStatus == 'WAIT'" type="primary" size="small"
          @click="adoptFn">审批通过</el-button>
        <el-button v-if="detailList.examineStatus == 'WAIT'" type="primary" size="small"
          @click="rejectFn">审批驳回</el-button>
        <el-button v-if="detailList.examineStatus == 'OK'" type="primary" size="small" @click="saveFn">保存</el-button>
      </div> -->
    </div>
  </div>
</template>

<script>
import imageUpload from '@/components/Common/image-upload.vue'
import { downloadFiles, downloadPdf } from '@/utils/util'
import { getFileUrl } from '@/api/common'
import { mapGetters } from 'vuex'
import {
  getDepositManageDetail,
  getDepositManageExamine,
  getDepositManageDownZip,
  getDepositManageEdit,
  getCommonFileGetStream,
  addAmendData
} from '@/api/engin_deposit/refund_list'
import { applyDeposit, computeDiff } from '@/api/engin_deposit.js'

import ret from 'bluebird/js/release/util'
export default {
  components: { imageUpload },
  props: {
    detailId: {
      type: String,
      required: true
    }
  },
  computed: {
    ...mapGetters(['name']),
    comTotal() {
      return (qty, price) => {
        console.log(qty, price)
        return Number(qty) * Number(price)
      }
    }
  },
  data() {
    return {
      isCustomer: JSON.parse(localStorage.getItem('supply_user')).isCustomer,
      isDis: true,
      imageURL: this.$imageUrl,
      title: '审批',
      imageURL: this.$imageUrl,
      listLoading: false, // 列表加载loading
      dataList: [], // 列表数据
      detailList: {},
      checkBy: '',
      checkDate: '',
      isRefundDeposit: true,
      baseURL: '',
      fileList: [],
      checkNote: '',
      restrictFilename: ['结算单', '合同', '明细表', '审核表', '收据', '发票', '照片', '相片'],
      datTate: new Date(),
      amendData: [],
      original: []
    }
  },
  watch: {
    'detailList.items': {
      handler(newValue, oldValue) {
        if (newValue && newValue.length) {
          newValue.forEach((item, index) => {
            item.contractAmount = Number(item.contractQty) * Number(item.contractPrice)
          })
        }
        this.detailList.items = newValue
      },
      immediate: true,
      deep: true
    }
  },
  created() {
    this.checkBy = this.name
    this.getData({ id: this.detailId })
  },
  methods: {
    // 审批通过后可以编辑
    async saveFn() {
      console.log(this.detailList)
      await getDepositManageEdit(this.detailList)
      this.$message.success('保存成功')
      this.goBack()
      this.$emit('updateList')
    },
    // 批量下载
    async batchDownloadFn() {
      downloadFiles('deposit-manage/downZip', { parentId: this.detailId })
    },
    // 下载
    async downLoadFn(v, name) {
      // getCommonFileGetStream({ key: v, fileName: name }).then((res) => {
      //   // window.open(res.data);
      // });
      // // window.open(this.imageURL + v);
      downloadFiles('common/file/getStream', { key: v, fileName: name })
      // await getCommonFileGetStream({ key: v, fileName: name });
    },
    // 检查文件类型
    checkFileType(url) {
      if (!url) return ''
      const fileSuffix = url.substring(url.lastIndexOf('.') + 1)

      if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
        return 'image'
      } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
        return 'word'
      } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
        return 'excel'
      } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
        return 'ppt'
      } else if (['pdf'].includes(fileSuffix)) {
        return 'pdf'
      } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
        return 'file'
      } else {
        return ''
      }
    },
    // 计算收差金额
    setDataQty(e, row) {
      // eslint-disable-next-line no-return-assign
      if (!row.dataQty) return (row.dataQty = 0)
      row.saleTypeId = this.detailList.saleTypeId
      computeDiff(row).then(res => {
        row.diffAmount = res.data.diffAmount
        row.diffPolicyPrice = res.data.diffPolicyPrice
        // this.$successMsg('已计算收差金额')
      })
    },
    // 审批驳回
    async rejectFn() {
      this.$confirm('此操作将驳回订单, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          if (this.isCustomer) {
            for (let i = 0; i < this.detailList.items.length; i++) {
              this.detailList.items[i].contractAmount =
                this.detailList.items[i].contractQty * this.detailList.items[i].contractPrice
              if (!this.detailList.items[i].contractAmount) {
                return this.$errorMsg('合同单价、合同数量不能为空')
              }
            }
          }

          //     this.detailList.items.map(e=>{
          //     e.contractAmount = e.contractQty * e.contractPrice
          //     if (!e.contractAmount) {
          //       return this.$errorMsg('合同单价、合同数量不能为空')
          //     }
          // })

          const data = {
            ...this.detailList,
            checkBy: this.checkBy,
            // checkDate: this.checkDate,
            isRefundDeposit: this.isRefundDeposit,
            checkNote: this.checkNote,
            examineResult: 0
          }

          if (!this.detailList.items.every(e => e.dataQty)) {
            this.$confirm(`上交资料为0，是否继续提交`, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            })
              .then(() => {
                getDepositManageExamine(data)
                  .then(res => {
                    if (!res.data) {
                      this.goBack()
                      this.$emit('updateList')
                    } else {
                      this.$confirm('审批成功！是否跳转下一张待审批订单?', '提示', {
                        confirmButtonText: '跳转',
                        cancelButtonText: '取消',
                        type: 'warning'
                      })
                        .then(() => {
                          this.$successMsg('进入下一张待审批订单')
                          this.detailList = res.data
                        })
                        .catch(() => {
                          this.goBack()
                          this.$emit('updateList')
                        })
                    }
                  })
                  .finally(res => {})
              })
              .catch(() => {})
          } else {
            getDepositManageExamine(data)
              .then(res => {
                if (!res.data) {
                  this.goBack()
                  this.$emit('updateList')
                } else {
                  this.$confirm('审批成功！是否跳转下一张待审批订单?', '提示', {
                    confirmButtonText: '跳转',
                    cancelButtonText: '取消',
                    type: 'warning'
                  })
                    .then(() => {
                      this.$successMsg('进入下一张待审批订单')
                      this.detailList = res.data
                    })
                    .catch(() => {
                      this.goBack()
                      this.$emit('updateList')
                    })
                }
              })
              .finally(res => {})
          }
        })
        .catch(() => {})
      // if (!this.detailList.installDate) {
      //   this.$message.error("请选择安装时间");
      //   return;
      // }
      // let data = {
      //   ...this.detailList,
      //   checkBy: this.checkBy,
      //   // checkDate: this.checkDate,
      //   isRefundDeposit: this.isRefundDeposit,
      //   checkNote: this.checkNote,
      //   examineResult: 0,
      // };
      // await getDepositManageExamine(data);
      // this.$message.success("审批驳回");
      // this.goBack();
      // this.$emit("updateList");
    },
    // 审批通过
    async adoptFn() {
      this.$confirm('此操作将审批订单, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          if (!this.detailList.installDate) {
            this.$message.error('请选择安装时间')
            return
          }

          if (this.isCustomer) {
            for (let i = 0; i < this.detailList.items.length; i++) {
              this.detailList.items[i].contractAmount =
                this.detailList.items[i].contractQty * this.detailList.items[i].contractPrice
              if (!this.detailList.items[i].contractAmount) {
                return this.$errorMsg('合同单价、合同数量不能为空')
              }
            }
          }

          const data = {
            ...this.detailList,
            checkBy: this.checkBy,
            // checkDate: this.checkDate,
            isRefundDeposit: this.isRefundDeposit,
            checkNote: this.checkNote,
            examineResult: 1
          }

          if (!this.detailList.items.every(e => e.dataQty)) {
            this.$confirm(`上交资料为0，是否继续提交`, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            })
              .then(() => {
                getDepositManageExamine(data)
                  .then(res => {
                    if (!res.data) {
                      this.goBack()
                      this.$emit('updateList')
                    } else {
                      this.$confirm('审批成功！是否跳转下一张待审批订单?', '提示', {
                        confirmButtonText: '跳转',
                        cancelButtonText: '取消',
                        type: 'warning'
                      })
                        .then(() => {
                          this.$successMsg('进入下一张待审批订单')
                          this.detailList = res.data
                        })
                        .catch(() => {
                          this.goBack()
                          this.$emit('updateList')
                        })
                    }
                  })
                  .finally(res => {})
              })
              .catch(() => {})
          } else {
            getDepositManageExamine(data)
              .then(res => {
                if (!res.data) {
                  this.goBack()
                  this.$emit('updateList')
                } else {
                  this.$confirm('审批成功！是否跳转下一张待审批订单?', '提示', {
                    confirmButtonText: '跳转',
                    cancelButtonText: '取消',
                    type: 'warning'
                  })
                    .then(() => {
                      this.$successMsg('进入下一张待审批订单')
                      this.detailList = res.data
                    })
                    .catch(() => {
                      this.goBack()
                      this.$emit('updateList')
                    })
                }
              })
              .finally(res => {})
          }
        })
        .catch(() => {})

      // if (!this.detailList.installDate) {
      //   this.$message.error("请选择安装时间");
      //   return;
      // }
      // let data = {
      //   ...this.detailList,
      //   checkBy: this.checkBy,
      //   // checkDate: this.checkDate,
      //   isRefundDeposit: this.isRefundDeposit,
      //   checkNote: this.checkNote,
      //   examineResult: 1,
      // };
      // await getDepositManageExamine(data);
      // this.$message.success("审批通过");
      // this.goBack();
      // this.$emit("updateList");
    },
    async getData(data) {
      const res = await getDepositManageDetail(data)
      console.log(res)
      if (res.data.dataList.length == 0) {
        this.isDis = true
      } else {
        this.isDis = false
      }
      const arr = []
      res.data.items.forEach(item => {
        if (Number(item.qty) > 0) {
          arr.push(item)
        }
        // item.number = (item.qty*100 - item.directTransferQty*100 - item.retiredQty*100) / 100;
        item.sums1 = ['orderHasSendQty', 'dataQty', 'qty', 'hasSendQty', 'contractQty']
        item.sums2 = [
          'totalAmount',
          'diffAmount',
          'price',
          'depositAmount',
          'contractPrice',
          'comTotal',
          'contractAmount'
        ]
      })
      res.data.collectList.forEach(item => {

// item.number = (item.qty*100 - item.directTransferQty*100 - item.retiredQty*100) / 100;
item.sums1 = ['orderHasSendQty', 'dataQty', 'hasSendQty']
item.sums2 = [ 'price', 'refundDepositAmount', 'depositAmount']
})
      res.data.items = arr
      this.amendData = res.data.dataList.filter(k => k.dataPosition == 'AMEND')
      this.original = res.data.dataList.filter(k => k.dataPosition != 'AMEND')
      res.data.realUseUnit =res.data.realUseUnit || res.data.refUseUnit
          res.data.realInstallAddress =   res.data.realInstallAddress ||res.data.refInstallAddress
      this.detailList = res.data
      if (res.data.examineStatus == 'SAVE' || res.data.examineStatus == 'OK' || res.data.examineStatus == 'FAIL') {
        this.title = '详情'
      }
    },
    goBack() {
      this.$emit('setShowPage', 0)
    },
    resetClick() {
      this.detailList.amendName = ''
      this.detailList.amendTime = ''
      this.fileList = []
    },
    replenishClick() {
      var arr = []
      if (this.fileList.length) {
        this.fileList.forEach(el => {
          arr.push({
            dataDescribe: el.name,
            enginOrderNo: this.detailList.refEnginRecordNo,
            fileName: el.name,
            fileUrl: el.url,
            dataPosition: 'AMEND'
          })
        })
      } else {
        this.$errorMsg('请补充资料')
        return
      }

      addAmendData({
        ...this.detailList,
        dataList: arr
      }).then(res => {
        this.$successMsg('已提交')
        this.goBack()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.inpt {
  ::v-deep .el-input__inner {
    text-align: right;
  }
}

.aaa {
  height: 64px;
  width: 64px;
}

.dateS {
  .value {
    padding: 0;
  }
}

.batchDownload {
  float: right;
  margin-top: 9px;
}

.gdzl {
  display: inline-block;
}

.dateStyle {
  width: 100%;
}

.label {
  width: 150px !important;
}

.selectStyle {
  width: 100%;
}

.flex {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
