| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687 |
- <template>
- <div class="context">
- <!-- panel-->
- <div class="">
- <div class="panel">
- <h5>预约管理</h5>
- </div>
- <div class="timeList">
- <ul>
- <li :class="[{'active': i == choiceDate}]" v-for="(day,i) in weeks" @click="choiceTime(i)">
- <em>{{ day.name }}</em><span>{{ day.data }}</span>
- </li>
- </ul>
- </div>
- <el-tabs v-model="activeName" type="card">
- <el-tab-pane label="会员预约列表" name="second">
- <div class="panel-body">
- <div class="panel_control">
- <el-row :gutter="1">
- <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">
- <em>预约课程:</em>
- <el-select v-model="panel.classId">
- <el-option
- v-for="item in panel.classOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="2">
- <el-button size="" type="primary" @click="query" plain :disabled="serachBtnStatus">
- 查询
- </el-button>
- </el-col>
- <el-col :span="8" style="float:right">
- <el-button class="pull-right vipAddBtn" type="warning" @click="addMember(1)" style="margin-left: 10px">本店预约</el-button>
- <el-button class="pull-right acrossAddBtn" type="success" @click="addMember(2)">跨店预约</el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- <br>
- <div class="table">
- <el-table
- :data="tableData2"
- border
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- @selection-change="handleSelectionChange" @current-change="clickChange"
- >
- >
- <el-table-column label="选择" width="55" fixed>
- <template slot-scope="scope">
- <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
- </template>
- </el-table-column>
- <el-table-column label="序号" type="index" width="50" align="center" fixed>
- <template scope="scope">
- <span>{{ (start) + scope.$index + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="UserName"
- label="会员名"
- fixed
- >
- </el-table-column>
- <el-table-column
- prop="Phone"
- label="手机号"
- width="160"
- sortable
- fixed
- >
- </el-table-column>
- <el-table-column
- prop="ClassName"
- label="预约课程"
- width="120"
- 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="BeginTime"
- label="上课时间"
- :formatter="filterFmtDate"
- width="160"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="Base.CreatedAt"
- label="会员预约时间"
- width="160"
- :formatter="filterFmtDate"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="ConsumeHour"
- label="消耗课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="RemainHour"
- label="剩余课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="Status"
- label="预约状态"
- sortable
- >
- <template slot-scope="scope">
- <span v-if="scope.row.Status == 1" style="color: chartreuse">已预约</span>
- <span v-if="scope.row.Status == 2" style="color: #ccc">已取消</span>
- <span v-if="scope.row.Status == 3" style="color: red">预约未到</span>
- <span v-if="scope.row.Status == 4" style="color: #015B9E">已完成</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="Status"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button type="danger" size="mini" round
- @click="BtnOrderCancelByManager(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-tab-pane>
- <el-tab-pane label="课程预约列表" name="first">
- <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=""
- @selection-change="handleSelectionChange" @current-change="clickChange"
- >
- <el-table-column label="序号" type="index" width="50" align="center">
- <template scope="scope">
- <span>{{ (start) + scope.$index + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="BeginTime"
- label="上课时间"
- width="160"
- :formatter="filterFmtDate"
- >
- </el-table-column>
- <el-table-column
- prop="ClassName"
- label="课程"
- width="110"
- 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="Recovered"
- label="预约比例"
- width="210px"
- sortable
- >
- <template slot-scope="scope">
- <el-progress
- :percentage="parseInt((scope.row.OrderCount/scope.row.OrderToplimit * 100))"
- :format="format"
- ></el-progress>
- </template>
- </el-table-column>
- <el-table-column
- prop="OrderToplimit"
- label="预约名额"
- >
- </el-table-column>
- <el-table-column
- prop="OrderCount"
- label="预约人数"
- >
- </el-table-column>
- <el-table-column
- prop="ConsumeHour"
- label="消耗课时"
- >
- </el-table-column>
- <el-table-column
- prop="WxOrder"
- label="微信可约"
- >
- <template slot-scope="scope">
- <!-- 0:不可预约 1:可预约-->
- <el-switch
- v-model="scope.row.WxOrder"
- :active-value="1"
- :inactive-value="0"
- active-color="#409EFF"
- inactive-color="#D9D9D9"
- @change=changeWechat($event,scope.row)
- >
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column
- prop="StdId"
- label="操作"
- width=70px
- >
- <template slot-scope="scope">
- <el-button type="text" @click="seeDetail(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-tab-pane>
- </el-tabs>
- </div>
- <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="650px">
- <div class="dialogContent">
- <div class="">
- <el-form ref="form" :model="form" label-width="160px">
- <el-form-item label="当前日期" :required="true">
- <el-input v-model="form.displayDay" placeholder="placeholder" :disabled="true"
- style="width: 220px"></el-input>
- </el-form-item>
- <el-form-item label="课程" :required="true">
- <el-select v-model="form.stdId" filterable placeholder="请选择"
- @change="vipSelect(form.stdId)">
- <el-option
- v-for="item in form.stdList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <!-- 课程联动查询userlist by classid-->
- <el-form-item label="本店会员" :required="true" v-if="form.addType == 1 ">
- <el-select v-model="form.userId" filterable placeholder="请选择"
- @change="reMainSelect(form.userId)">
- <el-option
- v-for="item in form.userList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="跨店会员" :required="true" v-if="form.addType == 2 ">
- <el-select v-model="form.userId" filterable placeholder="请选择"
- @change="reMainSelect(form.userId)">
- <el-option
- v-for="item in form.userList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="消耗课时">
- <el-input v-model="form.ConsumeHour" placeholder="placeholder" :disabled="true"
- style="width: 220px"></el-input>
- </el-form-item>
- <el-form-item label="会员剩余课时">
- <el-input v-model="form.remain" placeholder="placeholder" :disabled="true"
- style="width: 220px"></el-input>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <div class="dialogFooter">
- <el-button type="primary" size="small" @click="ConfirmOrderAddByManager"
- :disabeld="BtnConfirmOrderAddByManager">确定
- </el-button>
- <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
- </div>
- </el-dialog>
- <el-dialog title="预约会员" :visible.sync="dialogTableVisible" width="650px">
- <el-table :data="gridData">
- <el-table-column property="UserName" label="姓名" width="200"></el-table-column>
- <el-table-column property="Phone" label="手机"></el-table-column>
- </el-table>
- </el-dialog>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import {
- TodayClassOrderQuery,
- VipUserListQuery,
- TodayVipOrderQuery,
- ClassOrderQuery,
- OrderAddByManager,
- ClassListByOrderDate,
- VipUserOrderQuery,
- OrderCancelByManager,
- STTDetailWxOrderEdit,
- testTable,
- testSelect,
- WaitingBeginClassList,
- ShopWxStatusEdit,
- ClassListQuery,
- ClassSimpleQuery,
- AcrossUserSimpleQuery,
- VipUserSimpleQuery
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- BtnConfirmOrderAddByManager: false,
- serachBtnStatus: false,
- activeName: 'second',
- choiceDate: 0,//默认为今天
- tableView: true,//其他dialog
- dialogVisible: false,//其他dialog
- dialogTableVisible: false,//其他dialog
- dialogMemberVisible: false,//新增教练dialog
- dialogLesson: false,//课时调整
- dialogGift: false,//赠送课时调整
- dialogExpTime: false,//有效期调整
- dialogLessonTable: false,//教练课程
- dialogTitle: '增加预约',
- current: getNowDate(),
- dialogValue: [],
- weeks: [],
- gridData: [],
- start: 0,
- draw: 1,
- // panel 配置项目
- panel: {
- name: '',
- phone: '',
- classId: '0',
- usercode: '',
- username: '',
- compname: '',
- keyword: '',
- USERCODE: '',
- endType: '',
- taskstatus: 99,
- draw: 1,
- start: 0,
- recordsTotal: 0,
- recordsTotal2: 0,
- tableData: [],
- allTableData: [],
- allTableData2: [],
- limit: '10',
- multipleSort: false,
- loading: false,
- fileList: [],
- multipleSelection: [],
- detectedmac: '',
- 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(),
- },
- multipleSelection: [],
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 100,
- pageIndex: 1,
- },
- form: {
- name: '',
- displayDay: '',
- userCode: '',
- shopId: '',
- stdId: 0,
- userId: 0,
- memberType: 1,
- lesson: 1,
- gift: 1,
- btnType: 0,//0新建,1编辑编辑
- memo: '',
- expTime: '',
- dialogdata: [],//穿梭待选
- dialogValue: [],//穿梭已选
- userList: [],//穿梭已选
- stdList: [],//穿梭已选
- remain: 0,
- ConsumeHour: 0,
- addType: 0
- },
- memberTypes: [
- {value: 1, label: '年教练'},
- {value: 2, label: '充值教练'},
- ],
- tableData: [],
- tableData2: [],
- tableRadio: [],
- }
- },
- mounted() {
- if (this.$route.query.page == 'second') {
- this.panel.name = this.$route.query.name;
- this.activeName = 'second'
- } else {
- this.activeName = 'second'
- }
- this.ClassSelect();
- this.panelSelect();
- // this.getCurrWeekDays();
- this.getFurtherDays();
- },
- methods: {
- clickChange(item) {
- this.tableRadio = item
- },
- // .课程表详情微信可预约状态修改
- changeWechat(e, appoint) {
- let that = this;
- let statusText = appoint.WxOrder == 0 ? "关闭" : "开启";
- this.$confirm('是否' + statusText + '课程预约?', '微信预约操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- stdId: appoint.StdId,
- wxOrder: e,
- };
- let postdata = qs.stringify(param);
- STTDetailWxOrderEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '预约已' + statusText + '!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- // 状态返回
- appoint.WxOrder = e == 0 ? 1 : 0;
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }).catch(() => {
- this.appoint = "0";
- this.$message({
- type: 'info',
- message: '已取消当前操作'
- });
- });
- },
- panelSelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- ClassSimpleQuery(postdata).then(res => {
- // ClassListQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- if (json.Rs == null) return false;
- that.panel.classOptions = turnClassResToOption(json.Rs);
- that.panel.classOptions.unshift({value: '0', label: '全部'})
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- vipSelect(stdId) {
- let that = this;
- // 筛选相同的stdid的classId
- that.form.stdList.map(function (item) {
- if (item.value == stdId) {
- that.form.ConsumeHour = item.ConsumeHour;
- let param = {
- token: localStorage.token,
- // classId: item.classId
- };
- let postdata = qs.stringify(param);
- // VipUserListQuery
- // 本店会员添加时
- if (that.form.addType == 1) {
- VipUserSimpleQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.userId = '';
- that.form.userList = turnResToOptionBySimViper(json.Rs);
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }
- // 跨店会员添加时
- if (that.form.addType == 2) {
- AcrossUserSimpleQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.userId = '';
- that.form.userList = turnResToOptionBySimViper(json.Rs);
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }
- }
- })
- },
- reMainSelect(userId) {
- let that = this;
- this.form.userList.filter((v) => {
- if (v.key == userId) {
- that.form.remain = v.RemainHour;
- }
- })
- },
- ClassSelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- start: 1,//
- tableMax: 9999,//
- };
- let postdata = qs.stringify(param);
- WaitingBeginClassList(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.stdList = turnStdToOption(json.Rs);
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- ConfirmOrderAddByManager() {
- let that = this;
- that.BtnConfirmOrderAddByManager = true;
- let param = {
- token: localStorage.token,
- stdId: this.form.stdId,
- userId: this.form.userId,
- };
- let postdata = qs.stringify(param);
- OrderAddByManager(postdata).then(res => {
- let json = res;
- that.BtnConfirmOrderAddByManager = false;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '预约添加成功!',
- type: 'success'
- });
- this.getTableQuery2();
- that.dialogMemberVisible = false;
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- // 选择日期
- choiceTime(i) {
- this.choiceDate = parseInt(i);
- // 读取当前页
- if (this.activeName == 'first') {
- this.getTableQuery();
- } else {
- // second
- this.getTableQuery2();
- }
- },
- seeDetail(row) {
- let that = this;
- let dayIndex = parseInt(this.choiceDate);
- let param = {
- token: localStorage.token,
- classId: row.ClassId,
- orderDate: this.weeks[dayIndex].orderDate,
- stdId: row.StdId,
- };
- let postdata = qs.stringify(param);
- VipUserOrderQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- this.dialogTableVisible = true;
- this.gridData = json.Rs;
- console.log(123);
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- format(percentage) {
- return percentage === 100 ? '已满' : `${percentage}%`;
- },
- // 编辑
- BtnOrderCancelByManager(row) {
- let that = this;
- this.$confirm('是否取消用户 ' + row.UserName + ' 的预约?', '取消预约', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- orderId: row.OrderId,
- };
- let postdata = qs.stringify(param);
- OrderCancelByManager(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.UserName + '取消预约成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery2();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消操作'
- });
- });
- },
- // 禁用
- pauseRow(row) {
- let that = this;
- this.$confirm('是否禁用用户' + row.name + '?', '禁用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- Id: row.Id,
- status: 0,
- };
- let postdata = qs.stringify(param);
- testTable(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.name + '禁用成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消禁用'
- });
- });
- },
- // 启用
- runRow(row) {
- let that = this;
- this.$confirm('是否启用用户' + row.name + '?', '启用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- Id: row.Id,
- status: 1,
- };
- let postdata = qs.stringify(param);
- testTable(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.name + '启用成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消启用'
- });
- });
- },
- // 关闭所有
- allDialogClose() {
- this.dialogVisible = false;
- this.dialogGift = false;
- this.dialogLesson = false;
- this.dialogExpTime = false;
- this.dialogLessonTable = false;
- },
- // 用户禁用 todo
- // 用户启用 todo
- // 有效期调整
- ExpTimeChange() {
- // 仅针对年费用户,使用日期格式
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- if (parseInt(row.vipType) == 2) {
- this.$message({
- showClose: true,
- message: '错了哦,充值教练不能调整有效期',
- type: 'error'
- });
- return false
- }
- this.form.expTime = row.expTime;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogExpTime = true;
- },
- // 课时调整
- lessonChange() {
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- this.form.lesson = row.Recovered;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogLesson = true;
- },
- // 赠送调整
- giftChange() {
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- this.form.gift = row.Recovered;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogGift = true;
- },
- // 增删教练课程
- lessonStudenChange() {
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- this.form.gift = row.Recovered;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogLessonTable = true;
- },
- // 确认提交新增教练
- confirmMember() {
- let that = this;
- // checkNum
- if (!that.form.userCode) {
- this.$message.error('错了哦,手机号不能为空');
- return false
- }
- if (!globalCheckPhone(that.form.userCode)) {
- this.$message.error('错了哦,手机号格式不正确');
- return false
- }
- if (!that.form.name) {
- this.$message.error('错了哦,教练名不能为空');
- return false
- }
- if (that.form.name.length > 8) {
- this.$message.error('错了哦,教练名字数超过8个字');
- return false
- }
- if (that.form.memo) {
- if (that.form.memo.length > 200) {
- this.$message.error('错了哦,备注字数超过200个字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- name: that.form.name,
- memberType: that.form.memberType,
- lesson: that.form.lesson,
- gift: that.form.gift,
- memo: that.form.memo,
- dialogValue: that.form.dialogValue,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogMemberVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '教练添加成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- confirmEditMember() {
- let that = this;
- // checkNum
- if (!that.form.userCode) {
- this.$message.error('错了哦,手机号不能为空');
- return false
- }
- console.log(that.form.userCode);
- if (!globalCheckPhone(that.form.userCode)) {
- this.$message.error('错了哦,手机号格式不正确');
- return false
- }
- if (!that.form.name) {
- this.$message.error('错了哦,教练名不能为空');
- return false
- }
- if (that.form.name.length > 8) {
- this.$message.error('错了哦,教练名字数超过8个字');
- return false
- }
- if (that.form.memo) {
- if (that.form.memo.length > 200) {
- this.$message.error('错了哦,备注字数超过200个字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- name: that.form.name,
- memberType: that.form.memberType,
- lesson: that.form.lesson,
- gift: that.form.gift,
- memo: that.form.memo,
- dialogValue: that.form.dialogValue,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogMemberVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '教练信息编辑成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- // 确认提交课时
- confirmLesson() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- lesson: that.form.lesson,
- };
- let postdata = qs.stringify(param);
- testSelect(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 + ' 错误码:' + json.Code);
- }
- })
- },
- // 确认提交赠送
- confirmGift() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- gift: that.form.gift,
- };
- let postdata = qs.stringify(param);
- testSelect(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 + ' 错误码:' + json.Code);
- }
- })
- },
- // 确认提交有效期
- confirmExpTime() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- expTime: that.form.expTime,
- };
- let postdata = qs.stringify(param);
- testSelect(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 + ' 错误码:' + json.Code);
- }
- })
- },
- // 确认提交教练课程
- confirmLessonTable() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- dialogValue: that.form.dialogValue,
- };
- let postdata = qs.stringify(param);
- testSelect(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 + ' 错误码:' + json.Code);
- }
- })
- },
- // 新增预约
- addMember(type) {
- this.clearForm();
- // 加载当前可选课程
- this.getClassListByOrderDate();
- this.dialogMemberVisible = true;
- this.form.displayDay = this.weeks[this.choiceDate].data + ' ' + this.weeks[this.choiceDate].name;
- this.btnType = 0;
- this.form.ConsumeHour = 0;
- this.form.addType = type
- this.dialogTitle = '新增预约';
- },
- // 加载当前可选课程
- getClassListByOrderDate() {
- let that = this;
- let dayIndex = parseInt(this.choiceDate);
- let param = {
- token: localStorage.token,
- orderDate: this.weeks[dayIndex].orderDate,
- };
- let postdata = qs.stringify(param);
- ClassListByOrderDate(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.stdList = turnStdToOption(json.Rs);
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- // 删除
- delList() {
- let that = this;
- // checkNum
- if (!this.multipleSelection.length) {
- that.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- that.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let detectorid = that.tableRadio.Id;
- let param = {
- token: localStorage.token,
- detectorid: detectorid,
- status: 9,//0禁用1启用9删除
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该教练, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '选中的教练已删除!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 查询按钮
- 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.getTableQuery2();
- this.$message.success('查询完毕');
- },
- clearForm() {
- // clear
- this.form.stdId = '';
- this.form.userId = '';
- this.form.name = '';
- this.form.userCode = '';
- this.form.shopId = '';
- this.form.userList = [];
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- let dayIndex = parseInt(this.choiceDate);
- let param = {
- token: localStorage.token,
- orderDate: this.weeks[dayIndex].orderDate,
- };
- let postdata = qs.stringify(param);
- ClassOrderQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData = [];
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- getTableQuery2() {
- let that = this;
- that.loading = true;
- let dayIndex = parseInt(this.choiceDate);
- let param = {
- token: localStorage.token,
- classId: this.panel.classId,//
- stdId: 0,//
- name: this.panel.name,//
- phone: this.panel.phone,//
- orderDate: this.weeks[dayIndex].orderDate,
- };
- let postdata = qs.stringify(param);
- VipUserOrderQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData2 = json.Rs;
- that.recordsTotal2 = json.Rs.length;
- } else {
- that.allTableData2 = [];
- that.recordsTotal2 = 0;
- }
- // 设置分页数据
- that.setPaginations2();
- } else {
- that.$message.error(json.Memo + ' 错误码:' + json.Code);
- }
- })
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 设置分页数据
- setPaginations2() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal2;
- // 默认分页
- that.tableData2 = that.allTableData2.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();
- },
- // 自动排序
- sortChange(params) {
- console.log(params)
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- let that = this;
- return nonTfmtDate(column, 11);
- },
- // 过滤金额
- filterMoney(value, row, column) {
- let that = this;
- return parseFloat(column).toFixed(2);
- },
- // 本周
- getCurrWeekDays() {
- let now = new Date();
- let nowTime = now.getTime();
- let day = now.getDay();
- let oneDayTime = 24 * 60 * 60 * 1000;
- let days = '';
- let item = [];
- let month = 0;
- for (let i = 0; i < 7; i++) {
- days = new Date(nowTime + (i - day) * oneDayTime);//显示周日
- month = days.getMonth() + 1;
- item = {
- name: this.numberToWeek(days.getDay()),
- data: month + '月' + days.getDate() + '日',
- orderDate: new Date().getFullYear() + '-' + month + '-' + days.getDate()
- }
- this.weeks.push(item)
- }
- },
- // 获取未来7天的
- getFurtherDays() {
- let now = new Date();
- let nowTime = now.getTime();
- let oneDayTime = 24 * 60 * 60 * 1000;
- let days = '';
- let item = [];
- let month = 0;
- let day = 0;
- for (let i = 0; i < 7; i++) {
- days = new Date(nowTime + (i) * oneDayTime);//显示周日
- month = days.getMonth() + 1;
- day = days.getDate();
- month = month < 10 ? '0' + month : month;
- day = day < 10 ? '0' + day : day;
- item = {
- name: this.numberToWeek(days.getDay()),
- data: days.getMonth() + 1 + '月' + days.getDate() + '日',
- orderDate: days.getFullYear() + '-' + month + '-' + day
- }
- this.weeks.push(item)
- }
- this.getTableQuery();
- this.getTableQuery2();
- },
- numberToWeek(val) {
- switch (parseInt(val)) {
- case 1:
- return '星期一';
- break;
- case 2:
- return '星期二';
- break;
- case 3:
- return '星期三';
- break;
- case 4:
- return '星期四';
- break;
- case 5:
- return '星期五';
- break;
- case 6:
- return '星期六';
- break;
- case 0:
- return '星期天';
- break;
- }
- }
- },
- watch: {
- $route(to) {
- if (to.name == 'appoint') {
- this.panelSelect();
- if (this.$route.query.page == 'second') {
- this.activeName = 'second';
- this.panel.name = this.$route.query.name;
- // second
- this.getTableQuery2();
- }
- }
- },
- activeName(val) {
- // 重置一次选择
- this.tableRadio = [];
- if (val == 'first') {
- this.getTableQuery();
- } else {
- // second
- this.getTableQuery2();
- this.panelSelect();
- }
- },
- }
- }
- </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;
- }
- .panel-body {
- 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;
- }
- .dialogTitle {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #000000;
- font-size: 18px;
- text-align: center;
- }
- .dialogTitle em {
- float: none;
- font-style: normal;
- color: #3799FF;
- margin: 0;
- }
- /deep/ .el-transfer-panel__item .el-checkbox__input {
- left: 40px;
- }
- .dialogFooter {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- }
- .dialogFooter button {
- float: right;
- margin-left: 10px;
- }
- .dialogContent {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .dialogContent .pull-left {
- width: 30%;
- float: left;
- }
- .dialogContent .pull-right {
- width: 70%;
- float: right;
- }
- .current {
- width: 158px;
- height: 23px;
- /*float: left;*/
- border-radius: 250px;
- text-align: center;
- background: #F0F2F5;
- color: #545454;
- font-size: 14px;
- padding: 3px 10px;
- margin-left: 20px;
- }
- .timeList {
- width: 800px;
- overflow: hidden;
- float: right;
- position: relative;
- z-index: 100;
- cursor: pointer;
- }
- .timeList ul {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- list-style: none;
- }
- .timeList li {
- width: 100px;
- overflow: hidden;
- list-style: none;
- float: left;
- margin-right: 6px;
- border: 1px solid #ccc;
- border-bottom: 0;
- text-align: center;
- height: 40px;
- background: #fff;
- z-index: 222;
- }
- em {
- font-style: normal;
- }
- .timeList em {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- font-size: 14px;
- text-align: center;
- }
- .timeList span {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- font-size: 12px;
- text-align: center;
- }
- .timeList li.active {
- border: 1px solid #3799FF;
- border-bottom: 0;
- }
- .timeList li.active em {
- color: #3799FF;
- }
- .timeList li.active span {
- color: #3799FF;
- }
- .panel_control /deep/ .el-input {
- max-width: 140px;
- float: left;
- }
- .panel-body em {
- float: left;
- line-height: 40px;
- margin-right: 10px;
- }
- .gary {
- border: 1px solid #ccc;
- border-bottom: 0;
- color: #ccc;
- }
- .pull-right {
- float: right;
- }
- .lessons {
- padding: 1px 7px;
- border-radius: 250px;
- float: left;
- color: #000;
- }
- /deep/ .el-progress__text {
- position: relative;
- top: 1px;
- float: right;
- line-height: 14px;
- height: 16px;
- }
- /deep/ .el-progress-bar {
- width: 190px;
- float: left;
- overflow: hidden;
- margin-top: 5px;
- }
- .timeList li.active {
- color: #fff;
- background: #409EFF;
- }
- .timeList li.active span, .timeList li.active em {
- color: #fff;
- }
- .acrossAddBtn {
- margin-right: 10px;
- }
- /*ipad only*/
- @media only screen and (max-width: 1366px) {
- .panel-body em {
- font-size: 12px;
- }
- .timeList {
- width: 510px;
- }
- .timeList li {
- width: 60px;
- font-size: 12px;
- }
- .timeList em {
- font-size: 12px;
- }
- .timeList span {
- font-size: 12px;
- }
- .panel_control /deep/ .el-input {
- width: 130px;
- }
- /deep/ .el-button--warning {
- margin-bottom: 5px;
- }
- .acrossAddBtn {
- margin-right: 0;
- }
- }
- </style>
|