<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="广告主ID">
              <a-input placeholder="请输入广告主ID" v-model="queryParam.id"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="广告主名称">
              <a-input placeholder="请输入广告主名称" v-model="queryParam.accountName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="公司名称">
              <a-input placeholder="请输入公司名称" v-model="queryParam.corporationName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="审核状态">
              <a-select v-model="queryParam.reviewStatus" placeholder="请选择审核状态">
                <a-select-option :value="1">审核中</a-select-option>
                <a-select-option :value="2">审核通过</a-select-option>
                <a-select-option :value="3">审核拒绝</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button type="primary" icon="download" @click="handleExportXls('快手代理商账户表')">导出</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span slot="createTime" slot-scope="text">{{ text.split(' ')[0] }}</span>
      </a-table>
    </div>
    <!-- table区域-end -->
  </a-card>
</template>

<script>
import KuaishouAgentAccountModal from './modules/KuaishouAgentAccountModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'KuaishouAgentAccountList',
  mixins: [JeecgListMixin],
  components: {
    KuaishouAgentAccountModal
  },
  data() {
    return {
      description: '快手代理商账户表管理页面',
      // 表头
      columns: [
        {
          title: '广告主ID',
          align: 'center',
          dataIndex: 'accountId'
        },
        {
          title: '用户ID',
          align: 'center',
          dataIndex: 'userId'
        },
        {
          title: '广告主名称',
          align: 'center',
          dataIndex: 'accountName'
        },
        {
          title: '现金余额',
          align: 'center',
          dataIndex: 'balance'
        },
        {
          title: '信用余额',
          align: 'center',
          dataIndex: 'creditBalance'
        },
        // {
        //      title: 'extendedBalance',
        //      align:"center",
        //      dataIndex: 'extendedBalance'
        //     },
        {
          title: '返点余额',
          align: 'center',
          dataIndex: 'rebate'
        },
        // {
        //      title: 'preRebate',
        //      align:"center",
        //      dataIndex: 'preRebate'
        //     },
        {
          title: '框返余额',
          align: 'center',
          dataIndex: 'contractRebate'
        },
        {
          title: '激励余额',
          align: 'center',
          dataIndex: 'directRebate'
        },
        {
          title: '总余额',
          align: 'center',
          dataIndex: 'totalBalance'
        },
        // {
        //      title: 'kuaibiBalance',
        //      align:"center",
        //      dataIndex: 'kuaibiBalance'
        //     },
        // {
        //      title: 'pushBalance',
        //      align:"center",
        //      dataIndex: 'pushBalance'
        //     },
        // {
        //      title: 'recharged',
        //      align:"center",
        //      dataIndex: 'recharged'
        //     },
        {
          title: '公司名称',
          align: 'center',
          dataIndex: 'corporationName'
        },
        {
          title: '开户时间',
          align: 'center',
          dataIndex: 'createTime',
          scopedSlots: { customRender: 'createTime' }
        },

        {
          title: '审核状态',
          align: 'center',
          dataIndex: 'reviewStatus',
          customRender: (text, row, index) => {
            if (text == 1) {
              // 前4行数据以a标签的形式被渲染
              return '审核中'
            } else if (text == 2) {
              return '审核通过'
            } else if (text == 3) {
              return '审核拒绝'
            }
          }
        }
        // {
        //      title: 'frozenStatus',
        //      align:"center",
        //      dataIndex: 'frozenStatus'
        //     },
        // {
        //      title: 'transferAccountStatus',
        //      align:"center",
        //      dataIndex: 'transferAccountStatus'
        //     },
      ],
      url: {
        list: '/kuaishou/kuaishouAgentAccount/list',
        delete: '/kuaishou/kuaishouAgentAccount/delete',
        deleteBatch: '/kuaishou/kuaishouAgentAccount/deleteBatch',
        exportXlsUrl: 'kuaishou/kuaishouAgentAccount/exportXls'
      }
    }
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
