index.vue 61 KB

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