VIP11Apply.vue 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799
  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. const starTime1 = startTime
  1035. ? Number(startTime.split(":")[0])
  1036. : 0;
  1037. const starTime2 = startTime
  1038. ? Number(startTime.split(":")[1])
  1039. : 0;
  1040. if (starTime1 < 6 ) {
  1041. this.$toast("课程安排开始时间不可早于06:00");
  1042. return;
  1043. }
  1044. if (isAdd) {
  1045. // 判断时间范围是否有重复
  1046. scheduleList.push({
  1047. type: value[0], // 线上还是线下
  1048. weekStr: value[1],
  1049. weekIndex: this.getWeek(value[1]),
  1050. startTime: startTime,
  1051. endTime: endTime,
  1052. id: Date.now(),
  1053. });
  1054. // scheduleList.sort((a, b) => {
  1055. // return a.weekStr
  1056. // })
  1057. this.courseForm.teachingStatus = false;
  1058. this.setTimeTable();
  1059. } else {
  1060. this.$toast("该时间段已排课请重选时间");
  1061. return;
  1062. }
  1063. },
  1064. onShowTimeTable() {
  1065. // 显示排课列表
  1066. this.statusList.classTime = true;
  1067. this.setTimeTable();
  1068. },
  1069. setTimeTable() {
  1070. // 重置排课列表
  1071. this.timeTable = [];
  1072. let form = this.form,
  1073. scheduleList = this.scheduleList;
  1074. // if(!form.courseStart) {
  1075. // this.$toast('请选择排课开始时间')
  1076. // return
  1077. // }
  1078. // 拿到线上课数与线下课数 以及
  1079. let online = parseInt(
  1080. form.onlineClassesNums ? form.onlineClassesNums : 0
  1081. );
  1082. let offline = parseInt(
  1083. form.offlineClassesNums ? form.offlineClassesNums : 0
  1084. );
  1085. let giveNum = parseInt(this.other.giveNum);
  1086. let giveClassType = form.giveTeachMode;
  1087. if (giveClassType == "ONLINE") {
  1088. // 线上
  1089. online += giveNum;
  1090. } else if (giveClassType == "OFFLINE") {
  1091. offline += giveNum;
  1092. }
  1093. // 判断是否有课程安排
  1094. if (scheduleList.length <= 0) {
  1095. return;
  1096. }
  1097. let totalCount = Number(online) + Number(offline);
  1098. let tempCourseStart = form.courseStart.replace(/-/gi, "/");
  1099. let dateOperation = new Date(tempCourseStart);
  1100. let forMark = 0;
  1101. while (totalCount && totalCount > 0) {
  1102. for (let i = 0; i < scheduleList.length; i++) {
  1103. if (online == 0 && offline == 0) break;
  1104. let num = scheduleList[i].weekIndex - dateOperation.getDay();
  1105. // 如果是同一天一个周期会出现排课都排到一天
  1106. if (forMark > 0 && num == 0 && i == 0) {
  1107. num = num + 7;
  1108. }
  1109. if (num < 0) {
  1110. // 如果为负数则为下周
  1111. num = num + 7;
  1112. }
  1113. let dataStr = this.getThinkDate(dateOperation, num);
  1114. // 判断是否大于当前时间
  1115. let nowGetTime = new Date().getTime();
  1116. let courseTime = new Date(
  1117. dataStr.replace(/-/gi, "/") +
  1118. " " +
  1119. scheduleList[i].startTime +
  1120. ":00"
  1121. ).getTime();
  1122. if (nowGetTime < courseTime) {
  1123. let tempArr = {
  1124. classDate: dataStr,
  1125. startClassTimeStr: scheduleList[i].startTime,
  1126. endClassTimeStr: scheduleList[i].endTime,
  1127. };
  1128. if (scheduleList[i].type == "线上" && online > 0) {
  1129. tempArr.teachMode = "ONLINE";
  1130. this.timeTable.push(tempArr);
  1131. online--;
  1132. } else if (scheduleList[i].type == "线下" && offline > 0) {
  1133. tempArr.teachMode = "OFFLINE";
  1134. this.timeTable.push(tempArr);
  1135. offline--;
  1136. } else {
  1137. if (online > 0) {
  1138. tempArr.teachMode = "ONLINE";
  1139. this.timeTable.push(tempArr);
  1140. online--;
  1141. } else if (offline > 0) {
  1142. tempArr.teachMode = "OFFLINE";
  1143. this.timeTable.push(tempArr);
  1144. offline--;
  1145. }
  1146. }
  1147. totalCount--;
  1148. }
  1149. }
  1150. // 加一周
  1151. if (scheduleList.length == 1) {
  1152. dateOperation.setDate(dateOperation.getDate() + 7);
  1153. } else if (
  1154. scheduleList.every((item) => item.weekStr === scheduleList[0].weekStr)
  1155. ) {
  1156. // 标记循环次数(标记判断课程安排是不是同一天)
  1157. forMark++;
  1158. }
  1159. }
  1160. },
  1161. onGiveMode() {
  1162. // 赠送课改变时
  1163. this.statusList.giveTeachModeStatus = true;
  1164. this.getCalcClass();
  1165. },
  1166. getCalcClass() {
  1167. // 计算课酬
  1168. let loadData = this.loadData;
  1169. let form = this.form;
  1170. let vas = loadData.vipGroupActivitySelect, // 活动
  1171. vcs = loadData.vipGroupCategorySelect, // 课程形式
  1172. tc = loadData.teacherCategory, // 老师基本信息
  1173. oncn = form.onlineClassesNums ? form.onlineClassesNums : 0, // 线上课次数
  1174. offcn = form.offlineClassesNums ? form.offlineClassesNums : 0, // 线下课次数
  1175. giveNum = parseInt(this.other.giveNum),
  1176. giveTeachMode = form.giveTeachMode; // 线下或线下
  1177. // 优惠活动
  1178. // ...
  1179. if (vas.salarySettlementJson) {
  1180. let obj = JSON.parse(vas.salarySettlementJson);
  1181. // 获取每课时长
  1182. // 每45Min计算一些课酬
  1183. // let b = form.singleClassMinutes ? (form.singleClassMinutes / 45) : 0
  1184. let tempPrice = 0;
  1185. if (Number(oncn) + Number(offcn) > 0) {
  1186. let countPrice =
  1187. oncn * form.onlineClassesUnitPrice +
  1188. offcn * form.offlineClassesUnitPrice;
  1189. if (giveNum > 0 && !giveTeachMode) {
  1190. countPrice = 0;
  1191. }
  1192. tempPrice =
  1193. (countPrice * form.studentNum) /
  1194. (Number(oncn) + Number(offcn) + Number(giveNum));
  1195. if (vas.type == "DISCOUNT") {
  1196. tempPrice =
  1197. (tempPrice * (vas.attribute1 ? Number(vas.attribute1) : 100)) /
  1198. 100;
  1199. }
  1200. }
  1201. // 课程按课来计算
  1202. if (obj && obj.onlineSalarySettlement) {
  1203. let onss = obj.onlineSalarySettlement;
  1204. // 有线上课
  1205. if (onss.salarySettlementType == "TEACHER_DEFAULT") {
  1206. form.onlineTeacherSalary = Math.round(tc.offlineClassesSalary); // 线上课酬
  1207. } else if (onss.salarySettlementType == "RATIO_DISCOUNT") {
  1208. // 老师课酬的折扣 如果有则不打折
  1209. // form.onlineTeacherSalary = Math.round(vcs.onlineClassesUnitPrice * (onss.settlementValue ? onss.settlementValue : 100) / 100)
  1210. form.onlineTeacherSalary = Math.round(
  1211. tempPrice
  1212. ? (tempPrice *
  1213. (onss.settlementValue ? onss.settlementValue : 100)) /
  1214. 100
  1215. : 0
  1216. );
  1217. } else if (onss.salarySettlementType == "FIXED_SALARY") {
  1218. form.onlineTeacherSalary = Math.round(onss.settlementValue);
  1219. }
  1220. form.onlineTeacherSalary = Number(form.onlineTeacherSalary);
  1221. }
  1222. if (obj && obj.offlineSalarySettlement) {
  1223. let offss = obj.offlineSalarySettlement;
  1224. // 有线下课
  1225. if (offss.salarySettlementType == "TEACHER_DEFAULT") {
  1226. form.offlineTeacherSalary = Math.round(tc.offlineClassesSalary); // 线上课酬
  1227. } else if (offss.salarySettlementType == "RATIO_DISCOUNT") {
  1228. // 老师课酬的折扣
  1229. // form.offlineTeacherSalary = Math.round((vcs.offlineClassesUnitPrice * (offss.settlementValue ? offss.settlementValue : 100) / 100))
  1230. form.offlineTeacherSalary = Math.round(
  1231. tempPrice
  1232. ? (tempPrice *
  1233. (offss.settlementValue ? offss.settlementValue : 100)) /
  1234. 100
  1235. : 0
  1236. );
  1237. } else if (offss.salarySettlementType == "FIXED_SALARY") {
  1238. form.offlineTeacherSalary = Math.round(offss.settlementValue);
  1239. }
  1240. form.offlineTeacherSalary = Number(form.offlineTeacherSalary);
  1241. }
  1242. }
  1243. if (vas.type == "GIVE_CLASS" || vas.type == "BASE_ACTIVITY") {
  1244. form.totalCount = Math.round(
  1245. oncn * form.onlineClassesUnitPrice +
  1246. offcn * form.offlineClassesUnitPrice
  1247. );
  1248. } else if (vas.type == "DISCOUNT") {
  1249. form.totalCount = Math.round(
  1250. ((oncn * form.onlineClassesUnitPrice +
  1251. offcn * form.offlineClassesUnitPrice) *
  1252. Number(vas.attribute1)) /
  1253. 100
  1254. );
  1255. }
  1256. form.totalCount = Number(form.totalCount);
  1257. },
  1258. getThinkDate(date, num) {
  1259. let Stamp = date;
  1260. Stamp.setDate(date.getDate() + num); // 获取当前月数的第几天
  1261. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  1262. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1263. var mvar = "";
  1264. if (month < 10) {
  1265. mvar = "0" + month;
  1266. } else {
  1267. mvar = month + "";
  1268. }
  1269. var day = Stamp.getDate();
  1270. var dvar = "";
  1271. if (day < 10) {
  1272. dvar = "0" + day;
  1273. } else {
  1274. dvar = day + "";
  1275. }
  1276. return year + "-" + mvar + "-" + dvar;
  1277. },
  1278. // 分钟小时相加减
  1279. MinutesTest(houer, mins, interval) {
  1280. let min = mins.split("分")[0];
  1281. let sdate1 = new Date(1900, 1, 1, houer, min);
  1282. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  1283. let H = sdate1.getHours();
  1284. let M = sdate1.getMinutes();
  1285. if (H < 10) H = "0" + H;
  1286. if (M < 10) M = "0" + M;
  1287. return H + ":" + M;
  1288. },
  1289. // 判断时间是否在时间段内
  1290. timeIsrange(beginTime, endTime, nowTime) {
  1291. var strb = beginTime.split(":");
  1292. if (strb.length != 2) {
  1293. return false;
  1294. }
  1295. var stre = endTime.split(":");
  1296. if (stre.length != 2) {
  1297. return false;
  1298. }
  1299. var strn = nowTime.split(":");
  1300. if (stre.length != 2) {
  1301. return false;
  1302. }
  1303. var b = new Date();
  1304. var e = new Date();
  1305. var n = new Date();
  1306. b.setHours(strb[0]);
  1307. b.setMinutes(strb[1]);
  1308. e.setHours(stre[0]);
  1309. e.setMinutes(stre[1]);
  1310. n.setHours(strn[0]);
  1311. n.setMinutes(strn[1]);
  1312. if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
  1313. // 在时间范围内
  1314. return true;
  1315. } else {
  1316. // 不在时间范围内
  1317. return false;
  1318. }
  1319. },
  1320. getWeek(str) {
  1321. // 获取周几索引值
  1322. let template = {
  1323. 周一: 1,
  1324. 周二: 2,
  1325. 周三: 3,
  1326. 周四: 4,
  1327. 周五: 5,
  1328. 周六: 6,
  1329. 周日: 0,
  1330. };
  1331. return template[str];
  1332. },
  1333. formatter(type, value) {
  1334. if (type === "year") {
  1335. return `${value}年`;
  1336. } else if (type === "month") {
  1337. return `${value}月`;
  1338. } else if (type === "day") {
  1339. return `${value}日`;
  1340. }
  1341. return value;
  1342. },
  1343. async onSubmit() {
  1344. let form = this.form;
  1345. let statusList = this.statusList;
  1346. // 排课
  1347. this.setTimeTable();
  1348. // if (!(form.name)) {
  1349. // this.$toast('请输入课程班名称')
  1350. // return false
  1351. // }
  1352. if (!form.subjectIdList) {
  1353. this.$toast("请选择科目");
  1354. return false;
  1355. }
  1356. if (!form.vipGroupCategoryId) {
  1357. this.$toast("请选择课程形式");
  1358. return false;
  1359. }
  1360. if (!form.educationalTeacherId) {
  1361. this.$toast("请选择乐团主管");
  1362. return;
  1363. }
  1364. if (this.checkboxSelectIds.length <= 0) {
  1365. this.$toast("请选择上课学生");
  1366. return;
  1367. }
  1368. if (!form.vipGroupActivityId) {
  1369. this.$toast("请选择活动方案");
  1370. return false;
  1371. }
  1372. if (!form.singleClassMinutes) {
  1373. this.$toast("请选择每课时长");
  1374. return false;
  1375. }
  1376. let onlineClassesStatus =
  1377. !form.onlineClassesNums && form.onlineClassesNums <= 0 ? true : false;
  1378. let offlineClassesStatus =
  1379. !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false;
  1380. if (statusList.hasOnline) {
  1381. if (onlineClassesStatus) {
  1382. this.$toast("请输入线上课次数");
  1383. return false;
  1384. }
  1385. }
  1386. if (statusList.hasOffline) {
  1387. if (offlineClassesStatus) {
  1388. this.$toast("请输入线下课次数");
  1389. return false;
  1390. }
  1391. // 判断是否有线下
  1392. if (form.offlineClassesNums > 0 && !form.teacherSchoolId) {
  1393. this.$toast("请选择线下课地址");
  1394. return false;
  1395. }
  1396. }
  1397. // if (!form.registrationStartTime) {
  1398. // this.$toast('请选择报名开始时间')
  1399. // return false
  1400. // }
  1401. // if (!form.coursesExpireDate) {
  1402. // this.$toast('请选择报名结束时间')
  1403. // return false
  1404. // }
  1405. let vipGroupActivitySelect = this.loadData.vipGroupActivitySelect;
  1406. if (vipGroupActivitySelect.type == "GIVE_CLASS" && !form.giveTeachMode) {
  1407. this.$toast("请选择赠课类型");
  1408. return false;
  1409. }
  1410. if (this.scheduleList.length <= 0) {
  1411. this.$toast("课时安排不能为空");
  1412. return false;
  1413. }
  1414. if (statusList.hasOnline) {
  1415. if (!form.onlineClassesUnitPrice) {
  1416. this.$toast("请输入线上课单价");
  1417. return false;
  1418. }
  1419. if (!form.onlineTeacherSalary) {
  1420. this.$toast("请输入线上课课酬");
  1421. return false;
  1422. }
  1423. }
  1424. if (statusList.hasOffline) {
  1425. if (!form.offlineClassesUnitPrice) {
  1426. this.$toast("请输入线下课单价");
  1427. return false;
  1428. }
  1429. if (!form.offlineTeacherSalary) {
  1430. this.$toast("请输入线下课课酬");
  1431. return false;
  1432. }
  1433. }
  1434. if (form.giveTeachMode == "ONLINE") {
  1435. form.onlineClassesNum =
  1436. Number(form.onlineClassesNums) + Number(this.other.giveNum);
  1437. form.offlineClassesNum = Number(form.offlineClassesNums);
  1438. } else {
  1439. form.onlineClassesNum = Number(form.onlineClassesNums);
  1440. form.offlineClassesNum =
  1441. Number(form.offlineClassesNums) + Number(this.other.giveNum);
  1442. }
  1443. form.totalClassTimes =
  1444. Number(form.onlineClassesNums) +
  1445. Number(form.offlineClassesNums) +
  1446. Number(this.other.giveNum);
  1447. form.paymentExpireDate = form.coursesExpireDate;
  1448. form.studentIdList = this.checkboxSelectIds.join(",");
  1449. form.firstStudentId =
  1450. this.checkboxSelectDataList.length > 0
  1451. ? this.checkboxSelectDataList[0].userId
  1452. : null;
  1453. let params = {
  1454. courseSchedules: this.timeTable,
  1455. vipGroupApplyBaseInfo: form,
  1456. };
  1457. if (!this.onSubmitStatus) {
  1458. return;
  1459. }
  1460. this.onSubmitStatus = false;
  1461. setLoading(true);
  1462. await vipGroupApplyForDouble11(params)
  1463. .then((res) => {
  1464. let result = res.data;
  1465. setLoading(false);
  1466. if (result.code == 200) {
  1467. this.$toast("排课成功");
  1468. setTimeout(() => {
  1469. this.onSubmitStatus = true;
  1470. if (browser().iPhone) {
  1471. window.webkit.messageHandlers.DAYA.postMessage(
  1472. JSON.stringify({
  1473. api: "back",
  1474. })
  1475. );
  1476. } else if (browser().android) {
  1477. DAYA.postMessage(
  1478. JSON.stringify({
  1479. api: "back",
  1480. })
  1481. );
  1482. } else {
  1483. this.$router.push("/business");
  1484. }
  1485. }, 500);
  1486. } else {
  1487. this.onSubmitStatus = true;
  1488. this.$toast(result.msg);
  1489. }
  1490. })
  1491. .catch(() => {
  1492. setLoading(false);
  1493. });
  1494. },
  1495. // 搜索
  1496. onSearch() {
  1497. this.params.page = 1;
  1498. this.dataList = [];
  1499. this.dataShow = true;
  1500. this.loading = true;
  1501. this.finished = false;
  1502. this.getStudent();
  1503. },
  1504. async getStudent() {
  1505. let params = this.params;
  1506. await queryDouble11Students(params).then((res) => {
  1507. let result = res.data;
  1508. this.loading = false;
  1509. if (result.code == 200) {
  1510. params.page = result.data.pageNo;
  1511. this.dataList = this.dataList.concat(result.data.rows);
  1512. if (params.page >= result.data.totalPage) {
  1513. this.finished = true;
  1514. }
  1515. this.params.page++;
  1516. } else {
  1517. this.finished = true;
  1518. }
  1519. // 判断是否有数据
  1520. if (this.dataList.length <= 0) {
  1521. this.dataShow = false;
  1522. }
  1523. });
  1524. },
  1525. onPopupCancel() {
  1526. // 关闭弹窗
  1527. this.statusList.studentStatus = false;
  1528. // this.params.search = null
  1529. this.checkboxSelect = [];
  1530. this.checkboxSelectList = [];
  1531. },
  1532. onPopupSubmit() {
  1533. const vipGroupCategorySelect = this.loadData.vipGroupCategorySelect;
  1534. if (this.checkboxSelect.length != vipGroupCategorySelect.studentNum) {
  1535. this.$toast(
  1536. `请选择学生${vipGroupCategorySelect.studentNum}名,当前选择${this.checkboxSelect.length}名`
  1537. );
  1538. return;
  1539. }
  1540. this.checkboxSelectDataList = JSON.parse(
  1541. JSON.stringify(this.checkboxSelectList)
  1542. );
  1543. this.checkboxSelectIds = JSON.parse(JSON.stringify(this.checkboxSelect));
  1544. this.checkboxSelect = [];
  1545. this.checkboxSelectList = [];
  1546. this.loadData.vipGroupActivity = [];
  1547. this.formName.vipGroupActivityName = null;
  1548. this.formName.vipGroupCategoryIndex = 0;
  1549. this.form.vipGroupActivityId = null;
  1550. this.statusList.studentStatus = false;
  1551. },
  1552. onCheckboxSelect(value) {
  1553. // 如果没有次数则不能点击
  1554. if (!value.courseOneToOneTime && !value.courseOneToTwoTime) {
  1555. return;
  1556. }
  1557. if (this.checkboxSelect.includes(value.userId.toString())) {
  1558. this.checkboxSelect.forEach((item, index) => {
  1559. if (item == value.userId.toString()) {
  1560. this.checkboxSelect.splice(index, 1);
  1561. }
  1562. });
  1563. this.checkboxSelectList.forEach((item, index) => {
  1564. if (item.userId == value.userId) {
  1565. this.checkboxSelectList.splice(index, 1);
  1566. }
  1567. });
  1568. } else {
  1569. this.checkboxSelect.push(value.userId.toString());
  1570. this.checkboxSelectList.push(value);
  1571. }
  1572. // checkboxSelect = item.userId
  1573. },
  1574. desensitPhone(phone) {
  1575. // 手机号脱敏
  1576. let first = phone.substr(0, 3);
  1577. let last = phone.substr(-4);
  1578. return first + "****" + last;
  1579. },
  1580. },
  1581. };
  1582. </script>
  1583. <style lang='less' scoped>
  1584. @import url("../../assets/commonLess/variable.less");
  1585. .vip-title {
  1586. padding: .06rem .14rem .04rem;
  1587. font-size: .14rem;
  1588. color: #808080;
  1589. }
  1590. .add-plan {
  1591. display: flex;
  1592. align-items: center;
  1593. justify-content: center;
  1594. padding: 0.2rem 0;
  1595. font-size: 0.16rem;
  1596. color: @tFontColor;
  1597. .van-icon {
  1598. margin-right: 0.05rem;
  1599. font-size: 0.2rem;
  1600. }
  1601. }
  1602. .title-time {
  1603. display: flex;
  1604. align-items: center;
  1605. flex: 1 auto;
  1606. color: #4a4a4a;
  1607. .online {
  1608. color: @tFontColor;
  1609. }
  1610. .week {
  1611. padding-left: 0.4rem;
  1612. padding-right: 0.15rem;
  1613. }
  1614. }
  1615. // /deep/.van-field__label,
  1616. // /deep/.van-cell__value {
  1617. // flex: 1 auto;
  1618. // }
  1619. /deep/.van-field__label {
  1620. width: 50%;
  1621. }
  1622. /deep/.van-field__control:disabled {
  1623. color: #6a6969;
  1624. }
  1625. .button-group {
  1626. margin: 0.3rem 0.26rem 0.2rem;
  1627. .van-button--primary {
  1628. background: @mColor;
  1629. border-color: @mColor;
  1630. font-size: 0.18rem;
  1631. }
  1632. }
  1633. .van-row {
  1634. line-height: 0.4rem;
  1635. border-top: 1px solid #edeef0;
  1636. text-align: center;
  1637. font-size: 0.14rem;
  1638. &:first-child {
  1639. border-top: 0;
  1640. background: #edeef0;
  1641. color: #444;
  1642. font-size: 0.15rem;
  1643. }
  1644. }
  1645. .tableContainer {
  1646. max-height: 2.44rem;
  1647. overflow: auto;
  1648. .van-row {
  1649. color: #444;
  1650. &:first-child {
  1651. border-top: 0;
  1652. background: #fff;
  1653. font-size: 0.14rem;
  1654. }
  1655. }
  1656. }
  1657. .studentContainer {
  1658. /deep/.van-cell__title {
  1659. font-size: 0.14rem;
  1660. color: @mFontColor;
  1661. flex: 1 auto;
  1662. }
  1663. .logo {
  1664. width: 0.35rem;
  1665. height: 0.35rem;
  1666. margin-right: 0.12rem;
  1667. border-radius: 100%;
  1668. }
  1669. .input-cell {
  1670. padding: 0.12rem 0.16rem 0.2rem;
  1671. .van-checkbox {
  1672. justify-content: flex-end;
  1673. }
  1674. }
  1675. /deep/.van-cell__value {
  1676. height: 20px;
  1677. }
  1678. /deep/.van-checkbox__icon .van-icon {
  1679. border-color: @sFontColor;
  1680. }
  1681. /deep/.van-checkbox__icon--checked .van-icon {
  1682. border-color: #01C1B5;
  1683. }
  1684. // /deep/.van-checkbox__icon--checked {
  1685. // .van-icon {
  1686. // border-color: @orangeColor;
  1687. // background: @orangeColor;
  1688. // }
  1689. // }
  1690. .van-tag {
  1691. margin-left: 0.08rem;
  1692. }
  1693. }
  1694. .paddingB80 {
  1695. padding-bottom: 0.8rem;
  1696. }
  1697. .button-group-popup {
  1698. position: fixed;
  1699. bottom: 0;
  1700. padding: 0.2rem 0;
  1701. width: 100%;
  1702. text-align: center;
  1703. background-color: #ffffff;
  1704. .btn {
  1705. padding: 0 0.45rem;
  1706. line-height: 0.4rem;
  1707. display: inline-block;
  1708. border: 1px solid @mColor;
  1709. border-radius: 1rem;
  1710. color: @mColor;
  1711. background: #fff;
  1712. font-size: 0.18rem;
  1713. &.primary {
  1714. color: #fff;
  1715. background: @mColor;
  1716. }
  1717. }
  1718. .btn + .btn {
  1719. margin-left: 0.1rem;
  1720. }
  1721. }
  1722. .studentColor {
  1723. color: @mColor;
  1724. }
  1725. /deep/.van-field--disabled .van-field__label {
  1726. color: #323233;
  1727. }
  1728. .courseStudent {
  1729. .van-cell__value {
  1730. color: #b2b2b2;
  1731. font-size: 0.16rem;
  1732. }
  1733. }
  1734. /deep/.studentChiose {
  1735. border-radius: 0 0 0px 0px;
  1736. overflow: auto;
  1737. }
  1738. </style>