mo 2 gadi atpakaļ
vecāks
revīzija
53fa681fdb

+ 92 - 34
src/views/liveClassManager/liveClassTwo/components/studentList.vue

@@ -1,8 +1,40 @@
 <!--  -->
 <template>
   <div>
+    <save-form
+      :inline="true"
+      class="searchForm"
+      save-key="liveClassManager-studentList"
+      @submit="search"
+      @reset="onReSet"
+      :model="searchForm"
+      ref="searchForm"
+    >
+      <el-form-item prop="search">
+        <el-input
+          v-model.trim="searchForm.search"
+          clearable
+          @keyup.enter.native="
+            (e) => {
+              e.target.blur();
+              $refs.searchForm.save();
+              search();
+            }
+          "
+          placeholder="姓名/编号/手机号"
+        ></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="search" type="danger">搜索</el-button>
+        <el-button type="primary" native-type="reset">重置</el-button>
+      </el-form-item>
+    </save-form>
     <div class="tableWrap">
-      <el-table style="width: 100%" :header-cell-style="{ background: '#EDEEF0', color: '#444' }" :data="tableList">
+      <el-table
+        style="width: 100%"
+        :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+        :data="tableList"
+      >
         <el-table-column align="center" prop="studentId" label="编号"></el-table-column>
         <el-table-column align="center" prop="organName" label="分部"></el-table-column>
         <el-table-column align="center" label="学员姓名" prop="studentName">
@@ -30,40 +62,53 @@
           <template slot-scope="scope">
             <div>
               <auth auths="/liveBlackList">
-                <el-button type="text" v-if="scope.row.studentStatus == 0 || scope.row.studentStatus == 3
-                  " @click="lookFee(scope)">退学</el-button>
+                <el-button
+                  type="text"
+                  v-if="scope.row.studentStatus == 0 || scope.row.studentStatus == 3"
+                  @click="lookFee(scope)"
+                  >退学</el-button
+                >
               </auth>
 
               <el-button type="text" @click="onDetail(scope.row)">查看订单</el-button>
-
             </div>
           </template>
         </el-table-column>
       </el-table>
-      <pagination sync saveKey="liveClass-courseOverview" :total.sync="rules.total" :page.sync="rules.page"
-        :limit.sync="rules.limit" :page-sizes="rules.page_size" @pagination="getStudents" />
+      <pagination
+        sync
+        saveKey="liveClassManager-studentList"
+        :total.sync="rules.total"
+        :page.sync="rules.page"
+        :limit.sync="rules.limit"
+        :page-sizes="rules.page_size"
+        @pagination="getStudents"
+      />
     </div>
   </div>
 </template>
 
 <script>
-import { liveStudentList, leaveSchool, getStudentSurplusCourseFee } from '../../api';
+import { liveStudentList, leaveSchool, getStudentSurplusCourseFee } from "../../api";
 import pagination from "@/components/Pagination/index";
 export default {
   components: {
-    pagination
+    pagination,
   },
   data() {
     return {
       id: this.$route.query.id,
       tableList: [],
+      searchForm: {
+        search: "",
+      },
       rules: {
         // 分页规则
         limit: 10, // 限制显示条数
         page: 1, // 当前页
         total: 0, // 总条数
-        page_size: [10, 20, 40, 50] // 选择限制显示条数
-      }
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
     };
   },
   mounted() {
@@ -71,23 +116,32 @@ export default {
   },
   methods: {
     onDetail(row) {
-      console.log(row, '111')
+      console.log(row, "111");
       this.$router.push({
-        path: '/orderManager/income',
+        path: "/orderManager/income",
         query: {
-          orderNo: row.orderNo
-        }
-      })
+          orderNo: row.orderNo,
+        },
+      });
+    },
+    search() {
+      this.rules.page = 1;
+      this.getStudents();
+    },
+    onReSet() {
+      this.$refs.searchForm.resetFields();
+      (this.searchForm.id = this.$route.query.id), this.search();
     },
     async getStudents() {
       try {
         const { data } = await liveStudentList({
           liveGroupId: this.id,
           page: this.rules.page,
-          rows: this.rules.limit
-        })
-        console.log(data, 'data')
-        this.tableList = data.rows
+          rows: this.rules.limit,
+          ...this.searchForm,
+        });
+        console.log(data, "data");
+        this.tableList = data.rows;
         for (let i in this.tableList) {
           this.tableList[i].fee = 0;
           this.tableList[i].visible = false;
@@ -101,7 +155,7 @@ export default {
       let studentId = scope.row.studentId;
       let vipGroupId = this.id;
       let amount = scope.row.fee;
-      await leaveSchool({ studentId, vipGroupId, amount }).then(res => {
+      await leaveSchool({ studentId, vipGroupId, amount }).then((res) => {
         if (res.code == 200) {
           this.$message.success("退学成功");
           this.getStudents();
@@ -109,14 +163,14 @@ export default {
         if (res.code == 206) {
           this.$confirm(res.msg, "提示", {
             confirmButtonText: "确定",
-            cancelButtonText: "取消"
+            cancelButtonText: "取消",
           }).then(() => {
             leaveSchool({
               studentId,
               vipGroupId,
               amount,
-              confirmReturnActivityGive: true
-            }).then(res => {
+              confirmReturnActivityGive: true,
+            }).then((res) => {
               if (res.code == 200) {
                 this.$message.success("退学成功");
                 this.getStudents();
@@ -127,12 +181,16 @@ export default {
       });
     },
     lookFee(scope) {
-      this.$confirm(`是否确认将该学员退学?<p style="color: red;marginTop:20px">如需退款请在OA中操作</p>`, "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        dangerouslyUseHTMLString: true,
-        type: "warning"
-      })
+      this.$confirm(
+        `是否确认将该学员退学?<p style="color: red;marginTop:20px">如需退款请在OA中操作</p>`,
+        "提示",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          dangerouslyUseHTMLString: true,
+          type: "warning",
+        }
+      )
         .then(async () => {
           let id = scope.row.studentId;
           if (scope.row.studentStatus == 3) {
@@ -140,15 +198,15 @@ export default {
           } else {
             const { data } = await getStudentSurplusCourseFee({
               studentId: id,
-              vipGroupId: this.id
-            })
+              vipGroupId: this.id,
+            });
             scope.row.fee = data.suplusCourseFee;
             this.leaveSchool(scope);
           }
         })
-        .catch(() => { });
-    }
-  }
+        .catch(() => {});
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>