index.vue 47 KB

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