index.vue 81 KB

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