<template>
  <div v-loading="loading" style="padding: 20px">
    <div style="margin-bottom: 10px">
      <el-input v-model="search.uid" size="small" style="width: 200px" placeholder="用户的UID"></el-input>
      <el-button size="small"  @click="search_" type="primary">搜索</el-button>
      <el-button size="small"  @click="show_child_page('user_bond_fk_add',{})" type="primary">扣保证金</el-button>
      <div class="flex_1" />
    </div>

    <div style="width: 100%">
      <el-table row-key="id" :data="list">
        <el-table-column prop="order_no" fixed width="170px" label="UID">
          <template slot-scope="scope">
            <a style="color: #006eff" target="_blank" :href="scope.row.user_info.link">{{scope.row.uid}}</a>
          </template>
        </el-table-column>
        <el-table-column prop="money" label="保证金">
          <template slot-scope="scope">
            <span style="cursor: pointer" @click="show_pub_log(scope.row.uid)">{{scope.row.money}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="cz_money" label="充值总金额"></el-table-column>
        <el-table-column prop="tk_money" label="退款总金额"></el-table-column>
        <el-table-column prop="fk_money" label="罚款总金额"></el-table-column>
        <el-table-column prop="lasttime"  label="最后充值时间"></el-table-column>
      </el-table>
    </div>

    <el-pagination
      background
      style="margin-top: 10px"
      layout="total,prev, pager, next"
      :current-page="search.page"
      @current-change="page_event"
      :page-size="search.pagesize"
      :total="search.total">
    </el-pagination>

    <pub_log v-if="drawer_obj.pub_log" :back="this" :pro="drawer_obj.id" action="i_user_bond"></pub_log>
    <user_bond_fk_add v-if="child_page.type=='user_bond_fk_add'" :back="this" :pro="child_page.id"></user_bond_fk_add>
  </div>
</template>

<script>
  import user_bond_fk_add from '@/components/user_bond/user_bond_fk_add';
  import pub_log from '@/components/drawer/pub_log';
  export default {
    props: {
      status: {},
      role: {},
      invoice_type:{}
    },
    components: {user_bond_fk_add,pub_log},
    data() {
      return {
        loading: true,
        pay_type:"",
        drawer_obj:{
          user_settlement:false,
          user_invoice_add:false,
          id:0,
          pub_log:false,
          config:false,
          obj:{},
        },
        search: {
          pagesize: 10,
          total: 0,
          status:1,
          name: "",
          invoice_type:[],
          is_sx_js:true
        },
        child_page:{
          type:"",
          obj:{}
        }
      };
    },
    computed: {},
    watch: {},
    created() {
      this.search.status=this.status;
      this.search.invoice_type=this.invoice_type;
    },
    mounted() {
      this.getList();
    },
    methods: {
      show_child_page(type,obj)
      {
        this.child_page.type=type;
        this.child_page.obj=obj;
      },
      show_config()
      {
        this.drawer_obj.id = 0;
        this.drawer_obj.config = true;
      },
      show_pub_log(id)
      {
        this.drawer_obj.id = id;
        this.drawer_obj.pub_log = true;
      },
      async getList() {
        this.loading = true;
        this.drawer = false;
        let data=this.search;
        data.act="";
        let res = await this.$post("/uapi/pub/info/user/user_bond/admin_list", this.search);
        this.loading = false;
        if (res.status == 1) {
          this.list = res.data.list;
          this.search.total = res.data.total;
          this.payMoney=res.data.payMoney;
        }
      },
      page_event(page) {
        this.search.page = page;
        this.getList();
      },
      getData_(id) {
        this.search.status = id;
        this.search.page=0;
        this.getList();
      },
      search_() {
        this.search.page = 0;
        this.getList();
      },
    }
  };
</script>

<style scoped>
  .el-tag {
    cursor: pointer;
  }
</style>
