<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="accountRechargeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="商品ID" align="center" prop="goodsId" />
      <el-table-column label="订单号" align="center" prop="orderNo" />
      <el-table-column label="订单名" align="center" prop="orderName" />
<!--      1 金额  2 彩币-->
      <el-table-column label="账户" align="center" prop="accountType" />
      <el-table-column label="充值类型 0 手工充值 1 线上充值" align="center" prop="rechargeType" />
      <el-table-column label="充值金额" align="center" prop="rechargeMoney" />
      <el-table-column label="状态  1 申请 2 审核通过 3，审核不通过" align="center" prop="status" />
      <el-table-column label="充值平台类型" align="center" prop="platformType" />
      <el-table-column label="充值平台名称" align="center" prop="platformName" />
      <el-table-column label="" align="center" prop="payNo" />
      <el-table-column label="" align="center" prop="rechargeReward" />
      <el-table-column label="" align="center" prop="verifyTime" width="180" />
      <el-table-column label="" align="center" prop="operateIp" />
      <el-table-column label="类型: 0积分(默认)，1会员" align="center" prop="type" />
      <el-table-column label="" align="center" prop="appid" />
    </el-table>

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

  </div>
</template>

<script>
import { listAccountRecharge, getAccountRecharge, delAccountRecharge, addAccountRecharge, updateAccountRecharge } from "@/api/cai/accountRecharge";

export default {
  name: "AccountRecharge",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 充值记录表格数据
      accountRechargeList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userId: undefined,
        goodsId: undefined,
        orderNo: undefined,
        orderName: undefined,
        accountType: undefined,
        rechargeType: undefined,
        rechargeMoney: undefined,
        status: undefined,
        platformType: undefined,
        platformName: undefined,
        payNo: undefined,
        returnContent: undefined,
        rechargeReward: undefined,
        verifyTime: undefined,
        operateIp: undefined,
        type: undefined,
        appid: undefined
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询充值记录列表 */
    getList() {
      this.loading = true;
      listAccountRecharge(this.queryParams).then(response => {
        this.accountRechargeList = 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) {
    },
    /** 提交按钮 */
    submitForm() {
    },
  }
};
</script>
