vipReset.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header @back="goBack" content="VIP修改"></el-page-header>
  5. </h2>
  6. <div class="vipwrap">
  7. <div
  8. class="newBand"
  9. v-permission="'vipGroupManage/appendVipGroupCourseSchedules'"
  10. @click="addCourse"
  11. >VIP加课</div>
  12. <div class="newBand" v-permission="'courseSchedule/vipCourseAdjust'" @click="adjustment">批量调整</div>
  13. <div
  14. class="newBand"
  15. v-permission="'vipGroupManage/updateVipBaseInfo'"
  16. @click="addrVisible = true"
  17. >修改教学点</div>
  18. </div>
  19. <div class="tableWrap">
  20. <el-table
  21. :data="tableList"
  22. @selection-change="handleSelectionChange"
  23. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  24. >
  25. <el-table-column type="selection" :selectable="isDisabled" width="55"></el-table-column>
  26. <el-table-column label="课程名称" align="center" prop="name"></el-table-column>
  27. <!-- <el-table-column label="班级id"
  28. align="center"
  29. prop="classGroupId">
  30. </el-table-column>-->
  31. <el-table-column label="上课日期" align="center" prop="classDate">
  32. <template slot-scope="scope">
  33. <div>{{ scope.row.classDate | formatTimer}}</div>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="课程状态" align="center" prop="status">
  37. <template slot-scope="scope">
  38. <div>{{ scope.row.status | coursesStatus }}</div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="结算状态" align="center">
  42. <template slot-scope="scope">
  43. <div>{{scope.row.isSettlement?'已结算':'未结算'}}</div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="开始时间" align="center" prop="startClassTimeStr"></el-table-column>
  47. <el-table-column label="结束时间" align="center" prop="endClassTimeStr"></el-table-column>
  48. <el-table-column label="课程类型" align="center">
  49. <template slot-scope="scope">
  50. <div>{{ scope.row.teachMode | teachMode }}</div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="教学点" align="center" prop="schoolName">
  54. <template slot-scope="scope">
  55. <div>
  56. {{scope.row.schoolName?scope.row.schoolName:'网络教室'}}
  57. </div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="操作">
  61. <template slot-scope="scope">
  62. <div>
  63. <el-button
  64. type="text"
  65. v-permission="'courseSchedule/classStartDateAdjust'"
  66. v-if="!scope.row.isSettlement"
  67. @click="resetClass(scope.row)"
  68. >调整</el-button>
  69. <el-button
  70. type="text"
  71. v-permission="'courseSchedule/bathDelete'"
  72. v-if="scope.row.status != 'OVER'"
  73. @click="removeClass(scope.row)"
  74. >删除</el-button>
  75. </div>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <pagination
  80. :total="rules.total"
  81. :page.sync="rules.page"
  82. :limit.sync="rules.limit"
  83. :page-sizes="rules.page_size"
  84. @pagination="getList"
  85. />
  86. </div>
  87. <el-dialog title="课程调整" width="400px" :before-close="handleClose" :visible.sync="courseVisible">
  88. <el-form
  89. :model="maskForm"
  90. ref="maskForm"
  91. :rules="maskRules"
  92. label-position="right"
  93. label-width="80px;"
  94. :inline="true"
  95. >
  96. <el-form-item label="上课日期" prop="date">
  97. <el-date-picker
  98. v-model="maskForm.date"
  99. style="width:200px!important;"
  100. type="date"
  101. value-format="yyyy-MM-dd"
  102. placeholder="选择日期"
  103. ></el-date-picker>
  104. </el-form-item>
  105. <el-form-item label="开始时间" prop="startTime">
  106. <el-time-select
  107. placeholder="起始时间"
  108. style="width:200px!important;"
  109. v-model="startTime"
  110. :picker-options="{
  111. start: '04:30',
  112. step: '00:05',
  113. end: '23:30'
  114. }"
  115. ></el-time-select>
  116. </el-form-item>
  117. <!-- <el-form-item label="结束时间"
  118. prop="endTime">
  119. <el-time-select placeholder="结束时间"
  120. v-model="maskForm.endTime"
  121. :picker-options="{
  122. start: '04:30',
  123. step: '00:05',
  124. end: '23:30',
  125. minTime: maskForm.startTime
  126. }">
  127. </el-time-select>
  128. </el-form-item> v-if="maskForm.teachMode=='OFFLINE'"-->
  129. <el-form-item label="课程类型" prop="courseType">
  130. <el-select clearable v-model="maskForm.teachMode">
  131. <el-option label="线上课" value="ONLINE"></el-option>
  132. <el-option label="线下课" value="OFFLINE"></el-option>
  133. </el-select>
  134. </el-form-item>
  135. <el-form-item label="教学地点" v-if="maskForm.teachMode == 'OFFLINE'">
  136. <el-select v-model="maskForm.address" filterable clearable>
  137. <el-option
  138. v-for="(item,index) in schoolList"
  139. :key="index"
  140. :value="item.id"
  141. :label="item.name"
  142. ></el-option>
  143. </el-select>
  144. </el-form-item>
  145. </el-form>
  146. <div slot="footer" class="dialog-footer">
  147. <el-button @click="courseVisible = false">取 消</el-button>
  148. <el-button type="primary" @click="submitResetClass">确 定</el-button>
  149. </div>
  150. </el-dialog>
  151. <!-- a -->
  152. <!-- <el-dialog title="vip加课"
  153. width="1000px"
  154. :visible.sync="addCourseVisible">
  155. <el-button type="text"
  156. @click="addOneChiose">添加</el-button>
  157. <el-table :data='addTable'>
  158. <el-table-column label="上课日期"
  159. align="center"
  160. prop="name">
  161. <template slot-scope="scope">
  162. <div>
  163. <el-date-picker v-model="scope.row.classDate"
  164. style="width:200px!important"
  165. type="date"
  166. placeholder="选择日期">
  167. </el-date-picker>
  168. </div>
  169. </template>
  170. </el-table-column>
  171. <el-table-column label="课程开始时间"
  172. align="center"
  173. prop="startClassTimeStr">
  174. <template slot-scope="scope">
  175. <div>
  176. <el-time-select v-model="scope.row.startClassTimeStr"
  177. style="width:150px!important"
  178. :picker-options="{
  179. start: '04:30',
  180. step: '00:05',
  181. end: '23:30'
  182. }"
  183. placeholder="选择时间">
  184. </el-time-select>
  185. </div>
  186. </template>
  187. </el-table-column>
  188. <el-table-column label="课程形态"
  189. align="center"
  190. prop="name">
  191. <template slot-scope="scope">
  192. <div>
  193. <el-select v-model="scope.row.teachMode">
  194. <el-option label="线上课"
  195. value="ONLINE"></el-option>
  196. <el-option label="线下课"
  197. value="OFFLINE"></el-option>
  198. </el-select>
  199. </div>
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="操作"
  203. align="center">
  204. <template slot-scope="scope">
  205. <div>
  206. <el-button type="text"
  207. @click="removeMarkCourse(scope.row)">删除</el-button>
  208. </div>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. <span slot="footer"
  213. class="dialog-footer">
  214. <el-button @click="addCourseVisible = false">取 消</el-button>
  215. <el-button type="primary"
  216. @click="submitAdd">确 定</el-button>
  217. </span>
  218. </el-dialog>-->
  219. <el-dialog :title="adjustmentName" width="800px" :visible.sync="adjustmentVisible">
  220. <el-form
  221. :model="adjustmentForm"
  222. label-position="right"
  223. label-width="120px"
  224. ref="adjustmentForm"
  225. :rules="adjustmentRules"
  226. :inline="true"
  227. >
  228. <el-form-item label="已选择课时数" v-if="!isaddCourse">
  229. <el-input disabled v-model="adjustmentForm.count"></el-input>
  230. </el-form-item>
  231. <el-form-item label="添加课时数" prop="addCount" v-if="isaddCourse">
  232. <el-input type="number" @mousewheel.native.prevent v-model="adjustmentForm.addCount"></el-input>
  233. </el-form-item>
  234. <br />
  235. <el-form-item label="单课费用" prop="fee" v-if="isaddCourse">
  236. <el-input v-model="adjustmentForm.fee"></el-input>
  237. </el-form-item>
  238. <!-- v-if='isaddCourse' v-if="adjustmentForm.courseType=='OFFLINE'" -->
  239. <el-form-item label="课程类型" prop="courseType">
  240. <el-select clearable v-model="adjustmentForm.courseType">
  241. <el-option label="线上课" value="ONLINE"></el-option>
  242. <el-option label="线下课" value="OFFLINE"></el-option>
  243. </el-select>
  244. </el-form-item>
  245. <br />
  246. <el-form-item label="排课起始时间" prop="courseTime">
  247. <el-date-picker
  248. v-model="adjustmentForm.courseTime"
  249. :picker-options="pickerOptions"
  250. style="width:200px!important;"
  251. type="date"
  252. value-format="yyyy-MM-dd"
  253. placeholder="选择日期"
  254. ></el-date-picker>
  255. <el-checkbox style="margin-left:10px;" v-model="adjustmentForm.checked">是否跳过节假日</el-checkbox>
  256. </el-form-item>
  257. </el-form>
  258. <div class="WeekWrap">
  259. <h3 style="margin-bottom:20px;">
  260. 循环次数
  261. <el-button type="text" style="margin-left:10px;" @click="addWeek">添加</el-button>
  262. </h3>
  263. <div class="countWrap" style="margin-bottom:10px;">
  264. <div
  265. class="countItem"
  266. style="margin-bottom:20px;"
  267. v-for="(item,index) in weekList"
  268. :key="index"
  269. >
  270. <span>循环周期:</span>
  271. <el-select v-model="item.dayOfWeek" filterable clearable>
  272. <el-option
  273. v-for="(item,index) in weekDateList"
  274. :key="index"
  275. :label="item.label"
  276. :value="item.value"
  277. ></el-option>
  278. </el-select>
  279. <span style="margin-left:10px;">开始时间</span>
  280. <el-time-select
  281. style="margin-left:10px;"
  282. placeholder
  283. v-model="item.startClassTime"
  284. :picker-options="{
  285. start: '04:30',
  286. step: '00:05',
  287. end: '23:55'
  288. }"
  289. ></el-time-select>
  290. <el-button
  291. style="margin-left:10px;"
  292. type="danger"
  293. @click="removeWeek(item)"
  294. icon="el-icon-delete"
  295. circle
  296. ></el-button>
  297. </div>
  298. </div>
  299. </div>
  300. <div slot="footer" class="dialog-footer">
  301. <el-button @click="adjustmentVisible = false">取 消</el-button>
  302. <el-button type="primary" v-if="!isaddCourse" @click="submitAdjustment">确 定</el-button>
  303. <el-button type="primary" v-if="isaddCourse" @click="addCourseSubmit">确 定</el-button>
  304. </div>
  305. </el-dialog>
  306. <!-- 批量修改教学点 -->
  307. <el-dialog title="教学点" width="400px" :visible.sync="addrVisible">
  308. <el-form :model="addrForm">
  309. <el-form-item label="教学点">
  310. <el-select v-model="addrForm.address" clearable filterable>
  311. <el-option
  312. v-for="(item,index) in schoolList"
  313. :key="index"
  314. :value="item.id"
  315. :label="item.name"
  316. ></el-option>
  317. </el-select>
  318. </el-form-item>
  319. </el-form>
  320. <span slot="footer" class="dialog-footer">
  321. <el-button @click="addrVisible = false">取 消</el-button>
  322. <el-button type="primary" @click="resetAddrSubmit">确 定</el-button>
  323. </span>
  324. </el-dialog>
  325. </div>
  326. </template>
  327. <script>
  328. import { resetCourse } from "@/api/buildTeam";
  329. // import { getSchool } from '@/api/systemManage'
  330. import pagination from "@/components/Pagination/index";
  331. import {
  332. findVipGroupCourseSchedules,
  333. bathDelete,
  334. appendVipGroupCourseSchedules,
  335. vipCourseAdjust,
  336. updateVipBaseInfo,
  337. batchAppendVipGroupCourses
  338. } from "@/api/vipSeting";
  339. import { getTeachSchool } from "@/api/teacherManager";
  340. export default {
  341. components: {
  342. pagination
  343. },
  344. data() {
  345. return {
  346. pickerOptions: {
  347. disabledDate(time) {
  348. return time.getTime() + 86400000 <= new Date().getTime();
  349. }
  350. },
  351. addrVisible: false,
  352. adjustmentVisible: false,
  353. addCourseVisible: false,
  354. courseVisible: false,
  355. tableList: [],
  356. addTable: [],
  357. courseTime: "",
  358. vipid: "",
  359. addrForm: {
  360. address: ""
  361. },
  362. maskForm: {
  363. date: "",
  364. startTime: "",
  365. endTime: "",
  366. id: "",
  367. address: "",
  368. teachMode: ""
  369. },
  370. rules: {
  371. // 分页规则
  372. limit: 50, // 限制显示条数
  373. page: 1, // 当前页
  374. total: 0, // 总条数
  375. page_size: [50, 100] // 选择限制显示条数
  376. },
  377. maskRules: {
  378. date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
  379. // startTime: [{ required: true, message: '请选择上课开始时间', trigger: 'blur' },],
  380. endTime: [
  381. { required: true, message: "请选择上课结束时间", trigger: "blur" }
  382. ]
  383. },
  384. schoolList: [],
  385. Frules: null,
  386. FsearchForm: null,
  387. adjustmentForm: {
  388. count: "",
  389. courseTime: "",
  390. checked: false,
  391. addCount: "",
  392. courseType: "",
  393. fee: ""
  394. },
  395. adjustmentRules: {
  396. courseTime: [{ required: true, message: "请选择开始时间" }],
  397. addCount: [{ required: true, message: "请输入加课次数" }],
  398. courseType: [{ required: true, message: "请选择课程类型" }],
  399. fee: [{ required: true, message: "请输入费用" }]
  400. },
  401. weekDateList: [
  402. { value: "1", label: "星期一" },
  403. { value: "2", label: "星期二" },
  404. { value: "3", label: "星期三" },
  405. { value: "4", label: "星期四" },
  406. { value: "5", label: "星期五" },
  407. { value: "6", label: "星期六" },
  408. { value: "7", label: "星期日" }
  409. ],
  410. weekList: [
  411. {
  412. dayOfWeek: "",
  413. startTime: "",
  414. endTime: "",
  415. moid: new Date().getTime()
  416. }
  417. ],
  418. activeList: [],
  419. // 改版加课
  420. isaddCourse: false,
  421. adjustmentName: "",
  422. startTime: ""
  423. };
  424. },
  425. created() {
  426. this.__init();
  427. },
  428. mounted() {
  429. this.getList();
  430. },
  431. activated() {
  432. this.__init();
  433. this.getList();
  434. },
  435. methods: {
  436. __init() {
  437. this.vipid = this.$route.query.id;
  438. if (this.$route.query.rules) {
  439. this.Frules = this.$route.query.rules;
  440. }
  441. if (this.$route.query.searchForm) {
  442. this.FsearchForm = this.$route.query.searchForm;
  443. }
  444. },
  445. getList() {
  446. findVipGroupCourseSchedules({
  447. vipGroupId: this.vipid,
  448. rows: this.rules.limit,
  449. page: this.rules.page
  450. }).then(res => {
  451. if (res.code == 200) {
  452. this.tableList = res.data.pageInfo.rows;
  453. this.rules.total = res.data.pageInfo.total;
  454. this.courseTime = res.data.singleClassMinutes;
  455. if (this.tableList.length > 0) {
  456. getTeachSchool({
  457. userId: res.data.pageInfo.rows[0].teacherId
  458. }).then(res => {
  459. if (res.code == 200) {
  460. this.schoolList = res.data;
  461. }
  462. });
  463. }
  464. }
  465. });
  466. },
  467. goBack() {
  468. this.$router.push({
  469. path: "/business/vipList",
  470. query: { rules: this.Frules, searchForm: this.FsearchForm }
  471. });
  472. },
  473. resetClass(row) {
  474. /**
  475. * maskForm.startTime
  476. *
  477. */
  478. this.maskForm.date = row.classDate;
  479. this.startTime = row.startClassTimeStr;
  480. // this.maskForm.endTime = row.endClassTimeStr;
  481. this.maskForm.id = row.id;
  482. this.maskForm.address = row.schoolId;
  483. this.maskForm.teachMode = row.teachMode;
  484. // 修改课时
  485. this.courseVisible = true;
  486. },
  487. handleClose() {
  488. this.courseVisible = false;
  489. this.startTime = "";
  490. this.maskForm = {
  491. date: "",
  492. startTime: "",
  493. endTime: "",
  494. id: "",
  495. address: "",
  496. teachMode: ""
  497. };
  498. this.$refs["maskForm"].resetFields();
  499. },
  500. submitResetClass() {
  501. // endClassTimeStr: this.maskForm.endTime,
  502. if (!this.startTime) {
  503. this.$message.error("请填写修改时间");
  504. return;
  505. }
  506. let obj = {
  507. startClassTimeStr: this.startTime,
  508. id: this.maskForm.id,
  509. classDate: this.maskForm.date,
  510. schoolId: this.maskForm.address || null,
  511. teachMode: this.maskForm.teachMode || null
  512. };
  513. resetCourse(obj).then(res => {
  514. if (res.code == 200) {
  515. this.$message.success("修改成功");
  516. this.courseVisible = false;
  517. this.getList();
  518. } //else {
  519. // this.$message.error(res.msg)
  520. // }
  521. });
  522. },
  523. removeClass(row) {
  524. this.$confirm("是否删除该vip课程?", "提示", {
  525. confirmButtonText: "确定",
  526. cancelButtonText: "取消",
  527. type: "warning"
  528. }).then(() => {
  529. bathDelete({ courseScheduleIds: row.id }).then(res => {
  530. if (res.code == 200) {
  531. this.$message.success("删除成功");
  532. this.getList();
  533. }
  534. });
  535. });
  536. },
  537. // vip 家课
  538. addCourse() {
  539. this.adjustmentName = "vip加课";
  540. this.isaddCourse = true;
  541. this.adjustmentVisible = true;
  542. // this.adjustmentForm.count = 0;
  543. // this.addCourseVisible = true;
  544. },
  545. addOneChiose() {
  546. this.addTable.push({
  547. classDate: "",
  548. startClassTimeStr: "",
  549. endClassTimeStr: "",
  550. teachMode: "",
  551. moid: new Date().getTime()
  552. });
  553. },
  554. removeMarkCourse(row) {
  555. for (let i in this.addTable) {
  556. if (this.addTable[i].moid == row.moid) {
  557. this.addTable.splice(i, 1);
  558. }
  559. }
  560. },
  561. submitAdd() {
  562. let endClassTimeStr = this.MinutesTest(
  563. this.addTable[0].startClassTimeStr,
  564. 90
  565. );
  566. let some = {
  567. vipGroupApplyBaseInfo: {
  568. id: this.vipid
  569. },
  570. courseSchedules: []
  571. };
  572. for (let i in this.addTable) {
  573. let obj = {
  574. classDate: this.addTable[i].classDate,
  575. startClassTimeStr: this.addTable[i].startClassTimeStr,
  576. endClassTimeStr: this.MinutesTest(
  577. this.addTable[i].startClassTimeStr,
  578. this.courseTime
  579. ),
  580. teachMode: this.addTable[i].teachMode
  581. };
  582. some.courseSchedules.push(obj);
  583. }
  584. // 发请求干活
  585. appendVipGroupCourseSchedules(some).then(res => {
  586. if (res.code == 200) {
  587. this.addCourseVisible = false;
  588. this.rules.page = 1;
  589. this.getList();
  590. }
  591. });
  592. },
  593. isDisabled(row, index) {
  594. if (row.isSettlement) {
  595. return false;
  596. } else {
  597. return true;
  598. }
  599. },
  600. // 分钟小时相加减
  601. MinutesTest(str, interval) {
  602. let houer = str.split(":")[0];
  603. let min = str.split(":")[1];
  604. let sdate1 = new Date(1900, 1, 1, houer, min);
  605. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  606. let H = sdate1.getHours();
  607. let M = sdate1.getMinutes();
  608. if (H < 10) H = "0" + H;
  609. if (M < 10) M = "0" + M;
  610. return H + ":" + M;
  611. },
  612. handleSelectionChange(val) {
  613. this.adjustmentForm.count = val.length;
  614. this.activeList = val;
  615. },
  616. addWeek() {
  617. // 添加循环周期
  618. this.weekList.push({
  619. dayOfWeek: "",
  620. startClassTime: "",
  621. endClassTime: "",
  622. id: new Date()
  623. });
  624. },
  625. // 删除循环周
  626. removeWeek(item) {
  627. for (let i in this.weekList) {
  628. if (this.weekList[i].id == item.id) {
  629. this.weekList.splice(i, 1);
  630. }
  631. }
  632. },
  633. adjustment() {
  634. this.adjustmentName = "批量调整";
  635. this.isaddCourse = false;
  636. if (this.adjustmentForm.count <= 0) {
  637. this.$message.error("请至少勾选一节课");
  638. } else {
  639. this.adjustmentVisible = true;
  640. }
  641. },
  642. submitAdjustment() {
  643. this.$refs["adjustmentForm"].validate(item => {
  644. if (item) {
  645. let week = this.weekList;
  646. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  647. this.$message.error("至少排一节课");
  648. return;
  649. }
  650. // 开始
  651. let obj = {};
  652. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  653. let idArr = this.activeList.map(item => {
  654. return item.id;
  655. });
  656. let courseScheduleIds = idArr.join(",");
  657. obj.courseScheduleIds = courseScheduleIds;
  658. obj.courseTimes = this.weekList;
  659. obj.holiday = this.adjustmentForm.checked;
  660. obj.teachMode = this.adjustmentForm.courseType || null;
  661. console.log(obj);
  662. obj.vipGroupId = this.vipid;
  663. vipCourseAdjust(obj).then(res => {
  664. if (res.code == 200) {
  665. this.$message.success("恭喜您修改成功");
  666. this.adjustmentVisible = false;
  667. this.getList();
  668. }
  669. });
  670. }
  671. });
  672. },
  673. addCourseSubmit() {
  674. this.$refs["adjustmentForm"].validate(item => {
  675. if (item) {
  676. let week = this.weekList;
  677. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  678. this.$message.error("至少排一节课");
  679. return;
  680. }
  681. // 开始
  682. let obj = {};
  683. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  684. let idArr = this.activeList.map(item => {
  685. return item.id;
  686. });
  687. let courseScheduleIds = idArr.join(",");
  688. obj.courseScheduleIds = courseScheduleIds;
  689. obj.courseTimes = this.weekList;
  690. obj.holiday = this.adjustmentForm.checked;
  691. obj.vipGroupId = this.vipid;
  692. obj.courseCount = this.adjustmentForm.addCount;
  693. obj.teachMode = this.adjustmentForm.courseType;
  694. obj.singleClassPrice = this.adjustmentForm.fee;
  695. batchAppendVipGroupCourses(obj).then(res => {
  696. if (res.code == 200) {
  697. this.$message.success("恭喜您添加成功");
  698. this.adjustmentVisible = false;
  699. this.getList();
  700. }
  701. });
  702. }
  703. });
  704. },
  705. resetAddrSubmit() {
  706. if (!this.addrForm.address) {
  707. this.$message.error("请选择一个教学点");
  708. return;
  709. }
  710. // 修改教学点
  711. updateVipBaseInfo({
  712. id: this.vipid,
  713. teacherSchoolId: this.addrForm.address
  714. }).then(res => {
  715. if (res.code == 200) {
  716. this.$message.success("修改成功");
  717. this.addrVisible = false;
  718. this.getList();
  719. }
  720. });
  721. }
  722. },
  723. watch: {
  724. adjustmentVisible(val) {
  725. if (!val) {
  726. this.$refs["adjustmentForm"].resetFields();
  727. this.weekList = [];
  728. this.addWeek();
  729. }
  730. },
  731. addrVisible(val) {
  732. if (!val) {
  733. this.addrForm.address = "";
  734. }
  735. }
  736. }
  737. };
  738. </script>
  739. <style lang="scss" scoped>
  740. .vipwrap {
  741. display: flex;
  742. flex-direction: row;
  743. justify-content: flex-start;
  744. .newBand {
  745. margin-right: 20px;
  746. }
  747. }
  748. .resetClassForm {
  749. /deep/.el-date-editor.el-input,
  750. /deep/.el-date-editor.el-input__inner {
  751. width: 180px !important;
  752. }
  753. }
  754. /deep/.el-date-editor.el-input,
  755. /deep/.el-date-editor.el-input__inner {
  756. width: 100px !important;
  757. }
  758. </style>