VIP00Apply.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  1. <template>
  2. <div class="vipapply">
  3. <m-header v-if="statusList.headerStatus" />
  4. <div class="vip-title">课程信息</div>
  5. <van-cell-group>
  6. <!-- <van-field v-model="form.name" label="课程班名称" input-align="right" size="large" placeholder="请输入班级名称" /> -->
  7. <van-field v-model="formName.subjectListName" @click="onGetSheetList('subjectList')" label="科目名称" :readonly="true" input-align="right" is-link size="large" placeholder="请选择" />
  8. <van-field v-model="formName.vipGroupCategoryName" @click="onGetSheetList('vipGroupCategory')" label="课程形式" :readonly="true" input-align="right" is-link size="large" placeholder="请选择" />
  9. <van-field v-model="formName.educationalTeacherName" @click="onGetSheetList('teacherList')" label="乐团主管" :readonly="true" input-align="right" is-link size="large" placeholder="请选择" />
  10. <van-cell 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" />
  11. <div v-if="checkboxSelectDataList.length > 0" style="text-align: center;line-height: 1.8; padding: .05rem 0;background: #fafbff;">
  12. <p style="color: #323233;" v-for="(item, index) in checkboxSelectDataList" :key="index">
  13. {{ item.userName }} - {{ item.phone }}
  14. </p>
  15. </div>
  16. <van-field v-model="formName.vipGroupActivityName" @click="onGetSheetList('vipGroupActivity')" label="活动方案" :readonly="true" input-align="right" is-link size="large" placeholder="请选择" />
  17. </van-cell-group>
  18. <div class="vip-title">课时组成</div>
  19. <van-cell-group>
  20. <van-field v-model="form.studentNum" label="每班人数" disabled input-align="right" size="large" placeholder="每班预计招收人数" />
  21. <van-field v-model="form.singleClassMinutes" @click="onClickSingleClass" label="每课时长" :readonly="true" input-align="right" is-link size="large" placeholder="请输入每课时长" />
  22. <!-- 判断是否选择活动方案 -->
  23. <van-field v-if="statusList.hasOnline" v-model="form.onlineClassesNums" @keyup="onClassKeyUp" label="线上课" input-align="right" size="large" placeholder="请输入次数" type="number" />
  24. <van-field v-if="statusList.hasOffline" v-model="form.offlineClassesNums" @keyup="onClassKeyUp('offLine')" label="线下课" input-align="right" size="large" placeholder="请输入次数" type="number" />
  25. <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="请选择" />
  26. <!-- <van-field v-if="formName.vipGroupActivityName || statusList.hasOnline" v-model="form.onlineClassesNums" @keyup="onClassKeyUp" label="线上课" input-align="right" size="large" placeholder="请输入次数" type="number" />
  27. <van-field v-if="formName.vipGroupActivityName || statusList.hasOffline" v-model="form.offlineClassesNums" @keyup="onClassKeyUp" label="线下课" input-align="right" size="large" placeholder="请输入次数" type="number" /> -->
  28. </van-cell-group>
  29. <div class="vip-title">时间安排</div>
  30. <van-cell-group>
  31. <van-field v-model="form.registrationStartTime" label="报名开始时间" disabled @click="onEnListShow('start', form.registrationStartTime)" input-align="right" is-link size="large" placeholder="请选择" />
  32. <van-field v-model="form.coursesExpireDate" label="报名截止时间" disabled @click="onEnListShow('end', form.coursesExpireDate)" input-align="right" is-link size="large" placeholder="请选择" />
  33. </van-cell-group>
  34. <div class="vip-title">课时安排</div>
  35. <van-cell-group>
  36. <van-field v-model="form.totalClassTime" label="课时总数" disabled input-align="right" size="large" placeholder="请输入次数" />
  37. <van-field v-if="statusList.teachOnOrOff" v-model="formName.giveTeachModeName" @click="onGiveMode" label="赠课类型" :readonly="true" input-align="right" is-link size="large" placeholder="请选择" />
  38. <van-field @click="dataForm.status = true" v-model="form.courseStart" label="排课开始时间" :readonly="true" input-align="right" is-link size="large" placeholder="请选择" />
  39. <van-cell title-class="title-time" v-for="(item, index) in scheduleList" :key="index">
  40. <template slot="title">
  41. <span class="online">{{ item.type }}</span>
  42. <span class="week">{{ item.weekStr }}</span>
  43. <span class="timer">{{ item.startTime + '-' + item.endTime }}</span>
  44. </template>
  45. <template slot="default">
  46. <van-button type="warning" @click="onScheduleRemove(item)" round size="small" plain>删除</van-button>
  47. </template>
  48. </van-cell>
  49. <div class="add-plan van-cell" @click="onCourseShedule">
  50. <van-icon name="add-o" />课时安排
  51. </div>
  52. <van-field label="排课列表" v-if="scheduleList.length > 0" disabled input-align="right" @click="onShowTimeTable" is-link size="large" />
  53. </van-cell-group>
  54. <div class="vip-title">课酬设置</div>
  55. <van-cell-group>
  56. <van-field v-model="form.onlineClassesUnitPrice" label="线上课单价" type="number" input-align="right" size="large" @keyup="getCalcClass" :disabled="loadData.vipGroupActivitySelect.paymentReadonlyFlag == 0" placeholder="金额(每课时)" v-if="statusList.hasOnline" />
  57. <van-field v-model="form.offlineClassesUnitPrice" label="线下课单价" type="number" input-align="right" size="large" @keyup="getCalcClass" :disabled="loadData.vipGroupActivitySelect.paymentReadonlyFlag == 0" placeholder="金额(每课时)" v-if="statusList.hasOffline" />
  58. <van-field v-model="form.onlineTeacherSalary" label="线上课课酬" input-align="right" size="large" :disabled="loadData.vipGroupActivitySelect.salaryReadonlyFlag == 0" placeholder="金额(每课时)" v-if="statusList.hasOnline" type="number" />
  59. <!-- || other.onlineSalary !='TEACHER_DEFAULT' -->
  60. <van-field v-model="form.offlineTeacherSalary" label="线下课课酬" input-align="right" size="large" :disabled="loadData.vipGroupActivitySelect.salaryReadonlyFlag == 0" placeholder="金额(每课时)" v-if="statusList.hasOffline" type="number" />
  61. <!-- || other.offlineSalary !='TEACHER_DEFAULT' -->
  62. <van-field v-model="form.totalCount" disabled label="课程总价" input-align="right" size="large" placeholder="金额(每课时)" />
  63. </van-cell-group>
  64. <div class="button-group">
  65. <van-button type="primary" @click="onSubmit" round size="large">确认</van-button>
  66. </div>
  67. <!-- 每课时长 -->
  68. <van-action-sheet v-model="statusList.classTimerStatus" :actions="loadData.classTimer" cancel-text="取消" @cancel="statusList.classTimerStatus = false" @select="onClassTimerSelect" />
  69. <!-- 报名开始时间&报名结束时间 -->
  70. <van-popup v-model="enlistForm.status" position="bottom">
  71. <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" />
  72. </van-popup>
  73. <!-- 赠课类型 -->
  74. <van-action-sheet v-model="statusList.giveTeachModeStatus" :actions="loadData.giveTeachMode" cancel-text="取消" @cancel="statusList.giveTeachModeStatus = false" @select="onModeSelect" />
  75. <!-- 课程信息所用 :close-on-click-overlay="false" -->
  76. <van-popup v-model="sheetForm.sheetStatus" position="bottom">
  77. <van-picker :loading="sheetForm.loading" :default-index="sheetForm.index" :columns="sheetForm.columns" show-toolbar @cancel="sheetForm.sheetStatus = false" @confirm="onSheetConfirm" />
  78. </van-popup>
  79. <!-- 课时安排 -->
  80. <van-popup v-model="dataForm.status" position="bottom">
  81. <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" />
  82. </van-popup>
  83. <!-- 课时安排 -->
  84. <van-popup v-model="courseForm.teachingStatus" position="bottom">
  85. <van-picker :columns="courseForm.columns" show-toolbar @cancel="courseForm.teachingStatus = false" @confirm="onTeachinConfirm" />
  86. </van-popup>
  87. <!-- 选择上课学生 -->
  88. <van-popup v-model="statusList.studentStatus" :lock-scroll="true" position="bottom" :style="{ height: '180%' }">
  89. <van-sticky>
  90. <van-search show-action shape="round" @search="onSearch" v-model="params.search" placeholder="请输入学生名或手机号">
  91. <template #action>
  92. <div @click="onSearch">搜索</div>
  93. </template>
  94. </van-search>
  95. </van-sticky>
  96. <div class="paddingB80">
  97. <van-list v-model="loading" class="studentContainer" v-if="dataShow" key="data" :finished="finished" finished-text="" @load="getStudent">
  98. <van-checkbox-group v-model="checkboxSelect">
  99. <van-cell-group>
  100. <van-cell v-for="(item, index) in dataList" :key="index" @click="onCheckboxSelect(item)" class="input-cell" :center="true">
  101. <template slot="icon">
  102. <img class="logo" v-if="item.avatar" :src="item.avatar" alt="">
  103. <img class="logo" v-else src="@/assets/images/icon_student.png" alt="">
  104. </template>
  105. <template slot="title">
  106. {{ item.userName }}
  107. </template>
  108. <template slot="label">
  109. <span>{{ desensitPhone(item.phone) }}</span>
  110. </template>
  111. <template slot="default">
  112. <van-checkbox :name="item.userId.toString()"></van-checkbox>
  113. </template>
  114. </van-cell>
  115. </van-cell-group>
  116. </van-checkbox-group>
  117. </van-list>
  118. <m-empty class="empty" msg="暂无学生" v-else key="data" />
  119. </div>
  120. <div class="button-group-popup">
  121. <span class="btn" @click="onPopupCancel">取消</span>
  122. <span class="btn primary" @click="onPopupSubmit">确定</span>
  123. </div>
  124. </van-popup>
  125. <!-- 课表展示 -->
  126. <van-popup v-model="statusList.classTime" position="bottom">
  127. <van-row>
  128. <van-col span="12">上课类型</van-col>
  129. <van-col span="12">上课时间</van-col>
  130. </van-row>
  131. <div class="tableContainer">
  132. <van-row v-for="(item, index) in timeTable" :key="index">
  133. <van-col span="12">
  134. {{ item.teachMode == 'ONLINE' ? '线上' : '线下' }}
  135. </van-col>
  136. <van-col span="12">
  137. {{ item.classDate }} {{ item.startClassTimeStr }}
  138. </van-col>
  139. </van-row>
  140. </div>
  141. </van-popup>
  142. </div>
  143. </template>
  144. <script>
  145. /* eslint-disable */
  146. import MHeader from '@/components/MHeader'
  147. import {
  148. browser
  149. } from '@/common/common'
  150. import MEmpty from '@/components/MEmpty'
  151. import {
  152. findSubSubjects,
  153. vipGroupCategory,
  154. findByVipGroupCategory,
  155. findVipSchoolByTeacher2,
  156. findByTeacherAndCategory,
  157. vipGroupApply,
  158. findEducationUsers,
  159. queryStudentsWithTeacher
  160. } from '@/api/teacher'
  161. import setLoading from '@/utils/loading'
  162. let minutes = [] // 分钟数
  163. for (let i = 0; i < 60; i++) {
  164. let mi = i < 10 ? '0' + i : i
  165. minutes.push(mi + '分')
  166. }
  167. export default {
  168. name: 'vipapply',
  169. components: {
  170. MHeader,
  171. MEmpty
  172. },
  173. data() {
  174. return {
  175. dataForm: { // 时间下拉框
  176. status: false,
  177. minDate: new Date(),
  178. maxDate: new Date(2025, 10, 1),
  179. currentDate: new Date()
  180. },
  181. enlistForm: { // 时间下拉框
  182. updateStatus: '', // 修改哪个状态
  183. status: false,
  184. minDate: new Date(),
  185. maxDate: new Date(2025, 10, 1),
  186. currentDate: new Date()
  187. },
  188. statusList: { // 散状态集合
  189. giveTeachModeStatus: false, // 赠课弹窗状态
  190. teachOnOrOff: false, // 是否显示赠课
  191. hasOnline: false, // 是否显示线上
  192. hasOffline: false, // 是否显示线下
  193. classTime: false, // 课表展示
  194. headerStatus: false, // 头部是否展示
  195. classTimerStatus: false, // 每课时长状态
  196. studentStatus: false, // 上课学生状态
  197. },
  198. loadData: { // 下拉加载数据
  199. subjectList: [], // 声部列表
  200. subjectListSelect: [], // 选中的声部JSON
  201. vipGroupCategory: [], // 课程形式
  202. vipGroupCategorySelect: [], // 选中的课程形式JSON
  203. vipGroupActivity: [], // 活动文案
  204. vipGroupActivitySelect: [], // 选中的活动文案JSON
  205. teacherSchool: [], // 线下课地址
  206. teacherSchoolSelect: [], // 选中的线下课地址JSON
  207. teacherList: [], // 线下课地址
  208. teacherListSelect: [], // 选中的线下课地址JSON
  209. giveTeachMode: [{
  210. name: '线上课',
  211. value: 'ONLINE'
  212. }, {
  213. name: '线下课',
  214. value: 'OFFLINE'
  215. }], // 赠课
  216. giveTeachModeSelect: [], // 选中的赠课JSON
  217. teacherCategory: [], // 老师课酬信息
  218. classTimer: [], // 每课时长
  219. },
  220. sheetForm: { // 上拉弹窗
  221. currentType: null, // 当前选择的类型
  222. sheetStatus: false,
  223. loading: true, // 加载数据
  224. index: 0, // 选中的索引值
  225. columns: []
  226. },
  227. courseForm: { // 排课弹窗
  228. teachingStatus: false, // 课时安排状态
  229. columns: [{ // 课程选项
  230. values: ['线上', '线下'],
  231. className: 'type'
  232. }, {
  233. values: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  234. className: 'week'
  235. }, {
  236. values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
  237. className: 'hours',
  238. defaultIndex: 7
  239. }, {
  240. values: minutes,
  241. className: 'minutes'
  242. }]
  243. },
  244. form: {
  245. name: null,
  246. subjectIdList: null,
  247. vipGroupCategoryId: null,
  248. vipGroupActivityId: null,
  249. teacherSchoolId: null,
  250. educationalTeacherId: null,
  251. studentNum: null,
  252. singleClassMinutes: null,
  253. onlineClassesNums: null,
  254. offlineClassesNums: null,
  255. registrationStartTime: null,
  256. coursesExpireDate: null,
  257. totalClassTime: null,
  258. courseStart: null,
  259. giveTeachMode: null,
  260. onlineClassesUnitPrice: null,
  261. offlineClassesUnitPrice: null,
  262. onlineTeacherSalary: null,
  263. offlineTeacherSalary: null,
  264. totalCount: null,
  265. },
  266. formName: {
  267. subjectListName: null, // 声部名称
  268. subjectListIndex: 0, // 声部名称
  269. vipGroupCategoryName: null, // 课程形式
  270. vipGroupCategoryIndex: 0, // 课程形式
  271. vipGroupActivityName: null, // 活动文案
  272. vipGroupActivityIndex: 0, // 活动文案
  273. teacherSchoolName: null, // 线下课地址
  274. teacherSchoolIndex: 0, // 线下课地址
  275. giveTeachModeName: null, // 赠课类型
  276. educationalTeacherName: null, // 乐团主管
  277. educationalTeacherIndex: 0,
  278. },
  279. other: {
  280. onlineSalary: null, // 线上课课酬结算方式
  281. offlineSalary: null, // 线下课课酬结算方式
  282. giveNum: 0, // 赠送课时
  283. },
  284. scheduleList: [], // 课时安排
  285. timeTable: [], // 生成的课表
  286. onSubmitStatus: true, // 点击
  287. checkboxSelect: [],
  288. checkboxSelectIds: [],
  289. checkboxSelectList: [], //选中学生列表
  290. checkboxSelectDataList: [],
  291. loading: false,
  292. finished: false,
  293. params: {
  294. search: null,
  295. page: 1,
  296. rows: 20
  297. },
  298. dataShow: true, // 是否有数据
  299. dataList: [],
  300. salaryStatus: true, // 是否跳过课酬二次确认
  301. }
  302. },
  303. mounted() {
  304. let params = this.$route.query
  305. if (params.Authorization) {
  306. localStorage.setItem('Authorization', decodeURI(params.Authorization))
  307. localStorage.setItem('userInfo', decodeURI(params.Authorization))
  308. }
  309. document.title = 'VIP课程班申请'
  310. if (browser().android) {
  311. this.headerStatus = true
  312. }
  313. },
  314. methods: {
  315. onCheckStudent() {
  316. if (!this.form.vipGroupCategoryId) { // 判断是否选择了课程形式
  317. this.$toast('请选择课程形式')
  318. return
  319. }
  320. // this.checkboxSelectIds = JSON.parse(JSON.stringify(this.checkboxSelectIds))
  321. // this.checkboxSelectDataList = JSON.parse(JSON.stringify(this.checkboxSelectDataList))
  322. this.statusList.studentStatus = true
  323. },
  324. onGetSheetList(name) { // 获取科目列表
  325. let sheetForm = this.sheetForm
  326. sheetForm.columns = []
  327. if (!this.form.vipGroupCategoryId && name == 'vipGroupActivity') { // 判断是否选择了课程形式
  328. this.$toast('请选择课程形式')
  329. return
  330. }
  331. sheetForm.sheetStatus = true
  332. sheetForm.loading = true
  333. sheetForm.currentType = name
  334. sheetForm.index = 0
  335. let arr = this.loadData[name]
  336. if (arr.length > 0) {
  337. sheetForm.columns = arr
  338. sheetForm.index = this.formName[name + 'Index']
  339. sheetForm.loading = false
  340. } else {
  341. this.onLoadingData(name)
  342. }
  343. },
  344. onLoadingData() { // 加载数据
  345. let sheetForm = this.sheetForm
  346. if (sheetForm.currentType == 'subjectList') { // 声部列表
  347. findSubSubjects().then(res => {
  348. let result = res.data
  349. if (result.code == 200 && result.data.length > 0) {
  350. let tempArr = []
  351. result.data.forEach(item => {
  352. item.value = item.id
  353. item.text = item.name
  354. tempArr.push(item)
  355. })
  356. this.loadData.subjectList = tempArr
  357. sheetForm.columns = tempArr
  358. sheetForm.loading = false
  359. } else {
  360. this.$toast('暂无科目列表')
  361. sheetForm.loading = false
  362. }
  363. })
  364. } else if (sheetForm.currentType == 'vipGroupCategory') { // 课程形式
  365. vipGroupCategory().then(res => {
  366. let result = res.data
  367. if (result.code == 200 && result.data.length > 0) {
  368. let tempArr = []
  369. result.data.forEach(item => {
  370. item.value = item.id
  371. item.text = item.name
  372. tempArr.push(item)
  373. })
  374. this.loadData.vipGroupCategory = tempArr
  375. sheetForm.columns = tempArr
  376. sheetForm.loading = false
  377. } else {
  378. this.$toast('暂无课程形式')
  379. sheetForm.loading = false
  380. }
  381. })
  382. } else if (sheetForm.currentType == 'vipGroupActivity') { // 活动文案
  383. findByVipGroupCategory({
  384. categoryId: this.form.vipGroupCategoryId
  385. }).then(res => {
  386. let result = res.data
  387. if (result.code == 200 && result.data.length > 0) {
  388. let tempArr = []
  389. let regStr = new RegExp('双十一')
  390. result.data.forEach(item => {
  391. if(!regStr.test(item.name)) {
  392. item.value = item.id
  393. item.text = item.name
  394. item.startTime = item.startTime ? item.startTime.split(' ')[0] : null, // 报名开始时间
  395. item.endTime = item.endTime ? item.endTime.split(' ')[0] : null // 报名结束时间
  396. tempArr.push(item)
  397. }
  398. })
  399. this.loadData.vipGroupActivity = tempArr
  400. sheetForm.columns = tempArr
  401. sheetForm.loading = false
  402. } else {
  403. this.$toast('暂无活动方案')
  404. sheetForm.loading = false
  405. }
  406. })
  407. } else if (sheetForm.currentType == 'teacherSchool') { // 教师教学点
  408. findVipSchoolByTeacher2().then(res => {
  409. let result = res.data
  410. if (result.code == 200 && result.data.length > 0) {
  411. let tempArr = []
  412. result.data.forEach(item => {
  413. item.value = item.id
  414. item.text = item.name
  415. tempArr.push(item)
  416. })
  417. this.loadData.teacherSchool = tempArr
  418. sheetForm.columns = tempArr
  419. sheetForm.loading = false
  420. } else {
  421. this.$toast('暂无教学点')
  422. sheetForm.loading = false
  423. }
  424. })
  425. } else if (sheetForm.currentType == 'teacherList') { // 乐团主管
  426. findEducationUsers().then(res => {
  427. let result = res.data
  428. if (result.code == 200 && result.data.length > 0) {
  429. let tempArr = []
  430. result.data.forEach(item => {
  431. item.value = item.userId
  432. item.text = item.userName
  433. tempArr.push(item)
  434. })
  435. this.loadData.teacherList = tempArr
  436. sheetForm.columns = tempArr
  437. sheetForm.loading = false
  438. } else {
  439. this.$toast('暂无乐团主管')
  440. sheetForm.loading = false
  441. }
  442. })
  443. }
  444. },
  445. findTeacherCategory(id) { // 获取教师课酬
  446. findByTeacherAndCategory({
  447. categoryId: id
  448. }).then(res => {
  449. let result = res.data
  450. if (result.code == 200) {
  451. this.loadData.teacherCategory = result.data
  452. }
  453. })
  454. },
  455. onSheetConfirm(value, index) { // 上拉弹窗
  456. let sheetForm = this.sheetForm,
  457. form = this.form,
  458. formName = this.formName,
  459. loadData = this.loadData
  460. if (sheetForm.currentType == 'subjectList') { // 科目名称赋值
  461. form.subjectIdList = value.value
  462. formName.subjectListName = value.text
  463. formName.subjectListIndex = index
  464. loadData.subjectListSelect = value
  465. } else if (sheetForm.currentType == 'vipGroupCategory') { // 课程形式赋值
  466. if (loadData.vipGroupCategorySelect.id != value.id) {
  467. // 获取教师课酬
  468. this.findTeacherCategory(value.id)
  469. }
  470. form.vipGroupCategoryId = value.value
  471. formName.vipGroupCategoryName = value.text
  472. formName.vipGroupCategoryIndex = index
  473. loadData.vipGroupCategorySelect = value
  474. form.studentNum = value.studentNum // 每班人数
  475. // form.singleClassMinutes = value.singleClassMinutes // 每课时长
  476. form.onlineClassesUnitPrice = Math.ceil(value.onlineClassesUnitPrice)
  477. form.offlineClassesUnitPrice = Math.ceil(value.offlineClassesUnitPrice)
  478. // 每课时长赋值
  479. form.singleClassMinutes = null
  480. loadData.classTimer = []
  481. let tempSingle = value.singleClassMinutes.split(",")
  482. tempSingle.forEach(item => {
  483. this.loadData.classTimer.push({
  484. name: item,
  485. value: item
  486. })
  487. })
  488. // 重置上课学生
  489. this.checkboxSelect = []
  490. this.checkboxSelectIds = []
  491. this.checkboxSelectList = [] //选中学生列表
  492. this.checkboxSelectDataList = []
  493. // 重置活动文案
  494. form.vipGroupActivityId = null
  495. formName.vipGroupActivityName = null
  496. formName.vipGroupActivityIndex = 0
  497. loadData.vipGroupActivity = []
  498. loadData.vipGroupActivitySelect = []
  499. } else if (sheetForm.currentType == 'vipGroupActivity') { // 活动方案赋值
  500. // 重置线上课,线下课次数
  501. if (form.vipGroupActivityId != value.value) {
  502. form.offlineClassesNums = null
  503. form.onlineClassesNums = null
  504. }
  505. form.vipGroupActivityId = value.value
  506. formName.vipGroupActivityName = value.text
  507. formName.vipGroupActivityIndex = index
  508. loadData.vipGroupActivitySelect = value
  509. // 换活动之后单价重置
  510. form.onlineClassesUnitPrice = Math.ceil(loadData.vipGroupCategorySelect.onlineClassesUnitPrice)
  511. form.offlineClassesUnitPrice = Math.ceil(loadData.vipGroupCategorySelect.offlineClassesUnitPrice)
  512. this.onCalcClassTimes(value) // 计算时间等.........
  513. this.getCalcClass() // 课酬计算
  514. this.setTimeTable() // 重新排课
  515. // 时间安排
  516. // form.registrationStartTime = value.startTime
  517. // form.coursesExpireDate = value.endTime
  518. } else if (sheetForm.currentType == 'teacherSchool') { // 线下课地址
  519. form.teacherSchoolId = value.value
  520. formName.teacherSchoolName = value.text
  521. formName.teacherSchoolIndex = index
  522. } else if (sheetForm.currentType == 'teacherList') { // 乐团主管
  523. form.educationalTeacherId = value.value
  524. formName.educationalTeacherName = value.text
  525. formName.educationalTeacherIndex = index
  526. }
  527. sheetForm.sheetStatus = false
  528. },
  529. onClassKeyUp(type) { // 线上课&线下课修改时
  530. if(type == 'offLine' && this.form.offlineClassesNums <= 0) {
  531. this.form.teacherSchoolId = null
  532. this.formName.teacherSchoolName = null
  533. this.formName.teacherSchoolIndex = 0
  534. }
  535. let vas = this.loadData.vipGroupActivitySelect
  536. this.onCalcClassTimes(vas)
  537. this.getCalcClass()
  538. this.setTimeTable()
  539. },
  540. onCalcClassTimes(vas) { // 计算课时总数
  541. let form = this.form,
  542. other = this.other,
  543. statusList = this.statusList
  544. let totalCount = Number(form.onlineClassesNums) + Number(form.offlineClassesNums)
  545. // ...
  546. if (vas.salarySettlementJson) {
  547. let obj = JSON.parse(vas.salarySettlementJson)
  548. if (obj && obj.onlineSalarySettlement) {
  549. // 有线上课
  550. statusList.hasOnline = true
  551. } else {
  552. statusList.hasOnline = false
  553. }
  554. if (obj && obj.offlineSalarySettlement) {
  555. // 有线下课
  556. statusList.hasOffline = true
  557. } else {
  558. statusList.hasOffline = false
  559. }
  560. }
  561. if (vas.type == "GIVE_CLASS") { // 买赠活动
  562. this.statusList.teachOnOrOff = true // 显示赠课
  563. if (totalCount >= Number(vas.attribute1)) {
  564. form.totalClassTime = totalCount + '+' + vas.attribute2
  565. other.giveNum = vas.attribute2
  566. } else {
  567. form.totalClassTime = totalCount
  568. other.giveNum = 0
  569. }
  570. } else { // 折扣活动
  571. form.totalClassTime = totalCount
  572. other.giveNum = 0
  573. this.statusList.teachOnOrOff = false // 隐藏赠课
  574. }
  575. },
  576. onModeSelect(value) { // 赠课确认
  577. this.form.giveTeachMode = value.value
  578. this.formName.giveTeachModeName = value.name
  579. this.statusList.giveTeachModeStatus = false
  580. this.getCalcClass()
  581. },
  582. onClickSingleClass() {
  583. if (!this.formName.vipGroupCategoryName) {
  584. this.$toast('请选择课程形式')
  585. return
  586. }
  587. this.statusList.classTimerStatus = true
  588. },
  589. onClassTimerSelect(value) { // 每课时长设置
  590. this.form.singleClassMinutes = value.value
  591. this.statusList.classTimerStatus = false
  592. this.getCalcClass()
  593. },
  594. onCurrentConfirm(value) { // 排课开始时间
  595. let selectDate = new Date(value)
  596. let tempMonth = selectDate.getMonth() + 1 >= 10 ? selectDate.getMonth() + 1 : '0' + (selectDate.getMonth() + 1)
  597. let tempDay = selectDate.getDate() >= 10 ? selectDate.getDate() : '0' + selectDate.getDate()
  598. this.form.courseStart = selectDate.getFullYear() + '-' + tempMonth + '-' + tempDay
  599. this.dataForm.status = false
  600. },
  601. onEnlistConfirm(value) { // 报名开始/结束时间
  602. let selectDate = new Date(value)
  603. let tempMonth = selectDate.getMonth() + 1 >= 10 ? selectDate.getMonth() + 1 : '0' + (selectDate.getMonth() + 1)
  604. let tempDay = selectDate.getDate() >= 10 ? selectDate.getDate() : '0' + selectDate.getDate()
  605. let enlistForm = this.enlistForm
  606. let form = this.form
  607. if (enlistForm.updateStatus == 'start') {
  608. form.registrationStartTime = selectDate.getFullYear() + '-' + tempMonth + '-' + tempDay
  609. if (form.coursesExpireDate) {
  610. let temps = new Date(form.registrationStartTime.replace(/-/ig, '/')).getTime()
  611. let tempe = new Date(form.coursesExpireDate.replace(/-/ig, '/')).getTime()
  612. // 如果开始时间大于结束时间,结束时间制空
  613. if (temps > tempe) {
  614. form.coursesExpireDate = null
  615. }
  616. }
  617. } else if (enlistForm.updateStatus == 'end') {
  618. form.coursesExpireDate = selectDate.getFullYear() + '-' + tempMonth + '-' + tempDay
  619. }
  620. enlistForm.status = false
  621. },
  622. onEnListShow(type, value) { // 报名开始/截止时间
  623. let enlistForm = this.enlistForm
  624. if (type == 'end') {
  625. if (this.form.registrationStartTime) {
  626. enlistForm.minDate = new Date(this.form.registrationStartTime.replace(/-/ig, '/'))
  627. } else {
  628. enlistForm.minDate = new Date()
  629. }
  630. } else if (type == 'start') {
  631. // 开始时默认为当前时间
  632. enlistForm.minDate = new Date()
  633. }
  634. if (value) {
  635. enlistForm.currentDate = new Date(value.replace(/-/ig, '/'))
  636. } else {
  637. enlistForm.currentDate = new Date()
  638. }
  639. enlistForm.updateStatus = type
  640. enlistForm.status = true
  641. },
  642. onCourseShedule() { // 课时安排
  643. if (!this.form.singleClassMinutes) {
  644. this.$toast('请选每课时长')
  645. return
  646. }
  647. if (this.other.giveNum > 0 && !this.form.giveTeachMode) {
  648. this.$toast('请选择赠课类型')
  649. return
  650. }
  651. if (!this.form.courseStart) {
  652. this.$toast('请选择排课开始时间')
  653. return
  654. }
  655. this.courseForm.teachingStatus = true
  656. },
  657. onScheduleRemove(item) { // 删除课程安排
  658. let index = this.scheduleList.indexOf(item)
  659. if (index !== -1) {
  660. this.scheduleList.splice(index, 1)
  661. }
  662. },
  663. onTeachinConfirm(value) { // 添加课程
  664. let scheduleList = this.scheduleList
  665. let startTime = (value[2] >= 10 ? value[2] : '0' + value[2]) + ':' + value[3].split('分')[0]
  666. let endTime = this.MinutesTest(value[2], value[3], this.form.singleClassMinutes)
  667. let isAdd = true
  668. scheduleList.forEach(item => {
  669. let isStartTime = this.timeIsrange(startTime, endTime, item.startTime);
  670. let isEndTime = this.timeIsrange(startTime, endTime, item.endTime);
  671. if (isAdd) { //
  672. if (value[1] == item.weekStr) {
  673. if (isStartTime || isEndTime) {
  674. isAdd = false
  675. } else {
  676. isAdd = true
  677. }
  678. } else if (value[1] != item.weekStr) {
  679. isAdd = true
  680. }
  681. }
  682. })
  683. if (isAdd) { // 判断时间范围是否有重复
  684. scheduleList.push({
  685. type: value[0], // 线上还是线下
  686. weekStr: value[1],
  687. weekIndex: this.getWeek(value[1]),
  688. startTime: startTime,
  689. endTime: endTime,
  690. id: Date.now()
  691. })
  692. // scheduleList.sort((a, b) => {
  693. // return a.weekStr
  694. // })
  695. this.courseForm.teachingStatus = false
  696. this.setTimeTable()
  697. } else {
  698. this.$toast('该时间段已排课请重选时间')
  699. return
  700. }
  701. },
  702. onShowTimeTable() { // 显示排课列表
  703. this.statusList.classTime = true
  704. this.setTimeTable()
  705. },
  706. setTimeTable() {
  707. // 重置排课列表
  708. this.timeTable = []
  709. let form = this.form,
  710. scheduleList = this.scheduleList
  711. // if(!form.courseStart) {
  712. // this.$toast('请选择排课开始时间')
  713. // return
  714. // }
  715. // 拿到线上课数与线下课数 以及
  716. let online = parseInt(form.onlineClassesNums ? form.onlineClassesNums : 0)
  717. let offline = parseInt(form.offlineClassesNums ? form.offlineClassesNums : 0)
  718. let giveNum = parseInt(this.other.giveNum)
  719. let giveClassType = form.giveTeachMode
  720. if (giveClassType == 'ONLINE') {
  721. // 线上
  722. online += giveNum
  723. } else if (giveClassType == 'OFFLINE') {
  724. offline += giveNum
  725. }
  726. // 判断是否有课程安排
  727. if (scheduleList.length <= 0) {
  728. return
  729. }
  730. let totalCount = Number(online) + Number(offline)
  731. let tempCourseStart = form.courseStart.replace(/-/ig, '/')
  732. let dateOperation = new Date(tempCourseStart)
  733. let forMark = 0
  734. while (totalCount && totalCount > 0) {
  735. for (let i = 0; i < scheduleList.length; i++) {
  736. if (online == 0 && offline == 0) break
  737. let num = scheduleList[i].weekIndex - dateOperation.getDay()
  738. // 如果是同一天一个周期会出现排课都排到一天
  739. if (forMark > 0 && num == 0 && i == 0) {
  740. num = num + 7
  741. }
  742. if (num < 0) { // 如果为负数则为下周
  743. num = num + 7
  744. }
  745. let dataStr = this.getThinkDate(dateOperation, num)
  746. // 判断是否大于当前时间
  747. let nowGetTime = new Date().getTime()
  748. let courseTime = new Date(dataStr.replace(/-/ig, '/') + ' ' + scheduleList[i].startTime + ':00').getTime()
  749. if (nowGetTime < courseTime) {
  750. let tempArr = {
  751. 'classDate': dataStr,
  752. 'startClassTimeStr': scheduleList[i].startTime,
  753. "endClassTimeStr": scheduleList[i].endTime
  754. }
  755. if (scheduleList[i].type == '线上' && online > 0) {
  756. tempArr.teachMode = 'ONLINE'
  757. this.timeTable.push(tempArr)
  758. online--
  759. } else if (scheduleList[i].type == '线下' && offline > 0) {
  760. tempArr.teachMode = 'OFFLINE'
  761. this.timeTable.push(tempArr)
  762. offline--
  763. } else {
  764. if (online > 0) {
  765. tempArr.teachMode = 'ONLINE'
  766. this.timeTable.push(tempArr)
  767. online--
  768. } else if (offline > 0) {
  769. tempArr.teachMode = 'OFFLINE'
  770. this.timeTable.push(tempArr)
  771. offline--
  772. }
  773. }
  774. totalCount--
  775. }
  776. }
  777. // 加一周
  778. if (scheduleList.length == 1) {
  779. dateOperation.setDate(dateOperation.getDate() + 7)
  780. } else if (scheduleList.every(item => item.weekStr === scheduleList[0].weekStr)) {
  781. // 标记循环次数(标记判断课程安排是不是同一天)
  782. forMark++
  783. }
  784. }
  785. },
  786. onGiveMode() { // 赠送课改变时
  787. this.statusList.giveTeachModeStatus = true
  788. this.getCalcClass()
  789. },
  790. getCalcClass() { // 计算课酬
  791. let loadData = this.loadData
  792. let form = this.form
  793. let vas = loadData.vipGroupActivitySelect, // 活动
  794. vcs = loadData.vipGroupCategorySelect, // 课程形式
  795. tc = loadData.teacherCategory, // 老师基本信息
  796. oncn = form.onlineClassesNums ? form.onlineClassesNums : 0, // 线上课次数
  797. offcn = form.offlineClassesNums ? form.offlineClassesNums : 0, // 线下课次数
  798. giveNum = parseInt(this.other.giveNum),
  799. giveTeachMode = form.giveTeachMode // 线下或线下
  800. // 优惠活动
  801. // ...
  802. if (vas.salarySettlementJson) {
  803. let obj = JSON.parse(vas.salarySettlementJson)
  804. // 获取每课时长
  805. // 每45Min计算一些课酬
  806. // let b = form.singleClassMinutes ? (form.singleClassMinutes / 45) : 0
  807. let tempPrice = 0
  808. if ((Number(oncn) + Number(offcn)) > 0) {
  809. let countPrice = (oncn * form.onlineClassesUnitPrice) + (offcn * form.offlineClassesUnitPrice)
  810. if (giveNum > 0 && !giveTeachMode) {
  811. countPrice = 0
  812. }
  813. tempPrice = countPrice * form.studentNum / (Number(oncn) + Number(offcn) + Number(giveNum))
  814. if (vas.type == 'DISCOUNT') {
  815. tempPrice = tempPrice * (vas.attribute1 ? Number(vas.attribute1) : 100) / 100
  816. }
  817. }
  818. // 课程按课来计算
  819. if (obj && obj.onlineSalarySettlement) {
  820. let onss = obj.onlineSalarySettlement
  821. // 有线上课
  822. if (onss.salarySettlementType == 'TEACHER_DEFAULT') {
  823. form.onlineTeacherSalary = Math.round(tc.offlineClassesSalary) // 线上课酬
  824. } else if (onss.salarySettlementType == 'RATIO_DISCOUNT') {
  825. // 老师课酬的折扣 如果有则不打折
  826. // form.onlineTeacherSalary = Math.round(vcs.onlineClassesUnitPrice * (onss.settlementValue ? onss.settlementValue : 100) / 100)
  827. form.onlineTeacherSalary = Math.round(tempPrice ? (tempPrice * (onss.settlementValue ? onss.settlementValue :
  828. 100) / 100) : 0)
  829. } else if (onss.salarySettlementType == 'FIXED_SALARY') {
  830. form.onlineTeacherSalary = Math.round(onss.settlementValue)
  831. }
  832. form.onlineTeacherSalary = Number(form.onlineTeacherSalary)
  833. } else {
  834. form.onlineTeacherSalary = Math.round(tc.offlineClassesSalary)
  835. }
  836. if (obj && obj.offlineSalarySettlement) {
  837. let offss = obj.offlineSalarySettlement
  838. // 有线下课
  839. if (offss.salarySettlementType == 'TEACHER_DEFAULT') {
  840. form.offlineTeacherSalary = Math.round(tc.offlineClassesSalary) // 线上课酬
  841. } else if (offss.salarySettlementType == 'RATIO_DISCOUNT') {
  842. // 老师课酬的折扣
  843. // form.offlineTeacherSalary = Math.round((vcs.offlineClassesUnitPrice * (offss.settlementValue ? offss.settlementValue : 100) / 100))
  844. form.offlineTeacherSalary = Math.round(tempPrice ? (tempPrice * (offss.settlementValue ? offss.settlementValue :
  845. 100) / 100) : 0)
  846. } else if (offss.salarySettlementType == 'FIXED_SALARY') {
  847. form.offlineTeacherSalary = Math.round(offss.settlementValue)
  848. }
  849. form.offlineTeacherSalary = Number(form.offlineTeacherSalary)
  850. } else {
  851. form.offlineTeacherSalary = Math.round(tc.offlineClassesSalary)
  852. }
  853. }
  854. if (vas.type == 'GIVE_CLASS' || vas.type == 'BASE_ACTIVITY') {
  855. form.totalCount = Math.round((oncn * form.onlineClassesUnitPrice) + (offcn * form.offlineClassesUnitPrice))
  856. } else if (vas.type == 'DISCOUNT') {
  857. form.totalCount = Math.round(((oncn * form.onlineClassesUnitPrice) + (offcn * form.offlineClassesUnitPrice)) *
  858. Number(vas.attribute1) / 100)
  859. }
  860. form.totalCount = Number(form.totalCount)
  861. },
  862. getThinkDate(date, num) {
  863. let Stamp = date
  864. Stamp.setDate(date.getDate() + num) // 获取当前月数的第几天
  865. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  866. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  867. var mvar = '';
  868. if (month < 10) {
  869. mvar = '0' + month;
  870. } else {
  871. mvar = month + '';
  872. }
  873. var day = Stamp.getDate();
  874. var dvar = '';
  875. if (day < 10) {
  876. dvar = '0' + day;
  877. } else {
  878. dvar = day + '';
  879. }
  880. return year + "-" + mvar + '-' + dvar;
  881. },
  882. // 分钟小时相加减
  883. MinutesTest(houer, mins, interval) {
  884. let min = mins.split('分')[0]
  885. let sdate1 = new Date(1900, 1, 1, houer, min)
  886. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval))
  887. let H = sdate1.getHours()
  888. let M = sdate1.getMinutes()
  889. if (H < 10) H = '0' + H
  890. if (M < 10) M = '0' + M
  891. return H + ':' + M
  892. },
  893. // 判断时间是否在时间段内
  894. timeIsrange(beginTime, endTime, nowTime) {
  895. var strb = beginTime.split(":");
  896. if (strb.length != 2) {
  897. return false;
  898. }
  899. var stre = endTime.split(":");
  900. if (stre.length != 2) {
  901. return false;
  902. }
  903. var strn = nowTime.split(":");
  904. if (stre.length != 2) {
  905. return false;
  906. }
  907. var b = new Date();
  908. var e = new Date();
  909. var n = new Date();
  910. b.setHours(strb[0]);
  911. b.setMinutes(strb[1]);
  912. e.setHours(stre[0]);
  913. e.setMinutes(stre[1]);
  914. n.setHours(strn[0]);
  915. n.setMinutes(strn[1]);
  916. if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
  917. // 在时间范围内
  918. return true
  919. } else {
  920. // 不在时间范围内
  921. return false
  922. }
  923. },
  924. getWeek(str) { // 获取周几索引值
  925. let template = {
  926. '周一': 1,
  927. '周二': 2,
  928. '周三': 3,
  929. '周四': 4,
  930. '周五': 5,
  931. '周六': 6,
  932. '周日': 0
  933. }
  934. return template[str]
  935. },
  936. formatter(type, value) {
  937. if (type === 'year') {
  938. return `${value}年`;
  939. } else if (type === 'month') {
  940. return `${value}月`
  941. } else if (type === 'day') {
  942. return `${value}日`
  943. }
  944. return value;
  945. },
  946. async onSubmit() {
  947. let form = this.form
  948. let statusList = this.statusList
  949. // 排课
  950. this.setTimeTable()
  951. // if (!(form.name)) {
  952. // this.$toast('请输入课程班名称')
  953. // return false
  954. // }
  955. if (!form.subjectIdList) {
  956. this.$toast('请选择科目')
  957. return false
  958. }
  959. if (!form.vipGroupCategoryId) {
  960. this.$toast('请选择课程形式')
  961. return false
  962. }
  963. if (!form.educationalTeacherId) {
  964. this.$toast('请选择乐团主管')
  965. return
  966. }
  967. if(this.checkboxSelectIds.length <= 0) {
  968. this.$toast('请选择上课学生')
  969. return
  970. }
  971. if (!form.vipGroupActivityId) {
  972. this.$toast('请选择活动方案')
  973. return false
  974. }
  975. if (!form.singleClassMinutes) {
  976. this.$toast('请选择每课时长')
  977. return false
  978. }
  979. let onlineClassesStatus = !form.onlineClassesNums && form.onlineClassesNums <= 0 ? true : false
  980. let offlineClassesStatus = !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false
  981. if (statusList.hasOnline) {
  982. if (onlineClassesStatus) {
  983. this.$toast('请输入线上课次数')
  984. return false
  985. }
  986. }
  987. if (statusList.hasOffline) {
  988. if (offlineClassesStatus) {
  989. this.$toast('请输入线下课次数')
  990. return false
  991. }
  992. // 判断是否有线下
  993. if (form.offlineClassesNums > 0 && !form.teacherSchoolId) {
  994. this.$toast('请选择线下课地址')
  995. return false
  996. }
  997. }
  998. if (!form.registrationStartTime) {
  999. this.$toast('请选择报名开始时间')
  1000. return false
  1001. }
  1002. if (!form.coursesExpireDate) {
  1003. this.$toast('请选择报名结束时间')
  1004. return false
  1005. }
  1006. let vipGroupActivitySelect = this.loadData.vipGroupActivitySelect
  1007. if (vipGroupActivitySelect.type == 'GIVE_CLASS' && !form.giveTeachMode) {
  1008. this.$toast('请选择赠课类型')
  1009. return false
  1010. }
  1011. if (this.scheduleList.length <= 0) {
  1012. this.$toast('课时安排不能为空')
  1013. return false
  1014. }
  1015. // 如果线上和线下课酬都为0时
  1016. if(statusList.hasOnline && statusList.hasOffline) {
  1017. if(form.onlineClassesNums > 0 && form.onlineTeacherSalary <= 0 && form.offlineClassesNums > 0 && form.offlineTeacherSalary <= 0 && this.salaryStatus) {
  1018. this.$dialog.confirm({
  1019. message: '当前课程课酬预计为0,是否继续?'
  1020. }).then(() => {
  1021. this.salaryStatus = false
  1022. this.onSubmit()
  1023. })
  1024. return
  1025. }
  1026. }
  1027. if (statusList.hasOnline) {
  1028. if (!form.onlineClassesUnitPrice) {
  1029. this.$toast('请输入线上课单价')
  1030. return false
  1031. }
  1032. if (!form.onlineTeacherSalary) {
  1033. this.$toast('请输入线上课课酬')
  1034. return false
  1035. }
  1036. if(form.onlineClassesNums > 0 && form.onlineTeacherSalary <= 0 && this.salaryStatus) {
  1037. this.$dialog.confirm({
  1038. message: '当前课程线上课酬预计为0,是否继续?'
  1039. }).then(() => {
  1040. this.salaryStatus = false
  1041. this.onSubmit()
  1042. })
  1043. return
  1044. }
  1045. }
  1046. if (statusList.hasOffline) {
  1047. if (!form.offlineClassesUnitPrice) {
  1048. this.$toast('请输入线下课单价')
  1049. return false
  1050. }
  1051. if (!form.offlineTeacherSalary) {
  1052. this.$toast('请输入线下课课酬')
  1053. return false
  1054. }
  1055. if(form.offlineClassesNums > 0 && form.offlineTeacherSalary <= 0 && this.salaryStatus) {
  1056. this.$dialog.confirm({
  1057. message: '当前课程线下课酬预计为0,是否继续?'
  1058. }).then(() => {
  1059. this.salaryStatus = false
  1060. this.onSubmit()
  1061. })
  1062. return
  1063. }
  1064. }
  1065. if (form.giveTeachMode == 'ONLINE') {
  1066. form.onlineClassesNum = Number(form.onlineClassesNums) + Number(this.other.giveNum)
  1067. form.offlineClassesNum = Number(form.offlineClassesNums)
  1068. } else {
  1069. form.onlineClassesNum = Number(form.onlineClassesNums)
  1070. form.offlineClassesNum = Number(form.offlineClassesNums) + Number(this.other.giveNum)
  1071. }
  1072. form.totalClassTimes = Number(form.onlineClassesNums) + Number(form.offlineClassesNums) + Number(this.other.giveNum)
  1073. form.paymentExpireDate = form.coursesExpireDate
  1074. form.studentIdList = this.checkboxSelectIds.join(',')
  1075. let params = {
  1076. courseSchedules: this.timeTable,
  1077. vipGroupApplyBaseInfo: form
  1078. }
  1079. if (!this.onSubmitStatus) {
  1080. return
  1081. }
  1082. this.onSubmitStatus = false
  1083. setLoading(true)
  1084. await vipGroupApply(params).then(res => {
  1085. let result = res.data
  1086. setLoading(false)
  1087. if (result.code == 200) {
  1088. this.$toast('申请成功')
  1089. setTimeout(() => {
  1090. this.onSubmitStatus = true
  1091. if (browser().iPhone) {
  1092. window.webkit.messageHandlers.DAYA.postMessage(JSON.stringify({
  1093. api: 'back'
  1094. }))
  1095. } else if (browser().android) {
  1096. DAYA.postMessage(JSON.stringify({
  1097. api: 'back'
  1098. }))
  1099. } else {
  1100. this.$router.push('/business')
  1101. }
  1102. }, 500)
  1103. } else {
  1104. this.onSubmitStatus = true
  1105. this.salaryStatus = true
  1106. this.$toast(result.msg)
  1107. }
  1108. }).catch(() => {
  1109. this.onSubmitStatus = true
  1110. this.salaryStatus = true
  1111. setLoading(false)
  1112. })
  1113. },
  1114. // 搜索
  1115. onSearch() {
  1116. this.params.page = 1
  1117. this.dataList = []
  1118. this.dataShow = true
  1119. this.loading = true
  1120. this.finished = false
  1121. this.getStudent()
  1122. },
  1123. getStudent() {
  1124. let params = this.params
  1125. queryStudentsWithTeacher(params).then(res => {
  1126. let result = res.data
  1127. this.loading = false
  1128. if (result.code == 200) {
  1129. params.page = result.data.pageNo
  1130. this.dataList = this.dataList.concat(result.data.rows)
  1131. if (params.page >= result.data.totalPage) {
  1132. this.finished = true
  1133. }
  1134. this.params.page++
  1135. } else {
  1136. this.finished = true
  1137. }
  1138. // 判断是否有数据
  1139. if (this.dataList.length <= 0) {
  1140. this.dataShow = false
  1141. }
  1142. })
  1143. },
  1144. onPopupCancel() { // 关闭弹窗
  1145. this.statusList.studentStatus = false
  1146. // this.params.search = null
  1147. this.checkboxSelect = []
  1148. this.checkboxSelectList = []
  1149. },
  1150. onPopupSubmit() {
  1151. const vipGroupCategorySelect = this.loadData.vipGroupCategorySelect
  1152. if(this.checkboxSelect.length != vipGroupCategorySelect.studentNum) {
  1153. this.$toast(`请选择学生${vipGroupCategorySelect.studentNum}名,当前选择${this.checkboxSelect.length}名`)
  1154. return
  1155. }
  1156. this.checkboxSelectDataList = JSON.parse(JSON.stringify(this.checkboxSelectList))
  1157. this.checkboxSelectIds = JSON.parse(JSON.stringify(this.checkboxSelect))
  1158. this.checkboxSelect = []
  1159. this.checkboxSelectList = []
  1160. this.statusList.studentStatus = false
  1161. },
  1162. onCheckboxSelect(value) {
  1163. if(this.checkboxSelect.includes(value.userId.toString())) {
  1164. this.checkboxSelect.forEach((item, index) => {
  1165. if(item == value.userId.toString()) {
  1166. this.checkboxSelect.splice(index, 1)
  1167. }
  1168. })
  1169. this.checkboxSelectList.forEach((item, index) => {
  1170. if(item.userId == value.userId) {
  1171. this.checkboxSelectList.splice(index, 1)
  1172. }
  1173. })
  1174. } else {
  1175. this.checkboxSelect.push(value.userId.toString())
  1176. this.checkboxSelectList.push(value)
  1177. }
  1178. // checkboxSelect = item.userId
  1179. },
  1180. desensitPhone(phone) { // 手机号脱敏
  1181. let first = phone.substr(0, 3)
  1182. let last = phone.substr(-4)
  1183. return first + '****' + last
  1184. }
  1185. }
  1186. }
  1187. </script>
  1188. <style lang='less' scoped>
  1189. @import url("../../assets/commonLess/variable.less");
  1190. .vip-title {
  1191. padding: .06rem 0 .04rem;
  1192. font-size: .12rem;
  1193. color: @mFontColor;
  1194. text-align: center;
  1195. }
  1196. .add-plan {
  1197. display: flex;
  1198. align-items: center;
  1199. justify-content: center;
  1200. padding: .2rem 0;
  1201. font-size: .16rem;
  1202. color: @tFontColor;
  1203. .van-icon {
  1204. margin-right: .05rem;
  1205. font-size: .20rem;
  1206. }
  1207. }
  1208. .title-time {
  1209. display: flex;
  1210. align-items: center;
  1211. flex: 1 auto;
  1212. color: #4A4A4A;
  1213. .online {
  1214. color: @tFontColor;
  1215. }
  1216. .week {
  1217. padding-left: .4rem;
  1218. padding-right: .15rem;
  1219. }
  1220. }
  1221. /deep/.van-field__label,
  1222. /deep/.van-cell__value {
  1223. flex: 1 auto;
  1224. }
  1225. /deep/.van-field__control:disabled {
  1226. color: #6a6969;
  1227. }
  1228. .button-group {
  1229. margin: .3rem .26rem .2rem;
  1230. .van-button--primary {
  1231. background: @mColor;
  1232. border-color: @mColor;
  1233. font-size: .18rem;
  1234. }
  1235. }
  1236. .van-row {
  1237. line-height: .4rem;
  1238. border-top: 1px solid #edeef0;
  1239. text-align: center;
  1240. font-size: .14rem;
  1241. &:first-child {
  1242. border-top: 0;
  1243. background: #edeef0;
  1244. color: #444;
  1245. font-size: .15rem;
  1246. }
  1247. }
  1248. .tableContainer {
  1249. max-height: 2.44rem;
  1250. overflow: auto;
  1251. .van-row {
  1252. color: #444;
  1253. &:first-child {
  1254. border-top: 0;
  1255. background: #fff;
  1256. font-size: .14rem;
  1257. }
  1258. }
  1259. }
  1260. .studentContainer {
  1261. /deep/.van-cell__title {
  1262. font-size: .14rem;
  1263. color: @mFontColor;
  1264. flex: 1 auto;
  1265. }
  1266. .logo {
  1267. width: .35rem;
  1268. height: .35rem;
  1269. margin-right: .12rem;
  1270. border-radius: 100%;
  1271. }
  1272. .input-cell {
  1273. padding: .12rem .16rem .2rem;
  1274. .van-checkbox {
  1275. justify-content: flex-end;
  1276. }
  1277. }
  1278. /deep/.van-cell__value {
  1279. height: .2rem;
  1280. }
  1281. /deep/.van-checkbox__icon .van-icon {
  1282. border-color: @sFontColor;
  1283. }
  1284. /deep/.van-checkbox__icon--checked {
  1285. .van-icon {
  1286. border-color: @orangeColor;
  1287. background: @orangeColor;
  1288. }
  1289. }
  1290. .van-tag {
  1291. margin-left: .08rem;
  1292. }
  1293. }
  1294. .paddingB80 {
  1295. padding-bottom: .8rem
  1296. }
  1297. .button-group-popup {
  1298. position: fixed;
  1299. bottom: 0;
  1300. padding: 0.2rem 0;
  1301. width: 100%;
  1302. text-align: center;
  1303. background-color: #FFFFFF;
  1304. .btn {
  1305. padding: 0 0.45rem;
  1306. line-height: 0.4rem;
  1307. display: inline-block;
  1308. border: 1px solid @mColor;
  1309. border-radius: 1rem;
  1310. color: @mColor;
  1311. background: #fff;
  1312. font-size: 0.18rem;
  1313. &.primary {
  1314. color: #fff;
  1315. background: @mColor;
  1316. }
  1317. }
  1318. .btn+.btn {
  1319. margin-left: 0.1rem;
  1320. }
  1321. }
  1322. .studentColor {
  1323. color: #14928A;
  1324. }
  1325. /deep/.van-field--disabled .van-field__label {
  1326. color: #323233;
  1327. }
  1328. </style>