<template>
  <div class="app-container">
    <div v-show="viewState == 1">
      <!--标题按钮部分开始-->
      <div class="tab-header webtop">
        <!--标题-->
        <div>{{ viewTitle }}</div>
        <!--start 添加修改按钮-->
        <div>
          <el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
        </div>
      </div>
      <!--标题按钮部分结束-->
      <!--Start 新增修改部分-->
      <div class="listconadd">
        <el-form ref="form_obj" class="formadd">
          <el-table :key="tableKey" :data="list" :index="index" border style="width: 100%">
            <el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
            <el-table-column fixed label="操作" align="center" width="80">
              <template slot-scope="scope">
                <el-button type="primary" size="mini" @click="handleLook(scope.row)">查看</el-button>
              </template>
            </el-table-column>
            <el-table-column prop="createOrgName" label="分公司" align="center" width="150" />
            <el-table-column prop="purchaseSystemName" label="采购系统" align="center" width="140" />
            <el-table-column prop="brandName" label="品牌" align="center" />
            <el-table-column prop="createTime" label="创建日期" align="center" width="120" />
            <el-table-column prop="rebateTypeValue" label="返利类型" align="center" width="120" />
            <el-table-column prop="rebateName" label="返利名称" align="center" width="150" />
            <el-table-column prop="estimateRebate" label="预计返利" align="center" width="150" />
            <el-table-column prop="withholdCost" label="其中预提费用" align="center" width="150" />
            <el-table-column prop="palceGenDate" label="所属年月" align="center" width="120" />
            <el-table-column prop="uploadDate" label="上传日期" align="center" width="120" />
            <el-table-column prop="uploadMoney" label="上传金额" align="center" width="150" />
            <el-table-column prop="secondaryUploadDate" label="二次上传日期" align="center" width="140" />
            <el-table-column prop="secondaryUploadMoney" label="二次上传金额" align="center" width="140" />
            <el-table-column prop="stayDetermineMoney" label="其中待确定金额" align="center" width="150" />
            <el-table-column prop="money" label="其中费用" align="center" width="150" />
            <el-table-column prop="diffAmount" label="差异金额" align="center" width="120" />
            <el-table-column prop="isAdjustment" label="是否调整" align="center" width="120" />
            <el-table-column prop="adjustmentMoney" label="调整金额" align="center" width="150" />
            <el-table-column prop="adjustmentRemarks" label="调整说明" align="center" width="300" />
          </el-table>
        </el-form>
      </div>
    </div>
    <!--End 添加修改部分-->
    <specialrebatemanagementInfo v-show="viewState == 2" ref="divZhuanXiang" @doback="resetState" />
  </div>
</template>

<script>
import req from '@/api/specialrebate/specialrebatecheck'
import specialrebatemanagementInfo from '../../specialrebatemanagement/specialrebatemanagementInfo'

export default {
  name: 'SepcialRebateToBeCheckedInfo',
  components: {
    specialrebatemanagementInfo
  },
  data() {
    return {
      viewTitle: '',
      index: 0,
      tableKey: 0,
      viewState: 1,
      sids: [],
      // 表单数据
      list: [],
      rules: {},
      submitdisabled: false
    }
  },
  methods: {
    showInfo(sid, specialRebateSids) {
      this.$nextTick(() => {
        this.$refs['form_obj'].clearValidate()
      })
      this.viewTitle = '专项返利核对审核申请明细'
      req.specialRebateGroupDetails({ applySid: sid, specialRebateSids: specialRebateSids }).then((resp) => {
        if (resp.success) {
          this.list = resp.data
        }
      }).catch((e) => {
        this.list = []
      })
    },
    handleLook(row) {
      this.viewState = 2
      this.$refs['divZhuanXiang'].showInfo({ sid: row.specialRebateSid })
    },
    resetState() {
      this.viewState = 1
    },
    // 返回（===既判断）
    handleReturn() {
      // 表单数据
      this.list = []
      this.$refs['form_obj'].resetFields()
      this.$emit('doback')
    }
  }
}
</script>
<style scoped>
</style>

