<!--信用分明细-->
<template>
    <div class="page-container creditScoreList">
      <div class="page-top-title-box">
        <p class="page-top-title-name-p">信用分明细</p>
        <p class="page-top-title-out-p" @click="backPage">返回</p>
      </div>
      <div class="page-container">
        <div class="page-form-title-box" style="border:none;">
          <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
            <el-form-item label="变更时间" prop="dateRange" style="margin-left:10px;">
              <el-date-picker
                :clearable="false"
                v-model="dateRange"
                size="small"
                style="width: 240px"
                value-format="yyyy-MM-dd"
                type="daterange"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="状态" prop="bonusType" label-width="50px">
              <el-select v-model="queryParams.bonusType" clearable placeholder="请选择变动状态">
                <el-option
                  v-for="dict in bonusTypeOptions"
                  :key="dict.id"
                  :label="dict.name"
                  :value="dict.id"
                ></el-option>
              </el-select>
            </el-form-item>
            <p class="page-inquire-common-style-button" style="margin:0 20px;" @click="handleQuery">查询</p>
            <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
          </el-form>
        </div>
        <div class="page-content-box" style="padding-top:0;">
          <el-table v-loading="loading" class="table-box" border :data="recordList">
            <el-table-column label="信用分变动信息" align="left" prop="messageContent" show-overflow-tooltip/>
            <el-table-column label="添加人" align="left" prop="createByName"  width="260" show-overflow-tooltip/>
            <el-table-column label="变更时间" align="left" prop="createTime"  width="260" show-overflow-tooltip>
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
              </template>
            </el-table-column>
            <el-table-column label="变动" align="left" prop="points" width="260" show-overflow-tooltip>
              <template slot-scope="scope">
                <p :class="scope.row.points>0?'color_14AE10':(scope.row.points<0?'color_FF4E00':'')">{{scope.row.points}}</p>
              </template>
            </el-table-column>
            <el-table-column label="信用分余额" align="left" prop="surplusPoints"  width="260" show-overflow-tooltip/>
          </el-table>
          <pagination
            v-show="total>0"
            :total="total"
            layout="total, prev, pager, next, sizes, jumper"
            :page.sync="queryParams.page"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
          />
        </div>
      </div>
    </div>
</template>

<script>
  import { examPointsRecordGetPointsLoglist } from "@/api/creditViolation/index";

    export default {
      name: "creditScoreList",
      props: {
        propsData:{},
      },
      data() {
        return {
          //加载状态
          loading:false,
          // 显示搜索条件
          showSearch: true,
          // 查询参数
          queryParams: {
            page: 1,
            pageSize:20,
            points: null,
            joinUserId: null,
            mode: null,
            deptName: null,
            deptId: null,
            userId: null,
            bonusType: null,
          },
          //状态条件
          bonusTypeOptions:[
            {id:1,name:"获得"},
            {id:2,name:"扣减"},
          ],
          //列表数据
          recordList:[],
          total:0,
          // 日期范围
          dateRange: [],

        }
      },
      created(){
        this.getList()
      },
      methods:{
        //返回上级页面
        backPage(){
          this.$parent.goPage(1);
        },
        /** 查询数据 */
        getList() {
          this.loading = true;
          if(this.dateRange&&this.dateRange.length>0)
          {
            this.queryParams.startTime=this.dateRange[0]+'T00:00:00';
            this.queryParams.endTime=this.dateRange[1]+'T23:59:59';
          }
          else
          {
            this.queryParams.startTime=null;
            this.queryParams.endTime=null
          }

          this.queryParams.pointsId = this.propsData.userId;
          this.queryParams.pointsType = 1;
          examPointsRecordGetPointsLoglist(this.queryParams).then( response => {
            this.recordList =  response.data.records;
            this.total =  response.data.total;
            this.loading = false;
          });
        },
        /** 搜索按钮操作 */
        handleQuery() {
          this.queryParams.page = 1;
          this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
          this.resetForm("queryParams");
          this.queryParams = {};
          this.dateRange = [];
          this.recordList = [];
          this.handleQuery();
        },
      },
    }
</script>

<style scoped>

</style>

<style scoped lang="scss">
  .creditScoreList {

  }
</style>
