VIP11Apply.vue 55 KB

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