| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484 |
- <template>
- <div class="context">
- <!-- panel-->
- <div class="">
- <div class="panel">
- <h5>预约管理 <span class="current">{{current}}</span></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="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"
- >
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- type="index"
- label="序号"
- width="50">
- </el-table-column>
- <el-table-column
- prop="BeginTime"
- label="时间"
- :formatter="filterFmtDate"
- >
- </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="Recovered"
- label="预约进度"
- width="240px"
- sortable
- >
- <template slot-scope="scope">
- <el-progress
- :percentage="parseFloat((scope.row.OrderCount/scope.row.OrderToplimit * 100).toFixed(2))"
- :format="format"></el-progress>
- </template>
- </el-table-column>
- <el-table-column
- prop="OrderToplimit"
- label="预约名额"
- width="240px"
- >
- </el-table-column>
- <el-table-column
- prop="ConsumeHour"
- label="消耗课时"
- sortable
- >
- </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="Status"
- label="操作"
- >
- <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-tab-pane label="会员预约列表" name="second">
- <div class="panel-body">
- <div class="panel_control">
- <el-row :gutter="20">
- <el-col :span="5">
- <em>会员名:</em>
- <el-input v-model="panel.name" placeholder="请输入会员名"></el-input>
- </el-col>
- <el-col :span="5">
- <em>手机号:</em>
- <el-input v-model="panel.phone" placeholder="请输入手机号"></el-input>
- </el-col>
- <el-col :span="5">
- <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="4">
- <el-button size="" type="primary" @click="query" plain>查询</el-button>
- </el-col>
- <el-col :span="4">
- <el-button class="pull-right" type="warning" @click="addMember">增加预约</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"
- >
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- type="index"
- label="序号"
- width="50">
- </el-table-column>
- <el-table-column
- prop="UserName"
- label="会员名"
- >
- </el-table-column>
- <el-table-column
- prop="Phone"
- 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="CurrentDate"
- label="会员预约时间"
- sortable
- >
- <template slot-scope="scope">
- {{scope.row.CurrentDate}} {{scope.row.BeginStr}}
- </template>
- </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">已预约</span>
- <span v-if="scope.row.Status == 2">已取消</span>
- <span v-if="scope.row.Status == 3">预约未到</span>
- <span v-if="scope.row.Status == 4">已完成</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-tabs>
- </div>
- <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="480px">
- <div class="dialogContent">
- <div class="">
- <el-form ref="form" :model="form" label-width="160px">
- <el-form-item label="课程">
- <el-select v-model="form.stdId" filterable placeholder="请选择">
- <el-option
- v-for="item in form.stdList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="会员">
- <el-select v-model="form.userId" filterable placeholder="请选择">
- <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>
- </div>
- </div>
- <div class="dialogFooter">
- <el-button type="primary" size="small" @click="ConfirmOrderAddByManager">确定</el-button>
- <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
- </div>
- </el-dialog>
- <el-dialog title="课程会员" :visible.sync="dialogTableVisible">
- <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
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- // activeName: 'first',
- activeName: 'first',
- choiceDate: 0,//默认为今天
- // activeName: 'second',
- 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: [],
- // 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: '',
- userCode: '',
- shopId: '',
- memberType: 1,
- lesson: 1,
- gift: 1,
- btnType: 0,//0新建,1编辑编辑
- memo: '',
- expTime: '',
- dialogdata: [],//穿梭待选
- dialogValue: [],//穿梭已选
- userList: [],//穿梭已选
- stdList: [],//穿梭已选
- },
- memberTypes: [
- {value: 1, label: '年教练'},
- {value: 2, label: '充值教练'},
- ],
- tableData: [],
- tableData2: [],
- }
- },
- mounted() {
- this.vipSelect();
- this.ClassSelect();
- this.panelSelect();
- // this.getCurrWeekDays();
- this.getFurtherDays();
- },
- methods: {
- // .课程表详情微信可预约状态修改
- 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.wxVisible = 0;
- that.$message.error(json.Memo);
- }
- })
- }).catch(() => {
- this.appoint = "0"
- this.$message({
- type: 'info',
- message: '已取消当前操作'
- });
- });
- },
- panelSelect(){
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- ClassListQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.panel.classOptions = turnClassResToOption(json.Rs);
- that.panel.classOptions.unshift({value:'0',label:'全部'})
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- vipSelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- start: 1,//
- tableMax: 9999,//
- };
- let postdata = qs.stringify(param);
- VipUserListQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.form.userList = turnResToOption(json.Rs);
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- 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);
- }
- })
- },
- ConfirmOrderAddByManager() {
- let that = this;
- 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;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '预约添加成功!',
- type: 'success'
- });
- this.getTableQuery2();
- that.dialogMemberVisible = false;
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 选择日期
- 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);
- }
- })
- },
- 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);
- }
- })
- }).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);
- }
- })
- }).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);
- }
- })
- }).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.multipleSelection[0];
- 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.multipleSelection[0];
- 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.multipleSelection[0];
- 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.multipleSelection[0];
- 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);
- }
- })
- },
- confirmEditMember() {
- console.log(123);
- 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);
- }
- })
- },
- // 确认提交课时
- 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);
- }
- })
- },
- // 确认提交赠送
- 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);
- }
- })
- },
- // 确认提交有效期
- 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);
- }
- })
- },
- // 确认提交教练课程
- 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);
- }
- })
- },
- // 新增教练
- addMember() {
- this.clearForm();
- // 加载当前可选课程
- this.getClassListByOrderDate();
- this.dialogMemberVisible = true
- this.btnType = 0;
- 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);
- }
- })
- },
- // 删除
- 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.multipleSelection[0].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);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 查询按钮
- query() {
- this.getTableQuery2();
- this.$message.success('查询完毕');
- },
- clearForm() {
- // clear
- this.form.name = '';
- this.form.userCode = '';
- this.form.shopId = '';
- },
- // 页面数据查询
- 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);
- }
- })
- },
- 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) {
- console.log(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);
- }
- })
- },
- // 设置分页数据
- 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: new Date().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: {
- activeName(val) {
- if (val == 'first') {
- this.getTableQuery();
- } else {
- // second
- this.getTableQuery2();
- }
- },
- }
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- .context {
- overflow: hidden;
- 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;
- }
- </style>
|