VIP11Apply.vue 55 KB

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