|  | @@ -1,5 +1,7 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  | +    <div class="newBand"
 | 
	
		
			
				|  |  | +         @click="addStudentList">新增学员</div>
 | 
	
		
			
				|  |  |      <div class="tableWrap">
 | 
	
		
			
				|  |  |        <el-table :data='tableList'
 | 
	
		
			
				|  |  |                  :header-cell-style="{background:'#EDEEF0',color:'#444'}">
 | 
	
	
		
			
				|  | @@ -8,16 +10,20 @@
 | 
	
		
			
				|  |  |                           width="180">
 | 
	
		
			
				|  |  |          </el-table-column>
 | 
	
		
			
				|  |  |          <el-table-column label="手机号"
 | 
	
		
			
				|  |  | -                         prop="userName"
 | 
	
		
			
				|  |  | +                         prop="phone"
 | 
	
		
			
				|  |  |                           width="180">
 | 
	
		
			
				|  |  |          </el-table-column>
 | 
	
		
			
				|  |  |          <el-table-column label="操作">
 | 
	
		
			
				|  |  |            <template slot-scope="scope">
 | 
	
		
			
				|  |  |              <div>
 | 
	
		
			
				|  |  | -              <el-popover placement="top"
 | 
	
		
			
				|  |  | +              <!-- <el-popover placement="top"
 | 
	
		
			
				|  |  |                            width="160"
 | 
	
		
			
				|  |  | +                          trigger="click"
 | 
	
		
			
				|  |  |                            :ref="scope.$index">
 | 
	
		
			
				|  |  | -                <p>确定退学吗?</p>
 | 
	
		
			
				|  |  | +                <p>请输入退费金额</p>
 | 
	
		
			
				|  |  | +                <el-input style="margin:10px 0;"
 | 
	
		
			
				|  |  | +                          type="number"
 | 
	
		
			
				|  |  | +                          v-model="scope.row.fee"></el-input>
 | 
	
		
			
				|  |  |                  <div style="text-align: right; margin-top: 20px">
 | 
	
		
			
				|  |  |                    <el-button size="mini"
 | 
	
		
			
				|  |  |                               type="text"
 | 
	
	
		
			
				|  | @@ -27,22 +33,90 @@
 | 
	
		
			
				|  |  |                               @click="leaveSchool(scope)">确定</el-button>
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                  <el-button type="text"
 | 
	
		
			
				|  |  | -                           slot="reference">退学</el-button>
 | 
	
		
			
				|  |  | -              </el-popover>
 | 
	
		
			
				|  |  | +                           slot="reference"
 | 
	
		
			
				|  |  | +                           @click="lookFee(scope)">退学</el-button>
 | 
	
		
			
				|  |  | +              </el-popover> -->
 | 
	
		
			
				|  |  | +              <el-button type="text"
 | 
	
		
			
				|  |  | +                         @click="lookFee(scope)">退学</el-button>
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |            </template>
 | 
	
		
			
				|  |  |          </el-table-column>
 | 
	
		
			
				|  |  |        </el-table>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  | +    <el-dialog title="学员列表"
 | 
	
		
			
				|  |  | +               :visible.sync="maskVisible">
 | 
	
		
			
				|  |  | +      <el-form :model="maskForm"
 | 
	
		
			
				|  |  | +               :inline="true">
 | 
	
		
			
				|  |  | +        <el-form-item>
 | 
	
		
			
				|  |  | +          <el-input placeholder="请输入学生姓名或手机号"
 | 
	
		
			
				|  |  | +                    v-model='maskForm.search'></el-input>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +        <el-form-item>
 | 
	
		
			
				|  |  | +          <el-button type="danger"
 | 
	
		
			
				|  |  | +                     @click="search">搜索</el-button>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +        <el-form-item>
 | 
	
		
			
				|  |  | +          <el-button type="primary"
 | 
	
		
			
				|  |  | +                     @click="reset">重置</el-button>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +      </el-form>
 | 
	
		
			
				|  |  | +      <el-table :data="maskStudentList"
 | 
	
		
			
				|  |  | +                :header-cell-style="{background:'#EDEEF0',color:'#444'}">
 | 
	
		
			
				|  |  | +        <el-table-column label=""
 | 
	
		
			
				|  |  | +                         width="55">
 | 
	
		
			
				|  |  | +          <template slot-scope="scope">
 | 
	
		
			
				|  |  | +            <el-radio v-model="activeStudent"
 | 
	
		
			
				|  |  | +                      :label="scope.row.id"
 | 
	
		
			
				|  |  | +                      @change.native="getTemplateRow(scope.$index,scope.row)"> </el-radio>
 | 
	
		
			
				|  |  | +          </template>
 | 
	
		
			
				|  |  | +        </el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="userName"
 | 
	
		
			
				|  |  | +                         align="center"
 | 
	
		
			
				|  |  | +                         label="学生姓名"
 | 
	
		
			
				|  |  | +                         width="150"></el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="phone"
 | 
	
		
			
				|  |  | +                         align="center"
 | 
	
		
			
				|  |  | +                         label="手机号"
 | 
	
		
			
				|  |  | +                         width="200"></el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="courseSalary"
 | 
	
		
			
				|  |  | +                         label="剩余费用"></el-table-column>
 | 
	
		
			
				|  |  | +      </el-table>
 | 
	
		
			
				|  |  | +      <pagination :total="rules.total"
 | 
	
		
			
				|  |  | +                  :page.sync="rules.page"
 | 
	
		
			
				|  |  | +                  :limit.sync="rules.limit"
 | 
	
		
			
				|  |  | +                  :page-sizes="rules.page_size"
 | 
	
		
			
				|  |  | +                  @pagination="getList" />
 | 
	
		
			
				|  |  | +      <div slot="footer"
 | 
	
		
			
				|  |  | +           class="dialog-footer">
 | 
	
		
			
				|  |  | +        <el-button @click="maskVisible = false">取 消</el-button>
 | 
	
		
			
				|  |  | +        <el-button type="primary"
 | 
	
		
			
				|  |  | +                   @click="addStudent">确 定</el-button>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +    </el-dialog>
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { findVipGroupStudents, leaveSchool } from '@/api/vipSeting'
 | 
	
		
			
				|  |  | +import pagination from '@/components/Pagination/index'
 | 
	
		
			
				|  |  | +import { findVipGroupStudents, leaveSchool, getStudentSurplusCourseFee, getHaveCourseBalanceStudents, addVipGroupStudents } from '@/api/vipSeting'
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  | +  components: { pagination },
 | 
	
		
			
				|  |  |    data () {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  |        tableList: [],
 | 
	
		
			
				|  |  | -      id: ''
 | 
	
		
			
				|  |  | +      id: '',
 | 
	
		
			
				|  |  | +      maskStudentList: [],
 | 
	
		
			
				|  |  | +      maskVisible: false,
 | 
	
		
			
				|  |  | +      rules: {
 | 
	
		
			
				|  |  | +        // 分页规则
 | 
	
		
			
				|  |  | +        limit: 10, // 限制显示条数
 | 
	
		
			
				|  |  | +        page: 1, // 当前页
 | 
	
		
			
				|  |  | +        total: 0, // 总条数
 | 
	
		
			
				|  |  | +        page_size: [10, 20, 40, 50] // 选择限制显示条数
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      activeStudent: '',
 | 
	
		
			
				|  |  | +      maskForm: {
 | 
	
		
			
				|  |  | +        search: ''
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    mounted () {
 | 
	
	
		
			
				|  | @@ -51,13 +125,91 @@ export default {
 | 
	
		
			
				|  |  |      this.getStudents()
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | +    search () {
 | 
	
		
			
				|  |  | +      this.rules.page = 1;
 | 
	
		
			
				|  |  | +      this.getList()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    reset () {
 | 
	
		
			
				|  |  | +      this.rules.page = 1;
 | 
	
		
			
				|  |  | +      this.rules.search = null;
 | 
	
		
			
				|  |  | +      this.activeStudent = '';
 | 
	
		
			
				|  |  | +      this.getList();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      getStudents () {
 | 
	
		
			
				|  |  |        findVipGroupStudents({ vipGroupId: this.id }).then(res => {
 | 
	
		
			
				|  |  |          if (res.code == 200) {
 | 
	
		
			
				|  |  |            this.tableList = res.data.rows;
 | 
	
		
			
				|  |  | +          for (let i in this.tableList) {
 | 
	
		
			
				|  |  | +            this.tableList[i].fee = 0;
 | 
	
		
			
				|  |  | +            this.tableList[i].visible = false;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    leaveSchool (scope) {
 | 
	
		
			
				|  |  | +      let studentId = scope.row.id;
 | 
	
		
			
				|  |  | +      let vipGroupId = this.id;
 | 
	
		
			
				|  |  | +      let amount = scope.row.fee;
 | 
	
		
			
				|  |  | +      leaveSchool({ studentId, vipGroupId, amount }).then(res => {
 | 
	
		
			
				|  |  | +        if (res.code == 200) {
 | 
	
		
			
				|  |  | +          this.$message({
 | 
	
		
			
				|  |  | +            type: 'success',
 | 
	
		
			
				|  |  | +            message: '退学成功'
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          this.getStudents();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    lookFee (scope) {
 | 
	
		
			
				|  |  | +      let id = scope.row.id;
 | 
	
		
			
				|  |  | +      getStudentSurplusCourseFee({ studentId: id, vipGroupId: this.id }).then(res => {
 | 
	
		
			
				|  |  | +        if (res.code == 200) {
 | 
	
		
			
				|  |  | +          // scope.row.fee =
 | 
	
		
			
				|  |  | +          this.$prompt('请输入退课金额', '提示', {
 | 
	
		
			
				|  |  | +            confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +            cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +            inputValue: res.data.suplusCourseFee
 | 
	
		
			
				|  |  | +          }).then(({ value }) => {
 | 
	
		
			
				|  |  | +            scope.row.fee = value;
 | 
	
		
			
				|  |  | +            this.leaveSchool(scope);
 | 
	
		
			
				|  |  | +          }).catch(res => {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    addStudentList () {
 | 
	
		
			
				|  |  | +      // 发请求 搜索学生
 | 
	
		
			
				|  |  | +      this.getList();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    getList () {
 | 
	
		
			
				|  |  | +      let search = this.maskForm.search || null;
 | 
	
		
			
				|  |  | +      getHaveCourseBalanceStudents({ organId: this.$store.getters.organ, page: this.rules.page, rows: this.rules.limit, search }).then(res => {
 | 
	
		
			
				|  |  | +        if (res.code == 200) {
 | 
	
		
			
				|  |  | +          this.rules.total = res.data.total;
 | 
	
		
			
				|  |  | +          this.maskStudentList = res.data.rows;
 | 
	
		
			
				|  |  | +          this.maskVisible = true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    getTemplateRow (index, row) {
 | 
	
		
			
				|  |  | +      // console.log(row);
 | 
	
		
			
				|  |  | +      this.activeStudent = row.id;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    addStudent () {
 | 
	
		
			
				|  |  | +      if (!this.activeStudent) {
 | 
	
		
			
				|  |  | +        this.$message.error('请选择一名学生');
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      addVipGroupStudents({ vipGroupId: this.id, studentIds: this.activeStudent }).then(res => {
 | 
	
		
			
				|  |  | +        if (res.code == 200) {
 | 
	
		
			
				|  |  | +          this.$message.success('添加成功')
 | 
	
		
			
				|  |  | +          this.getList();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </script>
 |