<template>
  <div class="index flex column">
    <div class="serach flex row space-between">
      <el-button class="blackbtn" icon="el-icon-plus" @click="addCategory">申请新品牌</el-button>
    </div>
    <e-table class="table" ref="eTable" :tableHeadConfig="tableHeadConfig" :tableLoadData="tableLoadData"
      :pageShow="true" :total="searchForm.total" :currentPage="searchForm.page" :pageSize="searchForm.pageSize"
      @getPageList="getPageList" @changeSort="changeSort" showIndex="true">
      <template v-slot:operation="slotData">
        <div class="operationDiv">
          <el-button type="text" @click="toView(slotData.data.row)">查看</el-button>
        </div>
      </template>
    </e-table>
  </div>
</template>

<script>
  import eTable from '@/components/base-table'
  import {
    list,
  } from '@/api/brand'
  import store from '@/store/index'
  export default {
    name: "brand",
    components: {
      eTable
    },
    data() {
      return {
        searchForm: {
          total: 0,
          page: 1,
          pageSize: 10,
        },
        tableHeadConfig: [{
            label: '申请品牌',
            prop: 'brand_wording',
            isShow: true,
          },
          {
            label: '商标分类',
            prop: 'trademark_type',
            isShow: true,
          },
          {
            label: '经营类型',
            prop: 'brand_management_type',
            isShow: true,
          },
          {
            label: '申请时间',
            prop: 'create_time',
            isShow: true,
          },
          {
            label: '申请结果',
            prop: 'status',
            isShow: true,
          },
          {
            label: '操作',
            columnType: 'operation',
            slotName: 'operation',
            width: 200,
            isShow: true,
          }
        ],
        tableLoadData: [],
      };
    },
    created() {},
    methods: {
      getPageList(pageRequest) {
        if (pageRequest) {
          this.searchForm.page = pageRequest.pageIndex;
          this.searchForm.pageSize = pageRequest.pageSize;
        }
        list(this.searchForm).then(res => {
          this.searchForm.total = res.data.totalCount
          this.tableLoadData = res.data.list
        })
      },
      addCategory() { // 申请品牌
        this.$router.push({
            name: "addBrand",
            params: {
              isNew:true
            }
          });
      },
      toView(row) {
        this.$router.push({
          name: "brandDetail",
          params: {
            brand_info_id: row.brand_info_id
          }
        });
      },
    },
    activated(){
       this.getPageList()
    },
    mounted() {
    }
  };
</script>
<style lang="less" scoped>
  .btn_search {
    margin-left: 10px;
  }

  .serach {
    margin-bottom: 10px;
  }
</style>