finishDetail.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>下课详情
  5. <span class="current">{{BeginTime}} {{ClassName}} </span>
  6. </h5>
  7. <div class="panel-body">
  8. <div class="panel_control">
  9. <el-row :gutter="20">
  10. <el-col :span="4">
  11. <em>会员名:</em>
  12. <el-input v-model="panel.name" placeholder="请输入会员名"></el-input>
  13. </el-col>
  14. <el-col :span="4">
  15. <em>手机号:</em>
  16. <el-input v-model="panel.phone" placeholder="请输入手机号"></el-input>
  17. </el-col>
  18. <el-col :span="4">
  19. <el-button size="" type="primary" @click="query" plain>查询</el-button>
  20. </el-col>
  21. </el-row>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="change">
  26. <el-button @click="addFinish">确认下课</el-button>
  27. <el-button @click="addFinishMember">添加下课会员</el-button>
  28. </div>
  29. <div class="table">
  30. <el-table
  31. :data="tableData"
  32. border
  33. is-horizontal-resize
  34. :default-sort="{prop: 'date', order: 'descending'}"
  35. element-loading-background="rgba(0, 0, 0, 0.8)"
  36. class=""
  37. @selection-change="handleSelectionChange"
  38. >
  39. <el-table-column
  40. type="index"
  41. label="序号"
  42. width="50">
  43. </el-table-column>
  44. <el-table-column
  45. prop="Name"
  46. label="会员名"
  47. >
  48. </el-table-column>
  49. <el-table-column
  50. prop="Phone"
  51. label="手机号"
  52. sortable
  53. >
  54. </el-table-column>
  55. <el-table-column
  56. prop="Status"
  57. label="状态"
  58. sortable
  59. >
  60. <template slot-scope="scope">
  61. <span v-if="scope.row.Status == 1">预约上课 </span>
  62. <span v-if="scope.row.Status == 2">预约未到</span>
  63. <span v-if="scope.row.Status == 3">上课未预约</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="Status"
  68. label="操作"
  69. >
  70. <template slot-scope="scope">
  71. <el-button type="primary" round v-if="scope.row.Status == 1" size="mini"
  72. @click="pauseRow(scope.row,2)">
  73. 预约未到
  74. </el-button>
  75. <el-button type="warning" round v-if="scope.row.Status == 2" size="mini"
  76. @click="pauseRow(scope.row,1)">
  77. 撤销
  78. </el-button>
  79. <el-button type="danger" round v-if="scope.row.Status == 3" size="mini"
  80. @click="getClassOverDetailDel(scope.row)">
  81. 删除
  82. </el-button>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <br>
  87. <el-pagination
  88. background
  89. :total="pageination.total"
  90. :page-size="pageination.pageItem"
  91. @current-change="pageChange"
  92. ></el-pagination>
  93. </div>
  94. <el-dialog title="确认下课" :visible.sync="dialogFinishVisible" width="650px">
  95. <div class="dialogContent">
  96. <span class="blueTitle">{{ClassName}} {{BeginTime}}</span>
  97. <div>
  98. <el-transfer filterable v-model="dialogCoachValue" :data="form.dialogCoachdata"
  99. :titles="['教练列表', '已添加教练']"></el-transfer>
  100. </div>
  101. </div>
  102. <div class="dialogFooter">
  103. <el-button type="primary" size="small" @click="confirmClassFinish">确定</el-button>
  104. <el-button size="small" @click="dialogFinishVisible = false">取消</el-button>
  105. </div>
  106. </el-dialog>
  107. <el-dialog title="添加下课会员" :visible.sync="dialogVisible" width="650px">
  108. <div class="dialogContent viplist">
  109. <span class="blueTitle">{{ClassName}} {{BeginTime}}</span>
  110. <div>
  111. <el-transfer filterable v-model="dialogValue" :data="form.dialogdata"
  112. :titles="['会员列表', '已添加会员']"></el-transfer>
  113. </div>
  114. </div>
  115. <div class="dialogFooter">
  116. <el-button type="primary" size="small" @click="confirmMember">确定</el-button>
  117. <el-button size="small" @click="dialogVisible = false">取消</el-button>
  118. </div>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import Global from '../Global.js'
  124. import {
  125. ClassOverDetailListQuery,
  126. ClassVipuserQuery,
  127. ClassOverDetailAdd,
  128. ClassVipuserEdit,
  129. ClassOverDetailStatusEdit,
  130. ClassOverConfirm,
  131. testTable,
  132. testSelect,
  133. TeacherListQuery,
  134. ShopManagerListQuery,
  135. ClassOverDetailDel
  136. } from "../api/getApiRes";
  137. let qs = require('qs');
  138. export default {
  139. data() {
  140. return {
  141. dialogVisible: false,//添加下课会员
  142. dialogFinishVisible: false,//确认下课dialog
  143. dialogLesson: false,//课时调整
  144. dialogGift: false,//赠送课时调整
  145. dialogExpTime: false,//有效期调整
  146. dialogLessonTable: false,//会员课程
  147. dialogTitle: '新增会员',
  148. current: getNowDate(),
  149. dialogValue: [],
  150. dialogCoachValue: [],
  151. BeginTime: '',
  152. ClassName: '',
  153. // panel 配置项目
  154. panel: {
  155. name: '',
  156. phone: '',
  157. usercode: '',
  158. username: '',
  159. compname: '',
  160. keyword: '',
  161. USERCODE: '',
  162. endType: '',
  163. taskstatus: 99,
  164. draw: 1,
  165. start: 0,
  166. recordsTotal: 0,
  167. tableData: [],
  168. allTableData: [],
  169. limit: '10',
  170. multipleSort: false,
  171. loading: false,
  172. fileList: [],
  173. multipleSelection: [],
  174. detectedmac: '',
  175. options: [
  176. {value: 99, label: '全部'},
  177. {value: 1, label: '进行中'},
  178. {value: 2, label: '已完成'},
  179. ],
  180. endTypeOptions: [
  181. {value: 99, label: '全部'},
  182. {value: 30, label: '近一个月'},
  183. {value: 7, label: '近一周'},
  184. {value: 1, label: '当日'},
  185. ],
  186. time1: globalBt(),
  187. },
  188. multipleSelection: [],
  189. pageination: {
  190. pageItem: 100,
  191. pageoptions: pageOptions(),
  192. total: 100,
  193. pageIndex: 1,
  194. },
  195. form: {
  196. name: '',
  197. userCode: '',
  198. coach: '',
  199. coachOptions: [],
  200. shopId: '',
  201. memberType: 1,
  202. lesson: 1,
  203. gift: 1,
  204. btnType: 0,//0新建,1编辑编辑
  205. memo: '',
  206. expTime: '',
  207. dialogdata: [],//穿梭待选
  208. dialogValue: [],//穿梭已选
  209. dialogCoachdata: [],//穿梭已选
  210. },
  211. memberTypes: [
  212. {value: 1, label: '年会员'},
  213. {value: 2, label: '充值会员'},
  214. ],
  215. tableData: []
  216. }
  217. },
  218. mounted() {
  219. this.BeginTime = nonTfmtDatetoLength(this.$route.query.BeginTime, 16);
  220. this.ClassName = this.$route.query.ClassName;
  221. this.getTableQuery();
  222. // 获取教练选项
  223. // this.getCoachOption();
  224. },
  225. methods: {
  226. // 获取教练选项
  227. getCoachOption() {
  228. let that = this;
  229. let param = {
  230. token: localStorage.token,
  231. name: this.panel.name,//
  232. phone: this.panel.phone,//
  233. shopId: localStorage.ShopId,//
  234. adminType : 4,//
  235. start : 1,//
  236. tableMax : 299,//
  237. };
  238. let postdata = qs.stringify(param);
  239. ShopManagerListQuery(postdata).then(res => {
  240. let json = res;
  241. if (json.Code == 0) {
  242. that.form.dialogCoachdata = turnResToOptionByUsers(json.Rs);
  243. } else {
  244. that.$message.error(json.Memo);
  245. }
  246. })
  247. },
  248. // 获取本课程下的会员列表
  249. getClassVipuserQuery() {
  250. let that = this;
  251. let param = {
  252. token: localStorage.token,
  253. classId: this.$route.query.classId,
  254. };
  255. let postdata = qs.stringify(param);
  256. ClassVipuserQuery(postdata).then(res => {
  257. let json = res;
  258. if (json.Code == 0) {
  259. that.form.dialogdata = turnResToOptionByViper(json.Rs);
  260. console.log(that.form.dialogdata);
  261. } else {
  262. that.$message.error(json.Memo);
  263. }
  264. })
  265. },
  266. // 下课记录详情删除
  267. getClassOverDetailDel(row) {
  268. let that = this;
  269. let param = {
  270. token: localStorage.token,
  271. stdId: row.StdId,
  272. cfId: row.CfId,
  273. };
  274. this.$confirm('是否删除用户' + row.Name + '的下课记录?', '禁用操作', {
  275. confirmButtonText: '确定',
  276. cancelButtonText: '取消',
  277. type: 'warning'
  278. }).then(() => {
  279. let postdata = qs.stringify(param);
  280. ClassOverDetailDel(postdata).then(res => {
  281. let json = res;
  282. if (json.Code == 0) {
  283. that.$message({
  284. showClose: true,
  285. message: '当前学生上课记录已删除!',
  286. type: 'success'
  287. });
  288. that.getTableQuery();
  289. } else {
  290. that.$message.error(json.Memo);
  291. }
  292. })
  293. }).catch(() => {
  294. this.$message({
  295. type: 'info',
  296. message: '已取消删除'
  297. });
  298. });
  299. },
  300. // 编辑
  301. editMember(row) {
  302. let that = this;
  303. this.clearForm();
  304. this.form.userCode = row.userCode;
  305. this.form.name = row.name;
  306. this.form.memberType = row.vipType;
  307. this.form.lesson = row.Recovered;
  308. this.form.gift = row.Recovered;
  309. this.form.memo = row.memo;
  310. this.form.btnType = 1;
  311. this.form.shopId = row.Id;
  312. this.dialogFinishVisible = true
  313. this.dialogTitle = '编辑会员'
  314. },
  315. // 禁用
  316. pauseRow(row, status) {
  317. let that = this;
  318. let param = {
  319. token: localStorage.token,
  320. stdId: this.$route.query.id,
  321. cfId: row.CfId,
  322. status: status,
  323. };
  324. let postdata = qs.stringify(param);
  325. ClassOverDetailStatusEdit(postdata).then(res => {
  326. let json = res;
  327. if (json.Code == 0) {
  328. that.$message({
  329. showClose: true,
  330. message: '执行成功!',
  331. type: 'success'
  332. });
  333. // table 重载
  334. that.getTableQuery();
  335. } else {
  336. that.$message.error(json.Memo);
  337. }
  338. })
  339. },
  340. // 关闭所有
  341. allDialogClose() {
  342. this.dialogVisible = false;
  343. this.dialogGift = false;
  344. this.dialogLesson = false;
  345. this.dialogExpTime = false;
  346. this.dialogLessonTable = false;
  347. },
  348. // 确认提交下课会员
  349. confirmMember() {
  350. let that = this;
  351. // checkNum
  352. let userlist = that.dialogValue.toString();
  353. let param = {
  354. token: localStorage.token,
  355. stdId: this.$route.query.id,
  356. userlist: userlist
  357. };
  358. let postdata = qs.stringify(param);
  359. // 下课记录详情添加
  360. ClassOverDetailAdd(postdata).then(res => {
  361. let json = res;
  362. if (json.Code == 0) {
  363. // 关闭弹窗
  364. that.dialogVisible = false;
  365. // 重载列表
  366. that.getTableQuery();
  367. that.$message({
  368. showClose: true,
  369. message: '下课会员修改成功!',
  370. type: 'success'
  371. });
  372. that.getTableQuery()
  373. } else {
  374. that.$message.error(json.Memo);
  375. }
  376. })
  377. },
  378. // 确认下课
  379. confirmClassFinish() {
  380. let that = this;
  381. // checkNum
  382. let userlist = that.dialogCoachValue.toString();
  383. let param = {
  384. token: localStorage.token,
  385. stdId: this.$route.query.id,
  386. teacherList: userlist
  387. };
  388. let postdata = qs.stringify(param);
  389. // 下课记录详情添加
  390. ClassOverConfirm(postdata).then(res => {
  391. let json = res;
  392. if (json.Code == 0) {
  393. // 关闭弹窗
  394. that.dialogFinishVisible = false;
  395. // 重载列表
  396. that.getTableQuery();
  397. that.$message({
  398. showClose: true,
  399. message: '当前课程已确认下课!',
  400. type: 'success'
  401. });
  402. // 返回下课列表
  403. // that.$router.push({path: '/finish'});
  404. this.$router.go(-1);
  405. } else {
  406. that.$message.error(json.Memo);
  407. }
  408. })
  409. },
  410. // 确认提交课时
  411. confirmLesson() {
  412. let that = this;
  413. // checkNum
  414. let param = {
  415. token: localStorage.token,
  416. userCode: that.form.userCode,
  417. lesson: that.form.lesson,
  418. };
  419. let postdata = qs.stringify(param);
  420. testSelect(postdata).then(res => {
  421. let json = res;
  422. if (json.Code == 0) {
  423. // 关闭弹窗
  424. that.dialogVisible = false;
  425. // 重载列表
  426. that.getTableQuery();
  427. that.$message({
  428. showClose: true,
  429. message: '课时调整成功!',
  430. type: 'success'
  431. });
  432. } else {
  433. that.$message.error(json.Memo);
  434. }
  435. })
  436. },
  437. // 确认下课
  438. addFinish() {
  439. this.clearForm();
  440. // 重新获得教练名单
  441. this.getCoachOption();
  442. this.dialogFinishVisible = true
  443. this.btnType = 0;
  444. this.dialogTitle = '确认下课'
  445. },
  446. // 添加下课会员
  447. addFinishMember() {
  448. let that = this;
  449. this.clearForm();
  450. this.getClassVipuserQuery();
  451. this.dialogValue = [];
  452. let std = [];
  453. if (this.tableData) {
  454. this.tableData.map(function (item) {
  455. std.push(item.UserId)
  456. })
  457. }
  458. that.dialogValue = std;
  459. this.dialogVisible = true
  460. },
  461. // 删除
  462. delList() {
  463. let that = this;
  464. // checkNum
  465. if (!this.multipleSelection.length) {
  466. that.$message({
  467. showClose: true,
  468. message: '错了哦,需要先选中至少一条记录',
  469. type: 'error'
  470. });
  471. return false
  472. }
  473. if (this.multipleSelection.length != 1) {
  474. that.$message({
  475. showClose: true,
  476. message: '错了哦,只能选中一条记录',
  477. type: 'error'
  478. });
  479. return false
  480. }
  481. let detectorid = that.multipleSelection[0].Id;
  482. let param = {
  483. token: localStorage.token,
  484. detectorid: detectorid,
  485. status: 9,//0禁用1启用9删除
  486. };
  487. let postdata = qs.stringify(param);
  488. this.$confirm('此操作将永久删除该会员, 是否继续?', '提示', {
  489. confirmButtonText: '确定',
  490. cancelButtonText: '取消',
  491. type: 'warning'
  492. }).then(() => {
  493. testSelect(postdata).then(res => {
  494. let json = res;
  495. if (json.Code == 0) {
  496. that.$message({
  497. showClose: true,
  498. message: '选中的会员已删除!',
  499. type: 'success'
  500. });
  501. // 重载列表
  502. that.getTableQuery();
  503. } else {
  504. that.$message.error(json.Memo);
  505. }
  506. });
  507. }).catch(() => {
  508. this.$message({
  509. type: 'info',
  510. message: '已取消删除'
  511. });
  512. });
  513. },
  514. handleSelectionChange(val) {
  515. this.multipleSelection = val;
  516. },
  517. // 查询按钮
  518. query() {
  519. this.getTableQuery();
  520. this.$message.success('查询完毕');
  521. },
  522. clearForm() {
  523. // clear
  524. this.form.name = '';
  525. this.form.userCode = '';
  526. this.form.shopId = '';
  527. this.dialogCoachValue = [];
  528. },
  529. // 页面数据查询
  530. getTableQuery() {
  531. let that = this;
  532. // this.getGetChildRegionSelect(0, 1);
  533. that.loading = true;
  534. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  535. let param = {
  536. token: localStorage.token,
  537. stdId: this.$route.query.id,//标签名
  538. name: this.panel.name,//姓名
  539. phone: this.panel.phone,//手机号
  540. start: 1,//
  541. tableMax: 9999,//
  542. };
  543. let postdata = qs.stringify(param);
  544. ClassOverDetailListQuery(postdata).then(res => {
  545. let json = res;
  546. if (json.Code == 0) {
  547. that.loading = false;
  548. if (json.Rs) {
  549. that.allTableData = json.Rs;
  550. that.recordsTotal = json.Rs.length;
  551. } else {
  552. that.allTableData = [];
  553. that.recordsTotal = 0;
  554. }
  555. // 设置分页数据
  556. that.setPaginations();
  557. } else {
  558. that.$message.error(json.Memo);
  559. }
  560. })
  561. },
  562. // 设置分页数据
  563. setPaginations() {
  564. // 分页属性
  565. let that = this;
  566. that.pageination.total = that.recordsTotal;
  567. // 默认分页
  568. that.tableData = that.allTableData.filter((item, index) => {
  569. return index < that.pageination.pageItem;
  570. });
  571. },
  572. // 每页显示数量
  573. handleSizeChange() {
  574. let that = this;
  575. that.tableData = that.allTableData.filter((item, index) => {
  576. return index < that.pageination.pageItem;
  577. });
  578. that.draw = that.pageination.pageItem;
  579. that.getTableQuery();
  580. },
  581. // 翻页
  582. pageChange(pageIndex) {
  583. let that = this;
  584. // 获取当前页
  585. let index = that.pageination.pageItem * (pageIndex - 1);
  586. // 数据总数
  587. let nums = that.pageination.pageItem * pageIndex;
  588. // 容器
  589. let tables = [];
  590. for (var i = index; i < nums; i++) {
  591. if (that.allTableData[i]) {
  592. tables.push(that.allTableData[i])
  593. }
  594. this.tableData = tables;
  595. }
  596. that.start = index * that.draw;
  597. that.getTableQuery();
  598. },
  599. // 自动排序
  600. sortChange(params) {
  601. console.log(params)
  602. },
  603. },
  604. watch: {
  605. $route(to) {
  606. if (to.name == 'finishDetail') {
  607. this.BeginTime = nonTfmtDatetoLength(this.$route.query.BeginTime, 16);
  608. this.ClassName = this.$route.query.ClassName;
  609. this.getTableQuery();
  610. }
  611. },
  612. },
  613. }
  614. </script>
  615. <style scoped>
  616. @import "../assets/css/panel.css";
  617. .context {
  618. height: 770px;
  619. overflow-y: scroll;
  620. display: block;
  621. margin: 0 auto;
  622. background-color: #fff !important;
  623. padding: 30px;
  624. }
  625. .panel-body {
  626. padding: 20px;
  627. background: #F0F2F5;
  628. }
  629. .change {
  630. width: 100%;
  631. overflow: hidden;
  632. display: block;
  633. margin: 0 auto;
  634. padding-top: 10px;
  635. padding-bottom: 10px;
  636. }
  637. .change button {
  638. float: left;
  639. }
  640. .change button.pull-right {
  641. float: right;
  642. }
  643. .dialogTitle {
  644. width: 100%;
  645. overflow: hidden;
  646. display: block;
  647. margin: 0 auto;
  648. color: #000000;
  649. font-size: 18px;
  650. text-align: center;
  651. }
  652. .dialogTitle em {
  653. float: none;
  654. font-style: normal;
  655. color: #3799FF;
  656. margin: 0;
  657. }
  658. /deep/ .el-transfer-panel__item .el-checkbox__input {
  659. left: 40px;
  660. }
  661. .dialogFooter {
  662. width: 90%;
  663. overflow: hidden;
  664. display: block;
  665. margin: 0 auto;
  666. margin-top: 10px;
  667. }
  668. .dialogFooter button {
  669. float: right;
  670. margin-left: 10px;
  671. }
  672. .dialogContent {
  673. width: 100%;
  674. overflow: hidden;
  675. display: block;
  676. margin: 0 auto;
  677. }
  678. .dialogContent .pull-left {
  679. width: 30%;
  680. float: left;
  681. }
  682. .dialogContent .pull-right {
  683. width: 70%;
  684. float: right;
  685. }
  686. .blueTitle {
  687. width: 200px;
  688. overflow: hidden;
  689. display: block;
  690. margin: 0 auto;
  691. margin-top: 10px;
  692. margin-bottom: 40px;
  693. background: #F0F2F5;
  694. border-radius: 19px;
  695. text-align: center;
  696. color: #3799FF;
  697. font-size: 16px;
  698. padding: 5px 24px;
  699. }
  700. .current {
  701. width: 158px;
  702. height: 23px;
  703. border-radius: 250px;
  704. text-align: center;
  705. background: #F0F2F5;
  706. color: #545454;
  707. font-size: 14px;
  708. padding: 3px 10px;
  709. margin-left: 20px;
  710. }
  711. /deep/ .el-checkbox__inner {
  712. left: -20px;
  713. }
  714. .viplist /deep/ .el-transfer__buttons button:nth-child(1){
  715. display: none;
  716. }
  717. </style>