index.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header @back="onCancel" content="VIP课申请"></el-page-header>
  5. <!-- <div class="squrt" /> -->
  6. </h2>
  7. <div class="m-core">
  8. <div class="vipLeft">
  9. <h4>课程信息</h4>
  10. <el-form
  11. ref="leftForm"
  12. :rules="leftFormRules"
  13. :label-position="labelPosition"
  14. label-width="110px"
  15. :model="leftForm"
  16. >
  17. <el-form-item label="课程名称" prop="name">
  18. <el-input v-model.trim="leftForm.name" />
  19. </el-form-item>
  20. <el-form-item label="科目名称" prop="subject">
  21. <el-select v-model.trim="leftForm.subject" filterable clearable @change="changeSubject">
  22. <el-option
  23. v-for="(item,index) in subjectList"
  24. :key="index"
  25. :value="item.id"
  26. :label="item.name"
  27. />
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="指导老师" prop="teacher">
  31. <el-select
  32. v-model.trim="leftForm.teacher"
  33. filterable
  34. clearable
  35. :disabled="!leftForm.subject"
  36. @change="setSection($event)"
  37. >
  38. <el-option
  39. v-for="(item,index) in teacherList"
  40. :key="index"
  41. :label="item.realName"
  42. :value="item.id"
  43. />
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="教务老师" prop="educationalTeacherId">
  47. <el-select
  48. v-model.trim="leftForm.educationalTeacherId"
  49. filterable
  50. clearable
  51. :disabled="!leftForm.subject"
  52. @change="getClassOrgan()"
  53. >
  54. <el-option
  55. v-for="(item,index) in educationList"
  56. :key="index"
  57. :label="item.userName"
  58. :value="item.userId"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="课程分部" prop="classOrganId">
  63. <el-select
  64. v-model.trim="leftForm.classOrganId"
  65. filterable
  66. clearable
  67. :disabled="!leftForm.teacher || !leftForm.educationalTeacherId"
  68. >
  69. <el-option
  70. v-for="(item,index) in classOrganList"
  71. :key="index"
  72. :label="item.name"
  73. :value="item.id"
  74. />
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="课程形式" prop="courseType">
  78. <el-select
  79. v-model.trim="leftForm.courseType"
  80. clearable
  81. filterable
  82. :disabled="!leftForm.teacher"
  83. @change="changeType"
  84. >
  85. <el-option
  86. v-for="(item,index) in courseTypeList"
  87. :key="index"
  88. :label="item.name"
  89. :value="item.id"
  90. />
  91. </el-select>
  92. </el-form-item>
  93. <el-form-item label="活动方案" prop="activeType">
  94. <el-select
  95. v-model.trim="leftForm.activeType"
  96. filterable
  97. clearable
  98. :disabled="!leftForm.courseType"
  99. @change="chioseActive"
  100. >
  101. <el-option
  102. v-for="(item,index) in activeList"
  103. :key="index"
  104. :value="item.id"
  105. :label="item.name"
  106. />
  107. </el-select>
  108. </el-form-item>
  109. <!-- 11111111111111111111111111111111 -->
  110. <el-form-item label="教学点">
  111. <el-select
  112. v-model.trim="leftForm.section"
  113. filterable
  114. clearable
  115. :disabled="!leftForm.teacher"
  116. >
  117. <el-option
  118. v-for="(item,index) in scetionList"
  119. :key="index"
  120. :value="item.id"
  121. :label="item.name"
  122. />
  123. </el-select>
  124. </el-form-item>
  125. <el-form-item label="每班人数">
  126. <el-input
  127. type="number"
  128. @mousewheel.native.prevent
  129. v-model.trim="leftForm.classNum"
  130. disabled
  131. />
  132. </el-form-item>
  133. <el-form-item label="每课时长">
  134. <!-- <el-input type="number"
  135. v-model.trim="leftForm.classTime"
  136. disabled />-->
  137. <el-select v-model.trim="leftForm.classTime" :disabled="timeTable.length>0">
  138. <el-option
  139. v-for="(item,index) in this.classTimeList"
  140. :key="index"
  141. :value="item"
  142. :label="item"
  143. ></el-option>
  144. </el-select>
  145. </el-form-item>
  146. <el-form-item label="
  147. 报名开始时间" prop="signUpStart">
  148. <!-- @change="changeStartTime" -->
  149. <el-date-picker
  150. v-model.trim="leftForm.signUpStart"
  151. type="date"
  152. :picker-options="pickerOptions"
  153. value-format="yyyy-MM-dd HH:mm:ss"
  154. placeholder="请选择时间"
  155. />
  156. </el-form-item>
  157. <el-form-item label="报名结束时间" prop="signUpEnd">
  158. <el-date-picker
  159. v-model.trim="leftForm.signUpEnd"
  160. type="date"
  161. :picker-options="pickerOptions1"
  162. value-format="yyyy-MM-dd HH:mm:ss"
  163. placeholder="请选择时间"
  164. />
  165. </el-form-item>
  166. <el-form-item v-if="leftForm.courseStart" label="最早排课时间">
  167. <el-date-picker
  168. v-model.trim="leftForm.courseStart"
  169. disabled
  170. type="date"
  171. value-format="yyyy-MM-dd HH:mm:ss"
  172. placeholder="请选择时间"
  173. />
  174. </el-form-item>
  175. <el-form-item v-if="leftForm.courseEnd" label="最晚排课时间">
  176. <el-date-picker
  177. v-model.trim="leftForm.courseEnd"
  178. disabled
  179. type="date"
  180. value-format="yyyy-MM-dd HH:mm:ss"
  181. placeholder="请选择时间"
  182. />
  183. </el-form-item>
  184. </el-form>
  185. </div>
  186. <div class="center">
  187. <h4>排课设置</h4>
  188. <el-form :model="centerForm" label-width="100px" :label-position="labelPosition">
  189. <el-form-item v-if="hasOnline" label="线上课数">
  190. <el-input
  191. v-model.trim="centerForm.onlineCourseNum"
  192. @mousewheel.native.prevent
  193. type="number"
  194. />
  195. </el-form-item>
  196. <el-form-item v-if="hasOffline" label="线下课数">
  197. <el-input
  198. v-model.trim="centerForm.offlineCourseNum"
  199. @mousewheel.native.prevent
  200. type="number"
  201. />
  202. </el-form-item>
  203. <el-form-item label="待排课数">
  204. <el-input v-model.trim="allCourseCount" disabled />
  205. </el-form-item>
  206. <el-form-item v-if="hotType=='GIVE_CLASS'&&isGiveClass" label="赠课课程类型">
  207. <el-radio v-model.trim="centerForm.radio" label="ONLINE">线上课</el-radio>
  208. <el-radio v-model.trim="centerForm.radio" label="OFFLINE">线下课</el-radio>
  209. </el-form-item>
  210. </el-form>
  211. <!-- 排课列表开始 -->
  212. <div class="planList">
  213. <div class="planTop">
  214. <p>已排课程</p>
  215. <el-button type="text" @click="setCourse">{{id?'新增排课':'点击排课'}}</el-button>
  216. </div>
  217. <div class="planCore">
  218. <div class="row">
  219. <div class="name">时间</div>
  220. <div class="week">开始时间</div>
  221. <div class="time">结束时间</div>
  222. <div class="time">课程类型</div>
  223. </div>
  224. <div v-for="(item,index) in this.timeTable" :key="index" class="row">
  225. <div class="name">{{ item.classDate | formatTimer }}</div>
  226. <div class="week">{{ item.startClassTimeStr }}</div>
  227. <div class="time">{{ item.endClassTimeStr }}</div>
  228. <div class="time">{{ item.teachMode |teachMode }}</div>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. <div class="right">
  234. <h4>课酬设置</h4>
  235. <el-form :model="rightForm" label-width="100px" :label-position="labelPosition">
  236. <el-form-item v-if="hasOnline" label="线上课课酬">
  237. <el-input v-model.trim="rightForm.onlineCourse" :disabled="salaryReadonlyFlag==0" />
  238. <!-- || onlineSalary!='TEACHER_DEFAULT' -->
  239. </el-form-item>
  240. <el-form-item v-if="hasOffline" label="线下课课酬">
  241. <el-input v-model.trim="rightForm.offlineCourse" :disabled="salaryReadonlyFlag==0" />
  242. <!-- || offlineSalary!='TEACHER_DEFAULT' -->
  243. </el-form-item>
  244. <el-form-item v-if="hasOnline" label="线上课单价">
  245. <el-input v-model.trim="rightForm.onlinePrice" :disabled="paymentReadonlyFlag==0" />
  246. </el-form-item>
  247. <el-form-item v-if="hasOffline" label="线下课单价">
  248. <el-input v-model.trim="rightForm.offlinePrice" :disabled="paymentReadonlyFlag==0" />
  249. </el-form-item>
  250. <el-form-item label="课程总价">
  251. <el-input v-model.trim="rightForm.allPrice" disabled />
  252. </el-form-item>
  253. <el-form-item label="上课学生">
  254. <!-- :loading="loading" -->
  255. <el-select
  256. v-model.trim="rightForm.students"
  257. multiple
  258. clearable
  259. placeholder="请输入关键词"
  260. remote
  261. reserve-keyword
  262. filterable
  263. :disabled="!leftForm.classOrganId"
  264. :remote-method="remoteMethod"
  265. :loading="remoteLoading"
  266. >
  267. <el-option
  268. v-for="(item,index) in studentList"
  269. :key="index"
  270. :label="item.username"
  271. :value="item.userId"
  272. >
  273. <span style="float: left">{{ item.username }}</span>
  274. <span style="float: right; color: #8492a6; font-size: 13px">{{item.parentsPhone }}</span>
  275. </el-option>
  276. </el-select>
  277. </el-form-item>
  278. </el-form>
  279. <el-button type="primary" style="float:right" @click="computational">计算</el-button>
  280. </div>
  281. </div>
  282. <!-- 弹窗 -->
  283. <el-dialog title="VIP排课" ref="maskForm" width="500px" :visible.sync="dialogFormVisible">
  284. <el-form :model="maskForm" label-position="right" label-width="150px">
  285. <el-form-item label="线上课开课时间">
  286. <el-date-picker
  287. v-model.trim="maskForm.courseStartOnline"
  288. type="date"
  289. :picker-options="courseOption"
  290. placeholder="请选择开课时间"
  291. />
  292. </el-form-item>
  293. <el-form-item label="线下课开课时间">
  294. <el-date-picker
  295. v-model.trim="maskForm.courseStartOffline"
  296. type="date"
  297. :picker-options="courseOption"
  298. placeholder="请选择开课时间"
  299. />
  300. </el-form-item>
  301. <div class="line" style="height:1px; background:#ccc; margin:0 25px;"></div>
  302. <el-form-item label="课程类型" prop="type">
  303. <el-radio v-if="hasOnline" v-model.trim="maskForm.type" label="ONLINE">线上课</el-radio>
  304. <el-radio v-if="hasOffline" v-model.trim="maskForm.type" label="OFFLINE">线下课</el-radio>
  305. </el-form-item>
  306. <el-form-item label="循环周次" prop="week">
  307. <el-select v-model.trim="maskForm.week" style="width:220px!important;">
  308. <el-option label="星期日" value="0" />
  309. <el-option label="星期一" value="1" />
  310. <el-option label="星期二" value="2" />
  311. <el-option label="星期三" value="3" />
  312. <el-option label="星期四" value="4" />
  313. <el-option label="星期五" value="5" />
  314. <el-option label="星期六" value="6" />
  315. </el-select>
  316. </el-form-item>
  317. <el-form-item label="上课时间" prop="startTime">
  318. <el-time-picker
  319. v-model.trim="maskForm.startTime"
  320. format="HH:mm"
  321. value-format="HH:mm"
  322. :picker-options="{
  323. selectableRange: '00:00:00 - 23:59:00'
  324. }"
  325. placeholder="选择时间"
  326. />
  327. </el-form-item>
  328. </el-form>
  329. <div class="btnWrap">
  330. <div class="okBtn" @click="addWeek">确认</div>
  331. </div>
  332. <div class="planList">
  333. <div class="planTop">
  334. <p>已排课程</p>
  335. </div>
  336. <div class="planCore">
  337. <div v-for="(item,index) in this.lookList" class="row" :key="index">
  338. <div class="name">{{ item.type }}</div>
  339. <div class="week">{{ item.week }}</div>
  340. <div class="time">{{ item.time }}</div>
  341. <div class="operation">
  342. <el-button type="text" @click="removeWeekCourse(item.id)">删除</el-button>
  343. </div>
  344. </div>
  345. </div>
  346. <div slot="footer" style="margin-top:20px;" class="dialog-footer">
  347. <el-button @click="dialogFormVisible = false">取 消</el-button>
  348. <el-button type="primary" @click="setTimeTable">确 定</el-button>
  349. </div>
  350. </div>
  351. </el-dialog>
  352. <div class="btnWrap">
  353. <!-- <div class="closeBtn">
  354. 取消
  355. </div>-->
  356. <div class="okBtn" @click="submitInfo">{{id?'修改':'确定'}}</div>
  357. </div>
  358. </div>
  359. </template>
  360. <script>
  361. import { getTeacher, getSubject, findEducationUsers } from "@/api/buildTeam";
  362. import {
  363. vipGroupCategory,
  364. vipGroupActivityFind,
  365. getVipGroupCostCount,
  366. createVip,
  367. getVipGroupDetail,
  368. updateVipBaseInfo,
  369. getPublicOrgans,
  370. } from "@/api/vipSeting";
  371. import { getTeachSchool, getTeacherBySubject } from "@/api/teacherManager";
  372. import { queryStudentList } from "@/api/studentManager";
  373. import axios from "axios";
  374. import { getToken } from "@/utils/auth";
  375. export default {
  376. name: "buildVip",
  377. data() {
  378. return {
  379. dialogFormVisible: false,
  380. labelPosition: "right",
  381. leftForm: {
  382. name: "",
  383. teacher: "",
  384. subject: "",
  385. courseType: "",
  386. activeType: "",
  387. classNum: "",
  388. classTime: "",
  389. signUpStart: "",
  390. signUpEnd: "",
  391. courseStartOnline: "",
  392. courseStartOffline: "",
  393. courseEnd: "",
  394. section: "",
  395. courseStart: "",
  396. courseEnd: "",
  397. educationalTeacherId: "",
  398. classOrganId: "" // 课程分部
  399. },
  400. classTimeList: [],
  401. centerForm: {
  402. allCourseNum: "",
  403. onlineCourseNum: 0,
  404. offlineCourseNum: 0,
  405. radio: ""
  406. },
  407. maskForm: {
  408. type: "",
  409. week: "",
  410. startTime: ""
  411. },
  412. rightForm: {
  413. onlineCourse: "",
  414. offlineCourse: "",
  415. onlinePrice: "",
  416. offlinePrice: "",
  417. allPrice: "",
  418. students: []
  419. },
  420. remoteLoading: false,
  421. computationalBtn: false,
  422. subjectList: [], // 科目列表
  423. teacherList: [], // 老师列表
  424. educationList: [], // 教务
  425. classOrganList: [], // 公用分部
  426. courseTypeList: [], // 课程类型集合
  427. activeList: [], //活动集合
  428. hasOnline: false,
  429. hasOffline: false,
  430. onlineSalary: "", // 线上课课酬结算方式
  431. offlineSalary: "", // 线下课课酬结算方式
  432. hotType: "",
  433. attribute1: "",
  434. attribute2: "",
  435. salaryReadonlyFlag: "", // 老师课酬是否可配
  436. paymentReadonlyFlag: "", // 课程单价是否可配
  437. lookList: [],
  438. onlinelookList: [], // 展示课表线上
  439. offlineLookList: [], // 展示课表线下
  440. timeTable: [], // 真正的课表
  441. giveNum: "",
  442. weekDay: [
  443. "星期日",
  444. "星期一",
  445. "星期二",
  446. "星期三",
  447. "星期四",
  448. "星期五",
  449. "星期六"
  450. ],
  451. scetionList: [],
  452. isGiveClass: false,
  453. activeStartTime: null,
  454. courseOption: null,
  455. pickerOptions: null,
  456. pickerOptions1: null,
  457. leftFormRules: {
  458. /**?
  459. * teacher: '',
  460. subject: '',
  461. courseType: '',
  462. activeType: '',
  463. */
  464. name: [{ required: true, message: "请输入名称", trigger: "blur" }],
  465. teacher: [{ required: true, message: "请选择老师", trigger: "blur" }],
  466. educationalTeacherId: [
  467. { required: true, message: "请选择教务", trigger: "blur" }
  468. ],
  469. classOrganId:[
  470. { required: true, message: "请选择课程分部", trigger: "blur" }
  471. ],
  472. subject: [
  473. {
  474. required: true,
  475. message: "请选择科目",
  476. trigger: "blur"
  477. }
  478. ],
  479. courseType: [
  480. {
  481. required: true,
  482. message: "请选择课程类型",
  483. trigger: "blur"
  484. }
  485. ],
  486. activeType: [
  487. {
  488. required: true,
  489. message: "请选择活动",
  490. trigger: "blur"
  491. }
  492. ],
  493. signUpStart: [
  494. {
  495. required: true,
  496. message: "请选择报名开始时间",
  497. trigger: "blur"
  498. }
  499. ],
  500. signUpEnd: [
  501. {
  502. required: true,
  503. message: "请选择报名结束时间",
  504. trigger: "blur"
  505. }
  506. ]
  507. },
  508. id: "",
  509. studentList: []
  510. };
  511. },
  512. computed: {
  513. allCourseCount() {
  514. let online, offline;
  515. this.centerForm.onlineCourseNum
  516. ? (online = this.centerForm.onlineCourseNum)
  517. : (online = 0);
  518. this.centerForm.offlineCourseNum
  519. ? (offline = this.centerForm.offlineCourseNum)
  520. : (offline = 0);
  521. let giveNum;
  522. if (this.hotType == "GIVE_CLASS") {
  523. // this.attribute1 从多少节开始送
  524. // this.attribute2 送多少节
  525. giveNum = parseInt(
  526. parseInt(offline) + parseInt(online) - this.attribute1 >= 0
  527. ? (giveNum = this.attribute2)
  528. : (giveNum = 0)
  529. );
  530. if (giveNum) {
  531. // 有赠送课时
  532. this.isGiveClass = true;
  533. }
  534. this.giveNum = giveNum || 0;
  535. return parseInt(offline) + parseInt(online) + "+" + giveNum || "";
  536. }
  537. return parseInt(offline) + parseInt(online) || "";
  538. }
  539. },
  540. created() {
  541. // 如果有id则是修改 带出所有的数据
  542. // 没有id 则是新增
  543. // this.id = this.$route.query.id;
  544. // if (this.id) {
  545. // // 发请求获取信息
  546. // getVipGroupDetail({ vipGroupId: this.id }).then(res => {
  547. // if (res.code == 200) {
  548. // this.setVipInfo(res.data);
  549. // }
  550. // });
  551. // }
  552. this.init();
  553. },
  554. mounted() {
  555. // 获取所有老师的接口 根据声部id获取老师
  556. // 获取课程类型的接口
  557. // 获取学生列表
  558. // queryStudentList({ rows: 100000 }).then(res => {
  559. // if (res.code == 200) {
  560. // this.studentList = res.data.rows
  561. // }
  562. // })
  563. },
  564. activated() {
  565. Object.assign(this.$data, this.$options.data());
  566. setTimeout(() => {
  567. this.$refs["leftForm"].resetFields();
  568. }, 100);
  569. this.init();
  570. },
  571. methods: {
  572. init() {
  573. if (this.$route.query.rules) {
  574. this.rules = this.$route.query.rules;
  575. }
  576. if (this.$route.query.searchForm) {
  577. this.searchForm = this.$route.query.searchForm;
  578. }
  579. // 获取所有科目的接口
  580. getSubject({tenantId:1}).then(res => {
  581. if (res.code == 200) {
  582. this.subjectList = res.data;
  583. }
  584. });
  585. getTeacher().then(res => {
  586. if (res.code == 200) {
  587. this.teacherList = res.data;
  588. }
  589. });
  590. // 获取教务老师
  591. findEducationUsers({}).then(res => {
  592. if (res.code == 200) {
  593. this.educationList = res.data;
  594. }
  595. });
  596. this.pickerOptions = this.beginDate();
  597. this.pickerOptions1 = this.processDate();
  598. this.courseOption = this.coursesDate();
  599. },
  600. coursesDate() {
  601. let self = this;
  602. return {
  603. disabledDate: time => {
  604. if (self.leftForm.courseStart) {
  605. let date = new Date(self.leftForm.courseStart.replace(/-/, "/"));
  606. return time.getTime() < date.getTime();
  607. }
  608. return;
  609. }
  610. };
  611. },
  612. beginDate() {
  613. let self = this;
  614. return {
  615. disabledDate(time) {
  616. return time.getTime() + 86400000 <= new Date().getTime(); //开始时间不选时,结束时间最大值小于等于当天
  617. }
  618. };
  619. },
  620. processDate() {
  621. //提出结束时间必须大于提出开始时间
  622. let self = this;
  623. return {
  624. disabledDate(time) {
  625. if (self.leftForm.signUpStart) {
  626. return (
  627. new Date(self.leftForm.signUpStart).getTime() > time.getTime()
  628. );
  629. } else {
  630. return time.getTime() > Date.now();
  631. //开始时间不选时,结束时间最大值小于等于当天
  632. }
  633. }
  634. };
  635. },
  636. changeSubject(val) {
  637. this.leftForm.teacher = "";
  638. this.leftForm.section = "";
  639. // 根据科目id获取相应的老师
  640. // getTeacherBySubject({ subjecId: val }).then(res => {
  641. // if (res.code == 200) {
  642. // this.teacherList = res.data;
  643. // }
  644. // })
  645. },
  646. // 选择课程类型
  647. changeType(val) {
  648. // 在这里清空默认课酬
  649. this.rightForm.offlineCourse = "";
  650. this.rightForm.onlineCourse = "";
  651. this.leftForm.activeType = "";
  652. for (let i in this.courseTypeList) {
  653. if (this.courseTypeList[i].id == val) {
  654. // 学生人数
  655. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  656. // 每课时长
  657. this.classTimeList = this.courseTypeList[i].singleClassMinutes.split(
  658. ","
  659. );
  660. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  661. this.leftForm.classTime = this.classTimeList[0];
  662. // 线上课单节价格
  663. this.rightForm.onlinePrice = this.courseTypeList[
  664. i
  665. ].onlineClassesUnitPrice;
  666. // 线下课单节价格
  667. this.rightForm.offlinePrice = this.courseTypeList[
  668. i
  669. ].offlineClassesUnitPrice;
  670. }
  671. }
  672. // teacherId
  673. // 根据课程类型获取活动方案
  674. if (this.leftForm.courseType) {
  675. // console.log(this.leftForm.teacher)
  676. vipGroupActivityFind({
  677. categoryId: this.leftForm.courseType,
  678. teacherId: this.leftForm.teacher
  679. }).then(res => {
  680. if (res.code == 200) {
  681. this.activeList = res.data;
  682. }
  683. });
  684. }
  685. },
  686. // 选择活动方案
  687. chioseActive(val) {
  688. this.rightForm.offlineCourse = "";
  689. this.rightForm.onlineCourse = "";
  690. // this.rightForm.onlinePrice = '';
  691. // this.rightForm.offlinePrice = '';
  692. this.lookList = [];
  693. this.timeTable = [];
  694. this.attribute1 = "";
  695. this.attribute2 = "";
  696. this.giveNum = 0;
  697. this.isGiveClass = false;
  698. // 重置课程单价
  699. for (let i in this.courseTypeList) {
  700. if (this.courseTypeList[i].id == this.leftForm.courseType) {
  701. // 学生人数
  702. this.leftForm.classNum = this.courseTypeList[i].studentNum;
  703. // 每课时长
  704. this.classTimeList = this.courseTypeList[i].singleClassMinutes.split(
  705. ","
  706. );
  707. // this.leftForm.classTime = this.courseTypeList[i].singleClassMinutes;
  708. this.leftForm.classTime = this.classTimeList[0];
  709. // 线上课单节价格
  710. this.rightForm.onlinePrice = this.courseTypeList[
  711. i
  712. ].onlineClassesUnitPrice;
  713. // 线下课单节价格
  714. this.rightForm.offlinePrice = this.courseTypeList[
  715. i
  716. ].offlineClassesUnitPrice;
  717. }
  718. }
  719. // 根须活动id获取 相应的值
  720. for (let i in this.activeList) {
  721. if (this.activeList[i].id == val) {
  722. // 如果是买赠就必须选择赠课类型
  723. // 报名开始 报名结束 课程开始 课程结束 // 判断是否有线上,线下课 并同步状态
  724. // this.leftForm.signUpStart = this.activeList[i].startTime;
  725. // this.leftForm.signUpEnd = this.activeList[i].endTime;
  726. this.leftForm.courseStart = this.activeList[i].coursesStartTime;
  727. this.leftForm.courseEnd = this.activeList[i].coursesEndTime;
  728. // 获取活动种类并保存
  729. this.hotType = this.activeList[i].type;
  730. // 获取买赠必要参数
  731. this.attribute1 = this.activeList[i].attribute1;
  732. this.attribute2 = this.activeList[i].attribute2;
  733. // 存储课酬是否可配置
  734. this.salaryReadonlyFlag = this.activeList[i].salaryReadonlyFlag;
  735. this.paymentReadonlyFlag = this.activeList[i].paymentReadonlyFlag;
  736. // hasOnline: false, hasOffline: false 还需要判断type类型 根据活动id获取
  737. if (this.activeList[i].salarySettlementJson) {
  738. let obj = JSON.parse(this.activeList[i].salarySettlementJson);
  739. if (obj && obj.onlineSalarySettlement) {
  740. // 有线上课
  741. this.hasOnline = true;
  742. this.onlineSalary =
  743. obj.onlineSalarySettlement.salarySettlementType;
  744. // console.log('线上:' + this.onlineSalary)
  745. } else {
  746. this.hasOnline = false;
  747. }
  748. if (obj && obj.offlineSalarySettlement) {
  749. // 有线下课
  750. this.hasOffline = true;
  751. this.offlineSalary =
  752. obj.offlineSalarySettlement.salarySettlementType;
  753. // console.log('线下:' + this.offlineSalary)
  754. } else {
  755. this.hasOffline = false;
  756. }
  757. }
  758. }
  759. }
  760. },
  761. // 点击确插入课表
  762. addWeek() {
  763. let courseType = this.maskForm.type;
  764. // let week = ;this.maskForm.week
  765. let startTime = this.maskForm.startTime;
  766. if (!courseType || !this.maskForm.week || !startTime) {
  767. this.$message.error("请填写完成信息");
  768. return;
  769. }
  770. // 拿到相应的值插入数组
  771. let endTime = this.MinutesTest(startTime, this.leftForm.classTime);
  772. let str;
  773. switch (courseType) {
  774. case "ONLINE": {
  775. str = "线上课";
  776. break;
  777. }
  778. case "OFFLINE": {
  779. str = "线下课";
  780. break;
  781. }
  782. }
  783. let flag = false;
  784. for (let i in this.lookList) {
  785. if (this.lookList[i].weekDay == this.maskForm.week) {
  786. flag = true;
  787. }
  788. }
  789. // true=> 说明有这一周 那么循环找到这一周 在判断时间
  790. // flase=> 说明没有这一周的时间 直接添加
  791. if (flag) {
  792. // 有相同的周日
  793. let arr = [];
  794. for (let i in this.lookList) {
  795. if (this.lookList[i].weekDay == this.maskForm.week) {
  796. // 找到这一天的所有元素
  797. // && !this.timeIsrange(this.lookList[i].startTime, this.lookList[i].endTime, startTime) && !this.timeIsrange(this.lookList[i].startTime, this.lookList[i].endTime, endTime)
  798. let isStartTime = this.timeIsrange(
  799. startTime,
  800. endTime,
  801. this.lookList[i].startTime
  802. );
  803. let isEndTime = this.timeIsrange(
  804. startTime,
  805. endTime,
  806. this.lookList[i].endTime
  807. );
  808. arr.push(!isEndTime && !isStartTime);
  809. }
  810. }
  811. let isAdd = true;
  812. for (let j = 0; j < arr.length; j++) {
  813. isAdd = isAdd && arr[j];
  814. }
  815. if (isAdd) {
  816. this.lookList.push({
  817. type: str,
  818. week: this.weekDay[this.maskForm.week],
  819. weekDay: this.maskForm.week,
  820. startTime: startTime,
  821. endTime: endTime,
  822. time: startTime + "-" + endTime,
  823. id: Date.now()
  824. });
  825. } else {
  826. this.$message.error("该时间段已排课请重选时间");
  827. return;
  828. }
  829. } else {
  830. this.lookList.push({
  831. type: str,
  832. week: this.weekDay[this.maskForm.week],
  833. weekDay: this.maskForm.week,
  834. startTime: startTime,
  835. endTime: endTime,
  836. time: startTime + "-" + endTime,
  837. id: Date.now()
  838. });
  839. }
  840. // console.log(this.lookList)
  841. // let courseType = this.maskForm.type;
  842. // // let week = ;this.maskForm.week
  843. // let startTime = this.maskForm.startTime;
  844. this.maskForm.type = "";
  845. this.maskForm.week = "";
  846. this.maskForm.startTime = "";
  847. },
  848. // 分钟小时相加减
  849. MinutesTest(str, interval) {
  850. let houer = str.split(":")[0];
  851. let min = str.split(":")[1];
  852. let sdate1 = new Date(1900, 1, 1, houer, min);
  853. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  854. let H = sdate1.getHours();
  855. let M = sdate1.getMinutes();
  856. if (H < 10) H = "0" + H;
  857. if (M < 10) M = "0" + M;
  858. return H + ":" + M;
  859. },
  860. // 判断时间是否在时间段内
  861. timeIsrange(beginTime, endTime, nowTime) {
  862. var strb = beginTime.split(":");
  863. if (strb.length != 2) {
  864. return false;
  865. }
  866. var stre = endTime.split(":");
  867. if (stre.length != 2) {
  868. return false;
  869. }
  870. var strn = nowTime.split(":");
  871. if (stre.length != 2) {
  872. return false;
  873. }
  874. var b = new Date();
  875. var e = new Date();
  876. var n = new Date();
  877. b.setHours(strb[0]);
  878. b.setMinutes(strb[1]);
  879. e.setHours(stre[0]);
  880. e.setMinutes(stre[1]);
  881. n.setHours(strn[0]);
  882. n.setMinutes(strn[1]);
  883. if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
  884. // 在时间范围内
  885. return true;
  886. } else {
  887. // 不在时间范围内
  888. return false;
  889. }
  890. },
  891. removeWeekCourse(id) {
  892. for (let i in this.lookList) {
  893. if (this.lookList[i].id == id) {
  894. this.lookList.splice(i, 1);
  895. }
  896. }
  897. },
  898. setTimeTable() {
  899. // 拿到线上课数与线下课数 以及
  900. this.timeTable = [];
  901. let online = parseInt(this.centerForm.onlineCourseNum) || 0;
  902. let offline = parseInt(this.centerForm.offlineCourseNum) || 0;
  903. let giveNum = this.giveNum;
  904. let giveClassType = this.centerForm.radio;
  905. if (giveClassType == "ONLINE") {
  906. // 线上
  907. online += giveNum;
  908. } else if (giveClassType == "OFFLINE") {
  909. offline += giveNum;
  910. }
  911. // 这里判断是否选择了排课开始时间
  912. if (online && !this.maskForm.courseStartOnline) {
  913. this.$message.error("选择了线上课 但没有线上课开始时间");
  914. return;
  915. }
  916. if (offline && !this.maskForm.courseStartOffline) {
  917. this.$message.error("选择了线下课 但没有线下课开始时间");
  918. return;
  919. }
  920. let date, date1;
  921. if (this.maskForm.courseStartOnline) {
  922. date = new Date(this.maskForm.courseStartOnline.getTime());
  923. }
  924. if (this.maskForm.courseStartOffline) {
  925. date1 = new Date(this.maskForm.courseStartOffline.getTime());
  926. }
  927. // let startWeekday = this.maskForm.courseStart.getDay();
  928. let onlineList = []; // 装线上课的数组
  929. let offlineList = []; //装线下课的数组
  930. if (this.lookList.length <= 0) {
  931. this.$message.error("请先排课后再点击确认按钮");
  932. return;
  933. }
  934. for (let i in this.lookList) {
  935. if (this.lookList[i].type == "线上课") {
  936. onlineList.push({
  937. week: this.lookList[i].weekDay,
  938. date: this.lookList[i]
  939. });
  940. }
  941. if (this.lookList[i].type == "线下课") {
  942. offlineList.push({
  943. week: this.lookList[i].weekDay,
  944. date: this.lookList[i]
  945. });
  946. }
  947. }
  948. // console.log(onlineList + '----------------------------------------------------------------------------------');
  949. // console.log(offlineList);
  950. if (online > 0 && onlineList.length <= 0) {
  951. this.$message.error("选择了线上课但未排线上课");
  952. this.timeTable = [];
  953. return;
  954. }
  955. if (offline > 0 && offlineList.length <= 0) {
  956. this.$message.error("选择了线下课但未排线下课");
  957. this.timeTable = [];
  958. return;
  959. }
  960. // 获取要排课的总数 获取每周要排多少次
  961. while (online && online > 0) {
  962. // 排线上课g
  963. for (let i in onlineList) {
  964. let num;
  965. onlineList[i].week - date.getDay() >= 0
  966. ? (num = onlineList[i].week - date.getDay())
  967. : (num = onlineList[i].week - date.getDay() + 7); // +差值的天数://差值的天数+7
  968. // console.log(num);
  969. let dataStr = this.getThinkDate(date, num);
  970. this.timeTable.push({
  971. classDate: dataStr + " 00:00:00",
  972. actualTeacherId: this.leftForm.teacher,
  973. startClassTimeStr: onlineList[i].date.startTime,
  974. endClassTimeStr: onlineList[i].date.endTime,
  975. teachMode: "ONLINE"
  976. });
  977. online--;
  978. if (online == 0) break;
  979. }
  980. if (onlineList.length == 1 || this.isAllEqual(onlineList)) {
  981. date.setDate(date.getDate() + 7);
  982. }
  983. // 加一周
  984. }
  985. // console.log(date1)
  986. while (offline && offline > 0) {
  987. // 排线下课
  988. for (let i in offlineList) {
  989. let num;
  990. offlineList[i].week - date1.getDay() >= 0
  991. ? (num = offlineList[i].week - date1.getDay())
  992. : (num = offlineList[i].week - date1.getDay() + 7); // +差值的天数://差值的天数+7
  993. let dataStr = this.getThinkDate(date1, num);
  994. this.timeTable.push({
  995. classDate: dataStr + " 00:00:00",
  996. actualTeacherId: this.leftForm.teacher,
  997. startClassTimeStr: offlineList[i].date.startTime,
  998. endClassTimeStr: offlineList[i].date.endTime,
  999. teachMode: "OFFLINE"
  1000. });
  1001. offline--;
  1002. if (offline == 0) break;
  1003. }
  1004. // 加一周
  1005. if (offlineList.length == 1 || this.isAllEqual(offlineList)) {
  1006. date1.setDate(date1.getDate() + 7);
  1007. }
  1008. }
  1009. // console.log(this.timeTable);
  1010. this.dialogFormVisible = false;
  1011. },
  1012. getThinkDate(date, num) {
  1013. let Stamp = date;
  1014. Stamp.setDate(date.getDate() + num); // 获取当前月数的第几天
  1015. // console.log(date.getMonth() + 1)
  1016. // console.log(Stamp.getMonth() + 1)
  1017. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  1018. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1019. var mvar = "";
  1020. if (month < 10) {
  1021. mvar = "0" + month;
  1022. } else {
  1023. mvar = month + "";
  1024. }
  1025. var day = Stamp.getDate();
  1026. var dvar = "";
  1027. if (day < 10) {
  1028. dvar = "0" + day;
  1029. } else {
  1030. dvar = day + "";
  1031. }
  1032. // console.log(year + "-" + mvar + '-' + dvar);
  1033. return year + "-" + mvar + "-" + dvar;
  1034. },
  1035. // 计算课酬
  1036. computational() {
  1037. this.computationalBtn = true;
  1038. let userId = this.leftForm.teacher || null;
  1039. let giveTeachMode = this.centerForm.radio || null;
  1040. let vipGroupCategoryId = this.leftForm.courseType || null;
  1041. let vipGroupActivityId = this.leftForm.activeType || null;
  1042. let onlineClassesUnitPrice = this.rightForm.onlinePrice || null;
  1043. let offlineClassesUnitPrice = this.rightForm.offlinePrice || null;
  1044. let onlineClassesNum = this.centerForm.onlineCourseNum || 0;
  1045. let offlineClassesNum = this.centerForm.offlineCourseNum || 0;
  1046. let singleClassMinutes = this.leftForm.classTime;
  1047. if (this.hotType == "GIVE_CLASS") {
  1048. if (this.centerForm.radio == "ONLINE") {
  1049. onlineClassesNum =
  1050. parseInt(onlineClassesNum) + parseInt(this.giveNum);
  1051. } else if (this.centerForm.radio == "OFFLINE") {
  1052. offlineClassesNum =
  1053. parseInt(offlineClassesNum) + parseInt(this.giveNum);
  1054. }
  1055. }
  1056. let onlineTeacherSalary = this.rightForm.onlineCourse || null;
  1057. let offlineTeacherSalary = this.rightForm.offlineCourse || null;
  1058. getVipGroupCostCount({
  1059. vipGroupActivityId,
  1060. onlineClassesUnitPrice,
  1061. onlineTeacherSalary,
  1062. offlineTeacherSalary,
  1063. vipGroupCategoryId,
  1064. offlineClassesUnitPrice,
  1065. onlineClassesNum,
  1066. offlineClassesNum,
  1067. userId,
  1068. giveTeachMode,
  1069. singleClassMinutes
  1070. }).then(res => {
  1071. if (res.code == 200) {
  1072. this.rightForm.onlineCourse = res.data.onlineTeacherSalary;
  1073. this.rightForm.offlineCourse = res.data.offlineTeacherSalary;
  1074. this.rightForm.allPrice = res.data.totalPrice;
  1075. }
  1076. });
  1077. },
  1078. isAllEqual(array) {
  1079. if (array.length > 0) {
  1080. return !array.some((val, index) => {
  1081. return val.week != array[0].week;
  1082. });
  1083. } else {
  1084. return true;
  1085. }
  1086. },
  1087. submitInfo() {
  1088. if (!this.computationalBtn) {
  1089. this.$message.error("请点击计算按钮计算课酬");
  1090. return;
  1091. }
  1092. // 判断线上课课酬和线下课课酬
  1093. let online = parseInt(this.centerForm.onlineCourseNum);
  1094. let offline = parseInt(this.centerForm.offlineCourseNum);
  1095. let giveNum = this.giveNum;
  1096. let giveClassType = this.centerForm.radio;
  1097. if (giveClassType == "ONLINE") {
  1098. // 线上
  1099. online += giveNum;
  1100. } else if (giveClassType == "OFFLINE") {
  1101. offline += giveNum;
  1102. }
  1103. let obj = {};
  1104. obj.courseSchedules = this.timeTable;
  1105. /**
  1106. *
  1107. * teacher: '',
  1108. subject: '',
  1109. courseType: '',
  1110. activeType: '',
  1111. classNum: '',
  1112. classTime: '',
  1113. signUpStart: '',
  1114. signUpEnd: '',
  1115. courseStart: '',
  1116. courseEnd: ''
  1117. */
  1118. let studentIdList = this.rightForm.students.join(",") || null;
  1119. obj.vipGroupApplyBaseInfo = {
  1120. studentIdList,
  1121. coursesExpireDate: this.leftForm.courseEnd,
  1122. teacherSchoolId: this.leftForm.section,
  1123. name: this.leftForm.name,
  1124. offlineClassesNum: offline || 0,
  1125. onlineClassesNum: online || 0,
  1126. offlineClassesUnitPrice: this.rightForm.offlinePrice || 0,
  1127. onlineClassesUnitPrice: this.rightForm.onlinePrice || 0,
  1128. paymentExpireDate: this.leftForm.signUpEnd,
  1129. registrationStartTime: this.leftForm.signUpStart,
  1130. singleClassMinutes: this.leftForm.classTime,
  1131. studentNum: this.leftForm.classNum,
  1132. userId: this.leftForm.teacher,
  1133. vipGroupActivityId: this.leftForm.activeType,
  1134. vipGroupCategoryId: this.leftForm.courseType,
  1135. onlineTeacherSalary: this.rightForm.onlineCourse || 0,
  1136. offlineTeacherSalary: this.rightForm.offlineCourse || 0,
  1137. giveTeachMode: this.centerForm.radio,
  1138. subjectIdList: this.leftForm.subject,
  1139. educationalTeacherId: this.leftForm.educationalTeacherId,
  1140. organId: this.leftForm.classOrganId
  1141. };
  1142. // 调接前判断是新增还是修改
  1143. if (!this.id) {
  1144. // 新增
  1145. createVip(obj).then(res => {
  1146. if (res.code == 200) {
  1147. if (res.data == "ING") {
  1148. this.$confirm(
  1149. "课程提交成功,已提交运营主管审批,审批通过后,课程后创建成功!",
  1150. "提示",
  1151. {
  1152. confirmButtonText: "确定",
  1153. type: "warning"
  1154. }
  1155. ).then(() => {
  1156. // this.$message({
  1157. // type: 'success',
  1158. // message: '提交成功!'
  1159. // });
  1160. this.$message.success("提交成功");
  1161. this.$router.push({
  1162. path: "/business/vipList",
  1163. query: { rules: this.rules, searchForm: this.searchForm }
  1164. });
  1165. });
  1166. } else {
  1167. this.$message.success("恭喜您创建成功");
  1168. this.$router.push({
  1169. path: "/business/vipList",
  1170. query: { rules: this.rules, searchForm: this.searchForm }
  1171. });
  1172. }
  1173. }
  1174. });
  1175. } else {
  1176. // 修改
  1177. obj.vipGroupApplyBaseInfo.id = this.id;
  1178. updateVipBaseInfo(obj.vipGroupApplyBaseInfo).then(res => {});
  1179. }
  1180. },
  1181. setSection(val) {
  1182. this.leftForm.section = "";
  1183. this.rightForm.offlineCourse = "";
  1184. this.rightForm.onlineCourse = "";
  1185. this.leftForm.courseType = "";
  1186. if(val) {
  1187. getTeachSchool({ userId: val }).then(res => {
  1188. if (res.code == 200) {
  1189. this.scetionList = res.data;
  1190. }
  1191. });
  1192. }
  1193. for (let i in this.teacherList) {
  1194. if (this.teacherList[i].id == val) {
  1195. // 根据分部id去获取课程形式
  1196. vipGroupCategory({ organId: this.teacherList[i].organId }).then(
  1197. res => {
  1198. if (res.code == 200) {
  1199. this.courseTypeList = res.data;
  1200. }
  1201. }
  1202. );
  1203. }
  1204. }
  1205. this.getClassOrgan() // 获取公用部分
  1206. },
  1207. getClassOrgan() { // 获取公用分部
  1208. const leftForm = this.leftForm
  1209. let teacher = leftForm.teacher ? leftForm.teacher : null
  1210. let educationalTeacherId = leftForm.educationalTeacherId ? leftForm.educationalTeacherId : null
  1211. leftForm.classOrganId = null // 重置课程分部数据
  1212. this.classOrganList = []
  1213. if(!teacher || !educationalTeacherId) { // 如果没有选择指导老师和教务老师则不请求
  1214. return
  1215. }
  1216. getPublicOrgans({ teacherId: teacher, eduTeacherId: educationalTeacherId }).then(res => {
  1217. if(res.code == 200) {
  1218. let result = res.data ? res.data : []
  1219. this.classOrganList = result
  1220. }
  1221. })
  1222. },
  1223. onCancel() {
  1224. this.$router.push({
  1225. path: "/business/vipList",
  1226. query: { rules: this.rules, searchForm: this.searchForm }
  1227. });
  1228. },
  1229. setCourse() {
  1230. if (
  1231. this.hotType == "GIVE_CLASS" &&
  1232. this.isGiveClass &&
  1233. !this.centerForm.radio
  1234. ) {
  1235. this.$message.error("您还未选择赠课类型");
  1236. return;
  1237. }
  1238. this.$refs["leftForm"].validate(vali => {
  1239. if (vali) {
  1240. this.dialogFormVisible = true;
  1241. }
  1242. });
  1243. },
  1244. setVipInfo(data) {
  1245. this.leftForm.name = data.name;
  1246. this.leftForm.subject = parseInt(data.subjectIdList);
  1247. // 激活声部下的所有老师
  1248. this.changeSubject(parseInt(data.subjectIdList));
  1249. // 设置老师
  1250. this.leftForm.teacher = data.userId;
  1251. this.setSection(data.userId);
  1252. // 课程形式
  1253. this.leftForm.courseType = data.vipGroupCategoryId;
  1254. // 获取课程形式下的活动方案
  1255. this.changeType(this.leftForm.courseType);
  1256. // 根据课程形式获取活动方案
  1257. this.leftForm.activeType = data.vipGroupActivityId;
  1258. setTimeout(res => {
  1259. this.chioseActive(data.vipGroupActivityId);
  1260. }, 1000);
  1261. this.leftForm.section = data.teacherSchoolId;
  1262. this.leftForm.classNum = data.studentNum;
  1263. this.leftForm.classTime = data.singleClassMinutes;
  1264. this.leftForm.signUpStart = data.registrationStartTime;
  1265. this.leftForm.signUpEnd = data.paymentExpireDate;
  1266. this.centerForm.onlineCourseNum = data.onlineClassesNum;
  1267. this.centerForm.offlineCourseNum = data.offlineCourseNum;
  1268. /**
  1269. * rightForm: {
  1270. onlineCourse: '',
  1271. offlineCourse: '',
  1272. onlinePrice: '',
  1273. offlinePrice: '',
  1274. allPrice: ''
  1275. },
  1276. *
  1277. */
  1278. this.rightForm.onlineCourse = data.onlineTeacherSalary;
  1279. this.rightForm.onlinePrice = data.onlineClassesUnitPrice;
  1280. this.rightForm.offlineCourse = data.offlineTeacherSalary;
  1281. this.rightForm.offlinePrice = data.offlineClassesUnitPrice;
  1282. this.rightForm.allPrice = data.totalPrice;
  1283. //subjectIdList
  1284. },
  1285. remoteMethod(query) {
  1286. if (query !== "") {
  1287. this.remoteLoading = true;
  1288. // 发请求搜索
  1289. const url = "/api-web/studentManage/queryOrganStudentList"
  1290. const options = {
  1291. method: "get",
  1292. headers: {
  1293. Authorization: getToken()
  1294. },
  1295. params: {
  1296. rows: 100,
  1297. search: query,
  1298. organId: this.leftForm.classOrganId
  1299. },
  1300. url
  1301. }
  1302. this.remoteLoading = true
  1303. axios(options).then(res => {
  1304. this.remoteLoading = false
  1305. let result = res.data
  1306. if (result.code == 200) {
  1307. this.studentList = this.studentList.concat(result.data.rows);
  1308. this.unique(this.studentList, "userId");
  1309. }
  1310. })
  1311. // queryStudentList({ rows: 100, search: query }).then(res => {
  1312. // if (res.code == 200) {
  1313. // this.remoteLoading = false;
  1314. // this.studentList = this.studentList.concat(res.data.rows);
  1315. // this.unique(this.studentList, "userId");
  1316. // }
  1317. // });
  1318. }
  1319. },
  1320. unique(arr, u_key) {
  1321. let obj = {};
  1322. arr.reduce((prev, next) => {
  1323. obj[next[u_key] + typeof next[u_key]]
  1324. ? ""
  1325. : (obj[next[u_key] + typeof next[u_key]] = true && prev.push(next));
  1326. return prev;
  1327. }, []);
  1328. }
  1329. }
  1330. // watch: {
  1331. // rightForm: {
  1332. // handler (newName, oldName) {
  1333. // this.computationalBtn = false
  1334. // },
  1335. // deep: true
  1336. // }
  1337. // }
  1338. };
  1339. </script>
  1340. <style lang="scss" scoped>
  1341. .m-core {
  1342. margin-top: 30px;
  1343. display: flex;
  1344. flex-direction: row;
  1345. justify-content: space-around;
  1346. .el-input {
  1347. width: 180px;
  1348. }
  1349. h4 {
  1350. font-size: 16px;
  1351. background-color: #ccc;
  1352. color: #fff;
  1353. text-align: center;
  1354. width: 100%;
  1355. height: 40px;
  1356. line-height: 40px;
  1357. margin-bottom: 20px;
  1358. }
  1359. .vipLeft {
  1360. width: 400px;
  1361. // h4 {
  1362. // font-size: 16px;
  1363. // background-color: #ccc;
  1364. // color: #fff;
  1365. // text-align: center;
  1366. // width: 100%;
  1367. // height: 40px;
  1368. // line-height: 40px;
  1369. // margin-bottom: 20px;
  1370. // }
  1371. }
  1372. .center {
  1373. width: 400px;
  1374. }
  1375. .right {
  1376. width: 400px;
  1377. }
  1378. }
  1379. .planList {
  1380. padding: 0 25px;
  1381. .planTop {
  1382. height: 40px;
  1383. line-height: 40px;
  1384. display: flex;
  1385. flex-direction: row;
  1386. justify-content: space-between;
  1387. border-bottom: 1px solid #ccc;
  1388. margin-top: 20px;
  1389. > p {
  1390. font-size: 14px;
  1391. }
  1392. }
  1393. .planCore {
  1394. .row {
  1395. width: 100%;
  1396. display: flex;
  1397. flex-direction: row;
  1398. justify-content: space-between;
  1399. flex-wrap: nowrap;
  1400. height: 40px;
  1401. line-height: 40px;
  1402. font-size: 14px;
  1403. text-align: center;
  1404. div {
  1405. width: 87px;
  1406. }
  1407. // div {
  1408. // &:nth-child(1) {
  1409. // text-align: left;
  1410. // }
  1411. // }
  1412. }
  1413. }
  1414. }
  1415. .okBtn {
  1416. width: 120px;
  1417. height: 40px;
  1418. line-height: 40px;
  1419. text-align: center;
  1420. color: #fff;
  1421. border-radius: 4px;
  1422. margin-right: 20px;
  1423. cursor: pointer;
  1424. background-color: #f97215;
  1425. float: right;
  1426. }
  1427. </style>