index.vue 79 KB

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