index.vue 83 KB

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