index.vue 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header @back="onCancel" :content="title"></el-page-header>
  5. <!-- <div class="squrt" /> -->
  6. </h2>
  7. <div class="m-core">
  8. <div class="vipLeft">
  9. <el-alert
  10. title="课程信息"
  11. type="info"
  12. :closable="false"
  13. class="vipMsg"
  14. ></el-alert>
  15. <el-form
  16. ref="leftForm"
  17. :inline="true"
  18. :rules="leftFormRules"
  19. :label-position="labelPosition"
  20. label-width="110px"
  21. :model="leftForm"
  22. >
  23. <!-- <el-form-item label="课程名称" prop="name">
  24. <el-input v-model.trim="leftForm.name" />
  25. </el-form-item> -->
  26. <!-- :disabled="!leftForm.teacher || !leftForm.educationalTeacherId" -->
  27. <el-form-item label="课程分部" prop="classOrganId">
  28. <el-select
  29. v-model.trim="leftForm.classOrganId"
  30. filterable
  31. clearable
  32. @change="onClassChange"
  33. >
  34. <el-option
  35. v-for="(item, index) in selects.branchs"
  36. :key="index"
  37. :label="item.name"
  38. :value="item.id"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="科目名称" prop="subject">
  43. <el-select
  44. v-model.trim="leftForm.subject"
  45. filterable
  46. clearable
  47. @change="changeSubject"
  48. :disabled="!leftForm.classOrganId"
  49. >
  50. <el-option
  51. v-for="(item, index) in subjectList"
  52. :key="index"
  53. :value="item.id"
  54. :label="item.name"
  55. />
  56. </el-select>
  57. </el-form-item>
  58. <!-- -->
  59. <el-form-item label="指导老师" prop="teacher">
  60. <el-select
  61. v-model.trim="leftForm.teacher"
  62. filterable
  63. clearable
  64. :disabled="!leftForm.subject"
  65. @change="setSection($event)"
  66. >
  67. <el-option
  68. v-for="(item, index) in teacherList"
  69. :key="index"
  70. :label="item.realName"
  71. :value="item.id"
  72. />
  73. </el-select>
  74. </el-form-item>
  75. <!-- @change="getClassOrgan()" -->
  76. <el-form-item label="乐团主管" prop="educationalTeacherId">
  77. <el-select
  78. v-model.trim="leftForm.educationalTeacherId"
  79. filterable
  80. clearable
  81. :disabled="!leftForm.subject"
  82. >
  83. <el-option
  84. v-for="(item, index) in educationList"
  85. :key="index"
  86. :label="item.value"
  87. :value="item.key"
  88. />
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="课程形式" prop="courseType" v-if="!courseType">
  92. <el-select
  93. v-model.trim="leftForm.courseType"
  94. clearable
  95. filterable
  96. :disabled="!leftForm.classOrganId || !leftForm.teacher"
  97. @change="changeType"
  98. >
  99. <el-option
  100. v-for="(item, index) in courseTypeList"
  101. :key="index"
  102. :label="item.name"
  103. :value="item.id"
  104. />
  105. </el-select>
  106. </el-form-item>
  107. <el-form-item label="教学点" v-if="!courseType">
  108. <el-select
  109. v-model.trim="leftForm.section"
  110. filterable
  111. clearable
  112. :disabled="!leftForm.teacher"
  113. >
  114. <el-option
  115. v-for="(item, index) in scetionList"
  116. :key="index"
  117. :value="item.id"
  118. :label="item.name"
  119. />
  120. </el-select>
  121. </el-form-item>
  122. <el-form-item label="上课学员" prop="students" v-if="!courseType">
  123. <el-select
  124. v-model.trim="leftForm.students"
  125. collapse-tags
  126. multiple
  127. clearable
  128. placeholder="请输入上课学员"
  129. remote
  130. @change="changeStudent"
  131. filterable
  132. :multiple-limit="studentLimit"
  133. :disabled="!leftForm.classOrganId || !leftForm.courseType"
  134. :remote-method="remoteMethod"
  135. :loading="remoteLoading"
  136. >
  137. <el-option
  138. v-for="item in studentList"
  139. :key="item.userId"
  140. :label="item.username"
  141. :value="item.userId"
  142. >
  143. <span style="float: left">{{ item.username }}</span>
  144. <span style="float: right; color: #8492a6; font-size: 13px">{{
  145. item.parentsPhone
  146. }}</span>
  147. </el-option>
  148. </el-select>
  149. </el-form-item>
  150. <el-form-item label="上课学员" prop="students" v-else>
  151. <el-select
  152. v-model.trim="leftForm.students"
  153. collapse-tags
  154. clearable
  155. placeholder="请输入上课学员"
  156. remote
  157. @change="changeStudentP"
  158. filterable
  159. :multiple-limit="studentLimit"
  160. :disabled="!leftForm.classOrganId"
  161. :remote-method="remoteMethod"
  162. :loading="remoteLoading"
  163. >
  164. <el-option
  165. v-for="item in studentList"
  166. :key="item.userId"
  167. :label="item.username"
  168. :value="item.userId"
  169. >
  170. <span style="float: left">{{ item.username }}</span>
  171. <span style="float: right; color: #8492a6; font-size: 13px">{{
  172. item.parentsPhone
  173. }}</span>
  174. </el-option>
  175. </el-select>
  176. </el-form-item>
  177. <el-form-item label="活动方案" prop="activeType" v-if="courseType">
  178. <el-select
  179. v-model.trim="leftForm.activeType"
  180. filterable
  181. clearable
  182. :disabled="
  183. !leftForm.students ||
  184. (leftForm.students && leftForm.students.length <= 0)
  185. "
  186. @change="chioseActive"
  187. >
  188. <el-option
  189. v-for="(item, index) in activeList"
  190. :key="index"
  191. :value="item.id"
  192. :label="item.name"
  193. />
  194. </el-select>
  195. </el-form-item>
  196. <el-form-item label="活动方案" prop="activeType" v-else>
  197. <el-select
  198. v-model.trim="leftForm.activeType"
  199. filterable
  200. clearable
  201. :disabled="
  202. !leftForm.courseType ||
  203. !leftForm.students ||
  204. (leftForm.students && leftForm.students.length <= 0)
  205. "
  206. @change="chioseActive"
  207. >
  208. <el-option
  209. v-for="(item, index) in activeList"
  210. :key="index"
  211. :value="item.id"
  212. :label="item.name"
  213. />
  214. </el-select>
  215. </el-form-item>
  216. <el-form-item label="每课时长" prop="classTime">
  217. <el-select
  218. @change="
  219. () => {
  220. computationalBtn = false;
  221. }
  222. "
  223. v-model.trim="leftForm.classTime"
  224. :disabled="timeTable.length > 0 || classTimeDis"
  225. >
  226. <el-option
  227. v-for="(item, index) in this.classTimeList"
  228. :key="index"
  229. :value="item"
  230. :label="item"
  231. ></el-option>
  232. </el-select>
  233. </el-form-item>
  234. <el-form-item label="报名开始时间" prop="signUpStart">
  235. <!-- @change="changeStartTime" -->
  236. <el-date-picker
  237. v-model.trim="leftForm.signUpStart"
  238. type="date"
  239. :picker-options="pickerOptions"
  240. value-format="yyyy-MM-dd HH:mm:ss"
  241. placeholder="请选择时间"
  242. />
  243. <!-- <el-date-picker
  244. v-model="leftForm.signTimer"
  245. type="daterange"
  246. range-separator="至"
  247. start-placeholder="开始日期"
  248. end-placeholder="结束日期"
  249. >
  250. </el-date-picker> -->
  251. </el-form-item>
  252. <el-form-item label="报名结束时间" prop="signUpEnd">
  253. <el-date-picker
  254. v-model.trim="leftForm.signUpEnd"
  255. type="date"
  256. :picker-options="pickerOptions1"
  257. value-format="yyyy-MM-dd HH:mm:ss"
  258. placeholder="请选择时间"
  259. />
  260. </el-form-item>
  261. </el-form>
  262. </div>
  263. <div class="center">
  264. <el-alert
  265. title="排课设置"
  266. type="info"
  267. :closable="false"
  268. class="vipMsg"
  269. ></el-alert>
  270. <p class="submitP" v-if="minCourseNum > 0 && maxCourseNum > 0">
  271. 该活动最小课时数:<span style="color: red">{{ minCourseNum }}</span
  272. >节 最大课时数:<span style="color: red">{{ maxCourseNum }}</span
  273. >节
  274. </p>
  275. <el-form
  276. :inline="true"
  277. :model="centerForm"
  278. label-width="100px"
  279. :label-position="labelPosition"
  280. >
  281. <el-form-item v-if="leftForm.courseStart" label="最早排课时间">
  282. <el-date-picker
  283. v-model.trim="leftForm.courseStart"
  284. disabled
  285. type="date"
  286. value-format="yyyy-MM-dd HH:mm:ss"
  287. placeholder="请选择时间"
  288. />
  289. </el-form-item>
  290. <el-form-item v-if="leftForm.courseEnd" label="最晚排课时间">
  291. <el-date-picker
  292. v-model.trim="leftForm.courseEnd"
  293. disabled
  294. type="date"
  295. value-format="yyyy-MM-dd HH:mm:ss"
  296. placeholder="请选择时间"
  297. />
  298. </el-form-item>
  299. <el-form-item v-if="hasOnline" label="线上课数">
  300. <el-input
  301. v-model.trim="centerForm.onlineCourseNum"
  302. @mousewheel.native.prevent
  303. @input="onCourseNumChange('online')"
  304. type="number"
  305. >
  306. <template slot="append">节</template>
  307. </el-input>
  308. </el-form-item>
  309. <el-form-item v-if="hasOffline" label="线下课数">
  310. <el-input
  311. v-model.trim="centerForm.offlineCourseNum"
  312. @mousewheel.native.prevent
  313. @input="onCourseNumChange('offline')"
  314. type="number"
  315. >
  316. <template slot="append">节</template>
  317. </el-input>
  318. </el-form-item>
  319. <el-form-item label="待排课数">
  320. <el-input v-model.trim="allCourseCount" disabled>
  321. <template slot="append">节</template>
  322. </el-input>
  323. </el-form-item>
  324. <!-- <el-form-item
  325. v-if="hotType == 'GIVE_CLASS' && isGiveClass"
  326. label="赠课课程类型"
  327. >
  328. <el-radio v-model.trim="centerForm.radio" label="ONLINE"
  329. >线上课</el-radio
  330. >
  331. <el-radio v-model.trim="centerForm.radio" label="OFFLINE"
  332. >线下课</el-radio
  333. >
  334. </el-form-item> -->
  335. <el-form-item label="">
  336. <el-button type="danger" @click="setCourse">点击排课</el-button>
  337. </el-form-item>
  338. </el-form>
  339. <!-- 排课列表开始 planList-->
  340. <div class="">
  341. <!-- <div class="planTop">
  342. <p>已排课程</p>
  343. <el-button type="text" @click="setCourse">{{
  344. id ? "新增排课" : "点击排课"
  345. }}</el-button>
  346. </div> -->
  347. <!-- <div class="planCore"> -->
  348. <el-table
  349. style="width: 100%"
  350. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  351. :data="timeTable"
  352. >
  353. <el-table-column align="center" prop="studentId" label="课程时间">
  354. <template slot-scope="scope">
  355. <div>{{ scope.row.classDate | formatTimer }}</div>
  356. </template>
  357. </el-table-column>
  358. <el-table-column
  359. align="center"
  360. prop="studentId"
  361. label="课程开始时间"
  362. >
  363. <template slot-scope="scope">
  364. <div>{{ scope.row.startClassTimeStr }}</div>
  365. </template>
  366. </el-table-column>
  367. <el-table-column
  368. align="center"
  369. prop="studentId"
  370. label="课程结束时间"
  371. >
  372. <template slot-scope="scope">
  373. <div>{{ scope.row.endClassTimeStr }}</div>
  374. </template>
  375. </el-table-column>
  376. <el-table-column align="center" prop="studentId" label="课程类型">
  377. <template slot-scope="scope">
  378. <div>{{ scope.row.teachMode | teachMode }}</div>
  379. </template>
  380. </el-table-column>
  381. </el-table>
  382. <!-- <div class="row">
  383. <div class="name">时间</div>
  384. <div class="week">开始时间</div>
  385. <div class="time">结束时间</div>
  386. <div class="time">课程类型</div>
  387. </div> -->
  388. <!-- <div
  389. v-for="(item, index) in this.timeTable"
  390. :key="index"
  391. class="row"
  392. >
  393. <div class="name">{{ item.classDate | formatTimer }}</div>
  394. <div class="week">{{ item.startClassTimeStr }}</div>
  395. <div class="time">{{ item.endClassTimeStr }}</div>
  396. <div class="time">{{ item.teachMode | teachMode }}</div>
  397. </div> -->
  398. <!-- </div> -->
  399. </div>
  400. </div>
  401. <div class="right">
  402. <el-alert
  403. title="课酬&缴费设置"
  404. type="info"
  405. :closable="false"
  406. class="vipMsg"
  407. ></el-alert>
  408. <el-form
  409. :model="rightForm"
  410. label-width="100px"
  411. :label-position="labelPosition"
  412. :inline="true"
  413. >
  414. <el-form-item label="折扣">
  415. <el-input v-model.trim="rightForm.discount" disabled>
  416. <template slot="append">%</template>
  417. </el-input>
  418. </el-form-item>
  419. <el-form-item v-if="courseType == 'PRACTICE'" label="网管课酬">
  420. <el-input v-model.trim="rightForm.onlineCourse" :disabled="true">
  421. <template slot="append" v-if="!isMusicTheory">元/节</template>
  422. <template slot="append" v-else>元/人</template>
  423. </el-input>
  424. <!-- || onlineSalary!='TEACHER_DEFAULT' salaryReadonlyFlag==0 -->
  425. </el-form-item>
  426. <el-form-item v-else label="VIP课课酬">
  427. <el-input v-model.trim="rightForm.offlineCourse" :disabled="true">
  428. <template slot="append" v-if="!isMusicTheory">元/节</template>
  429. <template slot="append" v-else>元/人</template>
  430. </el-input>
  431. <!-- || offlineSalary!='TEACHER_DEFAULT' salaryReadonlyFlag==0 -->
  432. </el-form-item>
  433. <!-- <el-form-item v-if="hasOnline" label="线上课单价">
  434. <el-input
  435. v-model.trim="rightForm.onlinePrice"
  436. :disabled="paymentReadonlyFlag == 0"
  437. />
  438. </el-form-item>
  439. <el-form-item v-if="hasOffline" label="线下课单价">
  440. <el-input
  441. v-model.trim="rightForm.offlinePrice"
  442. :disabled="paymentReadonlyFlag == 0"
  443. />
  444. </el-form-item> -->
  445. <!-- <el-form-item label="课程总价">
  446. <el-input v-model.trim="rightForm.allPrice" disabled />
  447. </el-form-item> -->
  448. </el-form>
  449. <div style="width: 700px; clear: both">
  450. <el-table
  451. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  452. :data="activeStudentList"
  453. >
  454. <el-table-column align="center" prop="studentId" label="学员编号">
  455. </el-table-column>
  456. <el-table-column align="center" prop="userName" label="学员名称">
  457. </el-table-column>
  458. <el-table-column
  459. align="center"
  460. prop="studentId"
  461. v-if="hasOnline"
  462. label="线上课单价"
  463. >
  464. <template slot-scope="scope">
  465. <el-input-number
  466. :disabled="true"
  467. @change="changeStudentMoney"
  468. style="width: 90% !important"
  469. class="number-input"
  470. v-model="scope.row.onlineClassesUnitPrice"
  471. :controls="false"
  472. :min="0"
  473. placeholder="线上课单价"
  474. />
  475. </template>
  476. </el-table-column>
  477. <el-table-column
  478. align="center"
  479. prop="studentId"
  480. v-if="hasOffline"
  481. label="线下课单价"
  482. >
  483. <template slot-scope="scope">
  484. <el-input-number
  485. @change="changeStudentMoney"
  486. style="width: 90% !important"
  487. class="number-input"
  488. :disabled="true"
  489. v-model="scope.row.offlineClassesUnitPrice"
  490. :controls="false"
  491. :min="0"
  492. placeholder="线下课单价"
  493. />
  494. </template>
  495. </el-table-column>
  496. <el-table-column align="center" prop="studentId" label="">
  497. <template slot="header" slot-scope="slot">
  498. <div class="titleCell">
  499. <span>缴费总额</span>
  500. <el-tooltip placement="top" popper-class="mTooltip">
  501. <div slot="content">
  502. (线上课单价*课时数+线下课单价*课时数)*折扣后向上取整
  503. </div>
  504. <i
  505. class="el-icon-question micon el-tooltip"
  506. style="
  507. font-size: 18px;
  508. color: #f56c6c;
  509. top: 2px;
  510. position: relative;
  511. "
  512. ></i>
  513. </el-tooltip>
  514. </div>
  515. </template>
  516. <template slot-scope="scope">
  517. <el-input-number
  518. style="width: 90% !important"
  519. class="number-input"
  520. v-model="scope.row.paymentPrice"
  521. :controls="false"
  522. :min="0"
  523. :disabled="true"
  524. placeholder="缴费总额"
  525. />
  526. </template>
  527. </el-table-column>
  528. </el-table>
  529. <!-- class="computeMoney" -->
  530. <div style="overflow: hidden">
  531. <el-button
  532. type="primary"
  533. class="computeMoney"
  534. @click="computational"
  535. >计算</el-button
  536. >
  537. </div>
  538. </div>
  539. </div>
  540. </div>
  541. <!-- 弹窗 -->
  542. <el-dialog
  543. title="排课"
  544. ref="maskForm"
  545. width="500px"
  546. destroy-on-close
  547. :visible.sync="dialogFormVisible"
  548. >
  549. <el-form :model="maskForm" label-position="right" label-width="150px">
  550. <el-form-item label="开课时间">
  551. <!-- :picker-options="pickerOptions" -->
  552. <el-date-picker
  553. v-model.trim="maskForm.courseStartOnline"
  554. type="date"
  555. :picker-options="courseOption"
  556. placeholder="请选择开课时间"
  557. />
  558. </el-form-item>
  559. <!-- <el-form-item label="线下课开课时间">
  560. <el-date-picker
  561. v-model.trim="maskForm.courseStartOffline"
  562. type="date"
  563. :picker-options="courseOption"
  564. placeholder="请选择开课时间"
  565. />
  566. </el-form-item> -->
  567. <div
  568. class="line"
  569. style="height: 1px; background: #ccc; margin: 0 25px"
  570. ></div>
  571. <el-form-item label="课程类型" prop="type">
  572. <el-radio v-if="hasOnline" v-model.trim="maskForm.type" label="ONLINE"
  573. >线上课</el-radio
  574. >
  575. <el-radio
  576. v-if="hasOffline"
  577. v-model.trim="maskForm.type"
  578. label="OFFLINE"
  579. >线下课</el-radio
  580. >
  581. </el-form-item>
  582. <el-form-item label="循环周次" prop="week">
  583. <el-select
  584. v-model.trim="maskForm.week"
  585. style="width: 220px !important"
  586. >
  587. <el-option label="星期日" value="0" />
  588. <el-option label="星期一" value="1" />
  589. <el-option label="星期二" value="2" />
  590. <el-option label="星期三" value="3" />
  591. <el-option label="星期四" value="4" />
  592. <el-option label="星期五" value="5" />
  593. <el-option label="星期六" value="6" />
  594. </el-select>
  595. </el-form-item>
  596. <el-form-item label="上课时间" prop="startTime">
  597. <el-time-picker
  598. v-model.trim="maskForm.startTime"
  599. @change="getStartTime"
  600. format="HH:mm"
  601. value-format="HH:mm"
  602. placeholder="选择时间"
  603. />
  604. </el-form-item>
  605. <el-form-item label="下课时间" prop="endTime">
  606. <el-time-picker
  607. v-model.trim="maskForm.endTime"
  608. disabled
  609. format="HH:mm"
  610. value-format="HH:mm"
  611. :picker-options="{
  612. start: '04:30',
  613. step: '00:05',
  614. end: '23:30',
  615. }"
  616. placeholder="选择时间"
  617. />
  618. </el-form-item>
  619. </el-form>
  620. <div class="btnWrap">
  621. <div class="okBtn" @click="addWeek">确认</div>
  622. </div>
  623. <div class="planList">
  624. <div class="planTop">
  625. <p>已排课程</p>
  626. </div>
  627. <div class="planCore" v-if="this.lookList.length > 0">
  628. <div v-for="(item, index) in this.lookList" class="row" :key="index">
  629. <div class="name">{{ item.type }}</div>
  630. <div class="week">{{ item.week }}</div>
  631. <div class="time">{{ item.time }}</div>
  632. <div class="operation">
  633. <el-button type="text" @click="removeWeekCourse(item.id)"
  634. >删除</el-button
  635. >
  636. </div>
  637. </div>
  638. </div>
  639. <div class="nomore" v-else>暂无数据</div>
  640. <div slot="footer" style="margin-top: 20px" class="dialog-footer">
  641. <el-button @click="dialogFormVisible = false">取 消</el-button>
  642. <el-button type="primary" @click="setTimeTable">确 定</el-button>
  643. </div>
  644. </div>
  645. </el-dialog>
  646. <div class="btnWrap">
  647. <div class="okBtn" @click="submitInfo">{{ id ? "修改" : "确定" }}</div>
  648. <div class="okBtn" style="background-color: #14928a" @click="resetFrom">
  649. 重置
  650. </div>
  651. </div>
  652. <!-- <div class="btnWrap"> -->
  653. <!-- <div class="closeBtn">
  654. 取消
  655. </div>-->
  656. <!-- </div> -->
  657. </div>
  658. </template>
  659. <script>
  660. import {
  661. findTeacherByOrganId,
  662. getSubject,
  663. findEducationUsers,
  664. getPracticeApplySubjects,
  665. findUserByRole,
  666. } from "@/api/buildTeam";
  667. import {
  668. vipGroupCategory,
  669. vipGroupActivityFind,
  670. getVipGroupCostCount,
  671. createVip,
  672. updateVipBaseInfo,
  673. getPracticeGroupCostCount,
  674. createPractice,
  675. getPracticeGroupSellPrice,
  676. } from "@/api/vipSeting";
  677. import { getTeachSchool, getTeacherBySubject } from "@/api/teacherManager";
  678. import axios from "axios";
  679. import { getToken } from "@/utils/auth";
  680. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  681. import { queryOrganStudentList } from "@/api/studentManager";
  682. import merge from "webpack-merge";
  683. import dayjs from "dayjs";
  684. export default {
  685. name: "buildVip",
  686. data() {
  687. return {
  688. title: "VIP/乐理课申请",
  689. dialogFormVisible: false,
  690. labelPosition: "right",
  691. courseType: "",
  692. leftForm: {
  693. // name: "",
  694. teacher: "",
  695. subject: "",
  696. courseType: "",
  697. activeType: "",
  698. classNum: "",
  699. classTime: "",
  700. // signTimer:[],
  701. signUpStart: "",
  702. signUpEnd: "",
  703. courseStartOnline: "",
  704. courseStartOffline: "",
  705. section: "",
  706. courseStart: "",
  707. courseEnd: "",
  708. educationalTeacherId: "",
  709. students: [],
  710. classOrganId: "", // 课程分部
  711. },
  712. activeStudentList: [],
  713. studentLimit: 0,
  714. classTimeList: [],
  715. centerForm: {
  716. allCourseNum: "",
  717. onlineCourseNum: 0,
  718. offlineCourseNum: 0,
  719. radio: "",
  720. },
  721. maskForm: {
  722. type: "",
  723. week: "",
  724. startTime: "",
  725. endTime: "",
  726. },
  727. rightForm: {
  728. onlineCourse: "",
  729. offlineCourse: "",
  730. onlinePrice: "",
  731. offlinePrice: "",
  732. allPrice: "",
  733. discount: 100,
  734. },
  735. remoteLoading: false,
  736. computationalBtn: false,
  737. subjectList: [], // 科目列表
  738. teacherList: [], // 老师列表
  739. educationList: [], // 教务
  740. // classOrganList: [], // 公用分部
  741. courseTypeList: [], // 课程类型集合
  742. activeList: [], //活动集合
  743. hasOnline: true,
  744. hasOffline: true,
  745. onlineSalary: "", // 线上课课酬结算方式
  746. offlineSalary: "", // 线下课课酬结算方式
  747. hotType: "",
  748. attribute1: "",
  749. attribute2: "",
  750. attribute3: "",
  751. maxCourseNum: 0,
  752. minCourseNum: 0,
  753. salaryReadonlyFlag: "", // 老师课酬是否可配
  754. paymentReadonlyFlag: "", // 课程单价是否可配
  755. lookList: [],
  756. onlinelookList: [], // 展示课表线上
  757. offlineLookList: [], // 展示课表线下
  758. timeTable: [], // 真正的课表
  759. giveNum: "",
  760. chioseStudent: [],
  761. weekDay: [
  762. "星期日",
  763. "星期一",
  764. "星期二",
  765. "星期三",
  766. "星期四",
  767. "星期五",
  768. "星期六",
  769. ],
  770. scetionList: [],
  771. isGiveClass: false,
  772. activeStartTime: null,
  773. courseOption: null,
  774. pickerOptions: null,
  775. pickerOptions1: null,
  776. leftFormRules: {
  777. /**?
  778. * teacher: '',
  779. subject: '',
  780. courseType: '',
  781. activeType: '',
  782. */
  783. name: [
  784. {
  785. required: true,
  786. message: "请输入名称",
  787. trigger: "blur",
  788. },
  789. ],
  790. teacher: [
  791. {
  792. required: true,
  793. message: "请选择老师",
  794. trigger: "change",
  795. },
  796. ],
  797. educationalTeacherId: [
  798. {
  799. required: true,
  800. message: "请选择乐团主管",
  801. trigger: "change",
  802. },
  803. ],
  804. classOrganId: [
  805. {
  806. required: true,
  807. message: "请选择课程分部",
  808. trigger: "change",
  809. },
  810. ],
  811. subject: [
  812. {
  813. required: true,
  814. message: "请选择科目",
  815. trigger: "change",
  816. },
  817. ],
  818. courseType: [
  819. {
  820. required: true,
  821. message: "请选择课程形式",
  822. trigger: "change",
  823. },
  824. ],
  825. students: [
  826. {
  827. required: true,
  828. message: "请选择上课学生",
  829. trigger: "change",
  830. },
  831. ],
  832. // activeType: [
  833. // {
  834. // required: true,
  835. // message: "请选择活动",
  836. // trigger: "change",
  837. // },
  838. // ],
  839. signUpStart: [
  840. {
  841. required: true,
  842. message: "请选择报名开始时间",
  843. trigger: "change",
  844. },
  845. ],
  846. signUpEnd: [
  847. {
  848. required: true,
  849. message: "请选择报名结束时间",
  850. trigger: "change",
  851. },
  852. ],
  853. classTime: [
  854. {
  855. required: true,
  856. message: "请选择报每课时长",
  857. trigger: "change",
  858. },
  859. ],
  860. },
  861. id: "",
  862. studentList: [],
  863. courseTimeList: [],
  864. isMusicTheory: false,
  865. chioseStudent: [],
  866. classTimeDis: false,
  867. };
  868. },
  869. computed: {
  870. allCourseCount() {
  871. let online, offline;
  872. this.centerForm.onlineCourseNum
  873. ? (online = this.centerForm.onlineCourseNum)
  874. : (online = 0);
  875. this.centerForm.offlineCourseNum
  876. ? (offline = this.centerForm.offlineCourseNum)
  877. : (offline = 0);
  878. let giveNum;
  879. // if (this.hotType == "GIVE_CLASS") {
  880. // // this.attribute1 从多少节开始送
  881. // // this.attribute2 送多少节
  882. // giveNum = parseInt(
  883. // parseInt(offline) + parseInt(online) - this.attribute1 >= 0
  884. // ? (giveNum = this.attribute2)
  885. // : (giveNum = 0)
  886. // );
  887. // if (giveNum) {
  888. // // 有赠送课时
  889. // this.isGiveClass = true;
  890. // }
  891. // this.giveNum = giveNum || 0;
  892. // return parseInt(offline) + parseInt(online) + "+" + giveNum || "";
  893. // }
  894. return parseInt(offline) + parseInt(online) || "";
  895. },
  896. },
  897. created() {
  898. // this.init();
  899. },
  900. mounted() {
  901. // 获取所有老师的接口 根据声部id获取老师
  902. // 获取课程类型的接口
  903. // 获取学生列表
  904. // Object.assign(this.$data, this.$options.data());
  905. // setTimeout(() => {
  906. // this.$refs["leftForm"].resetFields();
  907. // }, 100);
  908. // 判断一下有没有缓存
  909. this.courseType = this.$route.query.courseType;
  910. if (this.courseType == "PRACTICE") {
  911. this.title = "网管课申请";
  912. this.$route.meta.title = "网管课申请";
  913. this.hasOffline = false;
  914. // this.$router.push(
  915. // {
  916. // query: merge(this.$route.query, {
  917. // courseType:'PRACTICE'
  918. // })
  919. // },
  920. // (router) => {
  921. // console.log(router);
  922. // }
  923. // );
  924. // let sotrage = JSON.parse(localStorage.getItem(`newPractice`));
  925. // if (sotrage?.leftForm?.classOrganId) {
  926. // this.$confirm("检测到您有未提交的数据, 是否恢复?", "提示", {
  927. // confirmButtonText: "确定",
  928. // cancelButtonText: "取消",
  929. // closeOnClickModal: false,
  930. // type: "warning",
  931. // }).then(async () => {
  932. // this.activeStudentList = sotrage.activeStudentList;
  933. // this.centerForm = sotrage.centerForm;
  934. // this.leftForm = sotrage.leftForm;
  935. // this.rightForm = sotrage.rightForm;
  936. // this.timeTable = sotrage.timeTable;
  937. // this.educationList = sotrage.educationList;
  938. // this.courseTypeList = sotrage.courseTypeList;
  939. // // 为了刷新线上课单价和线下课单价
  940. // await vipGroupCategory({
  941. // organId: sotrage?.leftForm?.classOrganId,
  942. // }).then((res) => {
  943. // if (res.code == 200) {
  944. // this.courseTypeList = res.data;
  945. // }
  946. // });
  947. // this.scetionList = sotrage.scetionList;
  948. // this.studentList = sotrage.studentList;
  949. // this.activeList = sotrage.activeList;
  950. // this.studentLimit = sotrage.studentLimit;
  951. // this.teacherList = sotrage.teacherList;
  952. // this.isMusicTheory = sotrage.isMusicTheory;
  953. // this.chioseStudent = sotrage.chioseStudent;
  954. // this.maxCourseNum = sotrage.maxCourseNum;
  955. // this.minCourseNum = sotrage.minCourseNum;
  956. // if (this.leftForm?.courseType) {
  957. // this.changePrice(this.leftForm.courseType);
  958. // }
  959. // });
  960. // }
  961. // } else {
  962. // this.title = "VIP/乐理课申请";
  963. // this.$route.meta.title = "VIP/乐理课申请";
  964. // let sotrage = JSON.parse(localStorage.getItem(`newVip`));
  965. // if (sotrage?.leftForm?.classOrganId) {
  966. // this.$confirm("检测到您有未提交的数据, 是否恢复?", "提示", {
  967. // confirmButtonText: "确定",
  968. // cancelButtonText: "取消",
  969. // closeOnClickModal: false,
  970. // type: "warning",
  971. // }).then(async () => {
  972. // this.activeStudentList = sotrage.activeStudentList;
  973. // this.centerForm = sotrage.centerForm;
  974. // this.leftForm = sotrage.leftForm;
  975. // this.rightForm = sotrage.rightForm;
  976. // this.timeTable = sotrage.timeTable;
  977. // this.educationList = sotrage.educationList;
  978. // this.courseTypeList = sotrage.courseTypeList;
  979. // this.maxCourseNum = sotrage.maxCourseNum;
  980. // this.minCourseNum = sotrage.minCourseNum;
  981. // // 为了刷新线上课单价和线下课单价
  982. // await vipGroupCategory({
  983. // organId: sotrage?.leftForm?.classOrganId,
  984. // }).then((res) => {
  985. // if (res.code == 200) {
  986. // this.courseTypeList = res.data;
  987. // }
  988. // });
  989. // this.scetionList = sotrage.scetionList;
  990. // this.studentList = sotrage.studentList;
  991. // this.activeList = sotrage.activeList;
  992. // this.studentLimit = sotrage.studentLimit;
  993. // this.teacherList = sotrage.teacherList;
  994. // this.isMusicTheory = sotrage.isMusicTheory;
  995. // this.chioseStudent = sotrage.chioseStudent;
  996. // if (this.leftForm?.courseType) {
  997. // this.changePrice(this.leftForm.courseType);
  998. // }
  999. // });
  1000. // }
  1001. }
  1002. this.init();
  1003. },
  1004. activated() {
  1005. // Object.assign(this.$data, this.$options.data());
  1006. // setTimeout(() => {
  1007. // this.$refs["leftForm"].resetFields();
  1008. // }, 100);
  1009. // this.init();
  1010. },
  1011. beforeDestroy() {},
  1012. beforeRouteLeave(to, from, next) {
  1013. if (this.leftForm?.classOrganId && from.path == "/business/buildVip") {
  1014. console.log(this.leftForm?.classOrganId);
  1015. this.$confirm("检测到您有未提交的数据, 离开将丢失该数据!", "提示", {
  1016. confirmButtonText: "确定",
  1017. cancelButtonText: "取消",
  1018. closeOnClickModal: false,
  1019. type: "warning",
  1020. })
  1021. .then(() => {
  1022. next();
  1023. })
  1024. .catch((err) => {});
  1025. } else {
  1026. next();
  1027. }
  1028. },
  1029. methods: {
  1030. resetFrom() {
  1031. this.leftForm = {
  1032. // name: "",
  1033. teacher: "",
  1034. subject: "",
  1035. courseType: "",
  1036. activeType: "",
  1037. classNum: "",
  1038. classTime: "",
  1039. // signTimer:[],
  1040. signUpStart: "",
  1041. signUpEnd: "",
  1042. courseStartOnline: "",
  1043. courseStartOffline: "",
  1044. section: "",
  1045. courseStart: "",
  1046. courseEnd: "",
  1047. educationalTeacherId: "",
  1048. students: [],
  1049. classOrganId: "", // 课程分部
  1050. };
  1051. this.activeStudentList = [];
  1052. this.studentLimit = 0;
  1053. this.classTimeList = [];
  1054. this.centerForm = {
  1055. allCourseNum: "",
  1056. onlineCourseNum: 0,
  1057. offlineCourseNum: 0,
  1058. radio: "",
  1059. };
  1060. this.maskForm = {
  1061. type: "",
  1062. week: "",
  1063. startTime: "",
  1064. endTime: "",
  1065. };
  1066. this.rightForm = {
  1067. onlineCourse: "",
  1068. offlineCourse: "",
  1069. onlinePrice: "",
  1070. offlinePrice: "",
  1071. allPrice: "",
  1072. discount: 100,
  1073. };
  1074. this.hasOnline = true;
  1075. this.hasOffline = true;
  1076. this.onlineSalary = ""; // 线上课课酬结算方式
  1077. this.offlineSalary = ""; // 线下课课酬结算方式
  1078. this.hotType = "";
  1079. this.attribute1 = "";
  1080. this.attribute2 = "";
  1081. this.attribute3 = "";
  1082. this.maxCourseNum = 0;
  1083. this.minCourseNum = 0;
  1084. this.salaryReadonlyFlag = ""; // 老师课酬是否可配
  1085. this.paymentReadonlyFlag = ""; // 课程单价是否可配
  1086. this.onlinelookList = []; // 展示课表线上
  1087. this.offlineLookList = []; // 展示课表线下
  1088. this.timeTable = []; // 真正的课表
  1089. this.giveNum = "";
  1090. this.chioseStudent = [];
  1091. this.$refs["leftForm"].resetFields();
  1092. localStorage.removeItem("newVip");
  1093. localStorage.removeItem(`newPractice`);
  1094. },
  1095. async init() {
  1096. if (this.$route.query.rules) {
  1097. this.rules = this.$route.query.rules;
  1098. }
  1099. if (this.$route.query.searchForm) {
  1100. this.searchForm = this.$route.query.searchForm;
  1101. }
  1102. // 获取所有科目的接口
  1103. await this.$store.dispatch("setBranchs");
  1104. if (this.selects.branchs.length <= 0) {
  1105. this.$bus.$emit("showguide", ["organ"]);
  1106. }
  1107. if (this.courseType == "PRACTICE") {
  1108. getPracticeApplySubjects().then((res) => {
  1109. if (res.code == 200) {
  1110. this.subjectList = res.data;
  1111. }
  1112. });
  1113. } else {
  1114. getSubject({
  1115. tenantId: 1,
  1116. }).then((res) => {
  1117. if (res.code == 200) {
  1118. this.subjectList = res.data;
  1119. }
  1120. });
  1121. }
  1122. // 获取乐团主管
  1123. this.pickerOptions = this.beginDate();
  1124. this.pickerOptions1 = this.processDate();
  1125. this.courseOption = this.coursesDate();
  1126. },
  1127. onCourseNumChange(type) {
  1128. // 折扣类型,并且设置的排课数有值
  1129. this.computationalBtn = false;
  1130. let centerForm = this.centerForm;
  1131. if (this.maxCourseNum > 0 && this.minCourseNum > 0) {
  1132. // 判断线上或线下总和大于排课次数
  1133. let onlineNum = centerForm.onlineCourseNum || 0;
  1134. let offlineNum = centerForm.offlineCourseNum || 0;
  1135. let allNUm = parseInt(onlineNum) + parseInt(offlineNum);
  1136. if (allNUm > this.maxCourseNum || allNUm < this.minCourseNum) {
  1137. this.$message.error("待排课数不可超过该活动限制");
  1138. return;
  1139. }
  1140. }
  1141. },
  1142. coursesDate() {
  1143. let self = this;
  1144. return {
  1145. firstDayOfWeek: 1,
  1146. disabledDate: (time) => {
  1147. if (self.leftForm.courseStart && self.leftForm.courseEnd) {
  1148. let date = new Date(self.leftForm.courseStart.replace(/-/, "/"));
  1149. let endDate = new Date(self.leftForm.courseEnd.replace(/-/, "/"));
  1150. let nowDate = new Date();
  1151. let changeDate =
  1152. date.getTime() - nowDate.getTime() > 0 ? date : nowDate;
  1153. let endChangeDate =
  1154. endDate.getTime() - nowDate.getTime() > 0 ? endDate : nowDate;
  1155. return (
  1156. time.getTime() < changeDate.getTime() ||
  1157. time.getTime() > endChangeDate.getTime()
  1158. );
  1159. }
  1160. return;
  1161. },
  1162. };
  1163. },
  1164. beginDate() {
  1165. let self = this;
  1166. return {
  1167. firstDayOfWeek: 1,
  1168. disabledDate(time) {
  1169. return time.getTime() + 86400000 <= new Date().getTime(); //开始时间不选时,结束时间最大值小于等于当天
  1170. },
  1171. };
  1172. },
  1173. processDate() {
  1174. //提出结束时间必须大于提出开始时间
  1175. let self = this;
  1176. return {
  1177. firstDayOfWeek: 1,
  1178. disabledDate(time) {
  1179. if (self.leftForm.signUpStart) {
  1180. return (
  1181. new Date(self.leftForm.signUpStart).getTime() > time.getTime()
  1182. );
  1183. } else {
  1184. return time.getTime() > Date.now();
  1185. //开始时间不选时,结束时间最大值小于等于当天
  1186. }
  1187. },
  1188. };
  1189. },
  1190. changeSubject(val) {
  1191. this.computationalBtn = false;
  1192. this.leftForm.teacher = "";
  1193. this.leftForm.section = "";
  1194. // 根据科目id获取相应的老师
  1195. findTeacherByOrganId({
  1196. subjectIds: val,
  1197. organId: this.leftForm.classOrganId,
  1198. }).then((res) => {
  1199. if (res.code == 200) {
  1200. this.teacherList = res.data;
  1201. if( this.teacherList.length <=0){
  1202. this.$bus.$emit("showguide", ['teacher']);
  1203. return
  1204. }
  1205. }
  1206. });
  1207. // getTeacherBySubject({ subjecId: val }).then(res => {
  1208. // if (res.code == 200) {
  1209. // this.teacherList = res.data;
  1210. // }
  1211. // })
  1212. },
  1213. // 选择课程类型
  1214. changeType(val) {
  1215. // 在这里清空默认课酬
  1216. this.rightForm.offlineCourse = "";
  1217. this.rightForm.onlineCourse = "";
  1218. this.leftForm.activeType = "";
  1219. this.computationalBtn = false;
  1220. this.leftForm.students = []; // 重置所选学生
  1221. this.changePrice(val);
  1222. },
  1223. changePrice(val) {
  1224. for (let i in this.courseTypeList) {
  1225. if (this.courseTypeList[i].id == val) {
  1226. // 学生人数
  1227. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  1228. this.studentLimit = this.courseTypeList[i].studentNum;
  1229. // 每课时长
  1230. this.classTimeList =
  1231. this.courseTypeList[i].singleClassMinutes.split(",");
  1232. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  1233. this.leftForm.classTime = this.classTimeList[0];
  1234. // 线上课单节价格
  1235. this.rightForm.onlinePrice =
  1236. this.courseTypeList[i].onlineClassesUnitPrice;
  1237. // 线下课单节价格
  1238. this.rightForm.offlinePrice =
  1239. this.courseTypeList[i].offlineClassesUnitPrice;
  1240. if(this.rightForm.onlinePrice<=0 || this.rightForm.offlinePrice<=0){
  1241. this.$bus.$emit("showguide", ['vipPrice']);
  1242. return
  1243. }
  1244. this.isMusicTheory = this.courseTypeList[i].musicTheory;
  1245. }
  1246. }
  1247. this.activeStudentList = [];
  1248. this.studentList.forEach((stu) => {
  1249. if (
  1250. Array.isArray(this.chioseStudent)
  1251. ? this.chioseStudent.indexOf(stu.userId) != -1
  1252. : stu.userId == this.chioseStudent
  1253. ) {
  1254. let discount = this.rightForm.discount
  1255. ? this.rightForm.discount
  1256. : 100;
  1257. this.activeStudentList.push({
  1258. studentId: stu.userId,
  1259. userName: stu.username,
  1260. onlineClassesUnitPrice: this.rightForm.onlinePrice,
  1261. offlineClassesUnitPrice: this.rightForm.offlinePrice,
  1262. paymentPrice: "",
  1263. });
  1264. }
  1265. });
  1266. },
  1267. // 选择活动方案
  1268. chioseActive(val) {
  1269. this.computationalBtn = false;
  1270. this.rightForm.offlineCourse = "";
  1271. this.rightForm.onlineCourse = "";
  1272. // this.rightForm.onlinePrice = '';
  1273. // this.rightForm.offlinePrice = '';
  1274. this.centerForm.onlineCourseNum = 0;
  1275. this.centerForm.offlineCourseNum = 0;
  1276. this.lookList = [];
  1277. this.timeTable = [];
  1278. this.attribute1 = "";
  1279. this.attribute2 = "";
  1280. this.attribute3 = "";
  1281. this.rightForm.discount = 100;
  1282. this.giveNum = 0;
  1283. this.isGiveClass = false;
  1284. this.leftForm.courseStart = "";
  1285. this.leftForm.courseEnd = "";
  1286. this.hasOnline = true;
  1287. this.hasOffline = true;
  1288. this.maxCourseNum = 0;
  1289. this.minCourseNum = 0;
  1290. if (val) {
  1291. this.classTimeDis = true;
  1292. for (let i in this.courseTypeList) {
  1293. if (this.courseTypeList[i].id == this.leftForm.courseType) {
  1294. // 学生人数
  1295. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  1296. // 每课时长
  1297. this.classTimeList =
  1298. this.courseTypeList[i].singleClassMinutes.split(",");
  1299. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  1300. this.leftForm.classTime = this.classTimeList[0];
  1301. // 线上课单节价格
  1302. this.rightForm.onlinePrice =
  1303. this.courseTypeList[i].onlineClassesUnitPrice;
  1304. // 线下课单节价格
  1305. this.rightForm.offlinePrice =
  1306. this.courseTypeList[i].offlineClassesUnitPrice;
  1307. this.rightForm.discount = this.courseTypeList[i].discount;
  1308. }
  1309. }
  1310. // 根须活动id获取 相应的值
  1311. for (let i in this.activeList) {
  1312. if (this.activeList[i].id == val) {
  1313. // 如果是买赠就必须选择赠课类型
  1314. // 报名开始 报名结束 课程开始 课程结束 // 判断是否有线上,线下课 并同步状态
  1315. // this.leftForm.signUpStart = this.activeList[i].startTime;
  1316. // this.leftForm.signUpEnd = this.activeList[i].endTime;
  1317. this.maxCourseNum = this.activeList[i].maxCourseNum || 0;
  1318. this.minCourseNum = this.activeList[i].minCourseNum || 0;
  1319. this.leftForm.courseStart = this.activeList[i].coursesStartTime;
  1320. this.leftForm.courseEnd = this.activeList[i].coursesEndTime;
  1321. this.rightForm.discount = this.activeList[i].discount;
  1322. this.leftForm.classTime = this.activeList[i].singleCourseTime;
  1323. // 获取活动种类并保存
  1324. this.hotType = this.activeList[i].type;
  1325. // 获取买赠必要参数
  1326. this.attribute1 = this.activeList[i].attribute1;
  1327. this.attribute2 = this.activeList[i].attribute2;
  1328. this.attribute3 = this.activeList[i].attribute3;
  1329. // 存储课酬是否可配置
  1330. this.salaryReadonlyFlag = this.activeList[i].salaryReadonlyFlag;
  1331. this.paymentReadonlyFlag = this.activeList[i].paymentReadonlyFlag;
  1332. if (this.courseType == "PRACTICE") {
  1333. this.hasOffline = false;
  1334. this.hasOnline = true;
  1335. } else {
  1336. if (this.activeList[i].teachMode == 0) {
  1337. this.hasOffline = false;
  1338. // -1:所有;0:线上;1:线下"
  1339. }
  1340. if (this.activeList[i].teachMode == 1) {
  1341. this.hasOnline = false;
  1342. }
  1343. }
  1344. this.activeStudentList = [];
  1345. this.studentList.forEach((stu) => {
  1346. if (
  1347. Array.isArray(this.chioseStudent)
  1348. ? this.chioseStudent.indexOf(stu.userId) != -1
  1349. : stu.userId == this.chioseStudent
  1350. ) {
  1351. let discount = this.rightForm.discount
  1352. ? this.rightForm.discount
  1353. : 100;
  1354. this.activeStudentList.push({
  1355. studentId: stu.userId,
  1356. userName: stu.username,
  1357. onlineClassesUnitPrice: this.rightForm.onlinePrice,
  1358. offlineClassesUnitPrice: this.rightForm.offlinePrice,
  1359. paymentPrice: "",
  1360. });
  1361. }
  1362. });
  1363. }
  1364. }
  1365. } else {
  1366. this.classTimeDis = false;
  1367. for (let i in this.courseTypeList) {
  1368. if (this.courseTypeList[i].id == this.leftForm.courseType) {
  1369. // 学生人数
  1370. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  1371. // 每课时长
  1372. this.classTimeList =
  1373. this.courseTypeList[i].singleClassMinutes.split(",");
  1374. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  1375. this.leftForm.classTime = this.classTimeList[0];
  1376. // 线上课单节价格
  1377. this.rightForm.onlinePrice =
  1378. this.courseTypeList[i].onlineClassesUnitPrice;
  1379. // 线下课单节价格
  1380. this.rightForm.offlinePrice =
  1381. this.courseTypeList[i].offlineClassesUnitPrice;
  1382. this.rightForm.discount = this.courseTypeList[i].discount;
  1383. }
  1384. }
  1385. this.leftForm.classTime = null;
  1386. if (this.courseType == "PRACTICE") {
  1387. this.hasOffline = false;
  1388. this.hasOnline = true;
  1389. this.classTimeList = [25];
  1390. }
  1391. }
  1392. // 重置课程单价
  1393. },
  1394. // 点击确插入课表
  1395. addWeek() {
  1396. let courseType = this.maskForm.type;
  1397. // let week = ;this.maskForm.week
  1398. let startTime = this.maskForm.startTime;
  1399. if (!courseType || !this.maskForm.week || !startTime) {
  1400. this.$message.error("请填写完成信息");
  1401. return;
  1402. }
  1403. // 拿到相应的值插入数组
  1404. let endTime = this.MinutesTest(startTime, this.leftForm.classTime);
  1405. let str;
  1406. switch (courseType) {
  1407. case "ONLINE": {
  1408. str = "线上课";
  1409. break;
  1410. }
  1411. case "OFFLINE": {
  1412. str = "线下课";
  1413. break;
  1414. }
  1415. }
  1416. let flag = false;
  1417. for (let i in this.lookList) {
  1418. if (this.lookList[i].weekDay == this.maskForm.week) {
  1419. flag = true;
  1420. }
  1421. }
  1422. // true=> 说明有这一周 那么循环找到这一周 在判断时间
  1423. // flase=> 说明没有这一周的时间 直接添加
  1424. if (flag) {
  1425. // 有相同的周日
  1426. let arr = [];
  1427. for (let i in this.lookList) {
  1428. if (this.lookList[i].weekDay == this.maskForm.week) {
  1429. // 找到这一天的所有元素
  1430. // && !this.timeIsrange(this.lookList[i].startTime, this.lookList[i].endTime, startTime) && !this.timeIsrange(this.lookList[i].startTime, this.lookList[i].endTime, endTime)
  1431. let isStartTime = this.timeIsrange(
  1432. startTime,
  1433. endTime,
  1434. this.lookList[i].startTime
  1435. );
  1436. let isEndTime = this.timeIsrange(
  1437. startTime,
  1438. endTime,
  1439. this.lookList[i].endTime
  1440. );
  1441. arr.push(!isEndTime && !isStartTime);
  1442. }
  1443. }
  1444. let isAdd = true;
  1445. for (let j = 0; j < arr.length; j++) {
  1446. isAdd = isAdd && arr[j];
  1447. }
  1448. if (isAdd) {
  1449. this.lookList.push({
  1450. type: str,
  1451. week: this.weekDay[this.maskForm.week],
  1452. weekDay: this.maskForm.week,
  1453. startTime: startTime,
  1454. endTime: endTime,
  1455. time: startTime + "-" + endTime,
  1456. id: Date.now(),
  1457. });
  1458. } else {
  1459. this.$message.error("该时间段已排课请重选时间");
  1460. return;
  1461. }
  1462. } else {
  1463. this.lookList.push({
  1464. type: str,
  1465. week: this.weekDay[this.maskForm.week],
  1466. weekDay: this.maskForm.week,
  1467. startTime: startTime,
  1468. endTime: endTime,
  1469. time: startTime + "-" + endTime,
  1470. id: Date.now(),
  1471. });
  1472. }
  1473. // let courseType = this.maskForm.type;
  1474. // // let week = ;this.maskForm.week
  1475. // let startTime = this.maskForm.startTime;
  1476. // 根据时间排序
  1477. this.maskForm.type = "";
  1478. this.maskForm.week = "";
  1479. this.maskForm.startTime = "";
  1480. this.maskForm.endTime = "";
  1481. },
  1482. // 分钟小时相加减
  1483. MinutesTest(str, interval) {
  1484. let houer = str.split(":")[0];
  1485. let min = str.split(":")[1];
  1486. let sdate1 = new Date(1900, 1, 1, houer, min);
  1487. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  1488. let H = sdate1.getHours();
  1489. let M = sdate1.getMinutes();
  1490. if (H < 10) H = "0" + H;
  1491. if (M < 10) M = "0" + M;
  1492. return H + ":" + M;
  1493. },
  1494. // 判断时间是否在时间段内
  1495. timeIsrange(beginTime, endTime, nowTime) {
  1496. var strb = beginTime.split(":");
  1497. if (strb.length != 2) {
  1498. return false;
  1499. }
  1500. var stre = endTime.split(":");
  1501. if (stre.length != 2) {
  1502. return false;
  1503. }
  1504. var strn = nowTime.split(":");
  1505. if (stre.length != 2) {
  1506. return false;
  1507. }
  1508. var b = new Date();
  1509. var e = new Date();
  1510. var n = new Date();
  1511. b.setHours(strb[0]);
  1512. b.setMinutes(strb[1]);
  1513. e.setHours(stre[0]);
  1514. e.setMinutes(stre[1]);
  1515. n.setHours(strn[0]);
  1516. n.setMinutes(strn[1]);
  1517. if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
  1518. // 在时间范围内
  1519. return true;
  1520. } else {
  1521. // 不在时间范围内
  1522. return false;
  1523. }
  1524. },
  1525. removeWeekCourse(id) {
  1526. for (let i in this.lookList) {
  1527. if (this.lookList[i].id == id) {
  1528. this.lookList.splice(i, 1);
  1529. }
  1530. }
  1531. },
  1532. setTimeTable() {
  1533. // 拿到线上课数与线下课数 以及
  1534. this.timeTable = [];
  1535. let online = parseInt(this.centerForm.onlineCourseNum) || 0;
  1536. let offline = parseInt(this.centerForm.offlineCourseNum) || 0;
  1537. let giveNum = this.giveNum;
  1538. let giveClassType = this.centerForm.radio;
  1539. if (giveClassType == "ONLINE") {
  1540. // 线上
  1541. online += giveNum;
  1542. } else if (giveClassType == "OFFLINE") {
  1543. offline += giveNum;
  1544. }
  1545. if (!this.maskForm.courseStartOnline) {
  1546. this.$message.error("请选择课程开始时间");
  1547. return;
  1548. }
  1549. // 这里判断是否选择了排课开始时间
  1550. // if (online && !this.maskForm.courseStartOnline) {
  1551. // this.$message.error("选择了线上课 但没有线上课开始时间");
  1552. // return;
  1553. // }
  1554. // if (offline && !this.maskForm.courseStartOffline) {
  1555. // this.$message.error("选择了线下课 但没有线下课开始时间");
  1556. // return;
  1557. // }
  1558. let date, date1;
  1559. date = new Date(this.maskForm.courseStartOnline.getTime());
  1560. date1 = new Date(this.maskForm.courseStartOnline.getTime());
  1561. // if (this.maskForm.courseStartOnline) {
  1562. // date = new Date(this.maskForm.courseStartOnline.getTime());
  1563. // }
  1564. // if (this.maskForm.courseStartOffline) {
  1565. // date1 = new Date(this.maskForm.courseStartOffline.getTime());
  1566. // }
  1567. // let startWeekday = this.maskForm.courseStart.getDay();
  1568. let onlineList = []; // 装线上课的数组
  1569. let offlineList = []; //装线下课的数组
  1570. if (this.lookList.length <= 0) {
  1571. this.$message.error("请先排课后再点击确认按钮");
  1572. return;
  1573. }
  1574. for (let i in this.lookList) {
  1575. if (this.lookList[i].type == "线上课") {
  1576. onlineList.push({
  1577. week: this.lookList[i].weekDay,
  1578. date: this.lookList[i],
  1579. });
  1580. }
  1581. if (this.lookList[i].type == "线下课") {
  1582. offlineList.push({
  1583. week: this.lookList[i].weekDay,
  1584. date: this.lookList[i],
  1585. });
  1586. }
  1587. }
  1588. // (onlineList + '----------------------------------------------------------------------------------');
  1589. // (offlineList);
  1590. if (online > 0 && onlineList.length <= 0) {
  1591. this.$message.error("选择了线上课但未排线上课");
  1592. this.timeTable = [];
  1593. return;
  1594. }
  1595. if (offline > 0 && offlineList.length <= 0) {
  1596. this.$message.error("选择了线下课但未排线下课");
  1597. this.timeTable = [];
  1598. return;
  1599. }
  1600. // 获取要排课的总数 获取每周要排多少次
  1601. while (online && online > 0) {
  1602. // 排线上课g
  1603. for (let i in onlineList) {
  1604. let num;
  1605. onlineList[i].week - date.getDay() >= 0
  1606. ? (num = onlineList[i].week - date.getDay())
  1607. : (num = onlineList[i].week - date.getDay() + 7); // +差值的天数://差值的天数+7
  1608. // (num);
  1609. let dataStr = this.getThinkDate(date, num);
  1610. this.timeTable.push({
  1611. classDate: dataStr + " 00:00:00",
  1612. actualTeacherId: this.leftForm.teacher,
  1613. startClassTimeStr: onlineList[i].date.startTime,
  1614. endClassTimeStr: onlineList[i].date.endTime,
  1615. teachMode: "ONLINE",
  1616. });
  1617. online--;
  1618. if (online == 0) break;
  1619. }
  1620. if (onlineList.length == 1 || this.isAllEqual(onlineList)) {
  1621. date.setDate(date.getDate() + 7);
  1622. }
  1623. // 加一周
  1624. }
  1625. // (date1)
  1626. while (offline && offline > 0) {
  1627. // 排线下课
  1628. for (let i in offlineList) {
  1629. let num;
  1630. offlineList[i].week - date1.getDay() >= 0
  1631. ? (num = offlineList[i].week - date1.getDay())
  1632. : (num = offlineList[i].week - date1.getDay() + 7); // +差值的天数://差值的天数+7
  1633. let dataStr = this.getThinkDate(date1, num);
  1634. this.timeTable.push({
  1635. classDate: dataStr + " 00:00:00",
  1636. actualTeacherId: this.leftForm.teacher,
  1637. startClassTimeStr: offlineList[i].date.startTime,
  1638. endClassTimeStr: offlineList[i].date.endTime,
  1639. teachMode: "OFFLINE",
  1640. });
  1641. offline--;
  1642. if (offline == 0) break;
  1643. }
  1644. // 加一周
  1645. if (offlineList.length == 1 || this.isAllEqual(offlineList)) {
  1646. date1.setDate(date1.getDate() + 7);
  1647. }
  1648. }
  1649. // (this.timeTable);
  1650. this.timeTable.sort((a, b) => {
  1651. let aStr = dayjs(
  1652. dayjs(a.classDate).format("YYYY-MM-DD") +
  1653. " " +
  1654. a.startClassTimeStr +
  1655. ":00"
  1656. ).valueOf();
  1657. let bStr = dayjs(
  1658. dayjs(b.classDate).format("YYYY-MM-DD") +
  1659. " " +
  1660. b.startClassTimeStr +
  1661. ":00"
  1662. ).valueOf();
  1663. return aStr - bStr;
  1664. });
  1665. this.dialogFormVisible = false;
  1666. },
  1667. getThinkDate(date, num) {
  1668. let Stamp = date;
  1669. Stamp.setDate(date.getDate() + num); // 获取当前月数的第几天
  1670. // (date.getMonth() + 1)
  1671. // (Stamp.getMonth() + 1)
  1672. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  1673. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1674. var mvar = "";
  1675. if (month < 10) {
  1676. mvar = "0" + month;
  1677. } else {
  1678. mvar = month + "";
  1679. }
  1680. var day = Stamp.getDate();
  1681. var dvar = "";
  1682. if (day < 10) {
  1683. dvar = "0" + day;
  1684. } else {
  1685. dvar = day + "";
  1686. }
  1687. // (year + "-" + mvar + '-' + dvar);
  1688. return year + "-" + mvar + "-" + dvar;
  1689. },
  1690. // 计算课酬
  1691. computational() {
  1692. if (this.timeTable.length <= 0) {
  1693. this.$message.error("请先排课再计算课酬");
  1694. return;
  1695. }
  1696. this.computationalBtn = true;
  1697. let userId = this.leftForm.teacher || null;
  1698. let giveTeachMode = this.centerForm.radio || null;
  1699. let vipGroupCategoryId = this.leftForm.courseType || null;
  1700. let vipGroupActivityId = this.leftForm.activeType || null;
  1701. let onlineClassesUnitPrice = this.rightForm.onlinePrice || null;
  1702. let offlineClassesUnitPrice = this.rightForm.offlinePrice || null;
  1703. let onlineClassesNum = this.centerForm.onlineCourseNum || 0;
  1704. let offlineClassesNum = this.centerForm.offlineCourseNum || 0;
  1705. let singleClassMinutes = this.leftForm.classTime;
  1706. if (this.hotType == "GIVE_CLASS") {
  1707. if (this.centerForm.radio == "ONLINE") {
  1708. onlineClassesNum = parseInt(onlineClassesNum);
  1709. } else if (this.centerForm.radio == "OFFLINE") {
  1710. offlineClassesNum = parseInt(offlineClassesNum);
  1711. }
  1712. }
  1713. let onlineTeacherSalary = this.rightForm.onlineCourse || null;
  1714. let offlineTeacherSalary = this.rightForm.offlineCourse || null;
  1715. let studentId = this.activeStudentList
  1716. .map((stu) => {
  1717. return stu.studentId;
  1718. })
  1719. .join(",");
  1720. if (this.courseType == "PRACTICE") {
  1721. getPracticeGroupCostCount({
  1722. vipGroupActivityId,
  1723. onlineClassesUnitPrice,
  1724. onlineTeacherSalary,
  1725. offlineTeacherSalary,
  1726. vipGroupCategoryId,
  1727. offlineClassesUnitPrice,
  1728. allCourseNum: onlineClassesNum,
  1729. offlineClassesNum,
  1730. userId,
  1731. giveTeachMode,
  1732. singleClassMinutes,
  1733. organId: this.leftForm?.classOrganId,
  1734. studentId,
  1735. }).then((res) => {
  1736. if (res.code == 200) {
  1737. this.rightForm.onlineCourse = res.data.onlineTeacherSalary;
  1738. this.rightForm.offlineCourse = res.data.offlineTeacherSalary;
  1739. this.rightForm.allPrice = res.data.totalPrice;
  1740. this.activeStudentList.forEach((stu) => {
  1741. stu.paymentPrice = res.data.totalPrice;
  1742. });
  1743. }
  1744. });
  1745. } else {
  1746. getVipGroupCostCount({
  1747. vipGroupActivityId,
  1748. onlineClassesUnitPrice,
  1749. onlineTeacherSalary,
  1750. offlineTeacherSalary,
  1751. vipGroupCategoryId,
  1752. offlineClassesUnitPrice,
  1753. onlineClassesNum,
  1754. offlineClassesNum,
  1755. userId,
  1756. studentIdList: userId,
  1757. giveTeachMode,
  1758. singleClassMinutes,
  1759. studentIdList: studentId,
  1760. }).then((res) => {
  1761. if (res.code == 200) {
  1762. this.rightForm.onlineCourse = res.data.onlineTeacherSalary;
  1763. this.rightForm.offlineCourse = res.data.offlineTeacherSalary;
  1764. this.rightForm.allPrice = res.data.totalPrice;
  1765. this.activeStudentList.forEach((stu) => {
  1766. stu.paymentPrice = res.data.totalPrice;
  1767. });
  1768. }
  1769. });
  1770. }
  1771. },
  1772. isAllEqual(array) {
  1773. if (array.length > 0) {
  1774. return !array.some((val, index) => {
  1775. return val.week != array[0].week;
  1776. });
  1777. } else {
  1778. return true;
  1779. }
  1780. },
  1781. submitInfo() {
  1782. if (!this.computationalBtn) {
  1783. this.$message.error("请点击计算按钮计算课酬");
  1784. return;
  1785. }
  1786. // let activeCourseType;
  1787. let flag = false;
  1788. // (this.courseTypeList,)
  1789. // this.courseTypeList.forEach((courseType) => {
  1790. // if (courseType.id == this.leftForm.courseType) {
  1791. // activeCourseType = courseType;
  1792. // }
  1793. // });
  1794. // (activeCourseType)
  1795. if (this.isMusicTheory) {
  1796. if (
  1797. this.leftForm.students.length > this.studentLimit ||
  1798. this.leftForm.students.length < 1
  1799. ) {
  1800. this.$message.error(`请选择上课学生为1-${this.studentLimit}人`);
  1801. flag = true;
  1802. }
  1803. } else {
  1804. if (
  1805. this.leftForm.students.length !== this.studentLimit &&
  1806. this.courseType != "PRACTICE"
  1807. ) {
  1808. this.$message.error(`请选择上课学生为${this.studentLimit}人`);
  1809. flag = true;
  1810. }
  1811. }
  1812. if (flag) return;
  1813. // 获取活动方案
  1814. // 判断线上课课酬和线下课课酬
  1815. let online = parseInt(this.centerForm.onlineCourseNum);
  1816. let offline = parseInt(this.centerForm.offlineCourseNum);
  1817. let giveNum = this.giveNum;
  1818. let giveClassType = this.centerForm.radio;
  1819. if (giveClassType == "ONLINE") {
  1820. // 线上
  1821. online += giveNum;
  1822. } else if (giveClassType == "OFFLINE") {
  1823. offline += giveNum;
  1824. }
  1825. let obj = {};
  1826. obj.courseSchedules = this.timeTable;
  1827. /**
  1828. *
  1829. * teacher: '',
  1830. subject: '',
  1831. courseType: '',
  1832. activeType: '',
  1833. classNum: '',
  1834. classTime: '',
  1835. signUpStart: '',
  1836. signUpEnd: '',
  1837. courseStart: '',
  1838. courseEnd: ''
  1839. */
  1840. let studentIdList = 0;
  1841. if (this.courseType == "PRACTICE") {
  1842. studentIdList = this.leftForm.students;
  1843. obj.practiceGroupApplyBaseInfoDto = {
  1844. studentId: studentIdList, // 这个不要了
  1845. vipGroupStudentCoursePrices: this.activeStudentList,
  1846. coursesExpireDate: this.leftForm.courseEnd,
  1847. teacherSchoolId: this.leftForm.section,
  1848. // name: this.leftForm.name,
  1849. offlineClassesNum: offline || 0,
  1850. onlineClassesNum: online || 0,
  1851. offlineClassesUnitPrice: this.rightForm.offlinePrice || 0,
  1852. onlineClassesUnitPrice: this.rightForm.onlinePrice || 0,
  1853. paymentExpireDate: this.leftForm.signUpEnd,
  1854. registrationStartTime: this.leftForm.signUpStart,
  1855. singleClassMinutes: this.leftForm.classTime,
  1856. studentNum: this.leftForm.classNum,
  1857. userId: this.leftForm.teacher,
  1858. vipGroupActivityId: this.leftForm.activeType,
  1859. vipGroupCategoryId: this.leftForm.courseType,
  1860. onlineTeacherSalary: this.rightForm.onlineCourse || 0,
  1861. offlineTeacherSalary: this.rightForm.offlineCourse || 0,
  1862. giveTeachMode: this.centerForm.radio,
  1863. subjectId: this.leftForm.subject,
  1864. educationalTeacherId: this.leftForm.educationalTeacherId,
  1865. organId: this.leftForm.classOrganId,
  1866. firstStudentId: this.leftForm.students[0] || null,
  1867. allCourseNum: online,
  1868. };
  1869. } else {
  1870. studentIdList = this.leftForm.students.join(",") || null;
  1871. obj.vipGroupApplyBaseInfo = {
  1872. studentId: studentIdList, // 这个不要了
  1873. studentIdList,
  1874. vipGroupStudentCoursePrices: this.activeStudentList,
  1875. coursesExpireDate: this.leftForm.courseEnd,
  1876. teacherSchoolId: this.leftForm.section,
  1877. // name: this.leftForm.name,
  1878. offlineClassesNum: offline || 0,
  1879. onlineClassesNum: online || 0,
  1880. offlineClassesUnitPrice: this.rightForm.offlinePrice || 0,
  1881. onlineClassesUnitPrice: this.rightForm.onlinePrice || 0,
  1882. paymentExpireDate: this.leftForm.signUpEnd,
  1883. registrationStartTime: this.leftForm.signUpStart,
  1884. singleClassMinutes: this.leftForm.classTime,
  1885. studentNum: this.leftForm.classNum,
  1886. userId: this.leftForm.teacher,
  1887. vipGroupActivityId: this.leftForm.activeType,
  1888. vipGroupCategoryId: this.leftForm.courseType,
  1889. onlineTeacherSalary: this.rightForm.onlineCourse || 0,
  1890. offlineTeacherSalary: this.rightForm.offlineCourse || 0,
  1891. giveTeachMode: this.centerForm.radio,
  1892. subjectIdList: this.leftForm.subject,
  1893. educationalTeacherId: this.leftForm.educationalTeacherId,
  1894. organId: this.leftForm.classOrganId,
  1895. firstStudentId: this.leftForm.students[0] || null,
  1896. };
  1897. }
  1898. if (this.courseType == "PRACTICE") {
  1899. createPractice(obj).then((res) => {
  1900. if (res.code == 200) {
  1901. this.resetFrom();
  1902. if (res.data == "ING") {
  1903. this.$confirm(
  1904. "课程提交成功,已提交运营主管审批,审批通过后,课程创建成功!",
  1905. "提示",
  1906. {
  1907. confirmButtonText: "确定",
  1908. type: "warning",
  1909. }
  1910. ).then(() => {
  1911. this.$message.success("提交成功");
  1912. this.$store.dispatch("delVisitedViews", this.$route);
  1913. this.$router.push({
  1914. path: "/vipManager/vipList",
  1915. query: {
  1916. rules: this.rules,
  1917. searchForm: this.searchForm,
  1918. },
  1919. });
  1920. });
  1921. } else {
  1922. this.$message.success("恭喜您创建成功");
  1923. this.onCancel();
  1924. }
  1925. }
  1926. if (res.code == 206) {
  1927. this.$confirm(res.msg, "提示", {
  1928. confirmButtonText: "确定",
  1929. type: "warning",
  1930. }).then(() => {
  1931. obj.allowOverstepActivityStudentNum = 1;
  1932. createPractice(obj).then((res) => {
  1933. if (res.code == 200) {
  1934. this.resetFrom();
  1935. this.$message.success("提交成功");
  1936. this.onCancel();
  1937. }
  1938. });
  1939. });
  1940. }
  1941. });
  1942. } else {
  1943. // 新增
  1944. createVip(obj).then((res) => {
  1945. if (res.code == 200) {
  1946. this.resetFrom();
  1947. if (res.data == "ING") {
  1948. this.$confirm(
  1949. "课程提交成功,已提交运营主管审批,审批通过后,课程创建成功!",
  1950. "提示",
  1951. {
  1952. confirmButtonText: "确定",
  1953. type: "warning",
  1954. }
  1955. ).then(() => {
  1956. this.$message.success("提交成功");
  1957. this.$store.dispatch("delVisitedViews", this.$route);
  1958. this.$router.push({
  1959. path: "/vipManager/vipList",
  1960. query: {
  1961. rules: this.rules,
  1962. searchForm: this.searchForm,
  1963. },
  1964. });
  1965. });
  1966. } else {
  1967. this.$message.success("恭喜您创建成功");
  1968. this.$store.dispatch("delVisitedViews", this.$route);
  1969. this.$router.push({
  1970. path: "/vipManager/vipList",
  1971. query: {
  1972. rules: this.rules,
  1973. searchForm: this.searchForm,
  1974. },
  1975. });
  1976. }
  1977. }
  1978. if (res.code == 206) {
  1979. this.$confirm(res.msg, "提示", {
  1980. confirmButtonText: "确定",
  1981. type: "warning",
  1982. }).then(() => {
  1983. obj.allowOverstepActivityStudentNum = 1;
  1984. createVip(obj).then((res) => {
  1985. if (res.code == 200) {
  1986. this.resetFrom();
  1987. this.$message.success("提交成功");
  1988. this.$store.dispatch("delVisitedViews", this.$route);
  1989. this.$router.push({
  1990. path: "/vipManager/vipList",
  1991. query: {
  1992. rules: this.rules,
  1993. searchForm: this.searchForm,
  1994. },
  1995. });
  1996. }
  1997. });
  1998. });
  1999. }
  2000. });
  2001. }
  2002. },
  2003. setSection(val) {
  2004. this.leftForm.section = "";
  2005. this.rightForm.offlineCourse = "";
  2006. this.rightForm.onlineCourse = "";
  2007. this.computationalBtn = false;
  2008. // this.leftForm.courseType = "";
  2009. if (val) {
  2010. getTeachSchool({
  2011. userId: val,
  2012. }).then((res) => {
  2013. if (res.code == 200) {
  2014. this.scetionList = res.data;
  2015. // if(this.scetionList.length <=0){
  2016. // this.$bus.$emit("showguide", ['teamPayType']);
  2017. // return
  2018. // }
  2019. }
  2020. });
  2021. }
  2022. // for (let i in this.teacherList) {
  2023. // if (this.teacherList[i].id == val) {
  2024. // // 根据分部id去获取课程形式
  2025. // vipGroupCategory({ organId: this.teacherList[i].organId }).then(
  2026. // res => {
  2027. // if (res.code == 200) {
  2028. // this.courseTypeList = res.data;
  2029. // }
  2030. // }
  2031. // );
  2032. // }
  2033. // }
  2034. // this.getClassOrgan(); // 获取公用部分
  2035. },
  2036. // getClassOrgan() {
  2037. // // 获取公用分部
  2038. // const leftForm = this.leftForm;
  2039. // let teacher = leftForm.teacher ? leftForm.teacher : null;
  2040. // let educationalTeacherId = leftForm.educationalTeacherId
  2041. // ? leftForm.educationalTeacherId
  2042. // : null;
  2043. // leftForm.classOrganId = null; // 重置课程分部数据
  2044. // this.classOrganList = [];
  2045. // // 初始化上课学生
  2046. // this.studentList = [];
  2047. // this.leftForm.students = [];
  2048. // if (!teacher || !educationalTeacherId) {
  2049. // // 如果没有选择指导老师和乐团主管则不请求
  2050. // return;
  2051. // }
  2052. // getPublicOrgans({
  2053. // teacherId: teacher,
  2054. // eduTeacherId: educationalTeacherId,
  2055. // }).then((res) => {
  2056. // if (res.code == 200) {
  2057. // let result = res.data ? res.data : [];
  2058. // this.classOrganList = result;
  2059. // }
  2060. // });
  2061. // },
  2062. async onClassChange(val) {
  2063. // 课程分部改变时
  2064. // 老师 乐团主管 都要重置
  2065. this.computationalBtn = false;
  2066. this.studentList = [];
  2067. this.activeStudentList = [];
  2068. this.$set(this.leftForm, "students", []);
  2069. this.$set(this.leftForm, "teacher", "");
  2070. this.$set(this.leftForm, "educationalTeacherId", "");
  2071. this.$set(this.leftForm, "section", "");
  2072. this.$set(this.leftForm, "activeType", "");
  2073. this.$set(this.leftForm, "classTime", "");
  2074. this.$set(this.leftForm, "subject", "");
  2075. // this.leftForm.students = [];
  2076. // this.leftForm.teacherId = "";
  2077. // this.leftForm.educationalTeacherId = "";
  2078. this.courseTypeList = [];
  2079. if (this.leftForm.courseType) {
  2080. this.$set(this.leftForm, "courseType", null);
  2081. }
  2082. // this.leftForm.courseType = null;
  2083. if (val) {
  2084. this.getOrganStudentList(val);
  2085. vipGroupCategory({
  2086. organId: val,
  2087. }).then((res) => {
  2088. if (res.code == 200) {
  2089. this.courseTypeList = res.data;
  2090. }
  2091. });
  2092. // 获取乐团主管
  2093. try {
  2094. const ruselt = await findUserByRole({
  2095. id: val,
  2096. });
  2097. this.educationList = ruselt?.data?.educationId;
  2098. if (this.educationList.length <= 0) {
  2099. this.$bus.$emit("showguide", ["teamManager"]);
  2100. return
  2101. }
  2102. } catch (e) {
  2103. console.log(e);
  2104. }
  2105. /**
  2106. *
  2107. // 乐团主管
  2108. this.educationList = ruselt?.data?.educationId;
  2109. */
  2110. // findEducationUsers({ organId: val }).then((res) => {
  2111. // if (res.code == 200) {
  2112. // this.educationList = res.data;
  2113. // }
  2114. // });
  2115. // 如果是网管课 则获取网管课单价
  2116. if (this.courseType == "PRACTICE") {
  2117. getPracticeGroupSellPrice({ organId: val }).then((res) => {
  2118. if (res.code == 200) {
  2119. this.rightForm.onlinePrice = res.data.singleClassMinutesPrice;
  2120. }
  2121. });
  2122. }
  2123. }
  2124. },
  2125. onCancel() {
  2126. if (this.courseType) {
  2127. this.$store.dispatch("delVisitedViews", this.$route);
  2128. this.$router.push({
  2129. path: "/accompanyManager/accompany",
  2130. });
  2131. } else {
  2132. this.$store.dispatch("delVisitedViews", this.$route);
  2133. this.$router.push({
  2134. path: "/vipManager/vipList",
  2135. });
  2136. }
  2137. },
  2138. setCourse() {
  2139. // if (
  2140. // this.hotType == "GIVE_CLASS" &&
  2141. // this.isGiveClass &&
  2142. // !this.centerForm.radio
  2143. // ) {
  2144. // this.$message.error("您还未选择赠课类型");
  2145. // return;
  2146. // }
  2147. this.$refs["leftForm"].validate((vali) => {
  2148. if (vali) {
  2149. let centerForm = this.centerForm;
  2150. if (this.maxCourseNum > 0 && this.minCourseNum > 0) {
  2151. // 判断线上或线下总和大于排课次数
  2152. let onlineNum = centerForm.onlineCourseNum || 0;
  2153. let offlineNum = centerForm.offlineCourseNum || 0;
  2154. let allNUm = parseInt(onlineNum) + parseInt(offlineNum);
  2155. if (allNUm > this.maxCourseNum || allNUm < this.minCourseNum) {
  2156. this.$message.error("待排课数不可超过该活动限制");
  2157. return;
  2158. }
  2159. }
  2160. this.dialogFormVisible = true;
  2161. }
  2162. });
  2163. },
  2164. // setVipInfo(data) {
  2165. // // this.leftForm.name = data.name;
  2166. // this.leftForm.subject = parseInt(data.subjectIdList);
  2167. // // 激活声部下的所有老师
  2168. // this.changeSubject(parseInt(data.subjectIdList));
  2169. // // 设置老师
  2170. // this.leftForm.teacher = data.userId;
  2171. // this.setSection(data.userId);
  2172. // // 课程形式
  2173. // this.leftForm.courseType = data.vipGroupCategoryId;
  2174. // // 获取课程形式下的活动方案
  2175. // this.changeType(this.leftForm.courseType);
  2176. // // 根据课程形式获取活动方案
  2177. // this.leftForm.activeType = data.vipGroupActivityId;
  2178. // setTimeout((res) => {
  2179. // this.chioseActive(data.vipGroupActivityId);
  2180. // }, 1000);
  2181. // this.leftForm.section = data.teacherSchoolId;
  2182. // this.leftForm.classNum = data.studentNum;
  2183. // this.leftForm.classTime = data.singleClassMinutes;
  2184. // this.leftForm.signUpStart = data.registrationStartTime;
  2185. // this.leftForm.signUpEnd = data.paymentExpireDate;
  2186. // this.centerForm.onlineCourseNum = data.onlineClassesNum;
  2187. // this.centerForm.offlineCourseNum = data.offlineCourseNum;
  2188. // /**
  2189. // * rightForm: {
  2190. // onlineCourse: '',
  2191. // offlineCourse: '',
  2192. // onlinePrice: '',
  2193. // offlinePrice: '',
  2194. // allPrice: ''
  2195. // },
  2196. // *
  2197. // */
  2198. // this.rightForm.onlineCourse = data.onlineTeacherSalary;
  2199. // this.rightForm.onlinePrice = data.onlineClassesUnitPrice;
  2200. // this.rightForm.offlineCourse = data.offlineTeacherSalary;
  2201. // this.rightForm.offlinePrice = data.offlineClassesUnitPrice;
  2202. // this.rightForm.allPrice = data.totalPrice;
  2203. // //subjectIdList
  2204. // },
  2205. getOrganStudentList(organId) {
  2206. if (organId) {
  2207. queryOrganStudentList({
  2208. rows: 50,
  2209. organId: organId,
  2210. }).then((res) => {
  2211. if (res.code == 200) {
  2212. this.studentList = res.data.rows;
  2213. }
  2214. });
  2215. }
  2216. },
  2217. remoteMethod(query) {
  2218. if (query !== "") {
  2219. this.remoteLoading = true;
  2220. // 发请求搜索
  2221. const url = "/api-web/studentManage/queryOrganStudentList";
  2222. const options = {
  2223. method: "get",
  2224. headers: {
  2225. Authorization: getToken(),
  2226. },
  2227. params: {
  2228. rows: 9999,
  2229. search: query,
  2230. organId: this.leftForm.classOrganId,
  2231. },
  2232. url,
  2233. };
  2234. this.remoteLoading = true;
  2235. // this.studentList = []
  2236. axios(options).then((res) => {
  2237. this.remoteLoading = false;
  2238. let result = res.data;
  2239. if (result.code == 200) {
  2240. // Array.prototype.splice.apply(this.studentList, result.data.rows);
  2241. if (result.data.rows && result.data.rows.length > 0) {
  2242. result.data.rows.forEach((item) => {
  2243. this.studentList.unshift(item);
  2244. });
  2245. this.studentList = this.deweight(this.studentList, "userId");
  2246. }
  2247. // this.studentList = this.studentList.concat(result.data.rows);
  2248. }
  2249. });
  2250. // queryStudentList({ rows: 100, search: query }).then(res => {
  2251. // if (res.code == 200) {
  2252. // this.remoteLoading = false;
  2253. // this.studentList = this.studentList.concat(res.data.rows);
  2254. // this.unique(this.studentList, "userId");
  2255. // }
  2256. // });
  2257. }
  2258. },
  2259. changeStudent(val) {
  2260. this.computationalBtn = false;
  2261. this.chioseActive();
  2262. this.leftForm.activeType = "";
  2263. this.activeStudentList = [];
  2264. this.chioseStudent = val;
  2265. let discount = this.rightForm.discount ? this.rightForm.discount : 100;
  2266. this.studentList.forEach((stu) => {
  2267. if (val.indexOf(stu.userId) != -1) {
  2268. this.activeStudentList.push({
  2269. studentId: stu.userId,
  2270. userName: stu.username,
  2271. onlineClassesUnitPrice: this.rightForm.onlinePrice,
  2272. offlineClassesUnitPrice: this.rightForm.offlinePrice,
  2273. paymentPrice: "",
  2274. });
  2275. }
  2276. });
  2277. if (
  2278. this.leftForm.courseType &&
  2279. this.leftForm.teacher &&
  2280. this.leftForm.students &&
  2281. this.leftForm.students.length >= 1
  2282. ) {
  2283. let studentIds = this.leftForm.students.join(",");
  2284. // 根据课程类型获取活动方案
  2285. vipGroupActivityFind({
  2286. categoryId: this.leftForm.courseType,
  2287. teacherId: this.leftForm.teacher,
  2288. studentIds,
  2289. }).then((res) => {
  2290. if (res.code == 200) {
  2291. this.activeList = res.data;
  2292. }
  2293. });
  2294. }
  2295. },
  2296. changeStudentP(val) {
  2297. this.chioseActive();
  2298. this.leftForm.activeType = "";
  2299. this.activeStudentList = [];
  2300. this.chioseStudent = val;
  2301. let discount = this.rightForm.discount ? this.rightForm.discount : 100;
  2302. this.studentList.forEach((stu) => {
  2303. if (val == stu.userId) {
  2304. this.activeStudentList.push({
  2305. studentId: stu.userId,
  2306. userName: stu.username,
  2307. onlineClassesUnitPrice: this.rightForm.onlinePrice,
  2308. offlineClassesUnitPrice: this.rightForm.offlinePrice,
  2309. paymentPrice: "",
  2310. });
  2311. }
  2312. });
  2313. if (this.leftForm.teacher && this.leftForm.students) {
  2314. let studentIds = this.leftForm.students;
  2315. // 根据课程类型获取活动方案
  2316. vipGroupActivityFind({
  2317. categoryId: this.leftForm.courseType,
  2318. teacherId: this.leftForm.teacher,
  2319. studentIds,
  2320. courseType: this.courseType,
  2321. }).then((res) => {
  2322. if (res.code == 200) {
  2323. this.activeList = res.data;
  2324. this.classTimeList = [25];
  2325. this.hasOffline = false;
  2326. }
  2327. });
  2328. }
  2329. },
  2330. // 制定属性去重
  2331. deweight(arr, key) {
  2332. let res = [];
  2333. arr.forEach((item) => {
  2334. let list = [];
  2335. res.forEach((resitem) => {
  2336. list.push(resitem[key]);
  2337. });
  2338. if (list.indexOf(item[key]) === -1) {
  2339. res.push(item);
  2340. }
  2341. });
  2342. return res;
  2343. },
  2344. getStartTime(val) {
  2345. if (val) {
  2346. let date = dayjs(new Date()).format("YYYY-MM-DD");
  2347. this.maskForm.endTime = addTimerFormMinute(
  2348. date,
  2349. val,
  2350. this.leftForm.classTime
  2351. );
  2352. } else {
  2353. this.maskForm.endTime = "";
  2354. }
  2355. if (!this.maskForm.endTime) {
  2356. this.maskForm.startTime = "";
  2357. }
  2358. },
  2359. changeStudentMoney(val) {
  2360. if (val) {
  2361. this.computationalBtn = false;
  2362. }
  2363. },
  2364. },
  2365. // watch: {
  2366. // rightForm: {
  2367. // handler (newName, oldName) {
  2368. // this.computationalBtn = false
  2369. // },
  2370. // deep: true
  2371. // }
  2372. // }
  2373. };
  2374. </script>
  2375. <style lang="scss" scoped>
  2376. .computeMoney {
  2377. margin-top: 10px;
  2378. float: right;
  2379. }
  2380. .m-core {
  2381. margin-top: 30px;
  2382. // display: flex;
  2383. // flex-direction: row;
  2384. // justify-content: space-around;
  2385. .el-input {
  2386. width: 180px;
  2387. }
  2388. h4 {
  2389. font-size: 16px;
  2390. background-color: #ccc;
  2391. color: #fff;
  2392. // text-align: center;
  2393. width: 100%;
  2394. height: 40px;
  2395. line-height: 40px;
  2396. margin-bottom: 20px;
  2397. padding: 0 20px;
  2398. }
  2399. // .vipLeft {
  2400. // width: 400px;
  2401. // // h4 {
  2402. // // font-size: 16px;
  2403. // // background-color: #ccc;
  2404. // // color: #fff;
  2405. // // text-align: center;
  2406. // // width: 100%;
  2407. // // height: 40px;
  2408. // // line-height: 40px;
  2409. // // margin-bottom: 20px;
  2410. // // }
  2411. // }
  2412. // .center {
  2413. // width: 400px;
  2414. // }
  2415. .right {
  2416. margin-top: 20px;
  2417. }
  2418. }
  2419. .vipMsg {
  2420. margin-bottom: 20px;
  2421. }
  2422. .planList {
  2423. padding: 0 25px;
  2424. .planTop {
  2425. height: 40px;
  2426. line-height: 40px;
  2427. display: flex;
  2428. flex-direction: row;
  2429. justify-content: space-between;
  2430. border-bottom: 1px solid #ccc;
  2431. margin-top: 20px;
  2432. > p {
  2433. font-size: 14px;
  2434. }
  2435. }
  2436. .planCore {
  2437. .row {
  2438. width: 100%;
  2439. display: flex;
  2440. flex-direction: row;
  2441. justify-content: space-between;
  2442. flex-wrap: nowrap;
  2443. height: 40px;
  2444. line-height: 40px;
  2445. font-size: 14px;
  2446. text-align: center;
  2447. div {
  2448. width: 87px;
  2449. }
  2450. // div {
  2451. // &:nth-child(1) {
  2452. // text-align: left;
  2453. // }
  2454. // }
  2455. }
  2456. }
  2457. .nomore {
  2458. display: flex;
  2459. flex-direction: row;
  2460. justify-content: center;
  2461. align-items: center;
  2462. height: 40px;
  2463. }
  2464. }
  2465. .okBtn {
  2466. width: 120px;
  2467. height: 40px;
  2468. line-height: 40px;
  2469. text-align: center;
  2470. color: #fff;
  2471. border-radius: 4px;
  2472. margin-right: 20px;
  2473. cursor: pointer;
  2474. background-color: #f97215;
  2475. float: right;
  2476. }
  2477. .submitP {
  2478. margin-bottom: 20px;
  2479. font-size: 14px;
  2480. padding-left: 24px;
  2481. }
  2482. </style>