vipReset.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. <template>
  2. <div>
  3. <div class="titlewrap">
  4. <!-- <h2> class="m-container"
  5. <el-page-header @back="goBack"
  6. :content="name"></el-page-header>
  7. </h2> -->
  8. <!-- <p style="margin-bottom:10px; margin-left:30px;">课程有效期:{{ startClassTime|dayjsFormat }} ~ {{endTime |dayjsFormat}}</p> -->
  9. </div>
  10. <div class="vipwrap">
  11. <!-- <div class="newBand"
  12. v-permission="'vipGroupManage/appendVipGroupCourseSchedules'"
  13. @click="addCourse">VIP加课</div> -->
  14. <el-button v-permission="'courseSchedule/vipCourseAdjust'" @click="adjustment" type="primary"
  15. style="margin-bottom:20px">
  16. 批量调整
  17. </el-button>
  18. <el-button v-permission="'vipGroupManage/updateVipBaseInfo'" @click="addrVisible = true" type="primary"
  19. style="margin-bottom:20px">
  20. 修改教学点
  21. </el-button>
  22. <el-button v-permission="'vipGroupManage/updateVipBaseInfo/courseClass'" @click="educationalVisible = true"
  23. type="primary" style="margin-bottom:20px">
  24. 课程组信息修改
  25. </el-button>
  26. <!-- <div class="newBand"
  27. v-permission="'vipGroupManage/update'"
  28. @click="expireVisible = true">有效期调整</div> -->
  29. </div>
  30. <div class="tableWrap">
  31. <el-table :data="tableList" ref="tableList" @selection-change="handleSelectionChange"
  32. :header-cell-style="{ background: '#EDEEF0', color: '#444' }">
  33. <el-table-column type="selection" :selectable="isDisabled" width="55"></el-table-column>
  34. <el-table-column label="课程名称" align="center" prop="name"></el-table-column>
  35. <el-table-column label="课程编号" align="center" prop="id">
  36. <template slot-scope="scope">
  37. <div>
  38. {{ scope.row.id ? scope.row.id : "--" }}
  39. </div>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="上课日期" align="center" prop="classDate">
  43. <template slot-scope="scope">
  44. <div>{{ scope.row.classDate | formatTimer }}</div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="课程状态" align="center" prop="status">
  48. <template slot-scope="scope">
  49. <div>{{ scope.row.status | coursesStatus }}</div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="是否点名" align="center">
  53. <template slot-scope="scope">
  54. <div>{{ scope.row.isCallNames ? "已点名" : "未点名" }}</div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="结算状态" align="center">
  58. <template slot-scope="scope">
  59. <div>{{ scope.row.isSettlement ? "已结算" : "未结算" }}</div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="开始时间" align="center" prop="startClassTimeStr">
  63. <template slot-scope="scope">
  64. <div>{{ scope.row.startClassTimeStr | timerForMinFormat }}</div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="结束时间" align="center" prop="endClassTimeStr">
  68. <template slot-scope="scope">
  69. <div>{{ scope.row.endClassTimeStr | timerForMinFormat }}</div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="课程类型" align="center">
  73. <template slot-scope="scope">
  74. <div>{{ scope.row.teachMode | teachMode }}</div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="教学点" align="center" prop="schoolName">
  78. <template slot-scope="scope">
  79. <div>
  80. {{ scope.row.schoolName ? scope.row.schoolName : "网络教室" }}
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="操作" width="180" align="center">
  85. <template slot-scope="scope">
  86. <div>
  87. <el-button type="text" v-if="scope.row.id &&
  88. !scope.row.isSettlement &&
  89. $helpers.permission(
  90. 'courseSchedule/classStartDateAdjust/vipReset'
  91. )
  92. " @click="resetClass(scope.row)">调整</el-button>
  93. <el-button type="text" v-if="scope.row.id &&
  94. !scope.row.isSettlement &&
  95. scope.row.status != 'OVER' &&
  96. $helpers.permission('courseSchedule/batchDelete')
  97. " @click="removeClass(scope.row)">删除</el-button>
  98. <!-- -->
  99. <el-button type="text" v-if="scope.row.id &&
  100. !scope.row.isSettlement &&
  101. $helpers.permission('vip/cleanAttendance')
  102. " @click="clearAttend(scope.row)">清除考勤</el-button>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. </el-table>
  107. <pagination sync :total.sync="rules.total" :page.sync="rules.page" :limit.sync="rules.limit"
  108. :page-sizes="rules.page_size" @pagination="getList" />
  109. </div>
  110. <el-dialog title="课程调整" width="400px" :before-close="handleClose" :visible.sync="courseVisible">
  111. <el-form :model="maskForm" class="maskForm" ref="maskForm" :rules="maskRules" label-position="right"
  112. label-width="80px" :inline="true">
  113. <el-form-item label="上课日期" prop="date">
  114. <el-date-picker v-model.trim="maskForm.date" type="date" :picker-options="coursesDate()"
  115. value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  116. </el-form-item>
  117. <el-form-item label="开始时间" prop="startTime">
  118. <el-time-picker placeholder="起始时间" v-model.trim="startTime" @change="changeStartTime" format="HH:mm"
  119. value-format="HH:mm" :picker-options="{
  120. selectableRange: `${nowTime} - 23:30:00`
  121. }"></el-time-picker>
  122. </el-form-item>
  123. <el-form-item label="结束时间" prop="endTime">
  124. <el-time-picker placeholder="结束时间" format="HH:mm" value-format="HH:mm" v-model="maskForm.endTime" disabled>
  125. </el-time-picker>
  126. </el-form-item>
  127. <!--v-if="maskForm.teachMode=='OFFLINE'"-->
  128. <el-form-item label="课程类型" prop="courseType">
  129. <el-select clearable v-model.trim="maskForm.teachMode">
  130. <el-option label="线上课" value="ONLINE"></el-option>
  131. <el-option label="线下课" value="OFFLINE"></el-option>
  132. </el-select>
  133. </el-form-item>
  134. <el-form-item label="教学地点" v-if="maskForm.teachMode == 'OFFLINE'">
  135. <el-select v-model.trim="maskForm.address" filterable clearable>
  136. <el-option v-for="(item, index) in schoolList" :key="index" :value="item.id" :label="item.name"></el-option>
  137. </el-select>
  138. </el-form-item>
  139. </el-form>
  140. <div slot="footer" class="dialog-footer">
  141. <el-button @click="courseVisible = false">取 消</el-button>
  142. <el-button type="primary" @click="submitResetClass">确 定</el-button>
  143. </div>
  144. </el-dialog>
  145. <!-- <el-dialog title="vip加课"
  146. width="1000px"
  147. :visible.sync="addCourseVisible">
  148. <el-button type="text"
  149. @click="addOneChiose">添加</el-button>
  150. <el-table :data='addTable'>
  151. <el-table-column label="上课日期"
  152. align="center"
  153. prop="name">
  154. <template slot-scope="scope">
  155. <div>
  156. <el-date-picker v-model.trim="scope.row.classDate"
  157. style="width:200px!important"
  158. type="date"
  159. placeholder="选择日期">
  160. </el-date-picker>
  161. </div>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="课程开始时间"
  165. align="center"
  166. prop="startClassTimeStr">
  167. <template slot-scope="scope">
  168. <div>
  169. <el-time-select v-model.trim="scope.row.startClassTimeStr"
  170. style="width:150px!important"
  171. :picker-options="{
  172. start: '04:30',
  173. step: '00:05',
  174. end: '23:30'
  175. }"
  176. placeholder="选择时间">
  177. </el-time-select>
  178. </div>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="课程形态"
  182. align="center"
  183. prop="name">
  184. <template slot-scope="scope">
  185. <div>
  186. <el-select v-model.trim="scope.row.teachMode">
  187. <el-option label="线上课"
  188. value="ONLINE"></el-option>
  189. <el-option label="线下课"
  190. value="OFFLINE"></el-option>
  191. </el-select>
  192. </div>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="操作"
  196. align="center">
  197. <template slot-scope="scope">
  198. <div>
  199. <el-button type="text"
  200. @click="removeMarkCourse(scope.row)">删除</el-button>
  201. </div>
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. <span slot="footer"
  206. class="dialog-footer">
  207. <el-button @click="addCourseVisible = false">取 消</el-button>
  208. <el-button type="primary"
  209. @click="submitAdd">确 定</el-button>
  210. </span>
  211. </el-dialog>-->
  212. <el-dialog :title="adjustmentName" width="800px" :visible.sync="adjustmentVisible">
  213. <el-form :model="adjustmentForm" label-position="right" label-width="120px" ref="adjustmentForm"
  214. :rules="adjustmentRules" :inline="true">
  215. <el-form-item label="已选择课时数" v-if="!isaddCourse">
  216. <el-input disabled v-model.trim="adjustmentForm.count"></el-input>
  217. </el-form-item>
  218. <el-form-item label="添加课时数" prop="addCount" v-if="isaddCourse">
  219. <el-input type="number" @mousewheel.native.prevent v-model.trim="adjustmentForm.addCount"></el-input>
  220. </el-form-item>
  221. <br />
  222. <el-form-item label="单课费用" prop="fee" v-if="isaddCourse">
  223. <el-input v-model.trim="adjustmentForm.fee"></el-input>
  224. </el-form-item>
  225. <!-- v-if='isaddCourse' v-if="adjustmentForm.courseType=='OFFLINE'" -->
  226. <el-form-item label="课程类型" prop="courseType">
  227. <el-select clearable v-model.trim="adjustmentForm.courseType">
  228. <el-option label="线上课" value="ONLINE"></el-option>
  229. <el-option label="线下课" value="OFFLINE"></el-option>
  230. </el-select>
  231. </el-form-item>
  232. <el-form-item label="教学地点" v-if="adjustmentForm.courseType == 'OFFLINE'">
  233. <el-select v-model.trim="adjustmentForm.address" filterable clearable>
  234. <el-option v-for="(item, index) in schoolList" :key="index" :value="item.id" :label="item.name"></el-option>
  235. </el-select>
  236. </el-form-item>
  237. <br />
  238. <el-form-item label="排课起始时间" prop="courseTime">
  239. <el-date-picker v-model.trim="adjustmentForm.courseTime" :picker-options="pickerOptions()"
  240. style="width:200px!important;" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  241. <el-checkbox style="margin-left:10px;" v-model.trim="adjustmentForm.checked">是否跳过节假日</el-checkbox>
  242. </el-form-item>
  243. </el-form>
  244. <div class="WeekWrap">
  245. <h3 style="margin-bottom:20px;">
  246. 循环次数
  247. <el-button type="text" style="margin-left:10px;" @click="addWeek">添加</el-button>
  248. </h3>
  249. <div class="countWrap" style="margin-bottom:10px;">
  250. <div class="countItem" style="margin-bottom:20px;" v-for="(item, index) in weekList" :key="index">
  251. <span>循环周期:</span>
  252. <el-select v-model.trim="item.dayOfWeek" filterable clearable>
  253. <el-option v-for="(item, index) in weekDateList" :key="index" :label="item.label"
  254. :value="item.value"></el-option>
  255. </el-select>
  256. <span style="margin-left:10px;">开始时间</span>
  257. <el-time-picker style="margin-left:10px;" placeholder v-model.trim="item.startClassTime" @change="val => {
  258. changeStartTimes(val, item);
  259. }
  260. " format="HH:mm" value-format="HH:mm" :picker-options="{
  261. selectableRange: '06:00:00 - 21:00:00'
  262. }"></el-time-picker>
  263. <span style="margin-left:10px;">结束时间</span>
  264. <el-time-picker style="margin-left:10px;" placeholder v-model.trim="item.endClassTime" format="HH:mm"
  265. value-format="HH:mm" disabled :picker-options="{
  266. selectableRange: '06:00:00 - 21:00:00'
  267. }"></el-time-picker>
  268. <el-button style="margin-left:10px;" type="danger" @click="removeWeek(item)" icon="el-icon-delete"
  269. circle></el-button>
  270. </div>
  271. </div>
  272. </div>
  273. <div slot="footer" class="dialog-footer">
  274. <el-button @click="adjustmentVisible = false">取 消</el-button>
  275. <el-button type="primary" v-if="!isaddCourse" @click="submitAdjustment">确 定</el-button>
  276. <el-button type="primary" v-if="isaddCourse" @click="addCourseSubmit">确 定</el-button>
  277. </div>
  278. </el-dialog>
  279. <!-- 批量修改教学点 -->
  280. <el-dialog title="教学点" width="400px" :visible.sync="addrVisible">
  281. <el-form :model="addrForm">
  282. <el-form-item label="教学点">
  283. <el-select v-model.trim="addrForm.address" clearable filterable>
  284. <el-option v-for="(item, index) in schoolList" :key="index" :value="item.id" :label="item.name"></el-option>
  285. </el-select>
  286. </el-form-item>
  287. </el-form>
  288. <span slot="footer" class="dialog-footer">
  289. <el-button @click="addrVisible = false">取 消</el-button>
  290. <el-button type="primary" @click="resetAddrSubmit">确 定</el-button>
  291. </span>
  292. </el-dialog>
  293. <!-- 课程信息老师 -->
  294. <el-dialog title="课程信息" width="400px" :visible.sync="educationalVisible">
  295. <el-form :model="addrForm" label-width="120px">
  296. <el-form-item label="课程分部" prop="organId">
  297. <el-select v-model.trim="addrForm.organId" filterable @change="onEduTeacher('on')" clearable>
  298. <el-option v-for="(item, index) in organList" :key="index" :label="item.name" :value="item.id" />
  299. </el-select>
  300. </el-form-item>
  301. <el-form-item label="乐团主管" prop="educationalTeacherId">
  302. <el-select v-model.trim="addrForm.educationalTeacherId" filterable :disabled="!addrForm.organId" clearable>
  303. <el-option v-for="(item, index) in educationList" :key="index" :label="item.realName" :value="item.id" />
  304. </el-select>
  305. </el-form-item>
  306. </el-form>
  307. <span slot="footer" class="dialog-footer">
  308. <el-button @click="educationalVisible = false">取 消</el-button>
  309. <el-button type="primary" @click="resetEducationalVisible">确 定</el-button>
  310. </span>
  311. </el-dialog>
  312. <el-dialog title="有效期调整" width="400px" :visible.sync="expireVisible">
  313. <el-form :model="expireForm" ref="expireForm" :rules="expireRules" label-position="right" label-width="80px;"
  314. :inline="true">
  315. <el-form-item label="课程结束时间" prop="coursesExpireDate">
  316. <el-date-picker v-model.trim="expireForm.coursesExpireDate" style="width:200px!important;" type="date"
  317. :picker-options="bigin" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  318. </el-form-item>
  319. <!-- <div style="padding-left: 15px; color: red;">课程结束时间不得晚于,{{ expireForm.tempCoursesExpireDate }}</div> -->
  320. </el-form>
  321. <div slot="footer" class="dialog-footer">
  322. <el-button @click="expireVisible = false">取 消</el-button>
  323. <el-button type="primary" @click="submitExpireDate">确 定</el-button>
  324. </div>
  325. </el-dialog>
  326. </div>
  327. </template>
  328. <script>
  329. import {
  330. resetCourse,
  331. cleanAttendance,
  332. getEmployeeOrgan
  333. } from "@/api/buildTeam";
  334. import { queryEmployByOrganId } from "@/api/systemManage";
  335. // import { getSchool } from '@/api/systemManage'
  336. import pagination from "@/components/Pagination/index";
  337. import {
  338. findVipGroupCourseSchedules,
  339. bathDelete,
  340. appendVipGroupCourseSchedules,
  341. vipCourseAdjust,
  342. updateVipBaseInfo,
  343. batchAppendVipGroupCourses,
  344. vipGroupManageUpdate
  345. } from "@/api/vipSeting";
  346. import { getTeachSchool } from "@/api/teacherManager";
  347. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  348. import dayjs from "dayjs";
  349. let that;
  350. export default {
  351. props: ["vipDetail"],
  352. components: {
  353. pagination
  354. },
  355. data() {
  356. return {
  357. expireVisible: false,
  358. addrVisible: false,
  359. adjustmentVisible: false,
  360. addCourseVisible: false,
  361. courseVisible: false,
  362. educationalVisible: false,
  363. tableList: [],
  364. addTable: [],
  365. educationList: [],
  366. courseTime: "",
  367. vipid: "",
  368. addrForm: {
  369. address: "",
  370. educationalTeacherId: "",
  371. organId: ""
  372. },
  373. maskForm: {
  374. date: "",
  375. startTime: "",
  376. endTime: "",
  377. id: "",
  378. address: "",
  379. teachMode: ""
  380. },
  381. rules: {
  382. // 分页规则
  383. limit: 50, // 限制显示条数
  384. page: 1, // 当前页
  385. total: 0, // 总条数
  386. page_size: [50, 100] // 选择限制显示条数
  387. },
  388. maskRules: {
  389. date: [{ required: true, message: "请选择上课时间", trigger: "blur" }]
  390. // startTime: [{ required: true, message: '请选择上课开始时间', trigger: 'blur' },],
  391. // endTime: [
  392. // { required: true, message: "请选择上课结束时间", trigger: "blur" }
  393. // ]
  394. },
  395. schoolList: [],
  396. Frules: null,
  397. FsearchForm: null,
  398. adjustmentForm: {
  399. count: "",
  400. courseTime: "",
  401. checked: false,
  402. addCount: "",
  403. courseType: "",
  404. fee: "",
  405. address: ""
  406. },
  407. adjustmentRules: {
  408. courseTime: [{ required: true, message: "请选择开始时间" }],
  409. addCount: [{ required: true, message: "请输入加课次数" }],
  410. courseType: [{ required: true, message: "请选择课程类型" }],
  411. fee: [{ required: true, message: "请输入费用" }],
  412. address: [{ required: true, message: "请选择教学地点" }]
  413. },
  414. weekDateList: [
  415. { value: "1", label: "星期一" },
  416. { value: "2", label: "星期二" },
  417. { value: "3", label: "星期三" },
  418. { value: "4", label: "星期四" },
  419. { value: "5", label: "星期五" },
  420. { value: "6", label: "星期六" },
  421. { value: "7", label: "星期日" }
  422. ],
  423. weekList: [
  424. {
  425. dayOfWeek: "",
  426. startTime: "",
  427. endTime: "",
  428. moid: new Date().getTime()
  429. }
  430. ],
  431. activeList: [],
  432. // 改版加课
  433. isaddCourse: false,
  434. adjustmentName: "",
  435. startTime: "",
  436. chioseVipList: [],
  437. organList: [],
  438. name: "",
  439. endTime: "",
  440. startClassTime: "",
  441. expireForm: {
  442. coursesExpireDate: null,
  443. tempCoursesExpireDate: null
  444. },
  445. bigin: this.beginDate(),
  446. expireRules: {
  447. coursesExpireDate: [
  448. { required: true, message: "请选择课程结束时间", trigger: "blur" }
  449. ]
  450. }
  451. };
  452. },
  453. created() {
  454. that = this;
  455. },
  456. mounted() {
  457. this.__init();
  458. this.getList();
  459. },
  460. activated() {
  461. this.__init();
  462. this.getList();
  463. },
  464. methods: {
  465. __init() {
  466. console.log(this.vipDetail);
  467. this.vipid = this.$route.query.id;
  468. let query = this.$route.query;
  469. let addrForm = this.addrForm;
  470. this.name = this.$route.query.name;
  471. this.endTime = this.$route.query.endTimeStr;
  472. this.expireForm.coursesExpireDate = this.endTime;
  473. this.startClassTime = this.$route.query.startTimeStr;
  474. if (query.educationalTeacherId) {
  475. addrForm.educationalTeacherId = Number(query.educationalTeacherId);
  476. } else {
  477. addrForm.educationalTeacherId = null;
  478. }
  479. if (query.organId) {
  480. addrForm.organId = Number(query.organId);
  481. this.onEduTeacher();
  482. } else {
  483. addrForm.organId = null;
  484. }
  485. if (query.rules) {
  486. this.Frules = query.rules;
  487. }
  488. if (query.searchForm) {
  489. this.FsearchForm = query.searchForm;
  490. }
  491. getEmployeeOrgan().then(res => {
  492. if (res.code == 200) {
  493. this.organList = res.data;
  494. }
  495. });
  496. // 取课程组上指导老师,教学点
  497. getTeachSchool({
  498. userId: query.userId
  499. }).then(res => {
  500. if (res.code == 200) {
  501. this.schoolList = res.data;
  502. }
  503. });
  504. },
  505. getList() {
  506. findVipGroupCourseSchedules({
  507. vipGroupId: this.vipid,
  508. rows: this.rules.limit,
  509. page: this.rules.page,
  510. gorupType: "VIP"
  511. }).then(res => {
  512. if (res.code == 200) {
  513. this.tableList = res.data.pageInfo.rows;
  514. this.rules.total = res.data.pageInfo.total;
  515. this.courseTime = res.data.singleClassMinutes;
  516. }
  517. });
  518. },
  519. goBack() {
  520. this.$store.dispatch("delVisitedViews", this.$route);
  521. this.$router.push({
  522. path: "/vipManager/vipList"
  523. });
  524. },
  525. resetClass(row) {
  526. /**
  527. * maskForm.startTime
  528. *
  529. */
  530. this.maskForm.date = row.classDate.split(" ")[0];
  531. this.startTime = row.startClassTimeStr.substring(0, 5);
  532. this.maskForm.endTime = row.endClassTimeStr.substring(0, 5);
  533. // this.maskForm.endTime = row.endClassTimeStr;
  534. this.maskForm.id = row.id;
  535. this.maskForm.address = row.schoolId || null;
  536. this.maskForm.teachMode = row.teachMode;
  537. // 修改课时
  538. this.courseVisible = true;
  539. },
  540. handleClose() {
  541. this.courseVisible = false;
  542. this.startTime = "";
  543. this.maskForm = {
  544. date: "",
  545. startTime: "",
  546. endTime: "",
  547. id: "",
  548. address: "",
  549. teachMode: ""
  550. };
  551. this.$refs["maskForm"].resetFields();
  552. },
  553. submitResetClass() {
  554. // endClassTimeStr: this.maskForm.endTime,
  555. if (!this.startTime) {
  556. this.$message.error("请填写修改时间");
  557. return;
  558. }
  559. let classTime = this.maskForm.date
  560. ? new Date(this.maskForm.date)
  561. : new Date();
  562. let ymd =
  563. classTime.getFullYear() +
  564. "-" +
  565. (classTime.getMonth() + 1) +
  566. "-" +
  567. classTime.getDate();
  568. let tempStartTime = this.startTime;
  569. if (this.startTime.length <= 5) {
  570. tempStartTime = tempStartTime + ":00";
  571. }
  572. let obj = {
  573. startClassTime: ymd + " " + this.startTime,
  574. // startClassTimeStr: this.startTime,
  575. id: this.maskForm.id,
  576. classDate: this.maskForm.date,
  577. schoolId: this.maskForm.address || null,
  578. teachMode: this.maskForm.teachMode || null,
  579. groupType: "VIP"
  580. };
  581. resetCourse(obj).then(res => {
  582. if (res.code == 200) {
  583. this.$message.success("修改成功");
  584. this.courseVisible = false;
  585. this.getList();
  586. } //else {
  587. // this.$message.error(res.msg)
  588. // }
  589. });
  590. },
  591. removeClass(row) {
  592. this.$confirm("是否删除该vip课程?", "提示", {
  593. confirmButtonText: "确定",
  594. cancelButtonText: "取消",
  595. type: "warning"
  596. }).then(() => {
  597. bathDelete({ courseScheduleIds: row.id }).then(res => {
  598. if (res.code == 200) {
  599. this.$message.success("删除成功");
  600. this.getList();
  601. }
  602. });
  603. });
  604. },
  605. // vip 家课
  606. addCourse() {
  607. this.adjustmentName = "vip加课";
  608. this.isaddCourse = true;
  609. this.adjustmentVisible = true;
  610. // this.adjustmentForm.count = 0;
  611. // this.addCourseVisible = true;
  612. },
  613. addOneChiose() {
  614. this.addTable.push({
  615. classDate: "",
  616. startClassTimeStr: "",
  617. endClassTimeStr: "",
  618. teachMode: "",
  619. moid: new Date().getTime()
  620. });
  621. },
  622. removeMarkCourse(row) {
  623. for (let i in this.addTable) {
  624. if (this.addTable[i].moid == row.moid) {
  625. this.addTable.splice(i, 1);
  626. }
  627. }
  628. },
  629. submitAdd() {
  630. let endClassTimeStr = this.MinutesTest(
  631. this.addTable[0].startClassTimeStr,
  632. 90
  633. );
  634. let some = {
  635. vipGroupApplyBaseInfo: {
  636. id: this.vipid
  637. },
  638. courseSchedules: []
  639. };
  640. for (let i in this.addTable) {
  641. let obj = {
  642. classDate: this.addTable[i].classDate,
  643. startClassTimeStr: this.addTable[i].startClassTimeStr,
  644. endClassTimeStr: this.MinutesTest(
  645. this.addTable[i].startClassTimeStr,
  646. this.courseTime
  647. ),
  648. teachMode: this.addTable[i].teachMode
  649. };
  650. some.courseSchedules.push(obj);
  651. }
  652. // 发请求干活
  653. appendVipGroupCourseSchedules(some).then(res => {
  654. if (res.code == 200) {
  655. this.addCourseVisible = false;
  656. this.rules.page = 1;
  657. this.getList();
  658. }
  659. });
  660. },
  661. isDisabled(row, index) {
  662. if (row.isSettlement || !row.id) {
  663. return false;
  664. } else {
  665. return true;
  666. }
  667. },
  668. // 分钟小时相加减
  669. MinutesTest(str, interval) {
  670. let houer = str.split(":")[0];
  671. let min = str.split(":")[1];
  672. let sdate1 = new Date(1900, 1, 1, houer, min);
  673. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  674. let H = sdate1.getHours();
  675. let M = sdate1.getMinutes();
  676. if (H < 10) H = "0" + H;
  677. if (M < 10) M = "0" + M;
  678. return H + ":" + M;
  679. },
  680. handleSelectionChange(val) {
  681. this.chioseVipList = val;
  682. this.adjustmentForm.count = val.length;
  683. this.activeList = val;
  684. },
  685. addWeek() {
  686. // 添加循环周期
  687. this.weekList.push({
  688. dayOfWeek: "",
  689. startClassTime: "",
  690. endClassTime: "",
  691. id: new Date()
  692. });
  693. },
  694. // 删除循环周
  695. removeWeek(item) {
  696. for (let i in this.weekList) {
  697. if (this.weekList[i].id == item.id) {
  698. this.weekList.splice(i, 1);
  699. }
  700. }
  701. },
  702. adjustment() {
  703. this.adjustmentName = "批量调整";
  704. this.isaddCourse = false;
  705. if (this.adjustmentForm.count <= 0) {
  706. this.$message.error("请至少勾选一节课");
  707. } else {
  708. this.adjustmentVisible = true;
  709. }
  710. },
  711. submitAdjustment() {
  712. this.$refs["adjustmentForm"].validate(item => {
  713. if (item) {
  714. let week = this.weekList;
  715. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  716. this.$message.error("至少排一节课");
  717. return;
  718. }
  719. // 开始
  720. let obj = {};
  721. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  722. let idArr = this.activeList.map(item => {
  723. return item.id;
  724. });
  725. // let tempWeekList = []
  726. // this.weekList.forEach(item => {
  727. // let tempTime = item.startClassTime.length <= 5 ? item.startClassTime + ':00' : item.startClassTime
  728. // tempWeekList.push({
  729. // dayOfWeek: item.dayOfWeek,
  730. // startTime: item.startTime,
  731. // endTime: item.endTime,
  732. // moid: item.moid,
  733. // startClassTime: obj.courseCreateStartTime + ' ' + tempTime,
  734. // })
  735. // })
  736. let courseScheduleIds = idArr.join(",");
  737. obj.courseScheduleIds = courseScheduleIds;
  738. obj.courseTimes = this.weekList;
  739. obj.holiday = this.adjustmentForm.checked;
  740. obj.teachMode = this.adjustmentForm.courseType || null;
  741. obj.groupType = "VIP";
  742. obj.vipGroupId = this.vipid;
  743. obj.schoolId = this.adjustmentForm.address || null;
  744. vipCourseAdjust(obj).then(res => {
  745. if (res.code == 200) {
  746. this.$message.success("恭喜您修改成功");
  747. this.adjustmentVisible = false;
  748. this.getList();
  749. }
  750. });
  751. }
  752. });
  753. },
  754. addCourseSubmit() {
  755. this.$refs["adjustmentForm"].validate(item => {
  756. if (item) {
  757. let week = this.weekList;
  758. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  759. this.$message.error("至少排一节课");
  760. return;
  761. }
  762. // 开始
  763. let obj = {};
  764. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  765. let idArr = this.activeList.map(item => {
  766. return item.id;
  767. });
  768. let courseScheduleIds = idArr.join(",");
  769. obj.courseScheduleIds = courseScheduleIds;
  770. obj.courseTimes = this.weekList;
  771. obj.holiday = this.adjustmentForm.checked;
  772. obj.vipGroupId = this.vipid;
  773. obj.courseCount = this.adjustmentForm.addCount;
  774. obj.teachMode = this.adjustmentForm.courseType;
  775. obj.singleClassPrice = this.adjustmentForm.fee;
  776. obj.groupType = "VIP";
  777. batchAppendVipGroupCourses(obj).then(res => {
  778. if (res.code == 200) {
  779. this.$message.success("恭喜您添加成功");
  780. this.adjustmentVisible = false;
  781. this.getList();
  782. }
  783. });
  784. }
  785. });
  786. },
  787. resetAddrSubmit() {
  788. if (!this.addrForm.address) {
  789. this.$message.error("请选择一个教学点");
  790. return;
  791. }
  792. // 修改教学点
  793. updateVipBaseInfo({
  794. id: this.vipid,
  795. teacherSchoolId: this.addrForm.address,
  796. educationalTeacherId: this.addrForm.educationalTeacherId
  797. }).then(res => {
  798. if (res.code == 200) {
  799. this.$message.success("修改成功");
  800. this.addrVisible = false;
  801. this.getList();
  802. }
  803. });
  804. },
  805. onEduTeacher(type) {
  806. this.educationList = [];
  807. let addrForm = this.addrForm;
  808. if (type) {
  809. addrForm.educationalTeacherId = null;
  810. }
  811. queryEmployByOrganId({ organId: addrForm.organId, rows: 10000 }).then(
  812. res => {
  813. if (res.code == 200) {
  814. this.educationList = res.data.rows;
  815. }
  816. }
  817. );
  818. },
  819. resetEducationalVisible() {
  820. let addrForm = this.addrForm;
  821. if (!addrForm.organId) {
  822. this.$message.error("请选择课程分部");
  823. return;
  824. }
  825. if (!addrForm.educationalTeacherId) {
  826. this.$message.error("请选择乐团主管");
  827. return;
  828. }
  829. // 修改乐团主管
  830. updateVipBaseInfo({
  831. id: this.vipid,
  832. organId: addrForm.organId,
  833. educationalTeacherId: addrForm.educationalTeacherId
  834. }).then(res => {
  835. if (res.code == 200) {
  836. this.$message.success("修改成功");
  837. this.educationalVisible = false;
  838. this.getList();
  839. }
  840. });
  841. },
  842. // 清除考勤
  843. clearAttend(row) {
  844. this.$confirm("是否清除考勤记录?", "提示", {
  845. confirmButtonText: "确定",
  846. cancelButtonText: "取消",
  847. type: "warning"
  848. })
  849. .then(() => {
  850. cleanAttendance({ courseScheduleIds: row.id }).then(res => {
  851. if (res.code == 200) {
  852. this.$message.success("清除成功");
  853. this.getList();
  854. } else {
  855. this.$message.error(res.msg);
  856. }
  857. });
  858. })
  859. .catch(() => { });
  860. },
  861. changeStartTime(val) {
  862. this.$nextTick(res => {
  863. if (val) {
  864. this.$set(
  865. this.maskForm,
  866. "endTime",
  867. addTimerFormMinute(this.maskForm.date, val, this.courseTime)
  868. );
  869. } else {
  870. this.$set(this.maskForm, "endTime", "");
  871. }
  872. if (!this.maskForm.endTime) {
  873. this.$set(this, "startTime", "");
  874. }
  875. });
  876. },
  877. changeStartTimes(val, item) {
  878. this.$nextTick(res => {
  879. if (val) {
  880. let str = dayjs(new Date()).format("YYYY-MM-DD");
  881. this.$set(
  882. item,
  883. "endClassTime",
  884. addTimerFormMinute(str, val, this.courseTime)
  885. );
  886. } else {
  887. this.$set(item, "endClassTime", "");
  888. }
  889. if (!item.endClassTime) {
  890. console.log(item.startClassTime);
  891. this.$set(item, "startClassTime", "");
  892. }
  893. });
  894. },
  895. coursesDate(dateStr) {
  896. let self = this;
  897. return {
  898. firstDayOfWeek: 1,
  899. disabledDate: time => {
  900. return time.getTime() + 86400000 <= new Date().getTime();
  901. }
  902. };
  903. },
  904. pickerOptions(dateStr) {
  905. return {
  906. firstDayOfWeek: 1,
  907. disabledDate(time) {
  908. return time.getTime() + 86400000 <= new Date().getTime();
  909. }
  910. };
  911. },
  912. submitExpireDate() {
  913. this.$refs.expireForm.validate(some => {
  914. if (some) {
  915. vipGroupManageUpdate({
  916. id: this.vipid,
  917. coursesExpireDate: this.expireForm.coursesExpireDate
  918. }).then(res => {
  919. if (res.code == 200) {
  920. this.$message.success("有效期修改成功");
  921. this.expireVisible = false;
  922. let str = this.expireForm.coursesExpireDate + " 00:00:00";
  923. this.$router.push({
  924. query: {
  925. ...this.$route.query,
  926. endTimeStr: str
  927. }
  928. });
  929. // this.$route.query.endTimeStr = str;
  930. this.endTime = str;
  931. console.log(str);
  932. this.getList();
  933. } else {
  934. this.$message.error(res.msg);
  935. }
  936. });
  937. } else {
  938. return;
  939. }
  940. });
  941. },
  942. beginDate() {
  943. let self = this;
  944. return {
  945. firstDayOfWeek: 1,
  946. disabledDate(time) {
  947. // if (self.expireForm.tempCoursesExpireDate) {
  948. // return new Date(self.expireForm.tempCoursesExpireDate).getTime() > time.getTime()
  949. // } else {
  950. return time.getTime() <= Date.now();
  951. //开始时间不选时,结束时间最大值小于等于当天
  952. // }
  953. }
  954. };
  955. }
  956. },
  957. watch: {
  958. adjustmentVisible(val) {
  959. if (!val) {
  960. this.adjustmentForm = {
  961. count: "",
  962. courseTime: "",
  963. checked: false,
  964. addCount: "",
  965. courseType: "",
  966. fee: "",
  967. address: ""
  968. };
  969. this.weekList = [];
  970. this.$refs["tableList"].clearSelection();
  971. this.$refs.adjustmentForm.resetFields();
  972. this.addWeek();
  973. }
  974. },
  975. addrVisible(val) {
  976. if (!val) {
  977. this.addrForm.address = "";
  978. }
  979. }
  980. },
  981. computed: {
  982. nowTime() {
  983. // console.log(that.maskForm.date)
  984. let str = "06:00:00";
  985. if (that.maskForm.date == dayjs(new Date()).format("YYYY-MM-DD")) {
  986. str = dayjs(new Date()).format("HH:mm:ss");
  987. }
  988. return str;
  989. }
  990. }
  991. };
  992. </script>
  993. <style lang="scss" scoped>
  994. .vipwrap {
  995. display: flex;
  996. flex-direction: row;
  997. justify-content: flex-start;
  998. .newBand {
  999. margin-right: 20px;
  1000. }
  1001. }
  1002. .resetClassForm {
  1003. ::v-deep .el-date-editor.el-input,
  1004. ::v-deep .el-date-editor.el-input__inner {
  1005. width: 180px !important;
  1006. }
  1007. }
  1008. .countWrap {
  1009. ::v-deep .el-date-editor.el-input,
  1010. ::v-deep .el-date-editor.el-input__inner {
  1011. width: 100px !important;
  1012. }
  1013. }
  1014. .maskForm {
  1015. ::v-deep .el-input {
  1016. width: 220px !important;
  1017. }
  1018. }
  1019. .titlewrap {
  1020. display: flex;
  1021. flex-direction: row;
  1022. justify-content: flex-start;
  1023. align-items: center;
  1024. }
  1025. </style>