xialei пре 1 година
родитељ
комит
4e1eb5375f
3 измењених фајлова са 195 додато и 0 уклоњено
  1. 42 0
      src/api/system.js
  2. 9 0
      src/router/modules/config.js
  3. 144 0
      src/views/contribution/contribution/index.vue

+ 42 - 0
src/api/system.js

@@ -32,6 +32,48 @@ export function classifyDelApi(id) {
32 32
   return request.delete(`config/classify/delete/${id}`)
33 33
 }
34 34
 
35
+
36
+
37
+
38
+
39
+/**
40
+ * @description 配置商家贡献值 -- 编辑表单
41
+ * @param {Object} param params {Object} 传值参数
42
+ */
43
+export function updateContributionTable(id) {
44
+  return request.get('config/contribution/update/table/' + id)
45
+}
46
+/**
47
+ * @description 配置商家贡献值 -- 添加表单
48
+ */
49
+export function createContributionTable() {
50
+  return request.get('config/contribution/create/table')
51
+}
52
+/**
53
+ * @description 配置商家贡献值 -- 列表
54
+ */
55
+export function ContributionLst(page, limit) {
56
+  return request.get('config/contribution/lst', { page, limit })
57
+}
58
+/**
59
+ * @description 配置商家贡献值 -- 修改状态
60
+ */
61
+export function changeContributionStatus(id, status) {
62
+  return request.post('config/contribution/status/' + id, { status })
63
+}
64
+
65
+/**
66
+ * @description 配置商家贡献值 -- 删除
67
+ */
68
+export function contributionDelApi(id) {
69
+  return request.delete(`config/contribution/delete/${id}`)
70
+}
71
+
72
+
73
+
74
+
75
+
76
+
35 77
 /**
36 78
  * @description 配置 -- 删除
37 79
  */

+ 9 - 0
src/router/modules/config.js

@@ -73,6 +73,15 @@ const configRouter =
73 73
             noCache: true
74 74
           },
75 75
           component: () => import('@/views/agreement/agree/index')
76
+        },
77
+        {
78
+          path: 'contribution',
79
+          name: 'system_contribution',
80
+          meta: {
81
+            title: '商家贡献值',
82
+            noCache: true
83
+          },
84
+          component: () => import('@/views/contribution/contribution/index')
76 85
         }
77 86
       ]
78 87
     }

+ 144 - 0
src/views/contribution/contribution/index.vue

@@ -0,0 +1,144 @@
1
+<template>
2
+  <div class="divBox">
3
+    <el-card class="box-card">
4
+      <div slot="header" class="clearfix">
5
+        <el-button size="small" type="primary" @click="onAdd">添加</el-button>
6
+      </div>  
7
+      <el-table
8
+        :data="tableData.data"
9
+        style="width: 100%"
10
+        size="small"
11
+        row-key="id"
12
+        default-expand-all
13
+        v-loading="listLoading"
14
+      >
15
+        <el-table-column
16
+          prop="id"
17
+          label="ID"
18
+          min-width="60"
19
+        />
20
+        <el-table-column
21
+          prop="title"
22
+          label="范围名称"
23
+          min-width="150"
24
+          :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
25
+        />
26
+        <el-table-column
27
+          prop="start"
28
+          label="范围开始"
29
+          min-width="150"
30
+        />
31
+        <el-table-column
32
+          prop="end"
33
+          label="范围结束"
34
+          min-width="150"
35
+        />
36
+        <el-table-column
37
+          prop="type"
38
+          label="类型"
39
+          min-width="150"
40
+        />
41
+
42
+        <el-table-column
43
+          prop="jd"
44
+          label="京豆"
45
+          min-width="150"
46
+        />
47
+
48
+        <el-table-column
49
+          prop="value"
50
+          label="贡献值"
51
+          min-width="150"
52
+        />
53
+
54
+        <el-table-column
55
+          prop="create_time"
56
+          label="创建时间"
57
+          min-width="150"
58
+        />
59
+        <el-table-column label="操作" min-width="100" fixed="right">
60
+          <template slot-scope="scope">
61
+            <el-button type="text" size="small" @click="onEdit(scope.row.id)">编辑</el-button>
62
+            <el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)">删除</el-button>
63
+          </template>
64
+        </el-table-column>
65
+      </el-table>
66
+    </el-card>
67
+  </div>
68
+</template>
69
+
70
+<script>
71
+import {
72
+  createContributionTable,
73
+  updateContributionTable,
74
+  ContributionLst,
75
+  changeContributionStatus,
76
+  contributionDelApi
77
+} from '@/api/system'
78
+export default {
79
+  name: 'Classify',
80
+  data() {
81
+    return {
82
+      tableData: {
83
+        data: [],
84
+        total: 0
85
+      },
86
+      listLoading: true
87
+    }
88
+  },
89
+  mounted() {
90
+    this.getList()
91
+  },
92
+  methods: {
93
+    // 列表
94
+    getList() {
95
+      this.listLoading = true
96
+      ContributionLst().then(res => {
97
+        this.tableData.data = res.data.list
98
+        this.tableData.total = res.data.count
99
+        this.listLoading = false
100
+      }).catch(res => {
101
+        this.listLoading = false
102
+        this.$message.error(res.message)
103
+      })
104
+    },
105
+    pageChange(page) {
106
+      this.tableData.page = page
107
+      this.getList()
108
+    },
109
+    handleSizeChange(val) {
110
+      this.tableData.limit = val
111
+      this.getList()
112
+    },
113
+    onchangeIsShow(row) {
114
+      changeContributionStatus(row.id, row.status).then(({ message }) => {
115
+        this.$message.success(message)
116
+      }).catch(({ message }) => {
117
+        this.$message.error(message)
118
+      })
119
+    },
120
+    // 添加
121
+    onAdd() {
122
+      this.$modalForm(createContributionTable()).then(() => this.getList())
123
+    },
124
+    // 编辑
125
+    onEdit(id) {
126
+      this.$modalForm(updateContributionTable(id)).then(() => this.getList())
127
+    },
128
+    // 删除
129
+    handleDelete(id, idx) {
130
+      this.$modalSure().then(() => {
131
+        contributionDelApi(id).then(({ message }) => {
132
+          this.$message.success(message)
133
+          this.getList()
134
+        }).catch(({ message }) => {
135
+          this.$message.error(message)
136
+        })
137
+      })
138
+    }
139
+  }
140
+}
141
+</script>
142
+
143
+<style scoped lang="stylus">
144
+</style>