瀏覽代碼

兑换码列表

natasha 1 年之前
父節點
當前提交
7cc0411cca
共有 1 個文件被更改,包括 155 次插入79 次删除
  1. 155 79
      src/views/cdkey_manage/index.vue

+ 155 - 79
src/views/cdkey_manage/index.vue

@@ -22,24 +22,24 @@
                         </el-input>
                     </div>
                     <div class="search-item">
-                        <label>账户类型</label>
-                        <el-select v-model="searchType" @change="getList(1)" placeholder="请选择">
+                        <label>状态</label>
+                        <el-select v-model="searchStatus" @change="getList(1)" placeholder="请选择">
                             <el-option
-                                v-for="item in typeList"
-                                :key="item.account_type"
-                                :label="item.account_type_name"
-                                :value="item.account_type">
+                                v-for="item in statusList"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
                             </el-option>
                         </el-select>
                     </div>
                     <div class="search-item">
-                        <label>状态</label>
-                        <el-select v-model="searchStatus" @change="getList(1)" placeholder="请选择">
+                        <label>类型</label>
+                        <el-select v-model="searchType" @change="getList(1)" placeholder="请选择">
                             <el-option
-                                v-for="item in $searchStatusList"
-                                :key="item.status"
-                                :label="item.status_name"
-                                :value="item.status">
+                                v-for="item in typeList"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
                             </el-option>
                         </el-select>
                     </div>
@@ -53,94 +53,121 @@
                     :max-height="tableHeight"
                     v-loading="tableLoading">
                     <el-table-column
-                        prop="user_name"
-                        label="用户名"
+                        type="index"
+                        label="#"
+                        sortable
+                        width="54"
+                        :index="(pageNumber-1)*pageSize+1">
+                    </el-table-column>
+                    <el-table-column
+                        prop="name"
+                        label="兑换码名称"
                         sortable="custom"
-                        width="200"
-                        class-name="user-info">
+                        width="163">
+                    </el-table-column>
+                    <el-table-column
+                        prop="code"
+                        label="兑换码"
+                        sortable="custom"
+                        width="160">
+                    </el-table-column>
+                    <el-table-column
+                        prop="type"
+                        label="类型"
+                        sortable="custom"
+                        width="92" >
                         <template slot-scope="scope">
-                            <el-image
-                                class="touxiang"
-                                :src="scope.row.image_url?scope.row.image_url:require('../../assets/avatar.png')"
-                                fit="cover" style="width:24px;height:24px;margin-right:8px">
-                            </el-image>
-                            <!-- <img class="touxiang" :src="scope.row.image_url?scope.row.image_url:require('../../assets/avatar.png')" /> -->
-                            <span class="name">{{scope.row.user_name}}</span>
+                            {{scope.row.type===0?'普通兑换码':'批量兑换码'}}
                         </template>
                     </el-table-column>
                     <el-table-column
-                        prop="real_name"
-                        label="真实姓名"
-                        width="112">
+                        prop="goods_count"
+                        label="内容数"
+                        min-width="80">
                     </el-table-column>
                     <el-table-column
-                        prop="sex_name"
-                        label="性别"
-                        width="56">
+                        prop="phone"
+                        label="使用情况"
+                        width="96">
+                        <template slot-scope="scope">
+                            {{scope.row.person_count_use+'/'+scope.row.person_count_max}}
+                        </template>
                     </el-table-column>
                     <el-table-column
-                        prop="account_type_name"
-                        label="账户类型"
-                        width="120" >
+                        prop="creator_name"
+                        label="创建人"
+                        width="88">
                     </el-table-column>
                     <el-table-column
-                        prop="email"
-                        label="邮箱"
-                        min-width="200">
+                        prop="create_time"
+                        label="创建时间"
+                        sortable="custom"
+                        width="164">
                     </el-table-column>
                     <el-table-column
-                        prop="phone"
-                        label="手机号"
-                        width="144">
+                        prop="end_date"
+                        label="到期日期"
+                        sortable="custom"
+                        width="126" >
                     </el-table-column>
                     <el-table-column
-                        prop="status"
+                        prop="valid_status"
                         label="状态"
-                        width="96" >
+                        width="88" >
                         <template slot-scope="scope">
                             <div class="status-box">
-                                <span :style="{background:statusList[scope.row.status].bg}"></span>
-                                <b :style="{color:statusList[scope.row.status].color}">{{statusList[scope.row.status].text}}</b>
+                                <span :style="{background:statusListCss[scope.row.valid_status].bg}"></span>
+                                <b :style="{color:statusListCss[scope.row.valid_status].color}">{{statusListCss[scope.row.valid_status].text}}</b>
                             </div>
                         </template>
                     </el-table-column>
                     <el-table-column
-                        prop="create_time"
-                        label="创建时间"
-                        sortable="custom"
-                        width="160">
-                        <template slot-scope="scope">
-                            {{scope.row.create_time?scope.row.create_time.substring(0,16):'-'}}
-                        </template>
+                        prop="momo"
+                        label="备注"
+                        width="120">
                     </el-table-column>
                     <el-table-column
                         fixed="right"
                         label="操作"
