index.vue 59 KB

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