Browse Source

2020 01/03 11:27

提交
mo 5 years ago
parent
commit
321cb460d1
1 changed files with 61 additions and 3 deletions
  1. 61 3
      src/views/buildVip/index.vue

+ 61 - 3
src/views/buildVip/index.vue

@@ -240,6 +240,25 @@
             <el-input v-model="rightForm.allPrice"
                       disabled />
           </el-form-item>
+          <el-form-item label="上课学生">
+            <!--      :loading="loading" -->
+            <el-select v-model="rightForm.students"
+                       multiple
+                       clearable
+                       placeholder="请输入关键词"
+                       remote
+                       reserve-keyword
+                       filterable
+                       :remote-method="remoteMethod">
+              <el-option v-for="(item,index) in studentList"
+                         :key="index"
+                         :label="item.username"
+                         :value="item.userId">
+                <span style="float: left">{{ item.username }}</span>
+                <span style="float: right; color: #8492a6; font-size: 13px">{{item.parentsPhone  }}</span>
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-form>
         <el-button type="primary"
                    style="float:right"
@@ -375,6 +394,7 @@
 import { getTeacher, getSubject } from '@/api/buildTeam'
 import { vipGroupCategory, vipGroupActivityFind, getVipGroupCostCount, createVip, getVipGroupDetail, updateVipBaseInfo } from '@/api/vipSeting'
 import { getTeachSchool, getTeacherBySubject } from '@/api/teacherManager'
+import { queryStudentList } from '@/api/studentManager'
 export default {
   data () {
     return {
@@ -412,7 +432,8 @@ export default {
         offlineCourse: '',
         onlinePrice: '',
         offlinePrice: '',
-        allPrice: ''
+        allPrice: '',
+        students: []
       },
       computationalBtn: false,
       subjectList: [], // 科目列表
@@ -485,7 +506,8 @@ export default {
           required: true, message: '请选择报名结束时间', trigger: 'blur'
         }]
       },
-      id: ''
+      id: '',
+      studentList: []
     }
   },
   computed: {
@@ -544,6 +566,13 @@ export default {
     })
     // 获取所有老师的接口  根据声部id获取老师
     // 获取课程类型的接口
+
+    // 获取学生列表
+    // queryStudentList({ rows: 100000 }).then(res => {
+    //   if (res.code == 200) {
+    //     this.studentList = res.data.rows
+    //   }
+    // })
   },
   methods: {
     beginDate () {
@@ -999,7 +1028,9 @@ export default {
         courseStart: '',
         courseEnd: ''
        */
+      let studentIdList = this.rightForm.students.join(',') || null
       obj.vipGroupApplyBaseInfo = {
+        studentIdList,
         coursesExpireDate: this.leftForm.courseEnd,
         teacherSchoolId: this.leftForm.section,
         name: this.leftForm.name,
@@ -1019,6 +1050,8 @@ export default {
         giveTeachMode: this.centerForm.radio,
         subjectIdList: this.leftForm.subject,
       }
+
+
       // 调接前判断是新增还是修改
       if (!this.id) {
         // 新增
@@ -1038,7 +1071,6 @@ export default {
 
     },
     setSection (val) {
-      console.log(val)
       this.leftForm.section = '';
       this.rightForm.offlineCourse = '';
       this.rightForm.onlineCourse = '';
@@ -1117,6 +1149,32 @@ export default {
       this.rightForm.allPrice = data.totalPrice;
 
       //subjectIdList
+    },
+    remoteMethod (query) {
+      if (query !== '') {
+        // this.loading = true;
+        // 发请求搜索
+        queryStudentList({ rows: 100, search: query }).then(res => {
+          if (res.code == 200) {
+            // this.loading = false;
+            this.studentList = this.studentList.concat(res.data.rows);
+            // this.studentList = res.data.rows;
+            this.unique(this.studentList, 'userId')
+            // console.log(this.studentList)
+
+          }
+        })
+
+      }
+
+    },
+    unique (arr, u_key) {
+      let obj = {}
+      arr.reduce((prev, next) => {
+        obj[next[u_key] + typeof next[u_key]] ? '' :
+          obj[next[u_key] + typeof next[u_key]] = true && prev.push(next)
+        return prev
+      }, [])
     }
   },
   // watch: {