-                        width="120">
+                        width="180">
                         <template slot-scope="scope">
                             <el-button
                                 @click.native.prevent="handleEdit(scope.row)"
                                 type="text"
                                 size="small"
                                 class="primary-btn">
-                                编辑
+                                查看
                             </el-button>
                             <el-button
                                 @click.native.prevent="handleUp(scope.row, scope.$index)"
                                 type="text"
                                 size="small"
                                 class="primary-btn"
-                                v-if="scope.row.status===0">
-                                
+                                v-if="scope.row.valid_status===0">
+                                启
                             </el-button>
                             <el-button
                                 @click.native.prevent="handleUp(scope.row, scope.$index)"
                                 type="text"
                                 size="small"
                                 class="red-btn"
-                                v-else-if="scope.row.status===1">
+                                v-else-if="scope.row.valid_status===1">
                                 停用
                             </el-button>
+                            <el-button
+                                @click.native.prevent="handleRevoca(scope.row)"
+                                type="text"
+                                size="small"
+                                class="primary-btn">
+                                撤回
+                            </el-button>
+                            <el-button
+                                @click.native.prevent="handleDelete(scope.row, scope.$index)"
+                                type="text"
+                                size="small"
+                                class="red-btn">
+                                删除
+                            </el-button>
                         </template>
                     </el-table-column>
                 </el-table>
@@ -167,7 +194,6 @@ import Header from "../../components/Header.vue";
 import NavMenu from "../../components/NavMenu.vue"
 import Breadcrumb from '../../components/Breadcrumb.vue';
 import { getLogin } from "@/api/ajax";
-import { mapState } from 'vuex';
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -194,20 +220,51 @@ export default {
         searchStatus: -1,
         typeList:[
             {
-                account_type:-1,
-                account_type_name:'全部'
+                value:-1,
+                label:'全部'
+            },
+            {
+                value:0,
+                label:'普通兑换码'
+            },
+            {
+                value:1,
+                label:'批量兑换码'
             }
         ],
-        statusList:{
+        statusList:[
+            {
+                label: '全部',
+                value: -1
+            },
+            {
+                label: '使用中',
+                value: 1
+            },
+            {
+                label: '已停用',
+                value: 0
+            },
+            {
+                label: '已到期',
+                value: 2
+            }
+        ],
+        statusListCss:{
             1:{
-                text:'正常',
+                text:'使用中',
                 bg:'#165DFF',
                 color:''
             },
             0:{
-                text:'停用',
+                text:'停用',
                 bg:'#F53F3F',
-                color:'#F53F3F'
+                color:''
+            },
+            2:{
+                text:'已过期',
+                bg:'#FF7D00',
+                color:''
             }
         },
         tableData:[
@@ -234,7 +291,6 @@ export default {
   },
   //计算属性 类似于data概念
   computed: {
-    ...mapState(['$searchStatusList']),
   },
   //监控data中数据变化
   watch: {},
@@ -248,6 +304,40 @@ export default {
         this.dataSort = dataSort
         this.getList()
     },
+    // 撤回
+    handleRevoca(row){
+        this.$confirm('确定撤回吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+
+        }).catch(() => {
+               
+        });
+    },
+    // 删除
+    handleDelete(row){
+        this.$confirm('确定删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+            let Mname = "/CourseServer/Manager/ZBCourseManager/DeleteZBCourse";
+            let data = {
+                id: row.id
+            };
+            getLogin(Mname, data).then(res => {
+                this.$message({
+                    type: 'success',
+                    message: '删除成功!'
+                });
+                this.getList()
+            });
+        }).catch(() => {
+               
+        });
+    },
     // 查询列表
     getList(page){
         this.tableLoading = true
@@ -269,9 +359,9 @@ export default {
             order_column_list = ['create_time:desc']
         }
         let data = {
-            search_content:this.searchInput.trim(),
-            account_type:this.searchType,
-            status:this.searchStatus,
+            content:this.searchInput.trim(),
+            type:this.searchType,
+            valid_status:this.searchStatus,
             page_capacity:this.pageSize,
             cur_page:this.pageNumber,
             order_column_list: order_column_list
@@ -349,24 +439,10 @@ export default {
         this.tableHeight = window.innerHeight - tableH;
       }
     },
-    // 用户类型列表
-    getUserAccountTypeList(){
-        let MethodName = "/OrgServer/DictManager/GetSysUserAccountTypeList";
-        getLogin(MethodName, {})
-        .then((res) => {
-            if(res.status===1){
-                this.typeList = this.typeList.concat(res.account_type_list)
-            }
-        })
-        .catch(() => {
-            this.loading = false
-        });
-    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
     this.getTableHeight();
-    this.getUserAccountTypeList()
     this.getList()
   },
   //生命周期 - 挂载完成(可以访问DOM元素)