| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- <template>
- <div class="context">
- <div class="panel">
- <div class="panel-body">
- <br>
- <el-page-header @back="goBack" content="课程管理">
- <br>
- </el-page-header>
- <span class="classNames">
- {{title}}
- </span>
- <br>
- <div class="panel_control">
- <el-row :gutter="20">
- <el-col :span="4">
- <em>会员名:</em>
- <el-input v-model="panel.name" placeholder="请输入会员名"></el-input>
- </el-col>
- <el-col :span="4">
- <em>手机号:</em>
- <el-input v-model="panel.phone" placeholder="请输入手机号" type="number"></el-input>
- </el-col>
- <el-col :span="4">
- <el-button size="" type="primary" @click="query" plain :disabled="serachBtnStatus">查询
- </el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- <div class="change">
- <el-button @click="addFinish">确认下课</el-button>
- <el-button @click="addFinishMember">添加上课会员</el-button>
- </div>
- </div>
- <div class="table">
- <el-table
- :data="tableData"
- border
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- >
- >
- <el-table-column
- type="index"
- label="排名"
- align="center"
- width="50">
- </el-table-column>
- <el-table-column
- prop="head"
- label="头像"
- align="center"
- sortable
- >
- <template slot-scope="scope">
- <img class="head" :src="scope.row.Head" alt="" height="51" width="51" v-if="scope.row.Head">
- <img class="head" src="../assets/img/nav/head.png" height="51" width="51" v-else/>
- </template>
- </el-table-column>
- <el-table-column
- prop="Name"
- label="会员名"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="ClassName"
- label="课程"
- sortable
- >
- <template slot-scope="scope">
- <span class="lessons"
- :style="{ background:scope.row.ClassColor }">{{scope.row.ClassName}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="OrderTime"
- label="预约时间"
- :formatter="filterFmtDate"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="RemainTotalhour"
- label="剩余全部课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="Status"
- label="状态"
- sortable
- >
- <template slot-scope="scope">
- <span v-if="scope.row.Status == 1">预约上课 </span>
- <span v-if="scope.row.Status == 2">预约未到</span>
- <span v-if="scope.row.Status == 3">上课未预约</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="Status"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button type="primary" round v-if="scope.row.Status == 1" size="mini"
- @click="pauseRow(scope.row,2)">
- 预约未到
- </el-button>
- <el-button type="warning" round v-if="scope.row.Status == 2" size="mini"
- @click="pauseRow(scope.row,1)">
- 撤销
- </el-button>
- <el-button type="danger" round v-if="scope.row.Status == 3" size="mini"
- @click="getClassOverDetailDel(scope.row)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- </div>
- <el-dialog title="添加上课会员" :visible.sync="dialogVisible" width="650px">
- <div class="dialogContent viplist">
- <span class="blueTitle">{{ClassName}} {{BeginTime}}</span>
- <div>
- <el-transfer filterable v-model="dialogValue" :data="form.dialogdata"
- :titles="['会员列表', '已添加会员']"></el-transfer>
- </div>
- </div>
- <div class="dialogFooter">
- <el-button type="primary" size="small" @click="confirmMember">确定</el-button>
- <el-button size="small" @click="dialogVisible = false">取消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import {
- ClassDetailQuery,
- ClassOverDetailListQuery,
- VipUserSimpleQuery,
- ClassOverDetailAdd,
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- serachBtnStatus: false,
- tableData: [],
- title: '',
- dialogVisible: false,//添加下课会员
- dialogFinishVisible: false,//确认下课dialog
- dialogLesson: false,//课时调整
- dialogGift: false,//赠送课时调整
- dialogExpTime: false,//有效期调整
- dialogLessonTable: false,//会员课程
- dialogTitle: '新增会员',
- current: getNowDate(),
- dialogValue: [],
- dialogCoachValue: [],
- BeginTime: '',
- ClassName: '',
- // panel 配置项目
- panel: {
- name: '',
- phone: '',
- usercode: '',
- username: '',
- compname: '',
- keyword: '',
- USERCODE: '',
- endType: '',
- taskstatus: 99,
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: false,
- fileList: [],
- multipleSelection: [],
- detectedmac: '',
- BeginTime: '',
- ClassName: '',
- options: [
- {value: 99, label: '全部'},
- {value: 1, label: '进行中'},
- {value: 2, label: '已完成'},
- ],
- endTypeOptions: [
- {value: 99, label: '全部'},
- {value: 30, label: '近一个月'},
- {value: 7, label: '近一周'},
- {value: 1, label: '当日'},
- ],
- time1: globalBt(),
- },
- form: {
- name: '',
- userCode: '',
- coach: '',
- coachOptions: [],
- shopId: '',
- memberType: 1,
- lesson: 1,
- gift: 1,
- btnType: 0,//0新建,1编辑编辑
- memo: '',
- expTime: '',
- dialogdata: [],//穿梭待选
- dialogValue: [],//穿梭已选
- dialogCoachdata: [],//穿梭已选
- },
- memberTypes: [
- {value: 1, label: '年会员'},
- {value: 2, label: '充值会员'},
- ],
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 100,
- pageIndex: 1,
- },
- }
- },
- mounted() {
- this.getTableQuery();
- this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
- },
- methods: {
- // 确认下课
- addFinish() {
- // this.clearForm();
- // // 重新获得教练名单
- // this.getCoachOption();
- // this.dialogFinishVisible = true
- // this.btnType = 0;
- this.dialogTitle = '确认下课'
- },
- // 添加下课会员
- addFinishMember() {
- let that = this;
- this.clearForm();
- this.getClassVipuserQuery();
- this.dialogValue = [];
- let std = [];
- if (this.tableData) {
- this.tableData.map(function (item) {
- std.push(item.UserId)
- })
- }
- that.dialogValue = std;
- this.dialogVisible = true
- },
- clearForm() {
- // clear
- this.form.name = '';
- this.form.userCode = '';
- this.form.shopId = '';
- this.dialogCoachValue = [];
- },
- // 获取本课程下的会员列表
- getClassVipuserQuery() {
- let that = this;
- let param = {
- token: localStorage.token,
- // classId: this.$route.query.classId,
- };
- let postdata = qs.stringify(param);
- // ClassVipuserQuery(postdata).then(res => {
- VipUserSimpleQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // that.form.dialogdata = turnResToOptionByViper(json.Rs);
- that.form.dialogdata = turnResToOptionBySimViper(json.Rs);
- console.log(that.form.dialogdata);
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 确认提交下课会员
- confirmMember() {
- let that = this;
- // checkNum
- let userlist = that.dialogValue.toString();
- let param = {
- token: localStorage.token,
- stdId: this.$route.query.StdId,
- userlist: userlist
- };
- let postdata = qs.stringify(param);
- // 下课记录详情添加
- ClassOverDetailAdd(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '下课会员修改成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- pauseRow() {
- },
- getClassOverDetailDel() {
- },
- // 查询按钮
- query() {
- let that = this;
- that.serachBtnStatus = true;
- let totalTime = 2
- let clock = window.setInterval(() => {
- totalTime--
- if (totalTime < 0) {
- totalTime = 2;
- that.serachBtnStatus = false;
- }
- }, 1000)
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- goBack() {
- this.$router.push({
- path: '/courses', query: {}
- });
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- let param = {
- token: localStorage.token,
- stdId: this.$route.query.StdId,
- start: 1,//
- tableMax: 9999,//
- };
- let postdata = qs.stringify(param);
- ClassOverDetailListQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 每页显示数量
- handleSizeChange() {
- let that = this;
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- that.draw = that.pageination.pageItem;
- // that.getTableQuery();
- },
- // 翻页
- pageChange(pageIndex) {
- let that = this;
- // 获取当前页
- let index = that.pageination.pageItem * (pageIndex - 1);
- // 数据总数
- let nums = that.pageination.pageItem * pageIndex;
- // 容器
- let tables = [];
- for (var i = index; i < nums; i++) {
- if (that.allTableData[i]) {
- tables.push(that.allTableData[i])
- }
- this.tableData = tables;
- }
- that.start = index * that.draw;
- // that.getTableQuery();
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- let that = this;
- if (column == "0001-01-01T08:05:43+08:05" || column == "0001-01-01T00:00:00Z") {
- return '未预约';
- } else {
- return nonTfmtDate(column, 11);
- }
- },
- },
- watch: {
- $route(to) {
- if (to.name == 'courseEdit') {
- this.getTableQuery();
- this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
- }
- },
- },
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- .context {
- height: 770px;
- overflow-y: scroll;
- display: block;
- margin: 0 auto;
- background-color: #fff !important;
- padding: 30px;
- }
- .classNames {
- width: 211px;
- height: 25px;
- background: #f0f2f5;
- font-family: "Source Han Sans CN";
- font-weight: normal;
- font-size: 16px;
- color: #3799ff;
- border-radius: 250px;
- text-align: center;
- margin-top: 15px;
- margin-bottom: 3px;
- float: left;
- }
- .head {
- overflow: hidden;
- display: block;
- margin: 0 auto;
- border-radius: 250px;
- }
- .panel_control {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- /deep/ .el-transfer-panel__item .el-checkbox__input {
- float: left;
- left: 20%;
- }
- /*.panel-body {*/
- .panel_control {
- padding: 20px;
- background: #F0F2F5;
- }
- .change {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .change button {
- float: left;
- }
- .change button.pull-right {
- float: right;
- }
- .lessons {
- padding: 1px 7px;
- border-radius: 250px;
- float: left;
- color: #000;
- }
- </style>
|