index.vue 61 KB

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