quanwei
2025-11-21 2d9362ae6f528f57e6133d5d80f0b633c24e8eb6
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
  <!--
        作者:
        时间:2025-11-18
        描述:插件中心-VIP专区-等级管理-等级列表
      -->
  <div class="common-level">
    <div class="common-level-head">
      <el-button size="small" type="primary" icon="el-icon-plus" @click="addClick">添加等级</el-button>
    </div>
    <div class="table-wrap">
      <el-table :data="tableData" style="width: 100%" v-loading="loading">
        <el-table-column prop="grade_id" label="ID" width="80"></el-table-column>
        <el-table-column prop="name" label="等级名称"></el-table-column>
        <el-table-column prop="weight" label="权重" ></el-table-column>
        <el-table-column prop="agent_money" label="推广佣金" width="100">
          <template slot-scope="scope">
            <span class="orange">¥{{ scope.row.agent_money }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="operating_subsidy" label="VIP专区补贴" >
          <template slot-scope="scope">
            <span class="orange">{{ scope.row.operating_subsidy }}%</span>
          </template>
        </el-table-column>
        <el-table-column prop="operating_subsidy" label="平台直推佣金" >
          <template slot-scope="scope">
            <span class="orange">{{ scope.row.commission }}%</span>
          </template>
        </el-table-column>
        <el-table-column prop="remark" label="升级条件" ></el-table-column>
        <el-table-column prop="create_time" label="创建时间" width="160">
          <template slot-scope="scope">
            <span>{{ scope.row.create_time }}</span>
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="120">
          <template slot-scope="scope">
            <el-button @click="editClick(scope.row)" type="text" size="small">编辑</el-button>
            <el-button @click="deleteClick(scope.row)" type="text" size="small" v-if="scope.row.is_default == 0">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!--添加-->
    <Add v-if="open_add" :open_add="open_add" @closeDialog="closeDialogFunc($event, 'add')"></Add>
    <!--编辑-->
    <Edit v-if="open_edit" :open_edit="open_edit" :form="userModel" @closeDialog="closeDialogFunc($event, 'edit')"></Edit>
  </div>
</template>
 
<script>
import vipApi from '@/api/plus/vip.js';
import Edit from './Edit.vue';
import Add from './Add.vue';
import {deepClone} from '@/utils/base.js';
 
export default {
  components: {
    /*编辑组件*/
    Edit,
    Add
  },
  data() {
    return {
      /*是否加载完成*/
      loading: true,
      /*列表数据*/
      tableData: [],
      /*是否打开添加弹窗*/
      open_add: false,
      /*是否打开编辑弹窗*/
      open_edit: false,
      /*当前编辑的对象*/
      userModel: {}
    };
  },
  created() {
    /*获取列表数据*/
    this.getData();
  },
  methods: {
    /*获取列表数据*/
    getData() {
      let self = this;
      self.loading = true;
      vipApi.gradelist({},true)
          .then( data => {
        self.loading = false;
        console.log(data);
        self.tableData = data.data.list;
      });
    },
 
    /*添加等级*/
    addClick() {
      this.open_add = true;
    },
 
    /*编辑等级*/
    editClick(item) {
      this.userModel = deepClone(item);
      this.open_edit = true;
    },
 
    /*关闭弹窗*/
    closeDialogFunc(e, f) {
      if (f == 'add') {
        this.open_add = e.openDialog;
        if (e.type == 'success') {
          this.getData();
        }
      }
      if (f == 'edit') {
        this.open_edit = e.openDialog;
        if (e.type == 'success') {
          this.getData();
        }
      }
    },
 
    /*删除等级*/
    deleteClick(item) {
      let self = this;
      self.$confirm('此操作将永久删除该等级, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        vipApi.deletegrade({
          grade_id: item.grade_id
        }, () => {
          self.$message({
            message: '删除成功',
            type: 'success'
          });
          self.getData();
        });
      });
    }
  }
};
</script>
 
<style></style>