<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="accountDetailList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="用户ID" align="center" prop="userId" />
<!--      ID 1 。充值的金额 2 。收益的金额 3 。充值的彩币 4 收益的彩币-->
      <el-table-column label="账户类型" align="center" prop="accountType" />
      <el-table-column label="类别" align="center" prop="cateId" />
      <el-table-column label="业务码" align="center" prop="businessCode" />
      <el-table-column label="原有紫贝" align="center" prop="beforeAmount" />
      <el-table-column label="变化值" align="center" prop="changeValue" />
      <el-table-column label="变化后紫贝" align="center" prop="afterAmount" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
      <el-table-column label="关键字" align="center" prop="trackParam" />
      <el-table-column label="备注" align="center" prop="remark" width="400" show-overflow-tooltip/>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listAccountDetail } from '@/api/cai/accountDetail'

export default {
  name: "AccountDetail",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 账户明细表格数据
      accountDetailList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userId: undefined,
        accountType: undefined,
        cateId: undefined,
        businessCode: undefined,
        orderNo: undefined,
        beforeAmount: undefined,
        afterAmount: undefined,
        changeValue: undefined,
        createTime1: undefined,
        trackUserId: undefined,
        trackParam: undefined,
        operateIp: undefined,
        isAdmin: undefined
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询账户明细列表 */
    getList() {
      this.loading = true;
      listAccountDetail(this.queryParams).then(response => {
        this.accountDetailList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
    },
  }
};
</script>
