<template>
  <div class="comment-box">
    <div class="d-s" style="margin-bottom: 10px">
      <div class="gang"></div>
      <div class="g-class">会员资产</div>
    </div>
    <el-table ref="tables" border v-loading="loading" :data="list">
      <el-table-column label="序号"   type="index"/>
      <el-table-column label="所属油站" prop="storeName" align="center"/>
      <el-table-column label="变动时间" prop="createTime" align="center"/>
      <el-table-column label="类型" align="center" prop="changeType">
        <template slot-scope="scope">

          <el-tag v-if="scope.row.changeType == 0">兑换</el-tag>
          <el-tag type="success" v-else>赠送</el-tag>

        </template>
      </el-table-column>
      <el-table-column label="变动积分" align="center" prop="pointsChange" />
      <el-table-column label="变动后积分" align="center" prop="currentPoints" />
      <el-table-column label="描述" align="center" prop="changeReason"/>
    </el-table>

    <pagination
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { getIntegralDetailList } from "@/api/cashier/userInfoOrder.js";

export default {
  props:["pUserId"],
  data(){
    return {
      userId:"",
      loading:false,
      list:[],
      total:0,
      queryParams:{
        page:1,
        pageSize:10,
      }
    }
  },
  created() {
    // this.userId = this.pUserId;
    this.userId = this.$route.query.id;
    this.getList()
  },
  methods:{
    getList(){
      this.loading = true
      this.queryParams.userId = this.userId
      getIntegralDetailList(this.queryParams).then(res=>{
        if (res.code == 200) {
          this.list = res.data.records
          this.total = res.data.total
          this.loading = false
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.d-s{
  display: flex;
  align-items: center;
}
.gang{
  width: 2px;
  height: 14px;
  background: #FF9655;
}
.g-class{
  font-size: 14px;
  margin-left: 6px;
}
.comment-box{
  box-sizing: border-box;
  padding: 10px 0;
}
</style>
