courseEdit.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <div class="panel-body">
  5. <br>
  6. <el-page-header @back="goBack" content="课程管理">
  7. <br>
  8. </el-page-header>
  9. <span class="classNames">
  10. {{title}}
  11. </span>
  12. <br>
  13. <div class="panel_control">
  14. <el-row :gutter="20">
  15. <el-col :span="4">
  16. <em>会员名:</em>
  17. <el-input v-model="panel.name" placeholder="请输入会员名"></el-input>
  18. </el-col>
  19. <el-col :span="4">
  20. <em>手机号:</em>
  21. <el-input v-model="panel.phone" placeholder="请输入手机号" type="number"></el-input>
  22. </el-col>
  23. <el-col :span="4">
  24. <el-button size="" type="primary" @click="query" plain :disabled="serachBtnStatus">查询
  25. </el-button>
  26. </el-col>
  27. </el-row>
  28. </div>
  29. </div>
  30. <div class="change">
  31. <el-button @click="addFinish">确认下课</el-button>
  32. <el-button @click="addFinishMember">添加上课会员</el-button>
  33. </div>
  34. </div>
  35. <div class="table">
  36. <el-table
  37. :data="tableData"
  38. border
  39. is-horizontal-resize
  40. :default-sort="{prop: 'date', order: 'descending'}"
  41. element-loading-background="rgba(0, 0, 0, 0.8)"
  42. class=""
  43. >
  44. >
  45. <el-table-column
  46. type="index"
  47. label="排名"
  48. align="center"
  49. width="50">
  50. </el-table-column>
  51. <el-table-column
  52. prop="head"
  53. label="头像"
  54. align="center"
  55. sortable
  56. >
  57. <template slot-scope="scope">
  58. <img class="head" :src="scope.row.Head" alt="" height="51" width="51" v-if="scope.row.Head">
  59. <img class="head" src="../assets/img/nav/head.png" height="51" width="51" v-else/>
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. prop="Name"
  64. label="会员名"
  65. sortable
  66. >
  67. </el-table-column>
  68. <el-table-column
  69. prop="ClassName"
  70. label="课程"
  71. sortable
  72. >
  73. <template slot-scope="scope">
  74. <span class="lessons"
  75. :style="{ background:scope.row.ClassColor }">{{scope.row.ClassName}}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. prop="OrderTime"
  80. label="预约时间"
  81. :formatter="filterFmtDate"
  82. sortable
  83. >
  84. </el-table-column>
  85. <el-table-column
  86. prop="RemainTotalhour"
  87. label="剩余全部课时"
  88. sortable
  89. >
  90. </el-table-column>
  91. <el-table-column
  92. prop="Status"
  93. label="状态"
  94. sortable
  95. >
  96. <template slot-scope="scope">
  97. <span v-if="scope.row.Status == 1">预约上课 </span>
  98. <span v-if="scope.row.Status == 2">预约未到</span>
  99. <span v-if="scope.row.Status == 3">上课未预约</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. prop="Status"
  104. label="操作"
  105. >
  106. <template slot-scope="scope">
  107. <el-button type="primary" round v-if="scope.row.Status == 1" size="mini"
  108. @click="pauseRow(scope.row,2)">
  109. 预约未到
  110. </el-button>
  111. <el-button type="warning" round v-if="scope.row.Status == 2" size="mini"
  112. @click="pauseRow(scope.row,1)">
  113. 撤销
  114. </el-button>
  115. <el-button type="danger" round v-if="scope.row.Status == 3" size="mini"
  116. @click="getClassOverDetailDel(scope.row)">
  117. 删除
  118. </el-button>
  119. </template>
  120. </el-table-column>
  121. </el-table>
  122. <br>
  123. <el-pagination
  124. background
  125. :total="pageination.total"
  126. :page-size="pageination.pageItem"
  127. @current-change="pageChange"
  128. ></el-pagination>
  129. </div>
  130. <el-dialog title="添加上课会员" :visible.sync="dialogVisible" width="650px">
  131. <div class="dialogContent viplist">
  132. <span class="blueTitle">{{ClassName}} {{BeginTime}}</span>
  133. <div>
  134. <el-transfer filterable v-model="dialogValue" :data="form.dialogdata"
  135. :titles="['会员列表', '已添加会员']"></el-transfer>
  136. </div>
  137. </div>
  138. <div class="dialogFooter">
  139. <el-button type="primary" size="small" @click="confirmMember">确定</el-button>
  140. <el-button size="small" @click="dialogVisible = false">取消</el-button>
  141. </div>
  142. </el-dialog>
  143. </div>
  144. </template>
  145. <script>
  146. import Global from '../Global.js'
  147. import {
  148. ClassDetailQuery,
  149. ClassOverDetailListQuery,
  150. VipUserSimpleQuery,
  151. ClassOverDetailAdd,
  152. } from "../api/getApiRes";
  153. let qs = require('qs');
  154. export default {
  155. data() {
  156. return {
  157. serachBtnStatus: false,
  158. tableData: [],
  159. title: '',
  160. dialogVisible: false,//添加下课会员
  161. dialogFinishVisible: false,//确认下课dialog
  162. dialogLesson: false,//课时调整
  163. dialogGift: false,//赠送课时调整
  164. dialogExpTime: false,//有效期调整
  165. dialogLessonTable: false,//会员课程
  166. dialogTitle: '新增会员',
  167. current: getNowDate(),
  168. dialogValue: [],
  169. dialogCoachValue: [],
  170. BeginTime: '',
  171. ClassName: '',
  172. // panel 配置项目
  173. panel: {
  174. name: '',
  175. phone: '',
  176. usercode: '',
  177. username: '',
  178. compname: '',
  179. keyword: '',
  180. USERCODE: '',
  181. endType: '',
  182. taskstatus: 99,
  183. draw: 1,
  184. start: 0,
  185. recordsTotal: 0,
  186. tableData: [],
  187. allTableData: [],
  188. limit: '10',
  189. multipleSort: false,
  190. loading: false,
  191. fileList: [],
  192. multipleSelection: [],
  193. detectedmac: '',
  194. BeginTime: '',
  195. ClassName: '',
  196. options: [
  197. {value: 99, label: '全部'},
  198. {value: 1, label: '进行中'},
  199. {value: 2, label: '已完成'},
  200. ],
  201. endTypeOptions: [
  202. {value: 99, label: '全部'},
  203. {value: 30, label: '近一个月'},
  204. {value: 7, label: '近一周'},
  205. {value: 1, label: '当日'},
  206. ],
  207. time1: globalBt(),
  208. },
  209. form: {
  210. name: '',
  211. userCode: '',
  212. coach: '',
  213. coachOptions: [],
  214. shopId: '',
  215. memberType: 1,
  216. lesson: 1,
  217. gift: 1,
  218. btnType: 0,//0新建,1编辑编辑
  219. memo: '',
  220. expTime: '',
  221. dialogdata: [],//穿梭待选
  222. dialogValue: [],//穿梭已选
  223. dialogCoachdata: [],//穿梭已选
  224. },
  225. memberTypes: [
  226. {value: 1, label: '年会员'},
  227. {value: 2, label: '充值会员'},
  228. ],
  229. pageination: {
  230. pageItem: 100,
  231. pageoptions: pageOptions(),
  232. total: 100,
  233. pageIndex: 1,
  234. },
  235. }
  236. },
  237. mounted() {
  238. this.getTableQuery();
  239. this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
  240. },
  241. methods: {
  242. // 确认下课
  243. addFinish() {
  244. // this.clearForm();
  245. // // 重新获得教练名单
  246. // this.getCoachOption();
  247. // this.dialogFinishVisible = true
  248. // this.btnType = 0;
  249. this.dialogTitle = '确认下课'
  250. },
  251. // 添加下课会员
  252. addFinishMember() {
  253. let that = this;
  254. this.clearForm();
  255. this.getClassVipuserQuery();
  256. this.dialogValue = [];
  257. let std = [];
  258. if (this.tableData) {
  259. this.tableData.map(function (item) {
  260. std.push(item.UserId)
  261. })
  262. }
  263. that.dialogValue = std;
  264. this.dialogVisible = true
  265. },
  266. clearForm() {
  267. // clear
  268. this.form.name = '';
  269. this.form.userCode = '';
  270. this.form.shopId = '';
  271. this.dialogCoachValue = [];
  272. },
  273. // 获取本课程下的会员列表
  274. getClassVipuserQuery() {
  275. let that = this;
  276. let param = {
  277. token: localStorage.token,
  278. // classId: this.$route.query.classId,
  279. };
  280. let postdata = qs.stringify(param);
  281. // ClassVipuserQuery(postdata).then(res => {
  282. VipUserSimpleQuery(postdata).then(res => {
  283. let json = res;
  284. if (json.Code == 0) {
  285. // that.form.dialogdata = turnResToOptionByViper(json.Rs);
  286. that.form.dialogdata = turnResToOptionBySimViper(json.Rs);
  287. console.log(that.form.dialogdata);
  288. } else {
  289. that.$message.error(json.Memo);
  290. }
  291. })
  292. },
  293. // 确认提交下课会员
  294. confirmMember() {
  295. let that = this;
  296. // checkNum
  297. let userlist = that.dialogValue.toString();
  298. let param = {
  299. token: localStorage.token,
  300. stdId: this.$route.query.StdId,
  301. userlist: userlist
  302. };
  303. let postdata = qs.stringify(param);
  304. // 下课记录详情添加
  305. ClassOverDetailAdd(postdata).then(res => {
  306. let json = res;
  307. if (json.Code == 0) {
  308. // 关闭弹窗
  309. that.dialogVisible = false;
  310. // 重载列表
  311. that.getTableQuery();
  312. that.$message({
  313. showClose: true,
  314. message: '下课会员修改成功!',
  315. type: 'success'
  316. });
  317. } else {
  318. that.$message.error(json.Memo);
  319. }
  320. })
  321. },
  322. pauseRow() {
  323. },
  324. getClassOverDetailDel() {
  325. },
  326. // 查询按钮
  327. query() {
  328. let that = this;
  329. that.serachBtnStatus = true;
  330. let totalTime = 2
  331. let clock = window.setInterval(() => {
  332. totalTime--
  333. if (totalTime < 0) {
  334. totalTime = 2;
  335. that.serachBtnStatus = false;
  336. }
  337. }, 1000)
  338. this.getTableQuery();
  339. this.$message.success('查询完毕');
  340. },
  341. goBack() {
  342. this.$router.push({
  343. path: '/courses', query: {}
  344. });
  345. },
  346. // 页面数据查询
  347. getTableQuery() {
  348. let that = this;
  349. that.loading = true;
  350. let param = {
  351. token: localStorage.token,
  352. stdId: this.$route.query.StdId,
  353. start: 1,//
  354. tableMax: 9999,//
  355. };
  356. let postdata = qs.stringify(param);
  357. ClassOverDetailListQuery(postdata).then(res => {
  358. let json = res;
  359. if (json.Code == 0) {
  360. that.loading = false;
  361. if (json.Rs) {
  362. that.allTableData = json.Rs;
  363. that.recordsTotal = json.Rs.length;
  364. } else {
  365. that.allTableData = [];
  366. that.recordsTotal = 0;
  367. }
  368. // 设置分页数据
  369. that.setPaginations();
  370. } else {
  371. that.$message.error(json.Memo);
  372. }
  373. })
  374. },
  375. // 设置分页数据
  376. setPaginations() {
  377. // 分页属性
  378. let that = this;
  379. that.pageination.total = that.recordsTotal;
  380. // 默认分页
  381. that.tableData = that.allTableData.filter((item, index) => {
  382. return index < that.pageination.pageItem;
  383. });
  384. },
  385. // 每页显示数量
  386. handleSizeChange() {
  387. let that = this;
  388. that.tableData = that.allTableData.filter((item, index) => {
  389. return index < that.pageination.pageItem;
  390. });
  391. that.draw = that.pageination.pageItem;
  392. // that.getTableQuery();
  393. },
  394. // 翻页
  395. pageChange(pageIndex) {
  396. let that = this;
  397. // 获取当前页
  398. let index = that.pageination.pageItem * (pageIndex - 1);
  399. // 数据总数
  400. let nums = that.pageination.pageItem * pageIndex;
  401. // 容器
  402. let tables = [];
  403. for (var i = index; i < nums; i++) {
  404. if (that.allTableData[i]) {
  405. tables.push(that.allTableData[i])
  406. }
  407. this.tableData = tables;
  408. }
  409. that.start = index * that.draw;
  410. // that.getTableQuery();
  411. },
  412. // 过滤时间
  413. filterFmtDate(value, row, column) {
  414. let that = this;
  415. if (column == "0001-01-01T08:05:43+08:05" || column == "0001-01-01T00:00:00Z") {
  416. return '未预约';
  417. } else {
  418. return nonTfmtDate(column, 11);
  419. }
  420. },
  421. },
  422. watch: {
  423. $route(to) {
  424. if (to.name == 'courseEdit') {
  425. this.getTableQuery();
  426. this.title = this.$route.query.ClassName + ' ' + this.$route.query.BeginStr + '-' + this.$route.query.EndStr;
  427. }
  428. },
  429. },
  430. }
  431. </script>
  432. <style scoped>
  433. @import "../assets/css/panel.css";
  434. .context {
  435. height: 770px;
  436. overflow-y: scroll;
  437. display: block;
  438. margin: 0 auto;
  439. background-color: #fff !important;
  440. padding: 30px;
  441. }
  442. .classNames {
  443. width: 211px;
  444. height: 25px;
  445. background: #f0f2f5;
  446. font-family: "Source Han Sans CN";
  447. font-weight: normal;
  448. font-size: 16px;
  449. color: #3799ff;
  450. border-radius: 250px;
  451. text-align: center;
  452. margin-top: 15px;
  453. margin-bottom: 3px;
  454. float: left;
  455. }
  456. .head {
  457. overflow: hidden;
  458. display: block;
  459. margin: 0 auto;
  460. border-radius: 250px;
  461. }
  462. .panel_control {
  463. width: 100%;
  464. overflow: hidden;
  465. display: block;
  466. margin: 0 auto;
  467. }
  468. /deep/ .el-transfer-panel__item .el-checkbox__input {
  469. float: left;
  470. left: 20%;
  471. }
  472. /*.panel-body {*/
  473. .panel_control {
  474. padding: 20px;
  475. background: #F0F2F5;
  476. }
  477. .change {
  478. width: 100%;
  479. overflow: hidden;
  480. display: block;
  481. margin: 0 auto;
  482. padding-top: 10px;
  483. padding-bottom: 10px;
  484. }
  485. .change button {
  486. float: left;
  487. }
  488. .change button.pull-right {
  489. float: right;
  490. }
  491. .lessons {
  492. padding: 1px 7px;
  493. border-radius: 250px;
  494. float: left;
  495. color: #000;
  496. }
  497. </style>