luobisheng
2022-11-28 fa5fd9d4f9c1ba33f26a343942a7941003cc601c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<template>
  <div class="content">
    <!-- 数据展示 -->
    <el-table
      ref="multipleTable"
      :header-cell-style="{
        background: '#06122c',
        'font-size': '12px',
        color: '#4b9bb7',
        'font-weight': '650',
        'line-height': '45px',
      }"
      :data="tableData"
      style="width: 100%"
      :row-class-name="tableRowClassName"
    >
      <el-table-column type="selection" min-width="5"> </el-table-column>
      <el-table-column prop="category" label="规则类别" min-width="100">
      </el-table-column>
      <el-table-column prop="deductionItem" label="扣分项" min-width="200">
      </el-table-column>
      <el-table-column prop="markScore" label="扣除分数" min-width="60">
      </el-table-column>
      <el-table-column prop="createTime" label="扣分时间" min-width="180">
      </el-table-column>
    </el-table>
 
    <!-- 分页 -->
    <div class="pagination">
      <el-pagination
        background
        :current-page="currentPage"
        layout="prev, pager, next"
        :total="totalNum"
        :page-size="pageSize"
        @current-change="changeCurrentPage"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import { getStoreScore } from "@/api/operate/storeManagement";
 
export default {
  created() {
    this.loadData();
  },
 
  props: ["storeInfo"],
  data() {
    return {
      tableData: [],
      currentPage: 1,
      totalNum: 0,
      pageSize: 10,
    };
  },
 
  methods: {
    loadData() {
      getStoreScore(this.storeInfo.id)
        .then((res) => {
          this.tableData = res.records;
          this.pageSize = res.size;
          this.totalNum = res.total;
        })
        .catch((err) => this.$message({ type: "error", message: err }));
    },
 
    changeCurrentPage(currentPage) {
      this.currentPage = currentPage;
      this.loadData();
    },
 
    tableRowClassName({ row, rowIndex }) {
      if ((rowIndex + 1) % 2 === 0) {
        return "warning-row";
      } else {
        return "success-row";
      }
    },
  },
};
</script>