index.vue 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header
  5. @back="onCancel"
  6. content="VIP/乐理课申请"
  7. ></el-page-header>
  8. <!-- <div class="squrt" /> -->
  9. </h2>
  10. <div class="m-core">
  11. <div class="vipLeft">
  12. <el-alert
  13. title="课程信息"
  14. type="info"
  15. :closable="false"
  16. class="vipMsg"
  17. ></el-alert>
  18. <el-form
  19. ref="leftForm"
  20. :inline="true"
  21. :rules="leftFormRules"
  22. :label-position="labelPosition"
  23. label-width="110px"
  24. :model="leftForm"
  25. >
  26. <!-- <el-form-item label="课程名称" prop="name">
  27. <el-input v-model.trim="leftForm.name" />
  28. </el-form-item> -->
  29. <!-- :disabled="!leftForm.teacher || !leftForm.educationalTeacherId" -->
  30. <el-form-item label="课程分部" prop="classOrganId">
  31. <el-select
  32. v-model.trim="leftForm.classOrganId"
  33. filterable
  34. clearable
  35. @change="onClassChange"
  36. >
  37. <el-option
  38. v-for="(item, index) in selects.branchs"
  39. :key="index"
  40. :label="item.name"
  41. :value="item.id"
  42. />
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="科目名称" prop="subject">
  46. <el-select
  47. v-model.trim="leftForm.subject"
  48. filterable
  49. clearable
  50. @change="changeSubject"
  51. :disabled="!leftForm.classOrganId"
  52. >
  53. <el-option
  54. v-for="(item, index) in subjectList"
  55. :key="index"
  56. :value="item.id"
  57. :label="item.name"
  58. />
  59. </el-select>
  60. </el-form-item>
  61. <!-- -->
  62. <el-form-item label="指导老师" prop="teacher">
  63. <el-select
  64. v-model.trim="leftForm.teacher"
  65. filterable
  66. clearable
  67. :disabled="!leftForm.subject"
  68. @change="setSection($event)"
  69. >
  70. <el-option
  71. v-for="(item, index) in teacherList"
  72. :key="index"
  73. :label="item.realName"
  74. :value="item.id"
  75. />
  76. </el-select>
  77. </el-form-item>
  78. <!-- @change="getClassOrgan()" -->
  79. <el-form-item label="乐团主管" prop="educationalTeacherId">
  80. <el-select
  81. v-model.trim="leftForm.educationalTeacherId"
  82. filterable
  83. clearable
  84. :disabled="!leftForm.subject"
  85. >
  86. <el-option
  87. v-for="(item, index) in educationList"
  88. :key="index"
  89. :label="item.userName"
  90. :value="item.userId"
  91. />
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item label="课程形式" prop="courseType">
  95. <el-select
  96. v-model.trim="leftForm.courseType"
  97. clearable
  98. filterable
  99. :disabled="!leftForm.classOrganId || !leftForm.teacher"
  100. @change="changeType"
  101. >
  102. <el-option
  103. v-for="(item, index) in courseTypeList"
  104. :key="index"
  105. :label="item.name"
  106. :value="item.id"
  107. />
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item label="教学点">
  111. <el-select
  112. v-model.trim="leftForm.section"
  113. filterable
  114. clearable
  115. :disabled="!leftForm.teacher"
  116. >
  117. <el-option
  118. v-for="(item, index) in scetionList"
  119. :key="index"
  120. :value="item.id"
  121. :label="item.name"
  122. />
  123. </el-select>
  124. </el-form-item>
  125. <el-form-item label="活动方案" prop="activeType" v-if="isMusicTheory">
  126. <el-select
  127. v-model.trim="leftForm.activeType"
  128. filterable
  129. clearable
  130. :disabled="!leftForm.courseType || isMusicTheory"
  131. @change="chioseActive"
  132. >
  133. <el-option
  134. v-for="(item, index) in activeList"
  135. :key="index"
  136. :value="item.id"
  137. :label="item.name"
  138. />
  139. </el-select>
  140. </el-form-item>
  141. <el-form-item label="活动方案" prop="activeType" v-else :rules=' [
  142. {
  143. required: true,
  144. message: "请选择活动方案",
  145. trigger: "change",
  146. },
  147. ]'>
  148. <el-select
  149. v-model.trim="leftForm.activeType"
  150. filterable
  151. clearable
  152. :disabled="!leftForm.courseType"
  153. @change="chioseActive"
  154. >
  155. <el-option
  156. v-for="(item, index) in activeList"
  157. :key="index"
  158. :value="item.id"
  159. :label="item.name"
  160. />
  161. </el-select>
  162. </el-form-item>
  163. <el-form-item label="每课时长">
  164. <el-select
  165. v-model.trim="leftForm.classTime"
  166. :disabled="timeTable.length > 0"
  167. >
  168. <el-option
  169. v-for="(item, index) in this.classTimeList"
  170. :key="index"
  171. :value="item"
  172. :label="item"
  173. ></el-option>
  174. </el-select>
  175. </el-form-item>
  176. <el-form-item label="报名开始时间" prop="signUpStart">
  177. <!-- @change="changeStartTime" -->
  178. <el-date-picker
  179. v-model.trim="leftForm.signUpStart"
  180. type="date"
  181. :picker-options="pickerOptions"
  182. value-format="yyyy-MM-dd HH:mm:ss"
  183. placeholder="请选择时间"
  184. />
  185. <!-- <el-date-picker
  186. v-model="leftForm.signTimer"
  187. type="daterange"
  188. range-separator="至"
  189. start-placeholder="开始日期"
  190. end-placeholder="结束日期"
  191. >
  192. </el-date-picker> -->
  193. </el-form-item>
  194. <el-form-item label="报名结束时间" prop="signUpEnd">
  195. <el-date-picker
  196. v-model.trim="leftForm.signUpEnd"
  197. type="date"
  198. :picker-options="pickerOptions1"
  199. value-format="yyyy-MM-dd HH:mm:ss"
  200. placeholder="请选择时间"
  201. />
  202. </el-form-item>
  203. <el-form-item label="上课学员" prop="students">
  204. <el-select
  205. v-model.trim="leftForm.students"
  206. multiple
  207. clearable
  208. placeholder="请输入上课学员"
  209. remote
  210. reserve-keyword
  211. @change="changeStudent"
  212. filterable
  213. :multiple-limit="studentLimit"
  214. :disabled="!leftForm.classOrganId || !leftForm.courseType"
  215. :remote-method="remoteMethod"
  216. :loading="remoteLoading"
  217. >
  218. <el-option
  219. v-for="item in studentList"
  220. :key="item.userId"
  221. :label="item.username"
  222. :value="item.userId"
  223. >
  224. <span style="float: left">{{ item.username }}</span>
  225. <span style="float: right; color: #8492a6; font-size: 13px">{{
  226. item.parentsPhone
  227. }}</span>
  228. </el-option>
  229. </el-select>
  230. </el-form-item>
  231. </el-form>
  232. </div>
  233. <div class="center">
  234. <el-alert
  235. title="排课设置"
  236. type="info"
  237. :closable="false"
  238. class="vipMsg"
  239. ></el-alert>
  240. <el-form
  241. :inline="true"
  242. :model="centerForm"
  243. label-width="100px"
  244. :label-position="labelPosition"
  245. >
  246. <el-form-item v-if="leftForm.courseStart" label="最早排课时间">
  247. <el-date-picker
  248. v-model.trim="leftForm.courseStart"
  249. disabled
  250. type="date"
  251. value-format="yyyy-MM-dd HH:mm:ss"
  252. placeholder="请选择时间"
  253. />
  254. </el-form-item>
  255. <el-form-item v-if="leftForm.courseEnd" label="最晚排课时间">
  256. <el-date-picker
  257. v-model.trim="leftForm.courseEnd"
  258. disabled
  259. type="date"
  260. value-format="yyyy-MM-dd HH:mm:ss"
  261. placeholder="请选择时间"
  262. />
  263. </el-form-item>
  264. <el-form-item v-if="hasOnline" label="线上课数">
  265. <el-input
  266. v-model.trim="centerForm.onlineCourseNum"
  267. @mousewheel.native.prevent
  268. @input="onCourseNumChange('online')"
  269. type="number"
  270. >
  271. <template slot="append">节</template>
  272. </el-input>
  273. </el-form-item>
  274. <el-form-item v-if="hasOffline" label="线下课数">
  275. <el-input
  276. v-model.trim="centerForm.offlineCourseNum"
  277. @mousewheel.native.prevent
  278. @input="onCourseNumChange('offline')"
  279. type="number"
  280. >
  281. <template slot="append">节</template>
  282. </el-input>
  283. </el-form-item>
  284. <el-form-item label="待排课数">
  285. <el-input v-model.trim="allCourseCount" disabled>
  286. <template slot="append">节</template>
  287. </el-input>
  288. </el-form-item>
  289. <el-form-item
  290. v-if="hotType == 'GIVE_CLASS' && isGiveClass"
  291. label="赠课课程类型"
  292. >
  293. <el-radio v-model.trim="centerForm.radio" label="ONLINE"
  294. >线上课</el-radio
  295. >
  296. <el-radio v-model.trim="centerForm.radio" label="OFFLINE"
  297. >线下课</el-radio
  298. >
  299. </el-form-item>
  300. <el-form-item label="">
  301. <el-button type="danger" @click="setCourse">点击排课</el-button>
  302. </el-form-item>
  303. </el-form>
  304. <!-- 排课列表开始 planList-->
  305. <div class="">
  306. <!-- <div class="planTop">
  307. <p>已排课程</p>
  308. <el-button type="text" @click="setCourse">{{
  309. id ? "新增排课" : "点击排课"
  310. }}</el-button>
  311. </div> -->
  312. <!-- <div class="planCore"> -->
  313. <el-table
  314. style="width: 100%"
  315. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  316. :data="timeTable"
  317. >
  318. <el-table-column align="center" prop="studentId" label="课程时间">
  319. <template slot-scope="scope">
  320. <div>{{ scope.row.classDate | formatTimer }}</div>
  321. </template>
  322. </el-table-column>
  323. <el-table-column
  324. align="center"
  325. prop="studentId"
  326. label="课程开始时间"
  327. >
  328. <template slot-scope="scope">
  329. <div>{{ scope.row.startClassTimeStr }}</div>
  330. </template>
  331. </el-table-column>
  332. <el-table-column
  333. align="center"
  334. prop="studentId"
  335. label="课程结束时间"
  336. >
  337. <template slot-scope="scope">
  338. <div>{{ scope.row.endClassTimeStr }}</div>
  339. </template>
  340. </el-table-column>
  341. <el-table-column align="center" prop="studentId" label="课程类型">
  342. <template slot-scope="scope">
  343. <div>{{ scope.row.teachMode | teachMode }}</div>
  344. </template>
  345. </el-table-column>
  346. </el-table>
  347. <!-- <div class="row">
  348. <div class="name">时间</div>
  349. <div class="week">开始时间</div>
  350. <div class="time">结束时间</div>
  351. <div class="time">课程类型</div>
  352. </div> -->
  353. <!-- <div
  354. v-for="(item, index) in this.timeTable"
  355. :key="index"
  356. class="row"
  357. >
  358. <div class="name">{{ item.classDate | formatTimer }}</div>
  359. <div class="week">{{ item.startClassTimeStr }}</div>
  360. <div class="time">{{ item.endClassTimeStr }}</div>
  361. <div class="time">{{ item.teachMode | teachMode }}</div>
  362. </div> -->
  363. <!-- </div> -->
  364. </div>
  365. </div>
  366. <div class="right">
  367. <el-alert
  368. title="课酬&缴费设置"
  369. type="info"
  370. :closable="false"
  371. class="vipMsg"
  372. ></el-alert>
  373. <el-form
  374. :model="rightForm"
  375. label-width="100px"
  376. :label-position="labelPosition"
  377. :inline="true"
  378. >
  379. <el-form-item v-if="hasOnline" label="线上课课酬">
  380. <el-input v-model.trim="rightForm.onlineCourse" :disabled="true">
  381. <template slot="append" v-if="!isMusicTheory">元/节</template>
  382. <template slot="append" v-else>元/人</template>
  383. </el-input>
  384. <!-- || onlineSalary!='TEACHER_DEFAULT' salaryReadonlyFlag==0 -->
  385. </el-form-item>
  386. <el-form-item v-if="hasOffline" label="线下课课酬">
  387. <el-input v-model.trim="rightForm.offlineCourse" :disabled="true">
  388. <template slot="append" v-if="!isMusicTheory">元/节</template>
  389. <template slot="append" v-else>元/人</template>
  390. </el-input>
  391. <!-- || offlineSalary!='TEACHER_DEFAULT' salaryReadonlyFlag==0 -->
  392. </el-form-item>
  393. <!-- <el-form-item v-if="hasOnline" label="线上课单价">
  394. <el-input
  395. v-model.trim="rightForm.onlinePrice"
  396. :disabled="paymentReadonlyFlag == 0"
  397. />
  398. </el-form-item>
  399. <el-form-item v-if="hasOffline" label="线下课单价">
  400. <el-input
  401. v-model.trim="rightForm.offlinePrice"
  402. :disabled="paymentReadonlyFlag == 0"
  403. />
  404. </el-form-item> -->
  405. <!-- <el-form-item label="课程总价">
  406. <el-input v-model.trim="rightForm.allPrice" disabled />
  407. </el-form-item> -->
  408. </el-form>
  409. <div style="width: 700px; clear: both">
  410. <el-table
  411. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  412. :data="activeStudentList"
  413. >
  414. <el-table-column align="center" prop="studentId" label="学员编号">
  415. </el-table-column>
  416. <el-table-column align="center" prop="userName" label="学员名称">
  417. </el-table-column>
  418. <el-table-column
  419. align="center"
  420. prop="studentId"
  421. v-if="hasOnline"
  422. label="线上课单价"
  423. >
  424. <template slot-scope="scope">
  425. <el-input-number
  426. :disabled="!isMusicTheory"
  427. size="mini"
  428. @change="changeStudentMoney"
  429. style="width: 90% !important"
  430. class="number-input"
  431. v-model="scope.row.onlineClassesUnitPrice"
  432. :controls="false"
  433. :min="0"
  434. placeholder="线上课单价"
  435. />
  436. </template>
  437. </el-table-column>
  438. <el-table-column
  439. align="center"
  440. prop="studentId"
  441. v-if="hasOffline"
  442. label="线下课单价"
  443. >
  444. <template slot-scope="scope">
  445. <el-input-number
  446. @change="changeStudentMoney"
  447. size="mini"
  448. style="width: 90% !important"
  449. class="number-input"
  450. :disabled="!isMusicTheory"
  451. v-model="scope.row.offlineClassesUnitPrice"
  452. :controls="false"
  453. :min="0"
  454. placeholder="线下课单价"
  455. />
  456. </template>
  457. </el-table-column>
  458. <el-table-column align="center" prop="studentId" label="缴费总额">
  459. <template slot-scope="scope">
  460. <el-input-number
  461. size="mini"
  462. style="width: 90% !important"
  463. class="number-input"
  464. v-model="scope.row.paymentPrice"
  465. :controls="false"
  466. :min="0"
  467. :disabled="true"
  468. placeholder="缴费总额"
  469. />
  470. </template>
  471. </el-table-column>
  472. </el-table>
  473. <!-- class="computeMoney" -->
  474. <div style="overflow: hidden">
  475. <el-button
  476. type="primary"
  477. class="computeMoney"
  478. @click="computational"
  479. >计算</el-button
  480. >
  481. </div>
  482. </div>
  483. </div>
  484. </div>
  485. <!-- 弹窗 -->
  486. <el-dialog
  487. title="VIP排课"
  488. ref="maskForm"
  489. width="500px"
  490. destroy-on-close
  491. :visible.sync="dialogFormVisible"
  492. >
  493. <el-form :model="maskForm" label-position="right" label-width="150px">
  494. <el-form-item label="线上课开课时间">
  495. <el-date-picker
  496. v-model.trim="maskForm.courseStartOnline"
  497. type="date"
  498. :picker-options="courseOption"
  499. placeholder="请选择开课时间"
  500. />
  501. </el-form-item>
  502. <el-form-item label="线下课开课时间">
  503. <el-date-picker
  504. v-model.trim="maskForm.courseStartOffline"
  505. type="date"
  506. :picker-options="courseOption"
  507. placeholder="请选择开课时间"
  508. />
  509. </el-form-item>
  510. <div
  511. class="line"
  512. style="height: 1px; background: #ccc; margin: 0 25px"
  513. ></div>
  514. <el-form-item label="课程类型" prop="type">
  515. <el-radio v-if="hasOnline" v-model.trim="maskForm.type" label="ONLINE"
  516. >线上课</el-radio
  517. >
  518. <el-radio
  519. v-if="hasOffline"
  520. v-model.trim="maskForm.type"
  521. label="OFFLINE"
  522. >线下课</el-radio
  523. >
  524. </el-form-item>
  525. <el-form-item label="循环周次" prop="week">
  526. <el-select
  527. v-model.trim="maskForm.week"
  528. style="width: 220px !important"
  529. >
  530. <el-option label="星期日" value="0" />
  531. <el-option label="星期一" value="1" />
  532. <el-option label="星期二" value="2" />
  533. <el-option label="星期三" value="3" />
  534. <el-option label="星期四" value="4" />
  535. <el-option label="星期五" value="5" />
  536. <el-option label="星期六" value="6" />
  537. </el-select>
  538. </el-form-item>
  539. <el-form-item label="上课时间" prop="startTime">
  540. <el-time-picker
  541. v-model.trim="maskForm.startTime"
  542. @change="getStartTime"
  543. format="HH:mm"
  544. value-format="HH:mm"
  545. placeholder="选择时间"
  546. />
  547. </el-form-item>
  548. <el-form-item label="下课时间" prop="endTime">
  549. <el-time-picker
  550. v-model.trim="maskForm.endTime"
  551. disabled
  552. format="HH:mm"
  553. value-format="HH:mm"
  554. :picker-options="{
  555. start: '04:30',
  556. step: '00:05',
  557. end: '23:30',
  558. }"
  559. placeholder="选择时间"
  560. />
  561. </el-form-item>
  562. </el-form>
  563. <div class="btnWrap">
  564. <div class="okBtn" @click="addWeek">确认</div>
  565. </div>
  566. <div class="planList">
  567. <div class="planTop">
  568. <p>已排课程</p>
  569. </div>
  570. <div class="planCore">
  571. <div v-for="(item, index) in this.lookList" class="row" :key="index">
  572. <div class="name">{{ item.type }}</div>
  573. <div class="week">{{ item.week }}</div>
  574. <div class="time">{{ item.time }}</div>
  575. <div class="operation">
  576. <el-button type="text" @click="removeWeekCourse(item.id)"
  577. >删除</el-button
  578. >
  579. </div>
  580. </div>
  581. </div>
  582. <div slot="footer" style="margin-top: 20px" class="dialog-footer">
  583. <el-button @click="dialogFormVisible = false">取 消</el-button>
  584. <el-button type="primary" @click="setTimeTable">确 定</el-button>
  585. </div>
  586. </div>
  587. </el-dialog>
  588. <el-row>
  589. <el-col>
  590. <div class="okBtn" @click="submitInfo">{{ id ? "修改" : "确定" }}</div>
  591. </el-col>
  592. </el-row>
  593. <!-- <div class="btnWrap"> -->
  594. <!-- <div class="closeBtn">
  595. 取消
  596. </div>-->
  597. <!-- </div> -->
  598. </div>
  599. </template>
  600. <script>
  601. import {
  602. findTeacherByOrganId,
  603. getSubject,
  604. findEducationUsers,
  605. } from "@/api/buildTeam";
  606. import {
  607. vipGroupCategory,
  608. vipGroupActivityFind,
  609. getVipGroupCostCount,
  610. createVip,
  611. getVipGroupDetail,
  612. updateVipBaseInfo,
  613. getPublicOrgans,
  614. } from "@/api/vipSeting";
  615. import { getTeachSchool, getTeacherBySubject } from "@/api/teacherManager";
  616. import { queryStudentList } from "@/api/studentManager";
  617. import axios from "axios";
  618. import { getToken } from "@/utils/auth";
  619. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  620. import dayjs from "dayjs";
  621. export default {
  622. name: "buildVip",
  623. data() {
  624. return {
  625. dialogFormVisible: false,
  626. labelPosition: "right",
  627. leftForm: {
  628. // name: "",
  629. teacher: "",
  630. subject: "",
  631. courseType: "",
  632. activeType: "",
  633. classNum: "",
  634. classTime: "",
  635. // signTimer:[],
  636. signUpStart: "",
  637. signUpEnd: "",
  638. courseStartOnline: "",
  639. courseStartOffline: "",
  640. section: "",
  641. courseStart: "",
  642. courseEnd: "",
  643. educationalTeacherId: "",
  644. students: [],
  645. classOrganId: "", // 课程分部
  646. },
  647. activeStudentList: [],
  648. studentLimit: 0,
  649. classTimeList: [],
  650. centerForm: {
  651. allCourseNum: "",
  652. onlineCourseNum: 0,
  653. offlineCourseNum: 0,
  654. radio: "",
  655. },
  656. maskForm: {
  657. type: "",
  658. week: "",
  659. startTime: "",
  660. endTime: "",
  661. },
  662. rightForm: {
  663. onlineCourse: "",
  664. offlineCourse: "",
  665. onlinePrice: "",
  666. offlinePrice: "",
  667. allPrice: "",
  668. },
  669. remoteLoading: false,
  670. computationalBtn: false,
  671. subjectList: [], // 科目列表
  672. teacherList: [], // 老师列表
  673. educationList: [], // 教务
  674. // classOrganList: [], // 公用分部
  675. courseTypeList: [], // 课程类型集合
  676. activeList: [], //活动集合
  677. hasOnline: true,
  678. hasOffline: true,
  679. onlineSalary: "", // 线上课课酬结算方式
  680. offlineSalary: "", // 线下课课酬结算方式
  681. hotType: "",
  682. attribute1: "",
  683. attribute2: "",
  684. attribute3: "",
  685. salaryReadonlyFlag: "", // 老师课酬是否可配
  686. paymentReadonlyFlag: "", // 课程单价是否可配
  687. lookList: [],
  688. onlinelookList: [], // 展示课表线上
  689. offlineLookList: [], // 展示课表线下
  690. timeTable: [], // 真正的课表
  691. giveNum: "",
  692. weekDay: [
  693. "星期日",
  694. "星期一",
  695. "星期二",
  696. "星期三",
  697. "星期四",
  698. "星期五",
  699. "星期六",
  700. ],
  701. scetionList: [],
  702. isGiveClass: false,
  703. activeStartTime: null,
  704. courseOption: null,
  705. pickerOptions: null,
  706. pickerOptions1: null,
  707. leftFormRules: {
  708. /**?
  709. * teacher: '',
  710. subject: '',
  711. courseType: '',
  712. activeType: '',
  713. */
  714. name: [
  715. {
  716. required: true,
  717. message: "请输入名称",
  718. trigger: "blur",
  719. },
  720. ],
  721. teacher: [
  722. {
  723. required: true,
  724. message: "请选择老师",
  725. trigger: "change",
  726. },
  727. ],
  728. educationalTeacherId: [
  729. {
  730. required: true,
  731. message: "请选择教务",
  732. trigger: "change",
  733. },
  734. ],
  735. classOrganId: [
  736. {
  737. required: true,
  738. message: "请选择课程分部",
  739. trigger: "change",
  740. },
  741. ],
  742. subject: [
  743. {
  744. required: true,
  745. message: "请选择科目",
  746. trigger: "change",
  747. },
  748. ],
  749. courseType: [
  750. {
  751. required: true,
  752. message: "请选择课程类型",
  753. trigger: "change",
  754. },
  755. ],
  756. students: [
  757. {
  758. required: true,
  759. message: "请选择上课学生",
  760. trigger: "change",
  761. },
  762. ],
  763. // activeType: [
  764. // {
  765. // required: true,
  766. // message: "请选择活动",
  767. // trigger: "change",
  768. // },
  769. // ],
  770. signUpStart: [
  771. {
  772. required: true,
  773. message: "请选择报名开始时间",
  774. trigger: "change",
  775. },
  776. ],
  777. signUpEnd: [
  778. {
  779. required: true,
  780. message: "请选择报名结束时间",
  781. trigger: "change",
  782. },
  783. ],
  784. },
  785. id: "",
  786. studentList: [],
  787. courseTimeList: [],
  788. isMusicTheory: false,
  789. };
  790. },
  791. computed: {
  792. allCourseCount() {
  793. let online, offline;
  794. this.centerForm.onlineCourseNum
  795. ? (online = this.centerForm.onlineCourseNum)
  796. : (online = 0);
  797. this.centerForm.offlineCourseNum
  798. ? (offline = this.centerForm.offlineCourseNum)
  799. : (offline = 0);
  800. let giveNum;
  801. if (this.hotType == "GIVE_CLASS") {
  802. // this.attribute1 从多少节开始送
  803. // this.attribute2 送多少节
  804. giveNum = parseInt(
  805. parseInt(offline) + parseInt(online) - this.attribute1 >= 0
  806. ? (giveNum = this.attribute2)
  807. : (giveNum = 0)
  808. );
  809. if (giveNum) {
  810. // 有赠送课时
  811. this.isGiveClass = true;
  812. }
  813. this.giveNum = giveNum || 0;
  814. return parseInt(offline) + parseInt(online) + "+" + giveNum || "";
  815. } else if(this.hotType == 'DISCOUNT' && this.attribute3 && this.attribute3 > 0) {
  816. return parseInt(this.attribute3)
  817. }
  818. return parseInt(offline) + parseInt(online) || "";
  819. },
  820. },
  821. created() {
  822. // this.init();
  823. },
  824. mounted() {
  825. // 获取所有老师的接口 根据声部id获取老师
  826. // 获取课程类型的接口
  827. // 获取学生列表
  828. Object.assign(this.$data, this.$options.data());
  829. setTimeout(() => {
  830. this.$refs["leftForm"].resetFields();
  831. }, 100);
  832. this.init();
  833. },
  834. // activated() {
  835. // Object.assign(this.$data, this.$options.data());
  836. // setTimeout(() => {
  837. // this.$refs["leftForm"].resetFields();
  838. // }, 100);
  839. // this.init();
  840. // },
  841. methods: {
  842. async init() {
  843. if (this.$route.query.rules) {
  844. this.rules = this.$route.query.rules;
  845. }
  846. if (this.$route.query.searchForm) {
  847. this.searchForm = this.$route.query.searchForm;
  848. }
  849. // 获取所有科目的接口
  850. await this.$store.dispatch("setBranchs");
  851. getSubject({
  852. tenantId: 1,
  853. }).then((res) => {
  854. if (res.code == 200) {
  855. this.subjectList = res.data;
  856. }
  857. });
  858. // 获取乐团主管
  859. this.pickerOptions = this.beginDate();
  860. this.pickerOptions1 = this.processDate();
  861. this.courseOption = this.coursesDate();
  862. },
  863. onCourseNumChange(type) {
  864. let centerForm = this.centerForm
  865. // 折扣类型,并且设置的排课数有值
  866. if(this.hotType == 'DISCOUNT' && this.attribute3 && this.attribute3 > 0) {
  867. // 判断线上或线下总和等于排课次数
  868. // console.log((parseInt(centerForm.onlineCourseNum) + parseInt(centerForm.offlineCourseNum)), this.attribute3)
  869. if((parseInt(centerForm.onlineCourseNum) + parseInt(centerForm.offlineCourseNum)) > this.attribute3) {
  870. if(type == 'online') {
  871. this.$message.error('线上课数加线下课数必须等于待排课数')
  872. } else if(type == 'offline') {
  873. this.$message.error('线上课数加线下课数必须等于待排课数')
  874. }
  875. }
  876. }
  877. },
  878. coursesDate() {
  879. let self = this;
  880. return {
  881. firstDayOfWeek: 1,
  882. disabledDate: (time) => {
  883. if (self.leftForm.courseStart) {
  884. let date = new Date(self.leftForm.courseStart.replace(/-/, "/"));
  885. return time.getTime() < date.getTime();
  886. }
  887. return;
  888. },
  889. };
  890. },
  891. beginDate() {
  892. let self = this;
  893. return {
  894. firstDayOfWeek: 1,
  895. disabledDate(time) {
  896. return time.getTime() + 86400000 <= new Date().getTime(); //开始时间不选时,结束时间最大值小于等于当天
  897. },
  898. };
  899. },
  900. processDate() {
  901. //提出结束时间必须大于提出开始时间
  902. let self = this;
  903. return {
  904. firstDayOfWeek: 1,
  905. disabledDate(time) {
  906. if (self.leftForm.signUpStart) {
  907. return (
  908. new Date(self.leftForm.signUpStart).getTime() > time.getTime()
  909. );
  910. } else {
  911. return time.getTime() > Date.now();
  912. //开始时间不选时,结束时间最大值小于等于当天
  913. }
  914. },
  915. };
  916. },
  917. changeSubject(val) {
  918. this.leftForm.teacher = "";
  919. this.leftForm.section = "";
  920. // 根据科目id获取相应的老师
  921. findTeacherByOrganId({
  922. subjectIds: val,
  923. organId: this.leftForm.classOrganId,
  924. }).then((res) => {
  925. if (res.code == 200) {
  926. this.teacherList = res.data;
  927. }
  928. });
  929. // getTeacherBySubject({ subjecId: val }).then(res => {
  930. // if (res.code == 200) {
  931. // this.teacherList = res.data;
  932. // }
  933. // })
  934. },
  935. // 选择课程类型
  936. changeType(val) {
  937. // 在这里清空默认课酬
  938. this.rightForm.offlineCourse = "";
  939. this.rightForm.onlineCourse = "";
  940. this.leftForm.activeType = "";
  941. this.leftForm.students = []; // 重置所选学生
  942. for (let i in this.courseTypeList) {
  943. if (this.courseTypeList[i].id == val) {
  944. // 学生人数
  945. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  946. this.studentLimit = this.courseTypeList[i].studentNum;
  947. // 每课时长
  948. this.classTimeList = this.courseTypeList[i].singleClassMinutes.split(
  949. ","
  950. );
  951. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  952. this.leftForm.classTime = this.classTimeList[0];
  953. // 线上课单节价格
  954. this.rightForm.onlinePrice = this.courseTypeList[
  955. i
  956. ].onlineClassesUnitPrice;
  957. // 线下课单节价格
  958. this.rightForm.offlinePrice = this.courseTypeList[
  959. i
  960. ].offlineClassesUnitPrice;
  961. this.isMusicTheory = this.courseTypeList[i].musicTheory;
  962. }
  963. }
  964. // teacherId
  965. if (this.leftForm.courseType && this.leftForm.teacher) {
  966. // 根据课程类型获取活动方案
  967. vipGroupActivityFind({
  968. categoryId: this.leftForm.courseType,
  969. teacherId: this.leftForm.teacher,
  970. }).then((res) => {
  971. if (res.code == 200) {
  972. this.activeList = res.data;
  973. }
  974. });
  975. }
  976. },
  977. // 选择活动方案
  978. chioseActive(val) {
  979. this.rightForm.offlineCourse = "";
  980. this.rightForm.onlineCourse = "";
  981. // this.rightForm.onlinePrice = '';
  982. // this.rightForm.offlinePrice = '';
  983. this.lookList = [];
  984. this.timeTable = [];
  985. this.attribute1 = "";
  986. this.attribute2 = "";
  987. this.attribute3 = ""
  988. this.giveNum = 0;
  989. this.isGiveClass = false;
  990. this.leftForm.courseStart = "";
  991. this.leftForm.courseEnd = "";
  992. this.hasOnline = true;
  993. this.hasOffline = true;
  994. if (val) {
  995. for (let i in this.courseTypeList) {
  996. if (this.courseTypeList[i].id == this.leftForm.courseType) {
  997. // 学生人数
  998. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  999. // 每课时长
  1000. this.classTimeList = this.courseTypeList[
  1001. i
  1002. ].singleClassMinutes.split(",");
  1003. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  1004. this.leftForm.classTime = this.classTimeList[0];
  1005. // 线上课单节价格
  1006. this.rightForm.onlinePrice = this.courseTypeList[
  1007. i
  1008. ].onlineClassesUnitPrice;
  1009. // 线下课单节价格
  1010. this.rightForm.offlinePrice = this.courseTypeList[
  1011. i
  1012. ].offlineClassesUnitPrice;
  1013. }
  1014. }
  1015. // 根须活动id获取 相应的值
  1016. for (let i in this.activeList) {
  1017. if (this.activeList[i].id == val) {
  1018. console.log(this.activeList[i])
  1019. // 如果是买赠就必须选择赠课类型
  1020. // 报名开始 报名结束 课程开始 课程结束 // 判断是否有线上,线下课 并同步状态
  1021. // this.leftForm.signUpStart = this.activeList[i].startTime;
  1022. // this.leftForm.signUpEnd = this.activeList[i].endTime;
  1023. this.leftForm.courseStart = this.activeList[i].coursesStartTime;
  1024. this.leftForm.courseEnd = this.activeList[i].coursesEndTime;
  1025. // 获取活动种类并保存
  1026. this.hotType = this.activeList[i].type;
  1027. // 获取买赠必要参数
  1028. this.attribute1 = this.activeList[i].attribute1;
  1029. this.attribute2 = this.activeList[i].attribute2;
  1030. this.attribute3 = this.activeList[i].attribute3;
  1031. // 存储课酬是否可配置
  1032. this.salaryReadonlyFlag = this.activeList[i].salaryReadonlyFlag;
  1033. this.paymentReadonlyFlag = this.activeList[i].paymentReadonlyFlag;
  1034. // hasOnline: false, hasOffline: false 还需要判断type类型 根据活动id获取
  1035. if (this.activeList[i].salarySettlementJson) {
  1036. let obj = JSON.parse(this.activeList[i].salarySettlementJson);
  1037. if (obj && obj.onlineSalarySettlement) {
  1038. // 有线上课
  1039. this.hasOnline = true;
  1040. this.onlineSalary =
  1041. obj.onlineSalarySettlement.salarySettlementType;
  1042. // console.log('线上:' + this.onlineSalary)
  1043. } else {
  1044. this.hasOnline = false;
  1045. }
  1046. if (obj && obj.offlineSalarySettlement) {
  1047. // 有线下课
  1048. this.hasOffline = true;
  1049. this.offlineSalary =
  1050. obj.offlineSalarySettlement.salarySettlementType;
  1051. // console.log('线下:' + this.offlineSalary)
  1052. } else {
  1053. this.hasOffline = false;
  1054. }
  1055. }
  1056. }
  1057. }
  1058. }
  1059. // 重置课程单价
  1060. },
  1061. // 点击确插入课表
  1062. addWeek() {
  1063. let courseType = this.maskForm.type;
  1064. // let week = ;this.maskForm.week
  1065. let startTime = this.maskForm.startTime;
  1066. if (!courseType || !this.maskForm.week || !startTime) {
  1067. this.$message.error("请填写完成信息");
  1068. return;
  1069. }
  1070. // 拿到相应的值插入数组
  1071. let endTime = this.MinutesTest(startTime, this.leftForm.classTime);
  1072. let str;
  1073. switch (courseType) {
  1074. case "ONLINE": {
  1075. str = "线上课";
  1076. break;
  1077. }
  1078. case "OFFLINE": {
  1079. str = "线下课";
  1080. break;
  1081. }
  1082. }
  1083. let flag = false;
  1084. for (let i in this.lookList) {
  1085. if (this.lookList[i].weekDay == this.maskForm.week) {
  1086. flag = true;
  1087. }
  1088. }
  1089. // true=> 说明有这一周 那么循环找到这一周 在判断时间
  1090. // flase=> 说明没有这一周的时间 直接添加
  1091. if (flag) {
  1092. // 有相同的周日
  1093. let arr = [];
  1094. for (let i in this.lookList) {
  1095. if (this.lookList[i].weekDay == this.maskForm.week) {
  1096. // 找到这一天的所有元素
  1097. // && !this.timeIsrange(this.lookList[i].startTime, this.lookList[i].endTime, startTime) && !this.timeIsrange(this.lookList[i].startTime, this.lookList[i].endTime, endTime)
  1098. let isStartTime = this.timeIsrange(
  1099. startTime,
  1100. endTime,
  1101. this.lookList[i].startTime
  1102. );
  1103. let isEndTime = this.timeIsrange(
  1104. startTime,
  1105. endTime,
  1106. this.lookList[i].endTime
  1107. );
  1108. arr.push(!isEndTime && !isStartTime);
  1109. }
  1110. }
  1111. let isAdd = true;
  1112. for (let j = 0; j < arr.length; j++) {
  1113. isAdd = isAdd && arr[j];
  1114. }
  1115. if (isAdd) {
  1116. this.lookList.push({
  1117. type: str,
  1118. week: this.weekDay[this.maskForm.week],
  1119. weekDay: this.maskForm.week,
  1120. startTime: startTime,
  1121. endTime: endTime,
  1122. time: startTime + "-" + endTime,
  1123. id: Date.now(),
  1124. });
  1125. } else {
  1126. this.$message.error("该时间段已排课请重选时间");
  1127. return;
  1128. }
  1129. } else {
  1130. this.lookList.push({
  1131. type: str,
  1132. week: this.weekDay[this.maskForm.week],
  1133. weekDay: this.maskForm.week,
  1134. startTime: startTime,
  1135. endTime: endTime,
  1136. time: startTime + "-" + endTime,
  1137. id: Date.now(),
  1138. });
  1139. }
  1140. // console.log(this.lookList)
  1141. // let courseType = this.maskForm.type;
  1142. // // let week = ;this.maskForm.week
  1143. // let startTime = this.maskForm.startTime;
  1144. this.maskForm.type = "";
  1145. this.maskForm.week = "";
  1146. this.maskForm.startTime = "";
  1147. this.maskForm.endTime = "";
  1148. },
  1149. // 分钟小时相加减
  1150. MinutesTest(str, interval) {
  1151. let houer = str.split(":")[0];
  1152. let min = str.split(":")[1];
  1153. let sdate1 = new Date(1900, 1, 1, houer, min);
  1154. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  1155. let H = sdate1.getHours();
  1156. let M = sdate1.getMinutes();
  1157. if (H < 10) H = "0" + H;
  1158. if (M < 10) M = "0" + M;
  1159. return H + ":" + M;
  1160. },
  1161. // 判断时间是否在时间段内
  1162. timeIsrange(beginTime, endTime, nowTime) {
  1163. var strb = beginTime.split(":");
  1164. if (strb.length != 2) {
  1165. return false;
  1166. }
  1167. var stre = endTime.split(":");
  1168. if (stre.length != 2) {
  1169. return false;
  1170. }
  1171. var strn = nowTime.split(":");
  1172. if (stre.length != 2) {
  1173. return false;
  1174. }
  1175. var b = new Date();
  1176. var e = new Date();
  1177. var n = new Date();
  1178. b.setHours(strb[0]);
  1179. b.setMinutes(strb[1]);
  1180. e.setHours(stre[0]);
  1181. e.setMinutes(stre[1]);
  1182. n.setHours(strn[0]);
  1183. n.setMinutes(strn[1]);
  1184. if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
  1185. // 在时间范围内
  1186. return true;
  1187. } else {
  1188. // 不在时间范围内
  1189. return false;
  1190. }
  1191. },
  1192. removeWeekCourse(id) {
  1193. for (let i in this.lookList) {
  1194. if (this.lookList[i].id == id) {
  1195. this.lookList.splice(i, 1);
  1196. }
  1197. }
  1198. },
  1199. setTimeTable() {
  1200. // 拿到线上课数与线下课数 以及
  1201. this.timeTable = [];
  1202. let online = parseInt(this.centerForm.onlineCourseNum) || 0;
  1203. let offline = parseInt(this.centerForm.offlineCourseNum) || 0;
  1204. let giveNum = this.giveNum;
  1205. let giveClassType = this.centerForm.radio;
  1206. if (giveClassType == "ONLINE") {
  1207. // 线上
  1208. online += giveNum;
  1209. } else if (giveClassType == "OFFLINE") {
  1210. offline += giveNum;
  1211. }
  1212. // 这里判断是否选择了排课开始时间
  1213. if (online && !this.maskForm.courseStartOnline) {
  1214. this.$message.error("选择了线上课 但没有线上课开始时间");
  1215. return;
  1216. }
  1217. if (offline && !this.maskForm.courseStartOffline) {
  1218. this.$message.error("选择了线下课 但没有线下课开始时间");
  1219. return;
  1220. }
  1221. let date, date1;
  1222. if (this.maskForm.courseStartOnline) {
  1223. date = new Date(this.maskForm.courseStartOnline.getTime());
  1224. }
  1225. if (this.maskForm.courseStartOffline) {
  1226. date1 = new Date(this.maskForm.courseStartOffline.getTime());
  1227. }
  1228. // let startWeekday = this.maskForm.courseStart.getDay();
  1229. let onlineList = []; // 装线上课的数组
  1230. let offlineList = []; //装线下课的数组
  1231. if (this.lookList.length <= 0) {
  1232. this.$message.error("请先排课后再点击确认按钮");
  1233. return;
  1234. }
  1235. for (let i in this.lookList) {
  1236. if (this.lookList[i].type == "线上课") {
  1237. onlineList.push({
  1238. week: this.lookList[i].weekDay,
  1239. date: this.lookList[i],
  1240. });
  1241. }
  1242. if (this.lookList[i].type == "线下课") {
  1243. offlineList.push({
  1244. week: this.lookList[i].weekDay,
  1245. date: this.lookList[i],
  1246. });
  1247. }
  1248. }
  1249. // console.log(onlineList + '----------------------------------------------------------------------------------');
  1250. // console.log(offlineList);
  1251. if (online > 0 && onlineList.length <= 0) {
  1252. this.$message.error("选择了线上课但未排线上课");
  1253. this.timeTable = [];
  1254. return;
  1255. }
  1256. if (offline > 0 && offlineList.length <= 0) {
  1257. this.$message.error("选择了线下课但未排线下课");
  1258. this.timeTable = [];
  1259. return;
  1260. }
  1261. // 获取要排课的总数 获取每周要排多少次
  1262. while (online && online > 0) {
  1263. // 排线上课g
  1264. for (let i in onlineList) {
  1265. let num;
  1266. onlineList[i].week - date.getDay() >= 0
  1267. ? (num = onlineList[i].week - date.getDay())
  1268. : (num = onlineList[i].week - date.getDay() + 7); // +差值的天数://差值的天数+7
  1269. // console.log(num);
  1270. let dataStr = this.getThinkDate(date, num);
  1271. this.timeTable.push({
  1272. classDate: dataStr + " 00:00:00",
  1273. actualTeacherId: this.leftForm.teacher,
  1274. startClassTimeStr: onlineList[i].date.startTime,
  1275. endClassTimeStr: onlineList[i].date.endTime,
  1276. teachMode: "ONLINE",
  1277. });
  1278. online--;
  1279. if (online == 0) break;
  1280. }
  1281. if (onlineList.length == 1 || this.isAllEqual(onlineList)) {
  1282. date.setDate(date.getDate() + 7);
  1283. }
  1284. // 加一周
  1285. }
  1286. // console.log(date1)
  1287. while (offline && offline > 0) {
  1288. // 排线下课
  1289. for (let i in offlineList) {
  1290. let num;
  1291. offlineList[i].week - date1.getDay() >= 0
  1292. ? (num = offlineList[i].week - date1.getDay())
  1293. : (num = offlineList[i].week - date1.getDay() + 7); // +差值的天数://差值的天数+7
  1294. let dataStr = this.getThinkDate(date1, num);
  1295. this.timeTable.push({
  1296. classDate: dataStr + " 00:00:00",
  1297. actualTeacherId: this.leftForm.teacher,
  1298. startClassTimeStr: offlineList[i].date.startTime,
  1299. endClassTimeStr: offlineList[i].date.endTime,
  1300. teachMode: "OFFLINE",
  1301. });
  1302. offline--;
  1303. if (offline == 0) break;
  1304. }
  1305. // 加一周
  1306. if (offlineList.length == 1 || this.isAllEqual(offlineList)) {
  1307. date1.setDate(date1.getDate() + 7);
  1308. }
  1309. }
  1310. // console.log(this.timeTable);
  1311. this.dialogFormVisible = false;
  1312. },
  1313. getThinkDate(date, num) {
  1314. let Stamp = date;
  1315. Stamp.setDate(date.getDate() + num); // 获取当前月数的第几天
  1316. // console.log(date.getMonth() + 1)
  1317. // console.log(Stamp.getMonth() + 1)
  1318. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  1319. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1320. var mvar = "";
  1321. if (month < 10) {
  1322. mvar = "0" + month;
  1323. } else {
  1324. mvar = month + "";
  1325. }
  1326. var day = Stamp.getDate();
  1327. var dvar = "";
  1328. if (day < 10) {
  1329. dvar = "0" + day;
  1330. } else {
  1331. dvar = day + "";
  1332. }
  1333. // console.log(year + "-" + mvar + '-' + dvar);
  1334. return year + "-" + mvar + "-" + dvar;
  1335. },
  1336. // 计算课酬
  1337. computational() {
  1338. console.log("lai");
  1339. this.computationalBtn = true;
  1340. let userId = this.leftForm.teacher || null;
  1341. let giveTeachMode = this.centerForm.radio || null;
  1342. let vipGroupCategoryId = this.leftForm.courseType || null;
  1343. let vipGroupActivityId = this.leftForm.activeType || null;
  1344. let onlineClassesUnitPrice = this.rightForm.onlinePrice || null;
  1345. let offlineClassesUnitPrice = this.rightForm.offlinePrice || null;
  1346. let onlineClassesNum = this.centerForm.onlineCourseNum || 0;
  1347. let offlineClassesNum = this.centerForm.offlineCourseNum || 0;
  1348. let singleClassMinutes = this.leftForm.classTime;
  1349. if (this.hotType == "GIVE_CLASS") {
  1350. if (this.centerForm.radio == "ONLINE") {
  1351. onlineClassesNum =
  1352. parseInt(onlineClassesNum) + parseInt(this.giveNum);
  1353. } else if (this.centerForm.radio == "OFFLINE") {
  1354. offlineClassesNum =
  1355. parseInt(offlineClassesNum) + parseInt(this.giveNum);
  1356. }
  1357. }
  1358. let onlineTeacherSalary = this.rightForm.onlineCourse || null;
  1359. let offlineTeacherSalary = this.rightForm.offlineCourse || null;
  1360. getVipGroupCostCount({
  1361. vipGroupActivityId,
  1362. onlineClassesUnitPrice,
  1363. onlineTeacherSalary,
  1364. offlineTeacherSalary,
  1365. vipGroupCategoryId,
  1366. offlineClassesUnitPrice,
  1367. onlineClassesNum,
  1368. offlineClassesNum,
  1369. userId,
  1370. giveTeachMode,
  1371. singleClassMinutes,
  1372. vipGroupStudentCoursePrices: this.activeStudentList,
  1373. }).then((res) => {
  1374. if (res.code == 200) {
  1375. this.rightForm.onlineCourse = res.data.onlineTeacherSalary;
  1376. this.rightForm.offlineCourse = res.data.offlineTeacherSalary;
  1377. this.rightForm.allPrice = res.data.totalPrice;
  1378. this.activeStudentList.forEach((stu) => {
  1379. if (res.data.hasOwnProperty(stu.studentId)) {
  1380. stu.paymentPrice = res.data[stu.studentId];
  1381. }
  1382. });
  1383. }
  1384. });
  1385. },
  1386. isAllEqual(array) {
  1387. if (array.length > 0) {
  1388. return !array.some((val, index) => {
  1389. return val.week != array[0].week;
  1390. });
  1391. } else {
  1392. return true;
  1393. }
  1394. },
  1395. submitInfo() {
  1396. if (!this.computationalBtn) {
  1397. this.$message.error("请点击计算按钮计算课酬");
  1398. return;
  1399. }
  1400. // let activeCourseType;
  1401. let flag = false;
  1402. // console.log(this.courseTypeList,)
  1403. // this.courseTypeList.forEach((courseType) => {
  1404. // if (courseType.id == this.leftForm.courseType) {
  1405. // activeCourseType = courseType;
  1406. // }
  1407. // });
  1408. // console.log(activeCourseType)
  1409. if (this.isMusicTheory) {
  1410. if (
  1411. this.leftForm.students.length > this.studentLimit ||
  1412. this.leftForm.students.length < 3
  1413. ) {
  1414. this.$message.error(`请选择上课学生为3-${this.studentLimit}人`);
  1415. flag = true;
  1416. }
  1417. } else {
  1418. if (this.leftForm.students.length !== this.studentLimit) {
  1419. this.$message.error(`请选择上课学生为${this.studentLimit}人`);
  1420. flag = true;
  1421. }
  1422. }
  1423. if (flag) return;
  1424. // 获取活动方案
  1425. // 判断线上课课酬和线下课课酬
  1426. let online = parseInt(this.centerForm.onlineCourseNum);
  1427. let offline = parseInt(this.centerForm.offlineCourseNum);
  1428. let giveNum = this.giveNum;
  1429. let giveClassType = this.centerForm.radio;
  1430. if (giveClassType == "ONLINE") {
  1431. // 线上
  1432. online += giveNum;
  1433. } else if (giveClassType == "OFFLINE") {
  1434. offline += giveNum;
  1435. }
  1436. let obj = {};
  1437. obj.courseSchedules = this.timeTable;
  1438. /**
  1439. *
  1440. * teacher: '',
  1441. subject: '',
  1442. courseType: '',
  1443. activeType: '',
  1444. classNum: '',
  1445. classTime: '',
  1446. signUpStart: '',
  1447. signUpEnd: '',
  1448. courseStart: '',
  1449. courseEnd: ''
  1450. */
  1451. let studentIdList = this.leftForm.students.join(",") || null;
  1452. obj.vipGroupApplyBaseInfo = {
  1453. studentIdList, // 这个不要了
  1454. vipGroupStudentCoursePrices: this.activeStudentList,
  1455. coursesExpireDate: this.leftForm.courseEnd,
  1456. teacherSchoolId: this.leftForm.section,
  1457. // name: this.leftForm.name,
  1458. offlineClassesNum: offline || 0,
  1459. onlineClassesNum: online || 0,
  1460. offlineClassesUnitPrice: this.rightForm.offlinePrice || 0,
  1461. onlineClassesUnitPrice: this.rightForm.onlinePrice || 0,
  1462. paymentExpireDate: this.leftForm.signUpEnd,
  1463. registrationStartTime: this.leftForm.signUpStart,
  1464. singleClassMinutes: this.leftForm.classTime,
  1465. studentNum: this.leftForm.classNum,
  1466. userId: this.leftForm.teacher,
  1467. vipGroupActivityId: this.leftForm.activeType,
  1468. vipGroupCategoryId: this.leftForm.courseType,
  1469. onlineTeacherSalary: this.rightForm.onlineCourse || 0,
  1470. offlineTeacherSalary: this.rightForm.offlineCourse || 0,
  1471. giveTeachMode: this.centerForm.radio,
  1472. subjectIdList: this.leftForm.subject,
  1473. educationalTeacherId: this.leftForm.educationalTeacherId,
  1474. organId: this.leftForm.classOrganId,
  1475. };
  1476. // 调接前判断是新增还是修改
  1477. if (!this.id) {
  1478. // 新增
  1479. createVip(obj).then((res) => {
  1480. if (res.code == 200) {
  1481. if (res.data == "ING") {
  1482. this.$confirm(
  1483. "课程提交成功,已提交运营主管审批,审批通过后,课程后创建成功!",
  1484. "提示",
  1485. {
  1486. confirmButtonText: "确定",
  1487. type: "warning",
  1488. }
  1489. ).then(() => {
  1490. // this.$message({
  1491. // type: 'success',
  1492. // message: '提交成功!'
  1493. // });
  1494. this.$message.success("提交成功");
  1495. this.$store.dispatch('delVisitedViews', this.$route)
  1496. this.$router.push({
  1497. path: "/business/vipList",
  1498. query: {
  1499. rules: this.rules,
  1500. searchForm: this.searchForm,
  1501. },
  1502. });
  1503. });
  1504. } else {
  1505. this.$message.success("恭喜您创建成功");
  1506. this.$store.dispatch('delVisitedViews', this.$route)
  1507. this.$router.push({
  1508. path: "/business/vipList",
  1509. query: {
  1510. rules: this.rules,
  1511. searchForm: this.searchForm,
  1512. },
  1513. });
  1514. }
  1515. }
  1516. });
  1517. } else {
  1518. // 修改
  1519. obj.vipGroupApplyBaseInfo.id = this.id;
  1520. updateVipBaseInfo(obj.vipGroupApplyBaseInfo).then((res) => {});
  1521. }
  1522. },
  1523. setSection(val) {
  1524. this.leftForm.section = "";
  1525. this.rightForm.offlineCourse = "";
  1526. this.rightForm.onlineCourse = "";
  1527. // this.leftForm.courseType = "";
  1528. if (val) {
  1529. getTeachSchool({
  1530. userId: val,
  1531. }).then((res) => {
  1532. if (res.code == 200) {
  1533. this.scetionList = res.data;
  1534. }
  1535. });
  1536. }
  1537. // for (let i in this.teacherList) {
  1538. // if (this.teacherList[i].id == val) {
  1539. // // 根据分部id去获取课程形式
  1540. // vipGroupCategory({ organId: this.teacherList[i].organId }).then(
  1541. // res => {
  1542. // if (res.code == 200) {
  1543. // this.courseTypeList = res.data;
  1544. // }
  1545. // }
  1546. // );
  1547. // }
  1548. // }
  1549. // this.getClassOrgan(); // 获取公用部分
  1550. },
  1551. // getClassOrgan() {
  1552. // // 获取公用分部
  1553. // const leftForm = this.leftForm;
  1554. // let teacher = leftForm.teacher ? leftForm.teacher : null;
  1555. // let educationalTeacherId = leftForm.educationalTeacherId
  1556. // ? leftForm.educationalTeacherId
  1557. // : null;
  1558. // leftForm.classOrganId = null; // 重置课程分部数据
  1559. // this.classOrganList = [];
  1560. // // 初始化上课学生
  1561. // this.studentList = [];
  1562. // this.leftForm.students = [];
  1563. // if (!teacher || !educationalTeacherId) {
  1564. // // 如果没有选择指导老师和乐团主管则不请求
  1565. // return;
  1566. // }
  1567. // getPublicOrgans({
  1568. // teacherId: teacher,
  1569. // eduTeacherId: educationalTeacherId,
  1570. // }).then((res) => {
  1571. // if (res.code == 200) {
  1572. // let result = res.data ? res.data : [];
  1573. // this.classOrganList = result;
  1574. // }
  1575. // });
  1576. // },
  1577. onClassChange(val) {
  1578. // 课程分部改变时
  1579. // 老师 乐团主管 都要重置
  1580. this.studentList = [];
  1581. this.$set(this.leftForm, "students", []);
  1582. this.$set(this.leftForm, "teacher", "");
  1583. this.$set(this.leftForm, "educationalTeacherId", "");
  1584. this.$set(this.leftForm, "section", "");
  1585. this.$set(this.leftForm, "activeType", "");
  1586. this.$set(this.leftForm, "classTime", "");
  1587. this.$set(this.leftForm, "subject", "");
  1588. // this.leftForm.students = [];
  1589. // this.leftForm.teacherId = "";
  1590. // this.leftForm.educationalTeacherId = "";
  1591. this.courseTypeList = [];
  1592. if (this.leftForm.courseType) {
  1593. this.$set(this.leftForm, "courseType", null);
  1594. }
  1595. // this.leftForm.courseType = null;
  1596. if (val) {
  1597. vipGroupCategory({
  1598. organId: val,
  1599. }).then((res) => {
  1600. if (res.code == 200) {
  1601. this.courseTypeList = res.data;
  1602. }
  1603. });
  1604. // 获取老师
  1605. // 获取乐团主管
  1606. findEducationUsers({ organId: val }).then((res) => {
  1607. if (res.code == 200) {
  1608. this.educationList = res.data;
  1609. }
  1610. });
  1611. }
  1612. },
  1613. onCancel() {
  1614. this.$store.dispatch('delVisitedViews', this.$route)
  1615. this.$router.push({
  1616. path: "/business/vipList",
  1617. query: {
  1618. rules: this.rules,
  1619. searchForm: this.searchForm,
  1620. },
  1621. });
  1622. },
  1623. setCourse() {
  1624. if (
  1625. this.hotType == "GIVE_CLASS" &&
  1626. this.isGiveClass &&
  1627. !this.centerForm.radio
  1628. ) {
  1629. this.$message.error("您还未选择赠课类型");
  1630. return;
  1631. }
  1632. this.$refs["leftForm"].validate((vali) => {
  1633. if (vali) {
  1634. let centerForm = this.centerForm
  1635. if(this.hotType == 'DISCOUNT' && this.attribute3 && this.attribute3 > 0) {
  1636. // 判断线上或线下总和大于排课次数
  1637. if((parseInt(centerForm.onlineCourseNum) + parseInt(centerForm.offlineCourseNum)) != this.attribute3) {
  1638. this.$message.error('线上课数加线下课数必须等于待排课数')
  1639. return
  1640. }
  1641. }
  1642. this.dialogFormVisible = true;
  1643. }
  1644. });
  1645. },
  1646. setVipInfo(data) {
  1647. // this.leftForm.name = data.name;
  1648. this.leftForm.subject = parseInt(data.subjectIdList);
  1649. // 激活声部下的所有老师
  1650. this.changeSubject(parseInt(data.subjectIdList));
  1651. // 设置老师
  1652. this.leftForm.teacher = data.userId;
  1653. this.setSection(data.userId);
  1654. // 课程形式
  1655. this.leftForm.courseType = data.vipGroupCategoryId;
  1656. // 获取课程形式下的活动方案
  1657. this.changeType(this.leftForm.courseType);
  1658. // 根据课程形式获取活动方案
  1659. this.leftForm.activeType = data.vipGroupActivityId;
  1660. setTimeout((res) => {
  1661. this.chioseActive(data.vipGroupActivityId);
  1662. }, 1000);
  1663. this.leftForm.section = data.teacherSchoolId;
  1664. this.leftForm.classNum = data.studentNum;
  1665. this.leftForm.classTime = data.singleClassMinutes;
  1666. this.leftForm.signUpStart = data.registrationStartTime;
  1667. this.leftForm.signUpEnd = data.paymentExpireDate;
  1668. this.centerForm.onlineCourseNum = data.onlineClassesNum;
  1669. this.centerForm.offlineCourseNum = data.offlineCourseNum;
  1670. /**
  1671. * rightForm: {
  1672. onlineCourse: '',
  1673. offlineCourse: '',
  1674. onlinePrice: '',
  1675. offlinePrice: '',
  1676. allPrice: ''
  1677. },
  1678. *
  1679. */
  1680. this.rightForm.onlineCourse = data.onlineTeacherSalary;
  1681. this.rightForm.onlinePrice = data.onlineClassesUnitPrice;
  1682. this.rightForm.offlineCourse = data.offlineTeacherSalary;
  1683. this.rightForm.offlinePrice = data.offlineClassesUnitPrice;
  1684. this.rightForm.allPrice = data.totalPrice;
  1685. //subjectIdList
  1686. },
  1687. remoteMethod(query) {
  1688. if (query !== "") {
  1689. this.remoteLoading = true;
  1690. // 发请求搜索
  1691. const url = "/api-web/studentManage/queryOrganStudentList";
  1692. const options = {
  1693. method: "get",
  1694. headers: {
  1695. Authorization: getToken(),
  1696. },
  1697. params: {
  1698. rows: 9999,
  1699. search: query,
  1700. organId: this.leftForm.classOrganId,
  1701. },
  1702. url,
  1703. };
  1704. this.remoteLoading = true;
  1705. // this.studentList = []
  1706. axios(options).then((res) => {
  1707. this.remoteLoading = false;
  1708. let result = res.data;
  1709. if (result.code == 200) {
  1710. // Array.prototype.splice.apply(this.studentList, result.data.rows);
  1711. if (result.data.rows && result.data.rows.length > 0) {
  1712. result.data.rows.forEach((item) => {
  1713. this.studentList.unshift(item);
  1714. });
  1715. this.studentList = this.deweight(this.studentList, "userId");
  1716. }
  1717. // this.studentList = this.studentList.concat(result.data.rows);
  1718. }
  1719. });
  1720. // queryStudentList({ rows: 100, search: query }).then(res => {
  1721. // if (res.code == 200) {
  1722. // this.remoteLoading = false;
  1723. // this.studentList = this.studentList.concat(res.data.rows);
  1724. // this.unique(this.studentList, "userId");
  1725. // }
  1726. // });
  1727. }
  1728. },
  1729. changeStudent(val) {
  1730. this.activeStudentList = [];
  1731. this.studentList.forEach((stu) => {
  1732. if (val.indexOf(stu.userId) != -1) {
  1733. this.activeStudentList.push({
  1734. studentId: stu.userId,
  1735. userName: stu.username,
  1736. onlineClassesUnitPrice: this.rightForm.onlinePrice,
  1737. offlineClassesUnitPrice: this.rightForm.offlinePrice,
  1738. paymentPrice: "",
  1739. });
  1740. }
  1741. });
  1742. },
  1743. // 制定属性去重
  1744. deweight(arr, key) {
  1745. let res = [];
  1746. arr.forEach((item) => {
  1747. let list = [];
  1748. res.forEach((resitem) => {
  1749. list.push(resitem[key]);
  1750. });
  1751. if (list.indexOf(item[key]) === -1) {
  1752. res.push(item);
  1753. }
  1754. });
  1755. return res;
  1756. },
  1757. getStartTime(val) {
  1758. if (val) {
  1759. let date = dayjs(new Date()).format("YYYY-MM-DD");
  1760. this.maskForm.endTime = addTimerFormMinute(
  1761. date,
  1762. val,
  1763. this.leftForm.classTime
  1764. );
  1765. } else {
  1766. this.maskForm.endTime = "";
  1767. }
  1768. if (!this.maskForm.endTime) {
  1769. this.maskForm.startTime = "";
  1770. }
  1771. },
  1772. changeStudentMoney(val) {
  1773. if (val) {
  1774. this.computationalBtn = false;
  1775. }
  1776. },
  1777. },
  1778. // watch: {
  1779. // rightForm: {
  1780. // handler (newName, oldName) {
  1781. // this.computationalBtn = false
  1782. // },
  1783. // deep: true
  1784. // }
  1785. // }
  1786. };
  1787. </script>
  1788. <style lang="scss" scoped>
  1789. .computeMoney {
  1790. margin-top: 10px;
  1791. float: right;
  1792. }
  1793. .m-core {
  1794. margin-top: 30px;
  1795. // display: flex;
  1796. // flex-direction: row;
  1797. // justify-content: space-around;
  1798. .el-input {
  1799. width: 180px;
  1800. }
  1801. h4 {
  1802. font-size: 16px;
  1803. background-color: #ccc;
  1804. color: #fff;
  1805. // text-align: center;
  1806. width: 100%;
  1807. height: 40px;
  1808. line-height: 40px;
  1809. margin-bottom: 20px;
  1810. padding: 0 20px;
  1811. }
  1812. // .vipLeft {
  1813. // width: 400px;
  1814. // // h4 {
  1815. // // font-size: 16px;
  1816. // // background-color: #ccc;
  1817. // // color: #fff;
  1818. // // text-align: center;
  1819. // // width: 100%;
  1820. // // height: 40px;
  1821. // // line-height: 40px;
  1822. // // margin-bottom: 20px;
  1823. // // }
  1824. // }
  1825. // .center {
  1826. // width: 400px;
  1827. // }
  1828. // .right {
  1829. // width: 400px;
  1830. // }
  1831. }
  1832. .vipMsg {
  1833. margin-bottom: 20px;
  1834. }
  1835. .planList {
  1836. padding: 0 25px;
  1837. .planTop {
  1838. height: 40px;
  1839. line-height: 40px;
  1840. display: flex;
  1841. flex-direction: row;
  1842. justify-content: space-between;
  1843. border-bottom: 1px solid #ccc;
  1844. margin-top: 20px;
  1845. > p {
  1846. font-size: 14px;
  1847. }
  1848. }
  1849. .planCore {
  1850. .row {
  1851. width: 100%;
  1852. display: flex;
  1853. flex-direction: row;
  1854. justify-content: space-between;
  1855. flex-wrap: nowrap;
  1856. height: 40px;
  1857. line-height: 40px;
  1858. font-size: 14px;
  1859. text-align: center;
  1860. div {
  1861. width: 87px;
  1862. }
  1863. // div {
  1864. // &:nth-child(1) {
  1865. // text-align: left;
  1866. // }
  1867. // }
  1868. }
  1869. }
  1870. }
  1871. .okBtn {
  1872. width: 120px;
  1873. height: 40px;
  1874. line-height: 40px;
  1875. text-align: center;
  1876. color: #fff;
  1877. border-radius: 4px;
  1878. margin-right: 20px;
  1879. cursor: pointer;
  1880. background-color: #f97215;
  1881. float: right;
  1882. }
  1883. </style>