<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="企业名称">
              <a-input placeholder="请输入企业名称" v-model="queryParam.companyName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="平台">
              <a-input placeholder="请输入平台名称" v-model="queryParam.platformName"></a-input>
            </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>
              <!--<a @click="handleToggleSearch" style="margin-left: 8px">-->
                <!--{{ toggleSearchStatus ? '收起' : '展开' }}-->
                <!--<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
              <!--</a>-->
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    
    <!-- 操作按钮区域 -->
    <div class="table-operator">

    </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="action" slot-scope="text, record">
              <a @click="handleMoney(record)" v-has="'cpaccount:recharge'">充值</a>
              <a-divider type="vertical" v-has="'cpaccount:detail'"/>
              <a @click="handleDetail(record)" v-has="'cpaccount:detail'">收支明细</a>
        </span>

      </a-table>
    </div>
    <HlgCpAccountRechargeModal ref="cpRechargeModal" @ok="modalFormOk"></HlgCpAccountRechargeModal>
    <HlgCpAccountPaymentDetailsModal ref="paymentDetailsModalForm" @ok="modalFormOk"></HlgCpAccountPaymentDetailsModal>
  </a-card>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import HlgCpAccountRechargeModal from './modules/HlgCpAccountRechargeModal'
  import HlgCpAccountPaymentDetailsModal from './modules/HlgCpAccountPaymentDetailsModal'

  export default {
    name: "HlgCpAccountList",
    mixins:[JeecgListMixin],
    components: {
      HlgCpAccountRechargeModal,
      HlgCpAccountPaymentDetailsModal
    },
    data () {
      return {
        description: 'hlg_cp_account管理页面',
        // 表头
        columns: [
          {
            title:'企业名称',
            align:"left",
            dataIndex: 'companyName',
          },
          {
            title:'平台',
            align:"left",
            dataIndex: 'platformName'
          },
          {
            title:'当前余额',
            align:"left",
            dataIndex: 'balance'
          },
          {
            title:'总充值金额',
            align:"left",
            dataIndex: 'totalDeposit'
          },
          {
            title:'总付款金额',
            align:"left",
            dataIndex: 'totalPayment'
          },
          {
            title:'总服务费',
            align:"left",
            dataIndex: 'totalDepositServiceFee'
          },
          {
            title: '操作',
            align: 'left',
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/hlgcpmanager/hlgCpAccount/list",
          delete: "/hlgcpmanager/hlgCpAccount/delete",
          deleteBatch: "/hlgcpmanager/hlgCpAccount/deleteBatch",
          exportXlsUrl: "/hlgcpmanager/hlgCpAccount/exportXls",
          importExcelUrl: "hlgcpmanager/hlgCpAccount/importExcel",
        },
        dictOptions:{
        } 
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      initDictConfig(){
      },
      handleMoney(record) {
        this.$refs.cpRechargeModal.edit(record)
        this.$refs.cpRechargeModal.title = '充值'
        this.$refs.cpRechargeModal.disableSubmit = false
      },
      handleDetail(record) {
        this.$refs.paymentDetailsModalForm.edit({ ...record })
        this.$refs.paymentDetailsModalForm.title =  record.companyName
        this.$refs.paymentDetailsModalForm.disableSubmit = false
      }
       
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>