<template>
  <div class="open-main-content">
    <flow-picture style="margin-bottom: 10px;" />
    <template v-if="!tableData.length">
      <empty />
    </template>
    <template v-else>
      <div class="search">
        <div slot="left" />
        <div slot="right">
          <div>
            <el-button type="primary" @click="handlerOperate('add', { id: 'add'})">提交开户资料</el-button>
          </div>
        </div>
      </div>
      <cy-comm-table
        ref="commTable"
        v-loading="loading"
        style="margin-top: 10px;"
        :columns="columns"
        :table-options="{}"
        :data="tableData"
        :count="total"
      />
    </template>
    <cy-dialog ref="failreasonDialog" title="报错原因" top="15vh">
      <cy-comm-table
        :columns="reasonColumns"
        :data="reasonList"
      />
      <div class="submit-btn">
        <el-button @click="() => { this.$refs.failreasonDialog.show = false }">取消</el-button>
      </div>
    </cy-dialog>
    <authorization ref="authorizationRef" :active-info="authActiveInfo" :fresh-page="true" />
  </div>
</template>

<script>
import mainContentTable from './mainContentTable'
import { getList } from '@/api/accountCenter/openInfoManage'
export default {
  components: {
    Empty: () => import('../components/Empty.vue'),
    FlowPicture: () => import('../components/FlowPicture.vue'),
    Authorization: () => import('../cyAccountManage/components/Authorization.vue')
  },
  mixins: [mainContentTable],
  data() {
    return {
      tableData: [],
      loading: false,
      authActiveInfo: []
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData(type) {
      if (type === 'search') {
        this.page = 1
        this.size = 10
      }
      this.loading = true
      const params = {
        // page: this.page || 1,
        // rows: this.size || 10
      }
      getList(params).then(({ data }) => {
        this.loading = false
        this.tableData = data
        // this.total = data.records
      })
    }
  }

}
</script>

<style lang="scss" scoped>
.open-main-content {

}

</style>
