<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-demo__rdaccountdailystat}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.advertiserId" placeholder="广告主账号" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-date-picker
                  v-model="date"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  @change="getTimes">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
<!--        <el-form-item>-->
<!--          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>-->
<!--        </el-form-item>-->
<!--        <el-form-item>-->
<!--          <el-button v-if="$hasPermission('demo:rdaccountdailystat:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>-->
<!--        </el-form-item>-->
<!--        <el-form-item>-->
<!--          <el-button v-if="$hasPermission('demo:rdaccountdailystat:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>-->
<!--        </el-form-item>-->
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="id" header-align="center" align="center"></el-table-column>
<!--        <el-table-column prop="advertPlatform" label="所属广告平台" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="advertiserId" label="广告主账号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="date" label="日期" header-align="center" align="center"></el-table-column>
        <el-table-column prop="balance" label="日终结余(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="cashCost" label="现金支出(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="cost" label="总支出(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="frozen" label="冻结(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="income" label="总存入(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="rewardCost" label="赠款支出(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="sharedWalletCost" label="共享钱包支出(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="transferIn" label="总转入(元)" header-align="center" align="center"></el-table-column>
        <el-table-column prop="transferOut" label="总转出(元)" header-align="center" align="center"></el-table-column>
<!--        <el-table-column prop="status" label="状态（开1、关0）" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column prop="createdBy" label="创建人" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column prop="updatedBy" label="修改人" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column prop="createTime" label="创建时间" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column prop="updateTime" label="修改时间" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column prop="deleteTime" label="删除时间" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">-->
<!--          <template slot-scope="scope">-->
<!--            <el-button v-if="$hasPermission('demo:rdaccountdailystat:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>-->
<!--            <el-button v-if="$hasPermission('demo:rdaccountdailystat:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
<!--          </template>-->
<!--        </el-table-column>-->
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './rdaccountdailystat-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/sys/rdaccountdailystat/page',
        getDataListIsPage: true,
        exportURL: '/sys/rdaccountdailystat/export',
        deleteURL: '/sys/rdaccountdailystat',
        deleteIsBatch: true
      },
      date:'',
      dataForm: {
        id: '',
        advertiserId:'',
        startDate:'',
        endDate:''
      }
    }
  },
  components: {
    AddOrUpdate
  },
  methods: {
    //利⽤change事件监听表单内容变化，并将选中的值赋值给所需要的两个字段
    //⽀付时间戳设置
    getTimes() {
      if (this.date != null) {
        this.dataForm.startDate = this.date[0]
        this.dataForm.endDate = this.date[1]
      }else{
        this.dataForm.startDate =''
        this.dataForm.endDate = ''
      }
    }
  }
}
</script>
