appoint.vue 56 KB

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