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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
| <template>
| <div class="cor-bus">
| <v-header
| title="积分设置"
| ></v-header>
| <div>
| <v-tool-table
| :trs="trs"
| :tds="tds"
| >
| <template v-slot:count="{scope}">
| <span v-if="scope.type">
| <span v-if="scope.type =='1'">{{scope.count}}次/月</span>
| <span v-if="scope.type =='2'">{{scope.count}}次/日</span>
| </span>
| <span v-else>不限制</span>
| </template>
| <template v-slot:btn="{scope}">
| <el-button
| type="text"
| @click="editIntegral(scope)"
| >编辑</el-button>
| </template>
| </v-tool-table>
| </div>
| <v-tool-page
| :item="paged"
| @on-page="onPage"
| ></v-tool-page>
| <!-- 编辑弹窗 -->
| <AddModel v-model="isShow" :item ="editData" @change="isShow = false" @success="onEditSuccess" />
| </div>
| </template>
| <script>
| import AddModel from "./components/editModel.vue"
| export default {
| name: "index",
| props: [],
| components: {AddModel},
| data() {
| return {
| bar: [],
| trs: [
| { text: "积分任务", val: "name" },
| { text: "积分值", val: "amount", width: "" },
| { text: "描述", val: "integralDescribe"},
| { text: "次数限制", val: "btn" , slot:"count"},
| { text: "更新时间", val: "updateAt" },
| { text: "操作", val: "btn" },
| ],
| tds: [],
| paged: { page: 0, total: 10, r: 0, limit: 10 },
| isShow:false ,
| editData:{}
| };
| },
|
| created() {},
|
| mounted() {
|
| },
|
| methods: {
| //编辑成功后重新渲染数据
| onEditSuccess () {
| this.init();
| },
|
| /** 分页 */
| onPage(v) {
| if (v.page === this.paged.page && v.page && !v.reset) {
| return 0;
| }
| this.paged.page = v.page;
| this.paged.limit = v.limit;
| this.init();
| },
|
| init() {
| let params = {
| pageNum: this.paged.page,
| pageSize: this.paged.limit,
| }
|
| this.$api.post("integral/rule/list", params, (e) => {
| this.tds = e.records;
| this.paged.total = e.total;
| });
| },
|
| //编辑
| editIntegral(e) {
| this.editData = e;
| this.isShow = true;
| }
| },
| };
| </script>
| <style scoped>
| .cor-bus{
| overflow: scroll;
| }
| .but {
| padding-bottom: 20px;
| display: flex;
| }
| </style>
|
|