<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">
        <div class="titwu"><span>单车返利核对审核申请</span></div>
        <el-form ref="form_obj" :model="formobj" :rules="rules" class="formadd">
          <div class="title">
            <div>本月各项返利核对情况</div>
          </div>
          <el-table :key="tableKey" :data="formobj.baseVehinstallModpricedetails" :index="index" border style="width: 100%">
            <el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
            <el-table-column label="返利类型" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.rebateTypeValue }}</span>
              </template>
            </el-table-column>
            <el-table-column label="数量" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.num }}</span>
              </template>
            </el-table-column>
            <el-table-column label="预提金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.withRebate }}</span>
              </template>
            </el-table-column>
            <el-table-column label="上传金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.uploadMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="待确认金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.stayDetermineMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="调整金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.adjustmentMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="费用" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.money }}</span>
              </template>
            </el-table-column>
            <el-table-column label="明细" align="center">
              <template slot-scope="scope">
                <el-button type="primary" size="mini" @click="handleLook(scope.row)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="title">
            <div>预提返利本月核对情况</div>
          </div>
          <el-table :key="baseVehinstallModpriceKey" :data="formobj.baseVehinstallModprice" :index="index" border style="width: 100%">
            <el-table-column fixed width="80px" label="序号" type="index" :index="index + 1" align="center"/>
            <el-table-column label="预提年月" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.palceGenDate }}</span>
              </template>
            </el-table-column>
            <el-table-column label="预提数量" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.withholdingAmount }}</span>
              </template>
            </el-table-column>
            <el-table-column label="预提金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.withRebate }}</span>
              </template>
            </el-table-column>
            <el-table-column label="上传数量" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.uploadAmount }}</span>
              </template>
            </el-table-column>
            <el-table-column label="上传金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.uploadMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="待确认金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.stayDetermineMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="调整金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.adjustmentMoney }}</span>
              </template>
            </el-table-column>
            <el-table-column label="费用" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.money }}</span>
              </template>
            </el-table-column>
            <el-table-column label="未上传数量" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.notUploadedAmount }}</span>
              </template>
            </el-table-column>
            <el-table-column label="未上传金额" align="center">
              <template slot-scope="scope">
                <span>{{ scope.row.notUploadedCost }}</span>
              </template>
            </el-table-column>
          </el-table>
          <el-row>
            <el-col :span="4">
              <span>备注</span>
            </el-col>
            <el-col :span="20">
              <el-form-item><el-input v-model="formobj.remarks" placeholder="" class="addinputw" clearable></el-input></el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
    <!--End 添加修改部分-->
    <bicyclerebatetobecheckedInfo v-show="viewState == 2" ref="divAdd" @doback="resetState"/>
  </div>
</template>

<script>
import req from '@/api/othermenu/shangzhuangtiaojia'
import bicyclerebatetobecheckedInfo from './relation/bicyclerebatetobecheckedInfo'

export default {
  name: 'bicyclerebatecheckInfo',
  components: {
    yiheduidanchefanli,
    bicyclerebatetobecheckedInfo
  },
  data() {
    return {
      viewTitle: '',
      index: 0,
      tableKey: 0,
      baseVehinstallModpriceKey: 1,
      viewState: 1,
      // 表单数据
      formobj: {},
      rules: {},
      submitdisabled: false
    }
  },
  methods: {
    showInfo(row) {
      this.$nextTick(() => {
        this.$refs['form_obj'].clearValidate()
      })
      this.viewTitle = '单车返利核对审核申请详情'
      console.log('编辑回显', row.sid)
      req.fetchBySid(row.sid).then((resp) => {
        this.formobj = resp.data
      }).catch((e) => {
        this.formobj = row
      })
    },
    // 返回（===既判断）
    handleReturn(isreload) {
      if (isreload === 'true') this.$emit('reloadlist')
      // 表单数据
      this.formobj = {}
      this.$refs['form_obj'].resetFields()
      this.$emit('doback')
    }
  }
}
</script>
<style scoped>
</style>

