<template>
  <div class="add-accounts">
    <!-- <div slot="bar">
      <div>
        业务审核
      </div>
    </div> -->
    <div slot="bottom">
      <div style="min-height: auto;">
        <!-- 出账 -->
        <edit-exit-account v-if="settleType === '2'" ref="exitAccountsContent" :disabled="disabled"></edit-exit-account>
        <!-- 入账 -->
        <add-accounts-content v-else ref="addAccountsContent" :disabled="disabled" />
        <div v-if="!disabled" class="submit-btn">
          <el-button style="width: 150px;" @click="() => { $router.go(-1) }">取消</el-button>
          <el-button style="width: 150px;" type="primary" @click="onSubmit">确定</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import AddAccountsContent from './components/AddAccountsContent.vue'
import EditExitAccount from './components/EditExitAccount'
import { onSubmit } from '@/api/financialManagement/financialManagement'
export default {
  name: 'BiddingManagementTemplateReview',
  components: {
    AddAccountsContent,
    EditExitAccount
  },
  data() {
    return {

    }
  },
  computed: {
    settleType() {
      return this.$route.query.entryOutType
    },
    disabled() {
      return this.$route.query.type === 'see'
    }
  },
  methods: {
    onSubmit() {
      this.submitEntryFinance()
    },
    // 提交入账
    submitEntryFinance() {
      this.$refs.addAccountsContent.getParams().then(data => {
        const params = {
          ...data
        }
        onSubmit(params).then(() => {
          this.$message.success('提交成功')
          this.$router.push({ name: 'FinancialManagement' })
        })
      })
    }
    // 提交出账
    // submitExitFinance() {
    //   console.log('出账提交')
    //   console.log('submitExitFinance-----')
    // }
  }
}
</script>

<style lang="scss" scoped>
  /* .template-examine .submit-btn {
    position: absolute;
    bottom: 40px;
    right: 40px;
  } */
</style>
