| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item>
- 等级列表
- </el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <div class="table-body">
- <!-- 添加 -->
- <template>
- <el-button @click="addLevel" size="mini" type="success">添加等级</el-button>
- <!-- <el-button @click="toCondition" size="mini" type="warning">设置升级条件</el-button> -->
- </template>
- <!-- 订单信息 -->
- <template>
- <el-table ref="multipleTable" :data="list" @selection-change="handleSelectionChange">
- <!-- 空数据 -->
- <template slot="empty">
- <el-empty description="暂无等级"></el-empty>
- </template>
- <!-- 数据 -->
- <el-table-column type="selection"></el-table-column>
- <el-table-column prop="id" align="center" label="ID"></el-table-column>
- <el-table-column prop="name" align="center" label="等级权重">
- <template slot-scope="scope">
- 等级{{ scope.row.level }}
- </template>
- </el-table-column>
- <el-table-column prop="name" align="center" label="等级名称"></el-table-column>
- <el-table-column prop="name" align="center" label="一级佣金">
- <template slot-scope="scope">
- {{ scope.row.commission1_value }}
- <span v-if="scope.row.commission1_type == 1">%</span>
- <span v-if="scope.row.commission1_type == 2">元</span>
- </template>
- </el-table-column>
- <el-table-column prop="name" align="center" label="二级佣金">
- <template slot-scope="scope">
- {{ scope.row.commission2_value }}
- <span v-if="scope.row.commission2_type == 1">%</span>
- <span v-if="scope.row.commission2_type == 2">元</span>
- </template>
- </el-table-column>
- <el-table-column prop="name" align="center" label="启动状态">
- <template slot-scope="scope">
- <el-switch
- :active-value="1"
- :inactive-value="0"
- @change="handleSwitch(scope.row)"
- v-model="scope.row.status">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="created_at" label="创建时间" align="center">
- <template slot-scope="scope">
- {{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}
- </template>
- </el-table-column>
- <el-table-column align="center" label="标题">
- <template slot-scope="scope">
- <el-button :loading="btnLoading" type="text" @click.stop="editLevel(scope.row.id)">
- 编辑
- </el-button>
- <el-button :loading="btnLoading" type="text" @click.stop="delLevel(scope.row.id)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </template>
- <!-- 分页 -->
- <el-row type="flex" class="page" justify="end" style="margin-top: 15px">
- <el-pagination
- @current-change="pagination"
- background
- layout="prev, pager, next"
- :page-count="pageCount"
- v-if="list"
- ></el-pagination>
- </el-row>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- limit: 20,
- list: [],
- pageCount: 0,
- page: 1,
- currentPage: null,
- listLoading: false,
- btnLoading: false,
- dialogVisible: false,
- };
- },
- methods: {
- addLevel() {
- navigateTo({
- r: 'operation-center/level/edit'
- })
- },
- toCondition() {
- navigateTo({
- r: 'operation-center/level/condition'
- })
- },
- handleSelectionChange(val) {
- this.select_order = val
- },
- // 全选
- allSelect() {
- if (this.checked) {
- this.goods_list.forEach(function(item, index) {
- if (!item.storage) {
- item.is_select = true
- }
- })
- } else {
- this.goods_list.forEach(function(item, index) {
- item.is_select = false
- })
- }
- },
- //搜索
- onSubmit() {
- this.page = 1
- this.getPageList()
- },
- pagination(currentPage) {
- this.page = currentPage
- this.getPageList()
- },
- getPageList() {
- this.listLoading = true;
- let params = {
- r: 'operation-center/level/index',
- page: this.page,
- limit: this.limit
- }
- params = Object.assign(params, this.searchData)
- request({
- params: params,
- method: 'get',
- }).then(e => {
- if (e.data.code === 0) {
- this.list = e.data.data.list
- this.pageCount = e.data.data.page_count
- this.currentPage = e.data.data.current_page
- } else {
- this.$message.error(e.data.msg)
- }
- this.listLoading = false
- })
- },
- //重置
- resetForm() {
- this.searchData = {
- user_id : undefined,
- user_keyword : undefined,
- order_no : undefined,
- time : [],
- }
- },
- editLevel(id) {
- navigateTo({
- r: 'operation-center/level/edit',
- id: id,
- })
- },
- delLevel(id) {
- this.$confirm('确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.btnLoading = true
- request({
- params: {
- r: 'operation-center/level/del-level',
- id: id,
- },
- method: 'get',
- }).then(e => {
- if (e.data.code === 0) {
- this.getPageList()
- } else {
- this.$message.error(e.data.msg);
- }
- this.btnLoading = false
- })
- })
- },
- handleSwitch(row) {
- request({
- params: {
- r: 'operation-center/level/switch-status',
- id: row.id,
- status: row.status,
- },
- method: 'get',
- }).then(e => {
- if (e.data.code === 0) {
- }
- })
- },
- },
- mounted: function() {
- this.page = getQuery('page') ? getQuery('page') : 1
- this.limit = getQuery('limit') ? getQuery('limit') : 20
- this.getPageList()
- }
- });
- </script>
- <style>
- </style>
|