appoint.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306
  1. <template>
  2. <div class="context">
  3. <!-- panel-->
  4. <div class="">
  5. <div class="panel">
  6. <h5>预约管理 <span class="current">{{current}}</span></h5>
  7. </div>
  8. <div class="timeList">
  9. <ul>
  10. <li :class="[{'active': i == choiceDate}]" v-for="(day,i) in weeks" @click="choiceTime(i)"><em>{{day.name}}</em><span>{{day.data}}</span>
  11. </li>
  12. </ul>
  13. </div>
  14. <el-tabs v-model="activeName" type="card">
  15. <el-tab-pane label="课程预览总览" name="first">
  16. <div class="table">
  17. <el-table
  18. :data="tableData"
  19. border
  20. is-horizontal-resize
  21. :default-sort="{prop: 'date', order: 'descending'}"
  22. element-loading-background="rgba(0, 0, 0, 0.8)"
  23. class=""
  24. @selection-change="handleSelectionChange"
  25. >
  26. <el-table-column
  27. type="selection"
  28. width="55">
  29. </el-table-column>
  30. <el-table-column
  31. type="index"
  32. label="序号"
  33. width="50">
  34. </el-table-column>
  35. <el-table-column
  36. prop="name"
  37. label="时间"
  38. >
  39. </el-table-column>
  40. <el-table-column
  41. prop="name"
  42. label="课程"
  43. sortable
  44. >
  45. </el-table-column>
  46. <el-table-column
  47. prop="Recovered"
  48. label="预约进度"
  49. width="240px"
  50. sortable
  51. >
  52. <template slot-scope="scope">
  53. <el-progress :percentage="100" :format="format"></el-progress>
  54. </template>
  55. </el-table-column>
  56. <el-table-column
  57. prop="Recovered"
  58. label="预约名额"
  59. width="240px"
  60. >
  61. <template slot-scope="scope">
  62. <el-input-number v-model="scope.row.Recovered" :min="1" :max="9999"
  63. label=""></el-input-number>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="Recovered"
  68. label="消耗课时"
  69. sortable
  70. >
  71. </el-table-column>
  72. <el-table-column
  73. prop="wxVisible"
  74. label="微信可预约"
  75. >
  76. <template slot-scope="scope">
  77. <el-switch
  78. v-model="scope.row.wxVisible"
  79. :active-value="1"
  80. :inactive-value="0"
  81. active-color="#409EFF"
  82. inactive-color="#D9D9D9"
  83. @change=changeWechat($event,scope.row)
  84. >
  85. </el-switch>
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. prop="Status"
  90. label="操作"
  91. >
  92. <template slot-scope="scope">
  93. <el-button type="text" @click="editMember(scope.row)">编辑</el-button>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <br>
  98. <el-pagination
  99. background
  100. :total="pageination.total"
  101. :page-size="pageination.pageItem"
  102. @current-change="pageChange"
  103. ></el-pagination>
  104. </div>
  105. </el-tab-pane>
  106. <el-tab-pane label="会员预约列表" name="second">
  107. <div class="panel-body">
  108. <div class="panel_control">
  109. <el-row :gutter="20">
  110. <el-col :span="5">
  111. <em>会员名:</em>
  112. <el-input v-model="panel.USERCODE" placeholder="请输入会员名"></el-input>
  113. </el-col>
  114. <el-col :span="5">
  115. <em>手机号:</em>
  116. <el-input v-model="panel.keyword" placeholder="请输入手机号"></el-input>
  117. </el-col>
  118. <el-col :span="5">
  119. <em>预约课程:</em>
  120. <el-select v-model="panel.endType">
  121. <el-option
  122. v-for="item in panel.endTypeOptions"
  123. :key="item.value"
  124. :label="item.label"
  125. :value="item.value">
  126. </el-option>
  127. </el-select>
  128. </el-col>
  129. <el-col :span="4">
  130. <el-button size="" type="primary" @click="query" plain>查询</el-button>
  131. </el-col>
  132. </el-row>
  133. </div>
  134. </div>
  135. <br>
  136. <div class="change">
  137. <el-button type="warning" @click="addMember">增加预约</el-button>
  138. </div>
  139. <div class="table">
  140. <el-table
  141. :data="tableData"
  142. border
  143. is-horizontal-resize
  144. :default-sort="{prop: 'date', order: 'descending'}"
  145. element-loading-background="rgba(0, 0, 0, 0.8)"
  146. class=""
  147. @selection-change="handleSelectionChange"
  148. >
  149. <el-table-column
  150. type="selection"
  151. width="55">
  152. </el-table-column>
  153. <el-table-column
  154. type="index"
  155. label="序号"
  156. width="50">
  157. </el-table-column>
  158. <el-table-column
  159. prop="name"
  160. label="会员名"
  161. >
  162. </el-table-column>
  163. <el-table-column
  164. prop="tel"
  165. label="手机号"
  166. sortable
  167. >
  168. </el-table-column>
  169. <el-table-column
  170. prop="name"
  171. label="预约课程"
  172. sortable
  173. >
  174. </el-table-column>
  175. <el-table-column
  176. prop="create"
  177. label="会员预约时间"
  178. sortable
  179. >
  180. </el-table-column>
  181. <el-table-column
  182. prop="Recovered"
  183. label="消耗课时"
  184. sortable
  185. >
  186. </el-table-column>
  187. <el-table-column
  188. prop="vipType"
  189. label="预约状态"
  190. sortable
  191. >
  192. <template slot-scope="scope">
  193. <span v-if="scope.row.vipType == 1">预约成功</span>
  194. <span v-if="scope.row.vipType == 2">预约失败</span>
  195. </template>
  196. </el-table-column>
  197. <el-table-column
  198. prop="Recovered"
  199. label="剩余课时"
  200. sortable
  201. >
  202. </el-table-column>
  203. <el-table-column
  204. prop="Status"
  205. label="操作"
  206. >
  207. <template slot-scope="scope">
  208. <el-button type="danger" size="mini" round @click="editMember(scope.row)">取消预约
  209. </el-button>
  210. </template>
  211. </el-table-column>
  212. </el-table>
  213. <br>
  214. <el-pagination
  215. background
  216. :total="pageination.total"
  217. :page-size="pageination.pageItem"
  218. @current-change="pageChange"
  219. ></el-pagination>
  220. </div>
  221. </el-tab-pane>
  222. </el-tabs>
  223. </div>
  224. <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="480px">
  225. <div class="dialogContent">
  226. <div class="">
  227. <el-form ref="form" :model="form" label-width="160px">
  228. <el-form-item label="课程">
  229. <el-select v-model="form.stdId" filterable placeholder="请选择" >
  230. <el-option
  231. v-for="item in form.stdList"
  232. :key="item.value"
  233. :label="item.label"
  234. :value="item.value">
  235. </el-option>
  236. </el-select>
  237. </el-form-item>
  238. <el-form-item label="会员">
  239. <el-select v-model="form.userId" filterable placeholder="请选择" >
  240. <el-option
  241. v-for="item in form.userList"
  242. :key="item.value"
  243. :label="item.label"
  244. :value="item.value">
  245. </el-option>
  246. </el-select>
  247. </el-form-item>
  248. </el-form>
  249. </div>
  250. </div>
  251. <div class="dialogFooter">
  252. <el-button type="primary" size="small" @click="ConfirmOrderAddByManager">确定</el-button>
  253. <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
  254. </div>
  255. </el-dialog>
  256. </div>
  257. </template>
  258. <script>
  259. import Global from '../Global.js'
  260. import {
  261. TodayClassOrderQuery,
  262. VipUserListQuery,
  263. TodayVipOrderQuery,
  264. OrderAddByManager,
  265. testTable,
  266. testSelect, WaitingBeginClassList
  267. } from "../api/getApiRes";
  268. let qs = require('qs');
  269. export default {
  270. data() {
  271. return {
  272. // activeName: 'first',
  273. activeName: 'second',
  274. choiceDate: 0,
  275. // activeName: 'second',
  276. tableView: true,//其他dialog
  277. dialogVisible: false,//其他dialog
  278. dialogMemberVisible: false,//新增教练dialog
  279. dialogLesson: false,//课时调整
  280. dialogGift: false,//赠送课时调整
  281. dialogExpTime: false,//有效期调整
  282. dialogLessonTable: false,//教练课程
  283. dialogTitle: '增加预约',
  284. current: getNowDate(),
  285. dialogValue: [],
  286. weeks: [],
  287. // panel 配置项目
  288. panel: {
  289. usercode: '',
  290. username: '',
  291. compname: '',
  292. keyword: '',
  293. USERCODE: '',
  294. endType: '',
  295. taskstatus: 99,
  296. draw: 1,
  297. start: 0,
  298. recordsTotal: 0,
  299. recordsTotal2: 0,
  300. tableData: [],
  301. allTableData: [],
  302. allTableData2: [],
  303. limit: '10',
  304. multipleSort: false,
  305. loading: false,
  306. fileList: [],
  307. multipleSelection: [],
  308. detectedmac: '',
  309. options: [
  310. {value: 99, label: '全部'},
  311. {value: 1, label: '进行中'},
  312. {value: 2, label: '已完成'},
  313. ],
  314. endTypeOptions: [
  315. {value: 99, label: '全部'},
  316. {value: 30, label: '近一个月'},
  317. {value: 7, label: '近一周'},
  318. {value: 1, label: '当日'},
  319. ],
  320. time1: globalBt(),
  321. },
  322. multipleSelection: [],
  323. pageination: {
  324. pageItem: 100,
  325. pageoptions: pageOptions(),
  326. total: 100,
  327. pageIndex: 1,
  328. },
  329. form: {
  330. name: '',
  331. userCode: '',
  332. shopId: '',
  333. memberType: 1,
  334. lesson: 1,
  335. gift: 1,
  336. btnType: 0,//0新建,1编辑编辑
  337. memo: '',
  338. expTime: '',
  339. dialogdata: [],//穿梭待选
  340. dialogValue: [],//穿梭已选
  341. userList: [],//穿梭已选
  342. stdList: [],//穿梭已选
  343. },
  344. memberTypes: [
  345. {value: 1, label: '年教练'},
  346. {value: 2, label: '充值教练'},
  347. ],
  348. tableData: [],
  349. tableData2: [],
  350. }
  351. },
  352. mounted() {
  353. this.vipSelect();
  354. this.ClassSelect();
  355. // this.getTableQuery();
  356. // this.getTableQuery2();
  357. this.getCurrWeekDays();
  358. },
  359. methods: {
  360. vipSelect(){
  361. let that = this;
  362. let param = {
  363. token: localStorage.token,
  364. start: 1,//
  365. tableMax: 9999,//
  366. };
  367. let postdata = qs.stringify(param);
  368. VipUserListQuery(postdata).then(res => {
  369. let json = res;
  370. if (json.Code == 0) {
  371. that.form.userList = turnResToOption(json.Rs);
  372. } else {
  373. that.$message.error(json.Memo);
  374. }
  375. })
  376. },
  377. ClassSelect(){
  378. let that = this;
  379. let param = {
  380. token: localStorage.token,
  381. start: 1,//
  382. tableMax: 9999,//
  383. };
  384. let postdata = qs.stringify(param);
  385. WaitingBeginClassList(postdata).then(res => {
  386. let json = res;
  387. if (json.Code == 0) {
  388. that.form.stdList = turnStdToOption(json.Rs);
  389. } else {
  390. that.$message.error(json.Memo);
  391. }
  392. })
  393. },
  394. ConfirmOrderAddByManager(){
  395. let that = this;
  396. let param = {
  397. token: localStorage.token,
  398. stdId : this.form.stdId ,
  399. userId : this.form.userId ,
  400. };
  401. let postdata = qs.stringify(param);
  402. OrderAddByManager(postdata).then(res => {
  403. let json = res;
  404. if (json.Code == 0) {
  405. that.$message({
  406. showClose: true,
  407. message: '预约添加成功!',
  408. type: 'success'
  409. });
  410. this.getTableQuery();
  411. that.dialogMemberVisible = false;
  412. } else {
  413. that.$message.error(json.Memo);
  414. }
  415. })
  416. },
  417. // 选择日期
  418. choiceTime(i) {
  419. console.log(123);
  420. this.choiceDate = parseInt(i);
  421. },
  422. format(percentage) {
  423. return percentage === 100 ? '已满' : `${percentage}%`;
  424. },
  425. // 编辑
  426. editMember(row) {
  427. let that = this;
  428. this.clearForm();
  429. this.form.userCode = row.userCode;
  430. this.form.name = row.name;
  431. this.form.memberType = row.vipType;
  432. this.form.lesson = row.Recovered;
  433. this.form.gift = row.Recovered;
  434. this.form.memo = row.memo;
  435. this.form.btnType = 1;
  436. this.form.shopId = row.Id;
  437. this.dialogMemberVisible = true
  438. this.dialogTitle = '编辑教练'
  439. },
  440. // 禁用
  441. pauseRow(row) {
  442. let that = this;
  443. this.$confirm('是否禁用用户' + row.name + '?', '禁用操作', {
  444. confirmButtonText: '确定',
  445. cancelButtonText: '取消',
  446. type: 'warning'
  447. }).then(() => {
  448. let param = {
  449. token: localStorage.token,
  450. Id: row.Id,
  451. status: 0,
  452. };
  453. let postdata = qs.stringify(param);
  454. testTable(postdata).then(res => {
  455. let json = res;
  456. if (json.Code == 0) {
  457. that.$message({
  458. showClose: true,
  459. message: row.name + '禁用成功!',
  460. type: 'success'
  461. });
  462. // table 重载
  463. that.getTableQuery();
  464. } else {
  465. that.$message.error(json.Memo);
  466. }
  467. })
  468. }).catch(() => {
  469. this.$message({
  470. type: 'info',
  471. message: '已取消禁用'
  472. });
  473. });
  474. },
  475. // 启用
  476. runRow(row) {
  477. let that = this;
  478. this.$confirm('是否启用用户' + row.name + '?', '启用操作', {
  479. confirmButtonText: '确定',
  480. cancelButtonText: '取消',
  481. type: 'warning'
  482. }).then(() => {
  483. let param = {
  484. token: localStorage.token,
  485. Id: row.Id,
  486. status: 1,
  487. };
  488. let postdata = qs.stringify(param);
  489. testTable(postdata).then(res => {
  490. let json = res;
  491. if (json.Code == 0) {
  492. that.$message({
  493. showClose: true,
  494. message: row.name + '启用成功!',
  495. type: 'success'
  496. });
  497. // table 重载
  498. that.getTableQuery();
  499. } else {
  500. that.$message.error(json.Memo);
  501. }
  502. })
  503. }).catch(() => {
  504. this.$message({
  505. type: 'info',
  506. message: '已取消启用'
  507. });
  508. });
  509. },
  510. // 关闭所有
  511. allDialogClose() {
  512. this.dialogVisible = false;
  513. this.dialogGift = false;
  514. this.dialogLesson = false;
  515. this.dialogExpTime = false;
  516. this.dialogLessonTable = false;
  517. },
  518. // 用户禁用 todo
  519. // 用户启用 todo
  520. // 有效期调整
  521. ExpTimeChange() {
  522. // 仅针对年费用户,使用日期格式
  523. this.allDialogClose();
  524. if (!this.multipleSelection.length) {
  525. this.$message({
  526. showClose: true,
  527. message: '错了哦,需要先选中至少一条记录',
  528. type: 'error'
  529. });
  530. return false
  531. }
  532. if (this.multipleSelection.length != 1) {
  533. this.$message({
  534. showClose: true,
  535. message: '错了哦,只能选中一条记录',
  536. type: 'error'
  537. });
  538. return false
  539. }
  540. let row = this.multipleSelection[0];
  541. if (parseInt(row.vipType) == 2) {
  542. this.$message({
  543. showClose: true,
  544. message: '错了哦,充值教练不能调整有效期',
  545. type: 'error'
  546. });
  547. return false
  548. }
  549. this.form.expTime = row.expTime;
  550. this.form.rowName = row.name;
  551. this.dialogVisible = true;
  552. this.dialogExpTime = true;
  553. },
  554. // 课时调整
  555. lessonChange() {
  556. this.allDialogClose();
  557. if (!this.multipleSelection.length) {
  558. this.$message({
  559. showClose: true,
  560. message: '错了哦,需要先选中至少一条记录',
  561. type: 'error'
  562. });
  563. return false
  564. }
  565. if (this.multipleSelection.length != 1) {
  566. this.$message({
  567. showClose: true,
  568. message: '错了哦,只能选中一条记录',
  569. type: 'error'
  570. });
  571. return false
  572. }
  573. let row = this.multipleSelection[0];
  574. this.form.lesson = row.Recovered;
  575. this.form.rowName = row.name;
  576. this.dialogVisible = true;
  577. this.dialogLesson = true;
  578. },
  579. // 赠送调整
  580. giftChange() {
  581. this.allDialogClose();
  582. if (!this.multipleSelection.length) {
  583. this.$message({
  584. showClose: true,
  585. message: '错了哦,需要先选中至少一条记录',
  586. type: 'error'
  587. });
  588. return false
  589. }
  590. if (this.multipleSelection.length != 1) {
  591. this.$message({
  592. showClose: true,
  593. message: '错了哦,只能选中一条记录',
  594. type: 'error'
  595. });
  596. return false
  597. }
  598. let row = this.multipleSelection[0];
  599. this.form.gift = row.Recovered;
  600. this.form.rowName = row.name;
  601. this.dialogVisible = true;
  602. this.dialogGift = true;
  603. },
  604. // 增删教练课程
  605. lessonStudenChange() {
  606. this.allDialogClose();
  607. if (!this.multipleSelection.length) {
  608. this.$message({
  609. showClose: true,
  610. message: '错了哦,需要先选中至少一条记录',
  611. type: 'error'
  612. });
  613. return false
  614. }
  615. if (this.multipleSelection.length != 1) {
  616. this.$message({
  617. showClose: true,
  618. message: '错了哦,只能选中一条记录',
  619. type: 'error'
  620. });
  621. return false
  622. }
  623. let row = this.multipleSelection[0];
  624. this.form.gift = row.Recovered;
  625. this.form.rowName = row.name;
  626. this.dialogVisible = true;
  627. this.dialogLessonTable = true;
  628. },
  629. // 确认提交新增教练
  630. confirmMember() {
  631. let that = this;
  632. // checkNum
  633. if (!that.form.userCode) {
  634. this.$message.error('错了哦,手机号不能为空');
  635. return false
  636. }
  637. if (!globalCheckPhone(that.form.userCode)) {
  638. this.$message.error('错了哦,手机号格式不正确');
  639. return false
  640. }
  641. if (!that.form.name) {
  642. this.$message.error('错了哦,教练名不能为空');
  643. return false
  644. }
  645. if (that.form.name.length > 8) {
  646. this.$message.error('错了哦,教练名字数超过8个字');
  647. return false
  648. }
  649. if (that.form.memo) {
  650. if (that.form.memo.length > 200) {
  651. this.$message.error('错了哦,备注字数超过200个字');
  652. return false
  653. }
  654. }
  655. let param = {
  656. token: localStorage.token,
  657. userCode: that.form.userCode,
  658. name: that.form.name,
  659. memberType: that.form.memberType,
  660. lesson: that.form.lesson,
  661. gift: that.form.gift,
  662. memo: that.form.memo,
  663. dialogValue: that.form.dialogValue,
  664. };
  665. let postdata = qs.stringify(param);
  666. testSelect(postdata).then(res => {
  667. let json = res;
  668. if (json.Code == 0) {
  669. // 关闭弹窗
  670. that.dialogMemberVisible = false;
  671. // 重载列表
  672. that.getTableQuery();
  673. that.$message({
  674. showClose: true,
  675. message: '教练添加成功!',
  676. type: 'success'
  677. });
  678. } else {
  679. that.$message.error(json.Memo);
  680. }
  681. })
  682. },
  683. confirmEditMember() {
  684. console.log(123);
  685. let that = this;
  686. // checkNum
  687. if (!that.form.userCode) {
  688. this.$message.error('错了哦,手机号不能为空');
  689. return false
  690. }
  691. console.log(that.form.userCode);
  692. if (!globalCheckPhone(that.form.userCode)) {
  693. this.$message.error('错了哦,手机号格式不正确');
  694. return false
  695. }
  696. if (!that.form.name) {
  697. this.$message.error('错了哦,教练名不能为空');
  698. return false
  699. }
  700. if (that.form.name.length > 8) {
  701. this.$message.error('错了哦,教练名字数超过8个字');
  702. return false
  703. }
  704. if (that.form.memo) {
  705. if (that.form.memo.length > 200) {
  706. this.$message.error('错了哦,备注字数超过200个字');
  707. return false
  708. }
  709. }
  710. let param = {
  711. token: localStorage.token,
  712. userCode: that.form.userCode,
  713. name: that.form.name,
  714. memberType: that.form.memberType,
  715. lesson: that.form.lesson,
  716. gift: that.form.gift,
  717. memo: that.form.memo,
  718. dialogValue: that.form.dialogValue,
  719. };
  720. let postdata = qs.stringify(param);
  721. testSelect(postdata).then(res => {
  722. let json = res;
  723. if (json.Code == 0) {
  724. // 关闭弹窗
  725. that.dialogMemberVisible = false;
  726. // 重载列表
  727. that.getTableQuery();
  728. that.$message({
  729. showClose: true,
  730. message: '教练信息编辑成功!',
  731. type: 'success'
  732. });
  733. } else {
  734. that.$message.error(json.Memo);
  735. }
  736. })
  737. },
  738. // 确认提交课时
  739. confirmLesson() {
  740. let that = this;
  741. // checkNum
  742. let param = {
  743. token: localStorage.token,
  744. userCode: that.form.userCode,
  745. lesson: that.form.lesson,
  746. };
  747. let postdata = qs.stringify(param);
  748. testSelect(postdata).then(res => {
  749. let json = res;
  750. if (json.Code == 0) {
  751. // 关闭弹窗
  752. that.dialogVisible = false;
  753. // 重载列表
  754. that.getTableQuery();
  755. that.$message({
  756. showClose: true,
  757. message: '课时调整成功!',
  758. type: 'success'
  759. });
  760. } else {
  761. that.$message.error(json.Memo);
  762. }
  763. })
  764. },
  765. // 确认提交赠送
  766. confirmGift() {
  767. let that = this;
  768. // checkNum
  769. let param = {
  770. token: localStorage.token,
  771. userCode: that.form.userCode,
  772. gift: that.form.gift,
  773. };
  774. let postdata = qs.stringify(param);
  775. testSelect(postdata).then(res => {
  776. let json = res;
  777. if (json.Code == 0) {
  778. // 关闭弹窗
  779. that.dialogVisible = false;
  780. // 重载列表
  781. that.getTableQuery();
  782. that.$message({
  783. showClose: true,
  784. message: '赠送课时调整成功!',
  785. type: 'success'
  786. });
  787. } else {
  788. that.$message.error(json.Memo);
  789. }
  790. })
  791. },
  792. // 确认提交有效期
  793. confirmExpTime() {
  794. let that = this;
  795. // checkNum
  796. let param = {
  797. token: localStorage.token,
  798. userCode: that.form.userCode,
  799. expTime: that.form.expTime,
  800. };
  801. let postdata = qs.stringify(param);
  802. testSelect(postdata).then(res => {
  803. let json = res;
  804. if (json.Code == 0) {
  805. // 关闭弹窗
  806. that.dialogVisible = false;
  807. // 重载列表
  808. that.getTableQuery();
  809. that.$message({
  810. showClose: true,
  811. message: '赠送课时调整成功!',
  812. type: 'success'
  813. });
  814. } else {
  815. that.$message.error(json.Memo);
  816. }
  817. })
  818. },
  819. // 确认提交教练课程
  820. confirmLessonTable() {
  821. let that = this;
  822. // checkNum
  823. let param = {
  824. token: localStorage.token,
  825. userCode: that.form.userCode,
  826. dialogValue: that.form.dialogValue,
  827. };
  828. let postdata = qs.stringify(param);
  829. testSelect(postdata).then(res => {
  830. let json = res;
  831. if (json.Code == 0) {
  832. // 关闭弹窗
  833. that.dialogVisible = false;
  834. // 重载列表
  835. that.getTableQuery();
  836. that.$message({
  837. showClose: true,
  838. message: '教练课程调整成功!',
  839. type: 'success'
  840. });
  841. } else {
  842. that.$message.error(json.Memo);
  843. }
  844. })
  845. },
  846. // 加载选项
  847. panelSelect() {
  848. let that = this;
  849. let param = {
  850. token: localStorage.token,
  851. };
  852. let postdata = qs.stringify(param);
  853. testSelect(postdata).then(res => {
  854. let json = res;
  855. if (json.Code == 0) {
  856. that.form.dialogdata = json.Rs;
  857. } else {
  858. that.$message.error(json.Memo);
  859. }
  860. })
  861. },
  862. // 新增教练
  863. addMember() {
  864. this.clearForm();
  865. this.dialogMemberVisible = true
  866. this.btnType = 0;
  867. this.dialogTitle = '新增教练'
  868. },
  869. // 删除
  870. delList() {
  871. let that = this;
  872. // checkNum
  873. if (!this.multipleSelection.length) {
  874. that.$message({
  875. showClose: true,
  876. message: '错了哦,需要先选中至少一条记录',
  877. type: 'error'
  878. });
  879. return false
  880. }
  881. if (this.multipleSelection.length != 1) {
  882. that.$message({
  883. showClose: true,
  884. message: '错了哦,只能选中一条记录',
  885. type: 'error'
  886. });
  887. return false
  888. }
  889. let detectorid = that.multipleSelection[0].Id;
  890. let param = {
  891. token: localStorage.token,
  892. detectorid: detectorid,
  893. status: 9,//0禁用1启用9删除
  894. };
  895. let postdata = qs.stringify(param);
  896. this.$confirm('此操作将永久删除该教练, 是否继续?', '提示', {
  897. confirmButtonText: '确定',
  898. cancelButtonText: '取消',
  899. type: 'warning'
  900. }).then(() => {
  901. testSelect(postdata).then(res => {
  902. let json = res;
  903. if (json.Code == 0) {
  904. that.$message({
  905. showClose: true,
  906. message: '选中的教练已删除!',
  907. type: 'success'
  908. });
  909. // 重载列表
  910. that.getTableQuery();
  911. } else {
  912. that.$message.error(json.Memo);
  913. }
  914. });
  915. }).catch(() => {
  916. this.$message({
  917. type: 'info',
  918. message: '已取消删除'
  919. });
  920. });
  921. },
  922. handleSelectionChange(val) {
  923. this.multipleSelection = val;
  924. },
  925. // 查询按钮
  926. query() {
  927. // this.getTableQuery();
  928. this.$message.success('查询完毕');
  929. },
  930. clearForm() {
  931. // clear
  932. this.form.name = '';
  933. this.form.userCode = '';
  934. this.form.shopId = '';
  935. },
  936. // 页面数据查询
  937. getTableQuery() {
  938. let that = this;
  939. // this.getGetChildRegionSelect(0, 1);
  940. that.loading = true;
  941. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  942. let param = {
  943. token: localStorage.token,
  944. };
  945. let postdata = qs.stringify(param);
  946. TodayClassOrderQuery(postdata).then(res => {
  947. let json = res;
  948. if (json.Code == 0) {
  949. that.loading = false;
  950. if (json.Rs) {
  951. that.allTableData = json.Rs;
  952. that.recordsTotal = json.Rs.length;
  953. } else {
  954. that.allTableData = [];
  955. that.recordsTotal = 0;
  956. }
  957. // 设置分页数据
  958. that.setPaginations();
  959. } else {
  960. that.$message.error(json.Memo);
  961. }
  962. })
  963. },
  964. getTableQuery2() {
  965. let that = this;
  966. // this.getGetChildRegionSelect(0, 1);
  967. that.loading = true;
  968. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  969. let param = {
  970. token: localStorage.token,
  971. supregionid: 0,//
  972. regionid: this.panel.regionid,//
  973. comid: 1,//
  974. tagname: that.panel.tagname,//标签名
  975. start: 1,//
  976. tableMax: 9999,//
  977. };
  978. let postdata = qs.stringify(param);
  979. testTable(postdata).then(res => {
  980. let json = res;
  981. if (json.Code == 0) {
  982. that.loading = false;
  983. if (json.Rs) {
  984. that.allTableData2 = json.Rs;
  985. that.recordsTotal2 = json.Rs.length;
  986. } else {
  987. that.allTableData2 = [];
  988. that.recordsTotal2 = 0;
  989. }
  990. // 设置分页数据
  991. that.setPaginations2();
  992. } else {
  993. that.$message.error(json.Memo);
  994. }
  995. })
  996. },
  997. // 导出excel
  998. btnExpAll() {
  999. let that = this;
  1000. let url = headapi + '?ctl=ajax&mod=czgl&act=czcx_excel';//获取
  1001. let bt = globaltime2String(that.panel.time1[0]);
  1002. let et = globaltime2String(that.panel.time1[1]);
  1003. let usercode = that.panel.usercode;
  1004. window.location = url + '&bt=' + bt + '&et=' + et + '&usercode=' + usercode;
  1005. },
  1006. // 设置分页数据
  1007. setPaginations() {
  1008. // 分页属性
  1009. let that = this;
  1010. that.pageination.total = that.recordsTotal;
  1011. // 默认分页
  1012. that.tableData = that.allTableData.filter((item, index) => {
  1013. return index < that.pageination.pageItem;
  1014. });
  1015. },
  1016. // 设置分页数据
  1017. setPaginations2() {
  1018. // 分页属性
  1019. let that = this;
  1020. that.pageination.total = that.recordsTotal;
  1021. // 默认分页
  1022. that.tableData = that.allTableData.filter((item, index) => {
  1023. return index < that.pageination.pageItem;
  1024. });
  1025. },
  1026. // 每页显示数量
  1027. handleSizeChange() {
  1028. let that = this;
  1029. that.tableData = that.allTableData.filter((item, index) => {
  1030. return index < that.pageination.pageItem;
  1031. });
  1032. that.draw = that.pageination.pageItem;
  1033. that.getTableQuery();
  1034. },
  1035. // 翻页
  1036. pageChange(pageIndex) {
  1037. let that = this;
  1038. // 获取当前页
  1039. let index = that.pageination.pageItem * (pageIndex - 1);
  1040. // 数据总数
  1041. let nums = that.pageination.pageItem * pageIndex;
  1042. // 容器
  1043. let tables = [];
  1044. for (var i = index; i < nums; i++) {
  1045. if (that.allTableData[i]) {
  1046. tables.push(that.allTableData[i])
  1047. }
  1048. this.tableData = tables;
  1049. }
  1050. that.start = index * that.draw;
  1051. that.getTableQuery();
  1052. },
  1053. // 自动排序
  1054. sortChange(params) {
  1055. console.log(params)
  1056. },
  1057. // 过滤时间
  1058. filterFmtDate(value, row, column) {
  1059. let that = this;
  1060. return nonTfmtDate(column, 11);
  1061. },
  1062. // 过滤金额
  1063. filterMoney(value, row, column) {
  1064. let that = this;
  1065. return parseFloat(column).toFixed(2);
  1066. },
  1067. // 本周
  1068. getCurrWeekDays() {
  1069. let now = new Date();
  1070. let nowTime = now.getTime();
  1071. let day = now.getDay();
  1072. let oneDayTime = 24 * 60 * 60 * 1000;
  1073. // let MondayTime = nowTime - (day - 1) * oneDayTime;//显示周一
  1074. let SundayTime = nowTime + (7 - day) * oneDayTime;//显示周日
  1075. let days = '';
  1076. let item = [];
  1077. for (let i = 0; i < 7; i++) {
  1078. days = new Date(nowTime + (i - day) * oneDayTime);//显示周日
  1079. item = {
  1080. name: this.numberToWeek(days.getDay()),
  1081. data: days.getMonth() + 1 + '月' + days.getDate() + '日'
  1082. }
  1083. this.weeks.push(item)
  1084. }
  1085. },
  1086. numberToWeek(val) {
  1087. switch (parseInt(val)) {
  1088. case 0:
  1089. return '星期一'
  1090. break;
  1091. case 1:
  1092. return '星期二'
  1093. break;
  1094. case 2:
  1095. return '星期三'
  1096. break;
  1097. case 3:
  1098. return '星期四'
  1099. break;
  1100. case 4:
  1101. return '星期五'
  1102. break;
  1103. case 5:
  1104. return '星期六'
  1105. break;
  1106. case 6:
  1107. return '星期天'
  1108. break;
  1109. }
  1110. }
  1111. },
  1112. }
  1113. </script>
  1114. <style scoped>
  1115. @import "../assets/css/panel.css";
  1116. .context {
  1117. overflow: hidden;
  1118. display: block;
  1119. margin: 0 auto;
  1120. background-color: #fff !important;
  1121. padding: 30px;
  1122. }
  1123. .panel-body {
  1124. padding: 20px;
  1125. background: #F0F2F5;
  1126. }
  1127. .change {
  1128. width: 100%;
  1129. overflow: hidden;
  1130. display: block;
  1131. margin: 0 auto;
  1132. padding-top: 10px;
  1133. padding-bottom: 10px;
  1134. }
  1135. .change button {
  1136. float: left;
  1137. }
  1138. .change button.pull-right {
  1139. float: right;
  1140. }
  1141. .dialogTitle {
  1142. width: 100%;
  1143. overflow: hidden;
  1144. display: block;
  1145. margin: 0 auto;
  1146. color: #000000;
  1147. font-size: 18px;
  1148. text-align: center;
  1149. }
  1150. .dialogTitle em {
  1151. float: none;
  1152. font-style: normal;
  1153. color: #3799FF;
  1154. margin: 0;
  1155. }
  1156. /deep/ .el-transfer-panel__item .el-checkbox__input {
  1157. left: 40px;
  1158. }
  1159. .dialogFooter {
  1160. width: 90%;
  1161. overflow: hidden;
  1162. display: block;
  1163. margin: 0 auto;
  1164. margin-top: 10px;
  1165. }
  1166. .dialogFooter button {
  1167. float: right;
  1168. margin-left: 10px;
  1169. }
  1170. .dialogContent {
  1171. width: 100%;
  1172. overflow: hidden;
  1173. display: block;
  1174. margin: 0 auto;
  1175. }
  1176. .dialogContent .pull-left {
  1177. width: 30%;
  1178. float: left;
  1179. }
  1180. .dialogContent .pull-right {
  1181. width: 70%;
  1182. float: right;
  1183. }
  1184. .current {
  1185. width: 158px;
  1186. height: 23px;
  1187. /*float: left;*/
  1188. border-radius: 250px;
  1189. text-align: center;
  1190. background: #F0F2F5;
  1191. color: #545454;
  1192. font-size: 14px;
  1193. padding: 3px 10px;
  1194. margin-left: 20px;
  1195. }
  1196. .timeList {
  1197. width: 800px;
  1198. overflow: hidden;
  1199. float: right;
  1200. position: relative;
  1201. z-index: 100;
  1202. cursor: pointer;
  1203. }
  1204. .timeList ul {
  1205. width: 100%;
  1206. overflow: hidden;
  1207. display: block;
  1208. margin: 0 auto;
  1209. list-style: none;
  1210. }
  1211. .timeList li {
  1212. width: 100px;
  1213. overflow: hidden;
  1214. list-style: none;
  1215. float: left;
  1216. margin-right: 6px;
  1217. border: 1px solid #ccc;
  1218. text-align: center;
  1219. height: 40px;
  1220. }
  1221. em {
  1222. font-style: normal;
  1223. }
  1224. .timeList em {
  1225. width: 100%;
  1226. overflow: hidden;
  1227. display: block;
  1228. margin: 0 auto;
  1229. font-size: 14px;
  1230. text-align: center;
  1231. }
  1232. .timeList span {
  1233. width: 100%;
  1234. overflow: hidden;
  1235. display: block;
  1236. margin: 0 auto;
  1237. font-size: 12px;
  1238. text-align: center;
  1239. }
  1240. .timeList li.active {
  1241. border: 1px solid #3799FF;
  1242. }
  1243. .timeList li.active em {
  1244. color: #3799FF;
  1245. }
  1246. .timeList li.active span {
  1247. color: #3799FF;
  1248. }
  1249. .panel_control /deep/ .el-input {
  1250. max-width: 140px;
  1251. float: left;
  1252. }
  1253. .panel-body em {
  1254. float: left;
  1255. line-height: 40px;
  1256. margin-right: 10px;
  1257. }
  1258. </style>