1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140 |
- <template>
- <div class="vipapply">
- <m-header v-if="statusList.headerStatus" />
- <div class="vip-title">课程信息</div>
- <van-cell-group>
- <!-- <van-field v-model="form.name" label="课程班名称" input-align="right" size="large" placeholder="请输入班级名称" /> -->
- <van-field
- v-model="courseTypeName"
- @click="statusList.courseTypeStatus = true"
- label="排课类型"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-field
- v-model="formName.subjectListName"
- @click="onGetSheetList('subjectList')"
- label="科目名称"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-field
- v-show="courseTypeVip"
- v-model="formName.vipGroupCategoryName"
- @click="onGetSheetList('vipGroupCategory')"
- label="课程形式"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-field
- v-model="formName.educationalTeacherName"
- @click="onGetSheetList('teacherList')"
- label="乐团主管"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-cell
- class="courseStudent"
- title="上课学生"
- @click="onCheckStudent"
- :readonly="true"
- input-align="right"
- :is-link="checkboxSelectDataList.length > 0 ? false : true"
- size="large"
- :value="checkboxSelectDataList.length > 0 ? '重新选择' : '请选择'"
- :value-class="[checkboxSelectDataList.length > 0 ? 'studentColor' : null, 'classStudent']"
- />
- <div
- v-if="checkboxSelectDataList.length > 0"
- style="
- text-align: center;
- line-height: 1.8;
- padding: 0.05rem 0;
- background: #fafbff;
- "
- >
- <p
- style="color: #323233"
- v-for="(item, index) in checkboxSelectDataList"
- :key="index"
- >
- {{ item.userName }} - {{ item.phone }}
- </p>
- </div>
- <van-field
- v-model="formName.vipGroupActivityName"
- @click="onGetSheetList('vipGroupActivity')"
- label="活动方案"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- </van-cell-group>
- <div class="vip-title">课时组成</div>
- <van-cell-group>
- <van-field
- v-model="form.studentNum"
- label="每班人数"
- :readonly="true"
- input-align="right"
- size="large"
- placeholder="每班预计招收人数"
- />
- <van-field
- v-model="form.singleClassMinutes"
- @click="onClickSingleClass"
- label="每课时长"
- :readonly="true"
- input-align="right"
- :is-link="form.vipGroupActivityId ? false : true"
- size="large"
- placeholder="请输入每课时长"
- />
- <!-- 判断是否选择活动方案 -->
- <div
- class="courseTips"
- v-if="
- loadData.vipGroupActivitySelect.maxCourseNum > 0 &&
- loadData.vipGroupActivitySelect.minCourseNum > 0
- "
- >
- 该活动最小课时数:<span>{{loadData.vipGroupActivitySelect.minCourseNum}}</span>节 最大课时数:<span>{{loadData.vipGroupActivitySelect.maxCourseNum}}</span>节
- </div>
- <van-field
- v-if="statusList.hasOnline"
- v-model="form.onlineClassesNums"
- @keyup="onClassKeyUp"
- label="线上课"
- input-align="right"
- size="large"
- placeholder="请输入次数"
- type="number"
- />
- <van-field
- v-if="statusList.hasOffline"
- v-model="form.offlineClassesNums"
- @keyup="onClassKeyUp('offLine')"
- label="线下课"
- input-align="right"
- size="large"
- placeholder="请输入次数"
- type="number"
- />
- <van-field
- v-if="form.offlineClassesNums > 0"
- v-model="formName.teacherSchoolName"
- @click="onGetSheetList('teacherSchool')"
- label="线下课地址"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-field
- v-model="form.totalClassTime"
- label="课时总数"
- :readonly="courseTypePractice ? false : true"
- @keyup="getCalcClass"
- type="number"
- input-align="right"
- size="large"
- placeholder="请输入次数"
- />
- </van-cell-group>
- <div class="vip-title">时间安排</div>
- <van-cell-group>
- <van-cell
- title="最早排课时间"
- :readonly="true"
- v-if="loadData.vipGroupActivitySelect.coursesStartTime"
- input-align="right"
- size="large"
- >
- <template #default>
- {{ dayjs(loadData.vipGroupActivitySelect.coursesStartTime).format("YYYY-MM-DD") }}
- </template>
- </van-cell>
- <van-cell
- title="最晚排课时间"
- :readonly="true"
- v-if="loadData.vipGroupActivitySelect.coursesEndTime"
- input-align="right"
- size="large"
- >
- <template #default>
- {{ dayjs(loadData.vipGroupActivitySelect.coursesEndTime).format("YYYY-MM-DD") }}
- </template>
- </van-cell>
- <van-field
- v-model="form.registrationStartTime"
- label="报名开始时间"
- :readonly="true"
- @click="onEnListShow('start', form.registrationStartTime)"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-field
- v-model="form.coursesExpireDate"
- label="报名截止时间"
- :readonly="true"
- @click="onEnListShow('end', form.coursesExpireDate)"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- </van-cell-group>
- <div class="vip-title">课时安排</div>
- <van-cell-group>
- <van-field
- @click="dataForm.status = true"
- v-model="form.courseStart"
- label="排课开始时间"
- :readonly="true"
- input-align="right"
- is-link
- size="large"
- placeholder="请选择"
- />
- <van-cell
- title-class="title-time"
- v-for="(item, index) in scheduleList"
- :key="index"
- >
- <template slot="title">
- <span class="online">{{ item.type }}</span>
- <span class="week">{{ item.weekStr }}</span>
- <span class="timer">{{ item.startTime + "-" + item.endTime }}</span>
- </template>
- <template slot="default">
- <van-button
- type="warning"
- @click="onScheduleRemove(item)"
- round
- size="small"
- plain
- >删除</van-button
- >
- </template>
- </van-cell>
- <div class="add-plan van-cell" @click="onCourseShedule">
- <van-icon name="add-o" />课时安排
- </div>
- <van-field
- label="排课列表"
- v-if="scheduleList.length > 0"
- :readonly="true"
- input-align="right"
- @click="onShowTimeTable"
- is-link
- size="large"
- />
- </van-cell-group>
- <div class="vip-title">课酬设置</div>
- <van-cell-group>
- <van-field
- v-model="form.onlineClassesUnitPrice"
- label="线上课单价"
- type="number"
- input-align="right"
- size="large"
- @keyup="getCalcClass"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="statusList.hasOnline"
- />
- <van-field
- v-model="form.offlineClassesUnitPrice"
- label="线下课单价"
- type="number"
- input-align="right"
- size="large"
- @keyup="getCalcClass"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="statusList.hasOffline"
- />
- <!-- <van-field
- v-model="form.onlineTeacherSalary"
- label="线上课课酬"
- input-align="right"
- size="large"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="statusList.hasOnline"
- type="number"
- />
- <van-field
- v-model="form.offlineTeacherSalary"
- label="线下课课酬"
- input-align="right"
- size="large"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="statusList.hasOffline"
- type="number"
- /> -->
- <van-field
- :value="statusList.hasOffline ? form.offlineTeacherSalary : form.onlineTeacherSalary"
- label="VIP课酬"
- input-align="right"
- size="large"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="statusList.hasOffline || statusList.hasOnline"
- type="number"
- />
- <van-field
- v-model="singleClassMinutesPrice"
- label="网管课单价"
- input-align="right"
- size="large"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="courseTypePractice"
- type="number"
- />
- <van-field
- v-model="form.onlineTeacherSalary"
- label="网管课课酬"
- input-align="right"
- size="large"
- :readonly="true"
- placeholder="金额(每课时)"
- v-if="courseTypePractice"
- type="number"
- />
- <van-field
- v-model="form.totalCount"
- :readonly="true"
- label="课程总价"
- input-align="right"
- size="large"
- placeholder="金额(每课时)"
- />
- </van-cell-group>
- <div class="button-group">
- <van-button type="primary" @click="onSubmit" round size="large"
- >确认</van-button
- >
- </div>
- <!-- 每课时长 -->
- <van-action-sheet
- v-model="statusList.classTimerStatus"
- :actions="loadData.classTimer"
- cancel-text="取消"
- @cancel="statusList.classTimerStatus = false"
- @select="onClassTimerSelect"
- />
- <!-- 报名开始时间&报名结束时间 -->
- <van-popup v-model="enlistForm.status" position="bottom">
- <van-datetime-picker
- v-model="enlistForm.currentDate"
- type="date"
- :min-date="enlistForm.minDate"
- :max-date="enlistForm.maxDate"
- :formatter="formatter"
- @cancel="enlistForm.status = false"
- @confirm="onEnlistConfirm"
- />
- </van-popup>
- <!-- 赠课类型 -->
- <van-action-sheet
- v-model="statusList.courseTypeStatus"
- :actions='[{name: "VIP课",value: "VIP"},{name: "网管课",value: "PRACTICE"}]'
- cancel-text="取消"
- @cancel="statusList.courseTypeStatus = false"
- @select="onCourseTypeSelect"
- />
- <!-- 课程信息所用 :close-on-click-overlay="false" -->
- <van-popup v-model="sheetForm.sheetStatus" position="bottom">
- <van-picker
- :loading="sheetForm.loading"
- :default-index="sheetForm.index"
- :columns="sheetForm.columns"
- show-toolbar
- @cancel="sheetForm.sheetStatus = false"
- @confirm="onSheetConfirm"
- />
- </van-popup>
- <!-- 课时安排 -->
- <van-popup v-model="dataForm.status" position="bottom">
- <van-datetime-picker
- v-model="dataForm.currentDate"
- type="date"
- :min-date="dataForm.minDate"
- :max-date="dataForm.maxDate"
- :formatter="formatter"
- @cancel="dataForm.status = false"
- @confirm="onCurrentConfirm"
- />
- </van-popup>
- <!-- 课时安排 -->
- <van-popup v-model="courseForm.teachingStatus" position="bottom">
- <van-picker
- :columns="courseForm.columns"
- show-toolbar
- @cancel="courseForm.teachingStatus = false"
- @confirm="onTeachinConfirm"
- />
- </van-popup>
- <!-- 选择上课学生 -->
- <van-popup
- v-model="statusList.studentStatus"
- :lock-scroll="true"
- position="bottom"
- :style="{ height: '180%' }"
- class="studentChiose"
- >
- <van-sticky>
- <van-search
- show-action
- shape="round"
- @search="onSearch"
- v-model="params.search"
- placeholder="请输入学生名或手机号"
- >
- <template #action>
- <div @click="onSearch">搜索</div>
- </template>
- </van-search>
- </van-sticky>
- <div class="paddingB80">
- <van-list
- v-model="loading"
- class="studentContainer"
- v-if="dataShow"
- key="data"
- :finished="finished"
- finished-text=""
- @load="getStudent"
- >
- <van-checkbox-group v-model="checkboxSelect">
- <van-cell-group>
- <van-cell
- v-for="(item, index) in dataList"
- :key="index"
- @click="onCheckboxSelect(item)"
- class="input-cell"
- :center="true"
- >
- <template slot="icon">
- <img
- class="logo"
- v-if="item.avatar"
- :src="item.avatar"
- alt=""
- />
- <img
- class="logo"
- v-else
- src="@/assets/images/icon_student.png"
- alt=""
- />
- </template>
- <template slot="title">
- {{ item.userName }}
- </template>
- <template slot="label">
- <span>{{ desensitPhone(item.phone) }}</span>
- </template>
- <template slot="default">
- <van-checkbox :name="item.userId.toString()"></van-checkbox>
- </template>
- </van-cell>
- </van-cell-group>
- </van-checkbox-group>
- </van-list>
- <m-empty class="empty" msg="暂无学生" v-else key="data" />
- </div>
- <div class="button-group-popup">
- <span class="btn" @click="onPopupCancel">取消</span>
- <span class="btn primary" @click="onPopupSubmit">确定</span>
- </div>
- </van-popup>
- <!-- 课表展示 -->
- <van-popup v-model="statusList.classTime" position="bottom" >
- <van-row>
- <van-col span="12">上课类型</van-col>
- <van-col span="12">上课时间</van-col>
- </van-row>
- <div class="tableContainer">
- <van-row v-for="(item, index) in timeTable" :key="index">
- <van-col span="12">
- {{ item.teachMode == "ONLINE" ? "线上" : "线下" }}
- </van-col>
- <van-col span="12">
- {{ item.classDate }} {{ item.startClassTimeStr }}
- </van-col>
- </van-row>
- </div>
- </van-popup>
- </div>
- </template>
- <script>
- /* eslint-disable */
- import MHeader from "@/components/MHeader";
- import { browser } from "@/common/common";
- import MEmpty from "@/components/MEmpty";
- import {
- findSubSubjects,
- vipGroupCategory,
- findByVipGroupCategory,
- findVipSchoolByTeacher2,
- findByTeacherAndCategory,
- vipGroupApply,
- findEducationUsers,
- queryStudentsWithTeacher,
- queryPracticeGroupSellPrice,
- getPracticeGroupCostCount,
- practiceGroupApply
- } from "@/api/teacher";
- import setLoading from "@/utils/loading";
- import dayjs from "dayjs";
- let minutes = []; // 分钟数
- for (let i = 0; i < 60; i++) {
- let mi = i < 10 ? "0" + i : i;
- minutes.push(mi + "分");
- }
- export default {
- name: "vipapply",
- components: {
- MHeader,
- MEmpty,
- },
- data() {
- return {
- dataForm: {
- // 时间下拉框
- status: false,
- minDate: new Date(),
- maxDate: new Date(2025, 10, 1),
- currentDate: new Date(),
- },
- enlistForm: {
- // 时间下拉框
- updateStatus: "", // 修改哪个状态
- status: false,
- minDate: new Date(),
- maxDate: new Date(2025, 10, 1),
- currentDate: new Date(),
- },
- statusList: {
- // 散状态集合
- hasOnline: true, // 是否显示线上
- hasOffline: true, // 是否显示线下
- classTime: false, // 课表展示
- headerStatus: false, // 头部是否展示
- classTimerStatus: false, // 每课时长状态
- studentStatus: false, // 上课学生状态
- courseTypeStatus: false, // 排课类型
- },
- loadData: {
- // 下拉加载数据
- subjectList: [], // 声部列表
- subjectListSelect: [], // 选中的声部JSON
- vipGroupCategory: [], // 课程形式
- vipGroupCategorySelect: [], // 选中的课程形式JSON
- vipGroupActivity: [], // 活动文案
- vipGroupActivitySelect: [], // 选中的活动文案JSON
- teacherSchool: [], // 线下课地址
- teacherSchoolSelect: [], // 选中的线下课地址JSON
- teacherList: [], // 线下课地址
- teacherListSelect: [], // 选中的线下课地址JSON
- teacherCategory: [], // 老师课酬信息
- classTimer: [], // 每课时长
- },
- sheetForm: {
- // 上拉弹窗
- currentType: null, // 当前选择的类型
- sheetStatus: false,
- loading: true, // 加载数据
- index: 0, // 选中的索引值
- columns: [],
- },
- courseForm: {
- // 排课弹窗
- teachingStatus: false, // 课时安排状态
- columns: [
- {
- // 课程选项
- values: ["线上", "线下"],
- className: "type",
- },
- {
- values: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
- className: "week",
- },
- {
- values: [
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
- ],
- className: "hours",
- defaultIndex: 7,
- },
- {
- values: minutes,
- className: "minutes",
- },
- ],
- },
- courseType: 'VIP', // VIP , PRACTICE
- courseTypeName: 'VIP课', // VIP , PRACTICE
- form: {
- name: null,
- subjectIdList: null,
- vipGroupCategoryId: null,
- vipGroupActivityId: null,
- teacherSchoolId: null,
- educationalTeacherId: null,
- studentNum: null,
- singleClassMinutes: null,
- onlineClassesNums: null,
- offlineClassesNums: null,
- registrationStartTime: null,
- coursesExpireDate: null,
- totalClassTime: null,
- courseStart: null,
- onlineClassesUnitPrice: null,
- offlineClassesUnitPrice: null,
- onlineTeacherSalary: null,
- offlineTeacherSalary: null,
- totalCount: null,
- },
- formName: {
- subjectListName: null, // 声部名称
- subjectListIndex: 0, // 声部名称
- vipGroupCategoryName: null, // 课程形式
- vipGroupCategoryIndex: 0, // 课程形式
- vipGroupActivityName: null, // 活动文案
- vipGroupActivityIndex: 0, // 活动文案
- teacherSchoolName: null, // 线下课地址
- teacherSchoolIndex: 0, // 线下课地址
- educationalTeacherName: null, // 乐团主管
- educationalTeacherIndex: 0,
- },
- other: {
- onlineSalary: null, // 线上课课酬结算方式
- offlineSalary: null, // 线下课课酬结算方式
- },
- scheduleList: [], // 课时安排
- timeTable: [], // 生成的课表
- onSubmitStatus: true, // 点击
- checkboxSelect: [],
- checkboxSelectIds: [],
- checkboxSelectList: [], //选中学生列表
- checkboxSelectDataList: [],
- loading: false,
- finished: false,
- params: {
- search: null,
- page: 1,
- rows: 20,
- },
- dataShow: true, // 是否有数据
- dataList: [],
- salaryStatus: true, // 是否跳过课酬二次确认
- singleClassMinutesPrice: 0, //网管课单价
- singleClassMinutesSalary: 0, // 网管课课酬
- };
- },
- mounted() {
- let params = this.$route.query;
- if (params.Authorization) {
- localStorage.setItem("Authorization", decodeURI(params.Authorization));
- localStorage.setItem("userInfo", decodeURI(params.Authorization));
- }
- document.title = "VIP课程申请";
- if (browser().android) {
- this.headerStatus = true;
- }
- },
- methods: {
- dayjs,
- onCheckStudent() {
- if (!this.form.vipGroupCategoryId && this.courseTypeVip) {
- // 判断是否选择了课程形式
- this.$toast("请选择课程形式");
- return;
- }
- this.statusList.studentStatus = true;
- },
- onGetSheetList(name) {
- // 获取科目列表
- let sheetForm = this.sheetForm;
- sheetForm.columns = [];
- if (!this.form.vipGroupCategoryId && name == "vipGroupActivity" && this.courseTypeVip) {
- this.$toast("请选择课程形式");
- return;
- } else if (
- (!this.checkboxSelectDataList ||
- (this.checkboxSelectDataList &&
- this.checkboxSelectDataList.length <= 0)) &&
- name == "vipGroupActivity"
- ) {
- // 判断是否选择了课程形式
- this.$toast("请选择上课学生");
- return;
- }
- sheetForm.sheetStatus = true;
- sheetForm.loading = true;
- sheetForm.currentType = name;
- sheetForm.index = 0;
- let arr = this.loadData[name];
- if (arr.length > 0) {
- sheetForm.columns = arr;
- sheetForm.index = this.formName[name + "Index"];
- sheetForm.loading = false;
- } else {
- this.onLoadingData(name);
- }
- },
- onLoadingData() {
- // 加载数据
- let sheetForm = this.sheetForm;
- if (sheetForm.currentType == "subjectList") {
- // 声部列表
- findSubSubjects().then((res) => {
- let result = res.data;
- if (result.code == 200 && result.data.length > 0) {
- let tempArr = [];
- result.data.forEach((item) => {
- item.value = item.id;
- item.text = item.name;
- tempArr.push(item);
- });
- this.loadData.subjectList = tempArr;
- sheetForm.columns = tempArr;
- sheetForm.loading = false;
- } else {
- this.$toast("暂无科目列表");
- sheetForm.loading = false;
- }
- });
- } else if (sheetForm.currentType == "vipGroupCategory") {
- // 课程形式
- vipGroupCategory().then((res) => {
- let result = res.data;
- if (result.code == 200 && result.data.length > 0) {
- let tempArr = [];
- result.data.forEach((item) => {
- item.value = item.id;
- item.text = item.name;
- tempArr.push(item);
- });
- this.loadData.vipGroupCategory = tempArr;
- sheetForm.columns = tempArr;
- sheetForm.loading = false;
- } else {
- this.$toast("暂无课程形式");
- sheetForm.loading = false;
- }
- });
- } else if (sheetForm.currentType == "vipGroupActivity") {
- // 活动文案
- let studentIds = [];
- if (
- this.checkboxSelectDataList &&
- this.checkboxSelectDataList.length > 0
- ) {
- this.checkboxSelectDataList.forEach((item) => {
- studentIds.push(item.userId);
- });
- }
- let params = {
- studentIds: studentIds.join(",")
- }
- if(this.courseTypeVip) {
- params.categoryId = this.form.vipGroupCategoryId
- } else if(this.courseTypePractice) {
- params.courseType = 'PRACTICE'
- }
- findByVipGroupCategory(params).then((res) => {
- let result = res.data;
- if (result.code == 200 && result.data.length > 0) {
- let tempArr = [];
- result.data.forEach((item) => {
- item.value = item.id;
- item.text = item.name;
- (item.startTime = item.startTime
- ? item.startTime.split(" ")[0]
- : null), // 报名开始时间
- (item.endTime = item.endTime
- ? item.endTime.split(" ")[0]
- : null); // 报名结束时间
- tempArr.push(item);
- });
- this.loadData.vipGroupActivity = tempArr;
- sheetForm.columns = tempArr;
- sheetForm.loading = false;
- } else {
- this.$toast("暂无活动方案");
- sheetForm.loading = false;
- }
- });
- } else if (sheetForm.currentType == "teacherSchool") {
- // 教师教学点
- findVipSchoolByTeacher2().then((res) => {
- let result = res.data;
- if (result.code == 200 && result.data.length > 0) {
- let tempArr = [];
- result.data.forEach((item) => {
- item.value = item.id;
- item.text = item.name;
- tempArr.push(item);
- });
- this.loadData.teacherSchool = tempArr;
- sheetForm.columns = tempArr;
- sheetForm.loading = false;
- } else {
- this.$toast("暂无教学点");
- sheetForm.loading = false;
- }
- });
- } else if (sheetForm.currentType == "teacherList") {
- // 乐团主管
- findEducationUsers().then((res) => {
- let result = res.data;
- if (result.code == 200 && result.data.length > 0) {
- let tempArr = [];
- result.data.forEach((item) => {
- item.value = item.userId;
- item.text = item.userName;
- tempArr.push(item);
- });
- this.loadData.teacherList = tempArr;
- sheetForm.columns = tempArr;
- sheetForm.loading = false;
- } else {
- this.$toast("暂无乐团主管");
- sheetForm.loading = false;
- }
- });
- }
- },
- findTeacherCategory(id) {
- // 获取教师课酬
- findByTeacherAndCategory({
- categoryId: id,
- }).then((res) => {
- let result = res.data;
- if (result.code == 200) {
- this.loadData.teacherCategory = result.data;
- }
- });
- },
- onSheetConfirm(value, index) {
- // 上拉弹窗
- let sheetForm = this.sheetForm,
- form = this.form,
- formName = this.formName,
- loadData = this.loadData;
- if (sheetForm.currentType == "subjectList") {
- // 科目名称赋值
- form.subjectIdList = value.value;
- formName.subjectListName = value.text;
- formName.subjectListIndex = index;
- loadData.subjectListSelect = value;
- } else if (sheetForm.currentType == "vipGroupCategory") {
- // 课程形式赋值
- if (loadData.vipGroupCategorySelect.id != value.id) {
- // 获取教师课酬
- this.findTeacherCategory(value.id);
- }
- form.vipGroupCategoryId = value.value;
- formName.vipGroupCategoryName = value.text;
- formName.vipGroupCategoryIndex = index;
- loadData.vipGroupCategorySelect = value;
- form.studentNum = value.studentNum; // 每班人数
- // form.singleClassMinutes = value.singleClassMinutes // 每课时长
- form.onlineClassesUnitPrice = Math.ceil(value.onlineClassesUnitPrice);
- // this.onlineUnitPrice = Math.ceil(value.onlineClassesUnitPrice)
- form.offlineClassesUnitPrice = Math.ceil(value.offlineClassesUnitPrice);
- // this.offLineUnitPrice = Math.ceil(value.offlineClassesUnitPrice)
- // 每课时长赋值
- form.singleClassMinutes = null;
- loadData.classTimer = [];
- let tempSingle = value.singleClassMinutes.split(",");
- tempSingle.forEach((item) => {
- this.loadData.classTimer.push({
- name: item,
- value: item,
- });
- });
- // 重置上课学生
- this.checkboxSelect = [];
- this.checkboxSelectIds = [];
- this.checkboxSelectList = []; //选中学生列表
- this.checkboxSelectDataList = [];
- // 重置活动文案
- form.vipGroupActivityId = null;
- formName.vipGroupActivityName = null;
- formName.vipGroupActivityIndex = 0;
- loadData.vipGroupActivity = [];
- loadData.vipGroupActivitySelect = [];
- } else if (sheetForm.currentType == "vipGroupActivity") {
- // 活动方案赋值
- // 重置线上课,线下课次数
- if (form.vipGroupActivityId != value.value) {
- form.offlineClassesNums = null;
- form.onlineClassesNums = null;
- }
- form.vipGroupActivityId = value.value;
- formName.vipGroupActivityName = value.text;
- formName.vipGroupActivityIndex = index;
- loadData.vipGroupActivitySelect = value;
- // 换活动之后单价重置
- form.onlineClassesUnitPrice = Math.ceil(
- loadData.vipGroupCategorySelect.onlineClassesUnitPrice || 0
- );
- form.offlineClassesUnitPrice = Math.ceil(
- loadData.vipGroupCategorySelect.offlineClassesUnitPrice || 0
- );
- form.singleClassMinutes = value.singleCourseTime
- if(this.courseTypeVip) {
- this.onCalcClassTimes(value); // 计算时间等.........
- } else {
- }
- this.getCalcClass(); // 课酬计算
- this.setTimeTable(); // 重新排课
- // 时间安排
- // form.registrationStartTime = value.startTime
- // form.coursesExpireDate = value.endTime
- } else if (sheetForm.currentType == "teacherSchool") {
- // 线下课地址
- form.teacherSchoolId = value.value;
- formName.teacherSchoolName = value.text;
- formName.teacherSchoolIndex = index;
- } else if (sheetForm.currentType == "teacherList") {
- // 乐团主管
- form.educationalTeacherId = value.value;
- formName.educationalTeacherName = value.text;
- formName.educationalTeacherIndex = index;
- }
- sheetForm.sheetStatus = false;
- },
- onClassKeyUp(type) {
- // 线上课&线下课修改时
- if (type == "offLine" && this.form.offlineClassesNums <= 0) {
- this.form.teacherSchoolId = null;
- this.formName.teacherSchoolName = null;
- this.formName.teacherSchoolIndex = 0;
- }
- let vas = this.loadData.vipGroupActivitySelect;
- this.onCalcClassTimes(vas);
- this.getCalcClass();
- this.setTimeTable();
- },
- onCalcClassTimes(vas) {
- // 计算课时总数
- let form = this.form,
- statusList = this.statusList;
- let totalCount = Number(form.onlineClassesNums) + Number(form.offlineClassesNums);
- // 获取总课次
- form.totalClassTime = totalCount
- // teachMode -1:所有;0:线上;1:线下
- // 设置是否有对的类型的课
- switch(vas.teachMode) {
- case -1:
- statusList.hasOffline = true;
- statusList.hasOnline = true;
- break;
- case 0:
- statusList.hasOnline = true;
- statusList.hasOffline = false;
- break;
- case 1:
- statusList.hasOnline = false;
- statusList.hasOffline = true;
- break;
- default:
- break;
- }
- },
- async onCourseTypeSelect(value) {
- // 课程类型
- this.statusList.courseTypeStatus = false
- if(value.value == this.courseType) return
- this.courseType = value.value
- this.courseTypeName = value.name
- let form = this.form,
- formName = this.formName,
- loadData = this.loadData
- // 课程形式重置
- form.vipGroupCategoryId = null
- formName.vipGroupCategoryName = null
- formName.vipGroupCategoryIndex = 0
- // 重置上课学生
- this.checkboxSelect = [];
- this.checkboxSelectIds = [];
- this.checkboxSelectList = []; //选中学生列表
- this.checkboxSelectDataList = [];
- // 重置活动文案
- form.vipGroupActivityId = null;
- formName.vipGroupActivityName = null;
- formName.vipGroupActivityIndex = 0;
- loadData.vipGroupActivity = [];
- loadData.vipGroupActivitySelect = [];
- // 更新每课时长
- form.singleClassMinutes = null
- // 课时总数
- form.totalClassTime = null
- form.offlineClassesNums = null
- form.onlineClassesNums = null
- this.scheduleList = [] // 清空课时安排
- if(value.value == 'VIP') {
- this.courseForm.columns[0].values = ["线上", "线下"]
- form.studentNum = null
- form.onlineClassesUnitPrice = 0
- form.onlineTeacherSalary = 0
- this.statusList.hasOnline = true
- this.statusList.hasOffline = true
- this.getCalcClass();
- } else if(value.value == 'PRACTICE') {
- this.courseForm.columns[0].values = ["线上"]
- // 重置地址数据
- this.form.teacherSchoolId = null;
- this.formName.teacherSchoolName = null;
- this.formName.teacherSchoolIndex = 0;
- // 每班人数 (网管课固定1人)
- form.studentNum = 1
- loadData.classTimer = [{ name: 25, value: 25 }];
- this.statusList.hasOnline = false
- this.statusList.hasOffline = false
- this.getCalcClass();
- // 判断是否已经有金额了
- if(!this.singleClassMinutesPrice) {
- await queryPracticeGroupSellPrice().then(res => {
- let result = res.data
- if(result.code == 200) {
- this.singleClassMinutesPrice = result.data.singleClassMinutesPrice || 0
- }
- })
- }
- if(!this.singleClassMinutesSalary) {
- await getPracticeGroupCostCount().then(res => {
- const result = res.data
- if(result.code == 200) {
- this.singleClassMinutesSalary = result.data.onlineTeacherSalary || 0
- }
- })
- }
- }
- },
- onClickSingleClass() {
- if (!this.formName.vipGroupCategoryName && this.courseTypeVip) {
- this.$toast("请选择课程形式");
- return;
- }
- // 如果选择了活动则,课时不能选择
- if(this.form.vipGroupActivityId) return
- this.statusList.classTimerStatus = true;
- },
- onClassTimerSelect(value) {
- // 每课时长设置
- this.form.singleClassMinutes = value.value;
- this.statusList.classTimerStatus = false;
- this.getCalcClass();
- },
- onCurrentConfirm(value) {
- // 排课开始时间
- let selectDate = new Date(value);
- let tempMonth =
- selectDate.getMonth() + 1 >= 10
- ? selectDate.getMonth() + 1
- : "0" + (selectDate.getMonth() + 1);
- let tempDay =
- selectDate.getDate() >= 10
- ? selectDate.getDate()
- : "0" + selectDate.getDate();
- this.form.courseStart =
- selectDate.getFullYear() + "-" + tempMonth + "-" + tempDay;
- this.dataForm.status = false;
- },
- onEnlistConfirm(value) {
- // 报名开始/结束时间
- let selectDate = new Date(value);
- let tempMonth =
- selectDate.getMonth() + 1 >= 10
- ? selectDate.getMonth() + 1
- : "0" + (selectDate.getMonth() + 1);
- let tempDay =
- selectDate.getDate() >= 10
- ? selectDate.getDate()
- : "0" + selectDate.getDate();
- let enlistForm = this.enlistForm;
- let form = this.form;
- if (enlistForm.updateStatus == "start") {
- form.registrationStartTime =
- selectDate.getFullYear() + "-" + tempMonth + "-" + tempDay;
- if (form.coursesExpireDate) {
- let temps = new Date(
- form.registrationStartTime.replace(/-/gi, "/")
- ).getTime();
- let tempe = new Date(
- form.coursesExpireDate.replace(/-/gi, "/")
- ).getTime();
- // 如果开始时间大于结束时间,结束时间制空
- if (temps > tempe) {
- form.coursesExpireDate = null;
- }
- }
- } else if (enlistForm.updateStatus == "end") {
- form.coursesExpireDate =
- selectDate.getFullYear() + "-" + tempMonth + "-" + tempDay;
- }
- enlistForm.status = false;
- },
- onEnListShow(type, value) {
- // 报名开始/截止时间
- let enlistForm = this.enlistForm;
- if (type == "end") {
- if (this.form.registrationStartTime) {
- enlistForm.minDate = new Date(this.form.registrationStartTime.replace(/-/gi, "/"));
- } else {
- enlistForm.minDate = new Date();
- }
- } else if (type == "start") {
- // 开始时默认为当前时间
- enlistForm.minDate = new Date();
- }
- if (value) {
- enlistForm.currentDate = new Date(value.replace(/-/gi, "/"));
- } else {
- enlistForm.currentDate = new Date();
- }
- enlistForm.updateStatus = type;
- enlistForm.status = true;
- },
- onCourseShedule() {
- // 课时安排
- if (!this.form.singleClassMinutes) {
- this.$toast("请选每课时长");
- return;
- }
- if (!this.form.courseStart) {
- this.$toast("请选择排课开始时间");
- return;
- }
- this.courseForm.teachingStatus = true;
- },
- onScheduleRemove(item) {
- // 删除课程安排
- this.$dialog.confirm({
- title: '提示',
- message: '是否删除该课时安排?',
- confirmButtonText: '确定',
- confirmButtonColor: '#269a93',
- cancelButtonText: '取消'
- }).then(() => {
- let index = this.scheduleList.indexOf(item);
- if (index !== -1) {
- this.scheduleList.splice(index, 1);
- }
- })
- },
- onTeachinConfirm(value) {
- // 添加课程
- let scheduleList = this.scheduleList;
- let startTime =
- (value[2] >= 10 ? value[2] : "0" + value[2]) +
- ":" +
- value[3].split("分")[0];
- let endTime = this.MinutesTest(
- value[2],
- value[3],
- this.form.singleClassMinutes
- );
- let isAdd = true;
- scheduleList.forEach((item) => {
- let isStartTime = this.timeIsrange(startTime, endTime, item.startTime);
- let isEndTime = this.timeIsrange(startTime, endTime, item.endTime);
- if (isAdd) {
- //
- if (value[1] == item.weekStr) {
- if (isStartTime || isEndTime) {
- isAdd = false;
- } else {
- isAdd = true;
- }
- } else if (value[1] != item.weekStr) {
- isAdd = true;
- }
- }
- });
- if (isAdd) {
- // 判断时间范围是否有重复
- scheduleList.push({
- type: value[0], // 线上还是线下
- weekStr: value[1],
- weekIndex: this.getWeek(value[1]),
- startTime: startTime,
- endTime: endTime,
- id: Date.now(),
- });
- // scheduleList.sort((a, b) => {
- // return a.weekStr
- // })
- this.courseForm.teachingStatus = false;
- this.setTimeTable();
- } else {
- this.$toast("该时间段已排课请重选时间");
- return;
- }
- },
- onShowTimeTable() {
- // 显示排课列表
- if (!this.checkCourseList()) {
- return;
- }
- this.statusList.classTime = true;
- this.setTimeTable();
- },
- setTimeTable() {
- if (!this.checkCourseList(false)) {
- return;
- }
- // 重置排课列表
- this.timeTable = [];
- let form = this.form,
- scheduleList = this.scheduleList;
- // 拿到线上课数与线下课数 以及
- let online = parseInt(form.onlineClassesNums || 0);
- let offline = parseInt(form.offlineClassesNums || 0);
- // 网管课默认只有线上课次
- if(this.courseTypePractice) {
- online = parseInt(form.totalClassTime || 0)
- }
- // 判断是否有课程安排
- if (scheduleList.length <= 0) {
- return;
- }
- let totalCount = Number(online) + Number(offline);
- let tempCourseStart = form.courseStart.replace(/-/gi, "/");
- let dateOperation = new Date(tempCourseStart);
- let forMark = 0;
- while (totalCount && totalCount > 0) {
- for (let i = 0; i < scheduleList.length; i++) {
- // console.log(totalCount, scheduleList)
- if (online == 0 && offline == 0) break;
- let num = scheduleList[i].weekIndex - dateOperation.getDay();
- // 如果是同一天一个周期会出现排课都排到一天
- if (forMark > 0 && num == 0 && i == 0) {
- num = num + 7;
- }
- if (num < 0) {
- // 如果为负数则为下周
- num = num + 7;
- }
- let dataStr = this.getThinkDate(dateOperation, num);
- // 判断是否大于当前时间
- let nowGetTime = new Date().getTime();
- let courseTime = new Date(
- dataStr.replace(/-/gi, "/") +
- " " +
- scheduleList[i].startTime +
- ":00"
- ).getTime();
- if (nowGetTime < courseTime) {
- let tempArr = {
- classDate: dataStr,
- startClassTimeStr: scheduleList[i].startTime,
- endClassTimeStr: scheduleList[i].endTime,
- };
- // console.log(scheduleList[i].type, online, offline)
- if (scheduleList[i].type == "线上" && online > 0) {
- tempArr.teachMode = "ONLINE";
- this.timeTable.push(tempArr);
- online--;
- totalCount--;
- } else if (scheduleList[i].type == "线下" && offline > 0) {
- tempArr.teachMode = "OFFLINE";
- this.timeTable.push(tempArr);
- offline--;
- totalCount--;
- }
- }
- }
- // 加一周
- if (scheduleList.length == 1) {
- dateOperation.setDate(dateOperation.getDate() + 7);
- } else if (
- scheduleList.every((item) => item.weekStr === scheduleList[0].weekStr)
- ) {
- // 标记循环次数(标记判断课程安排是不是同一天)
- forMark++;
- }
- }
- this.timeTable.sort((a, b) => {
- let aStr = dayjs(dayjs(a.classDate).format("YYYY-MM-DD") + " " + a.startClassTimeStr + ":00").valueOf();
- let bStr = dayjs(dayjs(b.classDate).format("YYYY-MM-DD") + " " + b.startClassTimeStr + ":00").valueOf();
- return aStr - bStr;
- });
- // console.log(this.timeTable)
- },
- getCalcClass() {
- // 计算课酬
- let loadData = this.loadData;
- let form = this.form;
- let vas = loadData.vipGroupActivitySelect, // 活动
- // vcs = loadData.vipGroupCategorySelect, // 课程形式
- tc = loadData.teacherCategory, // 老师基本信息
- oncn = form.onlineClassesNums ? form.onlineClassesNums : 0, // 线上课次数
- offcn = form.offlineClassesNums ? form.offlineClassesNums : 0 // 线下课次数
- // 网管课默认只有线上课次
- if(this.courseTypePractice) {
- oncn = parseInt(form.totalClassTime || 0)
- }
- // 优惠活动(如果没有则原价),可以为0,之前可以为空
- const discount = (typeof vas.discount !== 'number' ? 100 : vas.discount) / 100
- // 重置老师默认网管课金额
- if(this.courseTypePractice) {
- //老师课酬
- form.onlineTeacherSalary = Math.round(this.singleClassMinutesSalary)
- // 课程单价
- form.onlineClassesUnitPrice = Math.round(this.singleClassMinutesPrice)
- }
- // ...
- if (vas.salarySettlementJson) {
- let obj = JSON.parse(vas.salarySettlementJson);
- // 课程按课来计算
- if(this.courseTypeVip) {
- // 所有的课酬都取线下
- if(obj && obj.vipOfflineSalarySettlement) {
- let voss = obj.vipOfflineSalarySettlement
- if(voss.salarySettlementType == 'TEACHER_DEFAULT') {
- form.onlineTeacherSalary = Number(tc.offlineClassesSalary)
- form.offlineTeacherSalary = Number(tc.offlineClassesSalary)
- } else if(voss.salarySettlementType == 'FIXED_SALARY') {
- form.onlineTeacherSalary = Number(voss.settlementValue)
- form.offlineTeacherSalary = Number(voss.settlementValue)
- }
- } else {
- form.onlineTeacherSalary = Number(tc.offlineClassesSalary)
- form.offlineTeacherSalary = Number(tc.offlineClassesSalary)
- }
- } else if(this.courseTypePractice) {
- // //老师课酬
- if(obj && obj.practiceSalarySettlement) {
- let pss = obj.practiceSalarySettlement
- if(pss.salarySettlementType == 'TEACHER_DEFAULT') {
- form.onlineTeacherSalary = Number(this.singleClassMinutesSalary)
- } else if(pss.salarySettlementType == 'FIXED_SALARY') {
- form.onlineTeacherSalary = Number(pss.settlementValue)
- }
- } else {
- form.onlineTeacherSalary = Number(this.singleClassMinutesSalary)
- }
- }
- } else {
- if(this.courseTypeVip) {
- form.onlineTeacherSalary = Number(tc.offlineClassesSalary)
- form.offlineTeacherSalary = Number(tc.offlineClassesSalary)
- }
- }
- let totalCount = 0
- if(this.courseTypeVip) {
- totalCount = Math.ceil(Math.ceil(((oncn * form.onlineClassesUnitPrice + offcn * form.offlineClassesUnitPrice) * discount) * 10000) / 10000);
- } else {
- totalCount = Math.ceil(Math.ceil(((oncn * form.onlineClassesUnitPrice) * discount) * 10000) / 10000);
- }
- form.totalCount = Number(totalCount);
- },
- getThinkDate(date, num) {
- let Stamp = date;
- Stamp.setDate(date.getDate() + num); // 获取当前月数的第几天
- var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
- var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
- var mvar = "";
- if (month < 10) {
- mvar = "0" + month;
- } else {
- mvar = month + "";
- }
- var day = Stamp.getDate();
- var dvar = "";
- if (day < 10) {
- dvar = "0" + day;
- } else {
- dvar = day + "";
- }
- return year + "-" + mvar + "-" + dvar;
- },
- // 分钟小时相加减
- MinutesTest(houer, mins, interval) {
- let min = mins.split("分")[0];
- let sdate1 = new Date(1900, 1, 1, houer, min);
- sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
- let H = sdate1.getHours();
- let M = sdate1.getMinutes();
- if (H < 10) H = "0" + H;
- if (M < 10) M = "0" + M;
- return H + ":" + M;
- },
- // 判断时间是否在时间段内
- timeIsrange(beginTime, endTime, nowTime) {
- var strb = beginTime.split(":");
- if (strb.length != 2) {
- return false;
- }
- var stre = endTime.split(":");
- if (stre.length != 2) {
- return false;
- }
- var strn = nowTime.split(":");
- if (stre.length != 2) {
- return false;
- }
- var b = new Date();
- var e = new Date();
- var n = new Date();
- b.setHours(strb[0]);
- b.setMinutes(strb[1]);
- e.setHours(stre[0]);
- e.setMinutes(stre[1]);
- n.setHours(strn[0]);
- n.setMinutes(strn[1]);
- if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
- // 在时间范围内
- return true;
- } else {
- // 不在时间范围内
- return false;
- }
- },
- getWeek(str) {
- // 获取周几索引值
- let template = {
- 周一: 1,
- 周二: 2,
- 周三: 3,
- 周四: 4,
- 周五: 5,
- 周六: 6,
- 周日: 0,
- };
- return template[str];
- },
- formatter(type, value) {
- if (type === "year") {
- return `${value}年`;
- } else if (type === "month") {
- return `${value}月`;
- } else if (type === "day") {
- return `${value}日`;
- }
- return value;
- },
- async onSubmit(allowOverstepActivityStudentNum) {
- // 次数限制是否可以继续创建
- let form = this.form;
- let statusList = this.statusList;
- // if (!(form.name)) {
- // this.$toast('请输入课程班名称')
- // return false
- // }
- if (!form.subjectIdList) {
- this.$toast("请选择科目");
- return false;
- }
- if (!form.vipGroupCategoryId && this.courseTypeVip) {
- this.$toast("请选择课程形式");
- return false;
- }
- if (!form.educationalTeacherId) {
- this.$toast("请选择乐团主管");
- return;
- }
- if (this.checkboxSelectIds.length <= 0) {
- this.$toast("请选择上课学生");
- return;
- }
- // if (!form.vipGroupActivityId && this.courseTypeVip) {
- // this.$toast("请选择活动方案");
- // return false;
- // }
- if (!form.singleClassMinutes) {
- this.$toast("请选择每课时长");
- return false;
- }
- let onlineClassesStatus =
- !form.onlineClassesNums && form.onlineClassesNums <= 0 ? true : false;
- let offlineClassesStatus =
- !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false;
- if (statusList.hasOnline) {
- if (onlineClassesStatus) {
- this.$toast("请输入线上课次数");
- return false;
- }
- }
- if (statusList.hasOffline) {
- if (offlineClassesStatus) {
- this.$toast("请输入线下课次数");
- return false;
- }
- // 判断是否有线下
- if (form.offlineClassesNums > 0 && !form.teacherSchoolId) {
- this.$toast("请选择线下课地址");
- return false;
- }
- }
- // 判断课时总数
- if(form.totalClassTime <= 0) {
- this.$toast('请输入线上/线下课次数')
- return false;
- }
- if (!form.registrationStartTime) {
- this.$toast("请选择报名开始时间");
- return false;
- }
- if (!form.coursesExpireDate) {
- this.$toast("请选择报名结束时间");
- return false;
- }
- if (this.scheduleList.length <= 0) {
- this.$toast("课时安排不能为空");
- return false;
- }
- let vipGroupActivitySelect = this.loadData.vipGroupActivitySelect;
- if (vipGroupActivitySelect.minCourseNum > 0 && vipGroupActivitySelect.maxCourseNum > 0) {
- // debugger
- let tempCourseCount = Number(form.totalClassTime) || parseInt(form.onlineClassesNums || 0) + parseInt(form.offlineClassesNums || 0);
- if (
- vipGroupActivitySelect.minCourseNum > tempCourseCount ||
- tempCourseCount > vipGroupActivitySelect.maxCourseNum
- ) {
- this.$toast(
- `课时总数为${vipGroupActivitySelect.minCourseNum}~${vipGroupActivitySelect.maxCourseNum}节`
- );
- return;
- }
- }
- if (!this.checkCourseList()) {
- return;
- }
- // 排课
- this.setTimeTable();
- // 如果线上和线下课酬都为0时
- if (statusList.hasOnline && statusList.hasOffline) {
- if (
- form.onlineClassesNums > 0 &&
- form.onlineTeacherSalary <= 0 &&
- form.offlineClassesNums > 0 &&
- form.offlineTeacherSalary <= 0 &&
- this.salaryStatus
- ) {
- this.$dialog
- .confirm({
- message: "当前课程课酬预计为0,是否继续?",
- })
- .then(() => {
- this.salaryStatus = false;
- this.onSubmit();
- });
- return;
- }
- }
- if (statusList.hasOnline) {
- if (!form.onlineClassesUnitPrice) {
- this.$toast("请输入线上课单价");
- return false;
- }
- if (!form.onlineTeacherSalary) {
- this.$toast("请输入线上课课酬");
- return false;
- }
- if (
- form.onlineClassesNums > 0 &&
- form.onlineTeacherSalary <= 0 &&
- this.salaryStatus
- ) {
- this.$dialog
- .confirm({
- message: "当前课程线上课酬预计为0,是否继续?",
- })
- .then(() => {
- this.salaryStatus = false;
- this.onSubmit();
- });
- return;
- }
- }
- if (statusList.hasOffline) {
- if (!form.offlineClassesUnitPrice) {
- this.$toast("请输入线下课单价");
- return false;
- }
- if (!form.offlineTeacherSalary) {
- this.$toast("请输入线下课课酬");
- return false;
- }
- if (
- form.offlineClassesNums > 0 &&
- form.offlineTeacherSalary <= 0 &&
- this.salaryStatus
- ) {
- this.$dialog
- .confirm({
- message: "当前课程线下课酬预计为0,是否继续?",
- })
- .then(() => {
- this.salaryStatus = false;
- this.onSubmit();
- });
- return;
- }
- }
- form.onlineClassesNum = Number(form.onlineClassesNums);
- form.offlineClassesNum = Number(form.offlineClassesNums);
- if(this.courseTypePractice) { //网管课等于总课次
- form.onlineClassesNum = Number(form.totalClassTime)
- }
- form.totalClassTimes = Number(form.onlineClassesNums) +Number(form.offlineClassesNums)
- form.paymentExpireDate = form.coursesExpireDate;
- form.studentIdList = this.checkboxSelectIds.join(",");
- form.firstStudentId = this.checkboxSelectDataList.length > 0 ? this.checkboxSelectDataList[0].userId : null;
- let params = {
- courseSchedules: this.timeTable
- };
- if (allowOverstepActivityStudentNum == 1) {
- params.allowOverstepActivityStudentNum = 1;
- }
- if (!this.onSubmitStatus) {
- return;
- }
- this.onSubmitStatus = false;
- if(this.courseTypeVip) {
- params.vipGroupApplyBaseInfo = form
- await this.getVipApply(params)
- } else {
- params.practiceGroupApplyBaseInfoDto = form
- params.practiceGroupApplyBaseInfoDto.studentId = form.studentIdList
- params.practiceGroupApplyBaseInfoDto.allCourseNum = form.totalClassTime
- params.practiceGroupApplyBaseInfoDto.subjectId = form.subjectIdList
- await this.getPracticeApply(params)
- }
- },
- async getVipApply(params) {
- setLoading(true);
- await vipGroupApply(params)
- .then((res) => {
- let result = res.data;
- setLoading(false);
- if (result.code == 200) {
- this.$toast("申请成功");
- setTimeout(() => {
- this.onSubmitStatus = true;
- if (browser().iPhone) {
- window.webkit.messageHandlers.DAYA.postMessage(
- JSON.stringify({
- api: "back",
- })
- );
- } else if (browser().android) {
- DAYA.postMessage(
- JSON.stringify({
- api: "back",
- })
- );
- } else {
- this.$router.push("/business");
- }
- }, 500);
- } else if (result.code == 206) {
- this.onSubmitStatus = true;
- this.salaryStatus = true;
- this.$dialog
- .confirm({
- message: result.msg,
- showConfirmButton: true,
- showCancelButton: true,
- confirmButtonText: "继续创建",
- cancelButtonText: "取消",
- })
- .then(() => {
- this.salaryStatus = false;
- this.onSubmit(1);
- });
- return;
- } else {
- this.onSubmitStatus = true;
- this.salaryStatus = true;
- this.$toast(result.msg);
- }
- })
- .catch(() => {
- this.onSubmitStatus = true;
- this.salaryStatus = true;
- setLoading(false);
- });
- },
- async getPracticeApply(params) {
- setLoading(true);
- await practiceGroupApply(params)
- .then((res) => {
- let result = res.data;
- setLoading(false);
- if (result.code == 200) {
- this.$toast("申请成功");
- setTimeout(() => {
- this.onSubmitStatus = true;
- if (browser().iPhone) {
- window.webkit.messageHandlers.DAYA.postMessage(
- JSON.stringify({
- api: "back",
- })
- );
- } else if (browser().android) {
- DAYA.postMessage(
- JSON.stringify({
- api: "back",
- })
- );
- } else {
- this.$router.push("/business");
- }
- }, 500);
- } else if (result.code == 206) {
- this.onSubmitStatus = true;
- this.salaryStatus = true;
- this.$dialog
- .confirm({
- message: result.msg,
- showConfirmButton: true,
- showCancelButton: true,
- confirmButtonText: "继续创建",
- cancelButtonText: "取消",
- })
- .then(() => {
- this.salaryStatus = false;
- this.onSubmit(1);
- });
- return;
- } else {
- this.onSubmitStatus = true;
- this.salaryStatus = true;
- this.$toast(result.msg);
- }
- })
- .catch(() => {
- this.onSubmitStatus = true;
- this.salaryStatus = true;
- setLoading(false);
- });
- },
- checkCourseList(isShowToast = true) {
- let form = this.form;
- let scheduleList = this.scheduleList || [];
- let hasOnLine = false; // 是否有线上课时安排
- let hasOffLine = false;
- scheduleList.forEach((item) => {
- if (item.type == "线上") {
- hasOnLine = true;
- }
- if (item.type == "线下") {
- hasOffLine = true;
- }
- });
- let statusList = this.statusList;
- let onlineClassesStatus =
- !form.onlineClassesNums && form.onlineClassesNums <= 0 ? true : false;
- let offlineClassesStatus =
- !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false;
- if (statusList.hasOnline) {
- if (onlineClassesStatus) {
- if (isShowToast) {
- this.$toast("请输入线上课次数");
- }
- return false;
- }
- if (!onlineClassesStatus && !hasOnLine && form.onlineClassesNums > 0) {
- if (isShowToast) {
- this.$toast("课时安排缺少线上课类型");
- }
- return false;
- }
- }
- if (statusList.hasOffline) {
- if (offlineClassesStatus) {
- if (isShowToast) {
- this.$toast("请输入线下课次数");
- }
- return false;
- }
- if (
- !offlineClassesStatus &&
- !hasOffLine &&
- form.offlineClassesNums > 0
- ) {
- if (isShowToast) {
- this.$toast("课时安排缺少线下课类型");
- }
- return false;
- }
- }
- return true;
- },
- // 搜索
- onSearch() {
- this.params.page = 1;
- this.dataList = [];
- this.dataShow = true;
- this.loading = true;
- this.finished = false;
- this.getStudent();
- },
- getStudent() {
- let params = this.params;
- queryStudentsWithTeacher(params).then((res) => {
- let result = res.data;
- this.loading = false;
- if (result.code == 200) {
- params.page = result.data.pageNo;
- this.dataList = this.dataList.concat(result.data.rows);
- if (params.page >= result.data.totalPage) {
- this.finished = true;
- }
- this.params.page++;
- } else {
- this.finished = true;
- }
- // 判断是否有数据
- if (this.dataList.length <= 0) {
- this.dataShow = false;
- }
- });
- },
- onPopupCancel() {
- // 关闭弹窗
- this.statusList.studentStatus = false;
- // this.params.search = null
- this.checkboxSelect = [];
- this.checkboxSelectList = [];
- },
- onPopupSubmit() {
- const vipGroupCategorySelect = this.loadData.vipGroupCategorySelect;
- const compareNum = this.courseTypeVip ? vipGroupCategorySelect.studentNum : 1
- console.log(compareNum)
- if (this.checkboxSelect.length != compareNum) {
- this.$toast(
- `请选择学生${compareNum}名,当前选择${this.checkboxSelect.length}名`
- );
- return;
- }
- this.checkboxSelectDataList = JSON.parse(
- JSON.stringify(this.checkboxSelectList)
- );
- this.checkboxSelectIds = JSON.parse(JSON.stringify(this.checkboxSelect));
- this.checkboxSelect = [];
- this.checkboxSelectList = [];
- this.loadData.vipGroupActivity = [];
- this.formName.vipGroupActivityName = null;
- this.formName.vipGroupCategoryIndex = 0;
- this.form.vipGroupActivityId = null;
- this.statusList.studentStatus = false;
- this.loadData.vipGroupActivitySelect.maxCourseNum = 0
- this.loadData.vipGroupActivitySelect.minCourseNum = 0
- console.log(this.loadData.vipGroupActivitySelect)
- this.form.totalCount = null
- },
- onCheckboxSelect(value) {
- if (this.checkboxSelect.includes(value.userId.toString())) {
- this.checkboxSelect.forEach((item, index) => {
- if (item == value.userId.toString()) {
- this.checkboxSelect.splice(index, 1);
- }
- });
- this.checkboxSelectList.forEach((item, index) => {
- if (item.userId == value.userId) {
- this.checkboxSelectList.splice(index, 1);
- }
- });
- } else {
- this.checkboxSelect.push(value.userId.toString());
- this.checkboxSelectList.push(value);
- }
- // checkboxSelect = item.userId
- },
- desensitPhone(phone) {
- // 手机号脱敏
- let first = phone.substr(0, 3);
- let last = phone.substr(-4);
- return first + "****" + last;
- },
- },
- computed: {
- courseTypeVip() {
- return this.courseType == 'VIP' ? true : false
- },
- courseTypePractice() {
- return this.courseType == 'PRACTICE' ? true : false
- }
- }
- };
- </script>
- <style lang='less' scoped>
- @import url("../../assets/commonLess/variable.less");
- .vipapply {
- overflow: hidden;
- }
- .vip-title {
- padding: .06rem .14rem .04rem;
- font-size: .14rem;
- color: #808080;
- }
- .courseTips {
- font-size: 0.13rem;
- padding: 10px 16px;
- background: #f3f4f8;
- & > span {
- color: red;
- }
- }
- .add-plan {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0.2rem 0;
- font-size: 0.16rem;
- color: @tFontColor;
- .van-icon {
- margin-right: 0.05rem;
- font-size: 0.2rem;
- }
- }
- .title-time {
- display: flex;
- align-items: center;
- flex: 1 auto;
- color: #4a4a4a;
- .online {
- color: @tFontColor;
- }
- .week {
- padding-left: 0.4rem;
- padding-right: 0.15rem;
- }
- }
- // /deep/.van-field__label,
- // /deep/.van-cell__value {
- // // flex: 1 auto;
- // }
- /deep/.van-field__label {
- width: 50%;
- }
- /deep/.van-field__control:disabled {
- color: #6a6969;
- }
- .button-group {
- margin: 0.3rem 0.26rem 0.2rem;
- .van-button--primary {
- background: @mColor;
- border-color: @mColor;
- font-size: 0.18rem;
- }
- }
- .van-row {
- line-height: 0.4rem;
- border-top: 1px solid #edeef0;
- text-align: center;
- font-size: 0.14rem;
- &:first-child {
- border-top: 0;
- background: #edeef0;
- color: #444;
- font-size: 0.15rem;
- }
- }
- .tableContainer {
- max-height: 2.44rem;
- overflow: auto;
- .van-row {
- color: #444;
- &:first-child {
- border-top: 0;
- background: #fff;
- font-size: 0.14rem;
- }
- }
- }
- .studentContainer {
- /deep/.van-cell__title {
- font-size: 0.14rem;
- color: @mFontColor;
- flex: 1 auto;
- }
- .logo {
- width: 0.35rem;
- height: 0.35rem;
- margin-right: 0.12rem;
- border-radius: 100%;
- }
- .input-cell {
- padding: 0.12rem 0.16rem 0.2rem;
- .van-checkbox {
- justify-content: flex-end;
- }
- }
- /deep/.van-cell__value {
- height: 0.2rem;
- }
- /deep/.van-checkbox__icon .van-icon {
- border-color: @sFontColor;
- }
- /deep/.van-checkbox__icon--checked .van-icon {
- border-color: #01C1B5;
- }
- // /deep/.van-checkbox__icon--checked {
- // .van-icon {
- // border-color: @orangeColor;
- // background: @orangeColor;
- // }
- // }
- .van-tag {
- margin-left: 0.08rem;
- }
- }
- .paddingB80 {
- padding-bottom: 0.8rem;
- }
- .button-group-popup {
- position: fixed;
- bottom: 0;
- padding: 0.2rem 0;
- width: 100%;
- text-align: center;
- background-color: #ffffff;
- .btn {
- padding: 0 0.45rem;
- line-height: 0.4rem;
- display: inline-block;
- border: 1px solid @mColor;
- border-radius: 1rem;
- color: @mColor;
- background: #fff;
- font-size: 0.18rem;
- &.primary {
- color: #fff;
- background: @mColor;
- }
- }
- .btn + .btn {
- margin-left: 0.1rem;
- }
- }
- .studentColor {
- color: @mColor;
- }
- .classStudent {
- font-size: .14rem !important;
- }
- /deep/.van-field--disabled .van-field__label,
- /deep/.van-field__label {
- color: #323233;
- }
- .courseStudent {
- .van-cell__value {
- color: #b2b2b2;
- font-size: 0.16rem;
- }
- }
- /deep/.studentChiose {
- border-radius: 0 0 0px 0px;
- overflow: auto;
- }
- </style>
|