record.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>预约记录</h5>
  5. <div class="panel-body">
  6. <div class="panel_control">
  7. <el-row :gutter="20">
  8. <el-col :span="4">
  9. <em>姓名:</em>
  10. <el-input v-model="panel.name" placeholder="请输入姓名"></el-input>
  11. </el-col>
  12. <el-col :span="4">
  13. <em>手机号:</em>
  14. <el-input v-model="panel.phone" placeholder="请输入手机号" type="number"></el-input>
  15. </el-col>
  16. <el-col :span="7">
  17. <em>日期:</em>
  18. <el-date-picker
  19. v-model="panel.timeScope"
  20. type="daterange"
  21. range-separator="至"
  22. start-placeholder="开始日期"
  23. end-placeholder="结束日期">
  24. </el-date-picker>
  25. </el-col>
  26. <el-col :span="4">
  27. <em>预约课程:</em>
  28. <el-select v-model="panel.classId">
  29. <el-option
  30. v-for="item in panel.classOptions"
  31. :key="item.value"
  32. :label="item.label"
  33. :value="item.value">
  34. </el-option>
  35. </el-select>
  36. </el-col>
  37. <el-col :span="4">
  38. <em>状态:</em>
  39. <el-select v-model="panel.status">
  40. <el-option
  41. v-for="item in panel.options"
  42. :key="item.value"
  43. :label="item.label"
  44. :value="item.value">
  45. </el-option>
  46. </el-select>
  47. </el-col>
  48. <el-col :span="4">
  49. <el-button size="" type="primary" @click="query" :disabled="serachBtnStatus" plain>查询
  50. </el-button>
  51. </el-col>
  52. </el-row>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="table">
  57. <el-table
  58. :data="tableData"
  59. border
  60. is-horizontal-resize
  61. :default-sort="{prop: 'date', order: 'descending'}"
  62. element-loading-background="rgba(0, 0, 0, 0.8)"
  63. class=""
  64. @selection-change="handleSelectionChange"
  65. >
  66. >
  67. <el-table-column
  68. type="index"
  69. label="序号"
  70. align="center"
  71. width="50">
  72. </el-table-column>
  73. <el-table-column
  74. prop="UserName"
  75. label="会员名"
  76. width="90"
  77. >
  78. </el-table-column>
  79. <el-table-column
  80. prop="Phone"
  81. label="手机号"
  82. width="110"
  83. sortable
  84. >
  85. </el-table-column>
  86. <el-table-column
  87. prop="ClassName"
  88. label="预约课程"
  89. sortable
  90. >
  91. <template slot-scope="scope">
  92. <span class="lessons"
  93. :style="{ background:scope.row.ClassColor }">{{ scope.row.ClassName }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. prop="ConsumeHour"
  98. label="课时"
  99. width="80"
  100. sortable
  101. >
  102. </el-table-column>
  103. <el-table-column
  104. prop="Base.CreatedAt"
  105. label="预约日期"
  106. width="180"
  107. :formatter="filterFmtDate"
  108. sortable
  109. >
  110. </el-table-column>
  111. <el-table-column
  112. prop="BeginStr"
  113. label="上课时间"
  114. width="180"
  115. sortable
  116. >
  117. <template slot-scope="scope">
  118. {{ scope.row.BeginTime |filterNoTTime }} - {{ scope.row.EndStr }}
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. prop="RemainHour"
  123. label="是否跨店"
  124. width="110"
  125. sortable
  126. >
  127. <template slot-scope="scope">
  128. <span v-if="scope.row.RemainHour == ''" style="color:red;">跨店</span>
  129. <span v-else style="color: #000">本店用户</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column
  133. prop="Status"
  134. label="状态"
  135. width="110"
  136. sortable
  137. >
  138. <template slot-scope="scope">
  139. <span v-if="scope.row.Status == 1" style="color:yellowgreen;">已预约</span>
  140. <span v-if="scope.row.Status == 2" style="color: #ccc">已取消</span>
  141. <span v-if="scope.row.Status == 3" style="color: red">预约未到</span>
  142. <span v-if="scope.row.Status == 4" style="color:#000;">已完成</span>
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. <br>
  147. <el-pagination
  148. background
  149. :total="pageination.total"
  150. :page-size="pageination.pageItem"
  151. @current-change="pageChange"
  152. ></el-pagination>
  153. </div>
  154. </div>
  155. </template>
  156. <script>
  157. import Global from '../Global.js'
  158. import {
  159. OrderListQuery,
  160. ClassListQuery,
  161. } from "../api/getApiRes";
  162. let qs = require('qs');
  163. export default {
  164. data() {
  165. return {
  166. serachBtnStatus: false,
  167. dialogVisible: false,//其他dialog
  168. dialogMemberVisible: false,//新增会员dialog
  169. dialogLesson: false,//课时调整
  170. dialogGift: false,//赠送课时调整
  171. dialogExpTime: false,//有效期调整
  172. dialogLessonTable: false,//会员课程
  173. dialogTitle: '新增会员',
  174. dialogValue: [],
  175. // panel 配置项目
  176. panel: {
  177. status: '',
  178. classId: '',
  179. usercode: '',
  180. username: '',
  181. timeScope: globalBt2(7),
  182. compname: '',
  183. keyword: '',
  184. USERCODE: '',
  185. endType: '',
  186. taskstatus: 99,
  187. draw: 1,
  188. start: 0,
  189. recordsTotal: 0,
  190. tableData: [],
  191. allTableData: [],
  192. limit: '10',
  193. multipleSort: false,
  194. loading: false,
  195. fileList: [],
  196. multipleSelection: [],
  197. detectedmac: '',
  198. classOptions: [],
  199. options: [
  200. {value: '', label: '全部'},
  201. {value: 1, label: '已预约'},
  202. {value: 2, label: '已取消'},
  203. {value: 3, label: '预约未到'},
  204. {value: 4, label: '已完成'},
  205. ],
  206. endTypeOptions: [
  207. {value: 99, label: '全部'},
  208. {value: 30, label: '近一个月'},
  209. {value: 7, label: '近一周'},
  210. {value: 1, label: '当日'},
  211. ],
  212. time1: globalBt(),
  213. },
  214. multipleSelection: [],
  215. pageination: {
  216. pageItem: 100,
  217. pageoptions: pageOptions(),
  218. total: 100,
  219. pageIndex: 1,
  220. },
  221. form: {
  222. name: '',
  223. userCode: '',
  224. shopId: '',
  225. memberType: 1,
  226. lesson: 1,
  227. gift: 1,
  228. btnType: 0,//0新建,1编辑编辑
  229. memo: '',
  230. expTime: '',
  231. dialogdata: [],//穿梭待选
  232. dialogValue: [],//穿梭已选
  233. },
  234. memberTypes: [
  235. {value: 1, label: '年会员'},
  236. {value: 2, label: '充值会员'},
  237. ],
  238. tableData: []
  239. }
  240. },
  241. mounted() {
  242. this.panelSelect();
  243. this.getTableQuery();
  244. },
  245. methods: {
  246. // 加载选项
  247. panelSelect() {
  248. let that = this;
  249. let param = {
  250. token: localStorage.token,
  251. classType: 1//去掉午休
  252. };
  253. let postdata = qs.stringify(param);
  254. ClassListQuery(postdata).then(res => {
  255. let json = res;
  256. if (json.Code == 0) {
  257. if (json.Rs == null) return false;
  258. that.panel.classOptions = turnClassResToOption(json.Rs);
  259. that.panel.classOptions.unshift({value: '', label: '全部'})
  260. } else {
  261. that.$message.error(json.Memo + '错误码:' + json.Code);
  262. }
  263. })
  264. },
  265. handleSelectionChange(val) {
  266. this.multipleSelection = val;
  267. },
  268. // 查询按钮
  269. query() {
  270. let that = this;
  271. that.serachBtnStatus = true;
  272. let totalTime = 2;
  273. let clock = window.setInterval(() => {
  274. totalTime--;
  275. if (totalTime < 0) {
  276. totalTime = 2;
  277. that.serachBtnStatus = false;
  278. }
  279. }, 1000);
  280. this.getTableQuery();
  281. this.$message.success('查询完毕');
  282. },
  283. clearForm() {
  284. // clear
  285. this.form.name = '';
  286. this.form.userCode = '';
  287. this.form.shopId = '';
  288. },
  289. // 页面数据查询
  290. getTableQuery() {
  291. let that = this;
  292. // this.getGetChildRegionSelect(0, 1);
  293. that.loading = true;
  294. console.log(that.panel.timeScope[0]);
  295. // let beginOrdertime = parseInt(that.panel.timeScope[0].valueOf() / 1000);
  296. // let endOrdertime = parseInt(that.panel.timeScope[1].valueOf() / 1000);
  297. // beginOrdertime = '';
  298. // endOrdertime = '';
  299. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  300. let param = {
  301. token: localStorage.token,
  302. classId: that.panel.classId,//
  303. name: that.panel.name,//
  304. phone: that.panel.phone,//
  305. beginOrdertime:nonTfmtDatetoLength(that.panel.timeScope[0], 10) + " 00:00:00",//
  306. endOrdertime: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + " 23:59:59",//
  307. status: that.panel.status,//标签名
  308. };
  309. let postdata = qs.stringify(param);
  310. OrderListQuery(postdata).then(res => {
  311. let json = res;
  312. if (json.Code == 0) {
  313. that.loading = false;
  314. if (json.Rs) {
  315. that.allTableData = json.Rs;
  316. that.recordsTotal = json.Rs.length;
  317. } else {
  318. that.allTableData = [];
  319. that.recordsTotal = 0;
  320. }
  321. // 设置分页数据
  322. that.setPaginations();
  323. } else {
  324. that.$message.error(json.Memo + '错误码:' + json.Code);
  325. }
  326. })
  327. },
  328. // 设置分页数据
  329. setPaginations() {
  330. // 分页属性
  331. let that = this;
  332. that.pageination.total = that.recordsTotal;
  333. // 默认分页
  334. that.tableData = that.allTableData.filter((item, index) => {
  335. return index < that.pageination.pageItem;
  336. });
  337. },
  338. // 每页显示数量
  339. handleSizeChange() {
  340. let that = this;
  341. that.tableData = that.allTableData.filter((item, index) => {
  342. return index < that.pageination.pageItem;
  343. });
  344. that.draw = that.pageination.pageItem;
  345. // that.getTableQuery();
  346. },
  347. // 翻页
  348. pageChange(pageIndex) {
  349. let that = this;
  350. // 获取当前页
  351. let index = that.pageination.pageItem * (pageIndex - 1);
  352. // 数据总数
  353. let nums = that.pageination.pageItem * pageIndex;
  354. // 容器
  355. let tables = [];
  356. for (var i = index; i < nums; i++) {
  357. if (that.allTableData[i]) {
  358. tables.push(that.allTableData[i])
  359. }
  360. this.tableData = tables;
  361. }
  362. that.start = index * that.draw;
  363. // that.getTableQuery();
  364. },
  365. // 自动排序
  366. sortChange(params) {
  367. console.log(params)
  368. },
  369. // 过滤时间
  370. filterFmtDate(value, row, column) {
  371. let that = this;
  372. return nonTfmtDate(column, 11);
  373. },
  374. // 过滤金额
  375. filterMoney(value, row, column) {
  376. let that = this;
  377. return parseFloat(column).toFixed(2);
  378. },
  379. },
  380. filters: {
  381. filterNoTTime: function (value) {
  382. if (!value) {
  383. return 0
  384. } else {
  385. return nonTfmtDatetoLength(value, 16);
  386. }
  387. },
  388. },
  389. watch: {
  390. $route(to) {
  391. if (to.name == 'record') {
  392. this.panelSelect();
  393. this.getTableQuery();
  394. }
  395. },
  396. },
  397. }
  398. </script>
  399. <style scoped>
  400. @import "../assets/css/panel.css";
  401. .context {
  402. height: 770px;
  403. overflow-y: scroll;
  404. display: block;
  405. margin: 0 auto;
  406. background-color: #fff !important;
  407. padding: 30px;
  408. }
  409. .panel-body {
  410. padding: 20px;
  411. background: #F0F2F5;
  412. }
  413. .change {
  414. width: 100%;
  415. overflow: hidden;
  416. display: block;
  417. margin: 0 auto;
  418. padding-top: 10px;
  419. padding-bottom: 10px;
  420. }
  421. .change button {
  422. float: left;
  423. }
  424. .change button.pull-right {
  425. float: right;
  426. }
  427. .dialogTitle {
  428. width: 100%;
  429. overflow: hidden;
  430. display: block;
  431. margin: 0 auto;
  432. color: #000000;
  433. font-size: 18px;
  434. text-align: center;
  435. }
  436. .dialogTitle em {
  437. float: none;
  438. font-style: normal;
  439. color: #3799FF;
  440. margin: 0;
  441. }
  442. /deep/ .el-transfer-panel__item .el-checkbox__input {
  443. left: 40px;
  444. }
  445. .dialogFooter {
  446. width: 90%;
  447. overflow: hidden;
  448. display: block;
  449. margin: 0 auto;
  450. margin-top: 10px;
  451. }
  452. .dialogFooter button {
  453. float: right;
  454. margin-left: 10px;
  455. }
  456. .dialogContent {
  457. width: 100%;
  458. overflow: hidden;
  459. display: block;
  460. margin: 0 auto;
  461. }
  462. .dialogContent .pull-left {
  463. width: 30%;
  464. float: left;
  465. }
  466. .dialogContent .pull-right {
  467. width: 70%;
  468. float: right;
  469. }
  470. .panel /deep/ .el-date-editor--daterange {
  471. /*width: 260px;*/
  472. }
  473. /deep/ .el-col-4 {
  474. width: 15% !important;
  475. }
  476. .panel /deep/ .el-input__inner {
  477. /*width: 130px;*/
  478. }
  479. .panel /deep/ .el-input {
  480. /*width: 130px;*/
  481. }
  482. .panel /deep/ .el-select {
  483. width: 130px;
  484. }
  485. /deep/ .el-date-editor .el-range-separator {
  486. line-height: 22px;
  487. }
  488. .lessons {
  489. padding: 1px 7px;
  490. border-radius: 250px;
  491. float: left;
  492. color: #000;
  493. }
  494. .el-col-7 {
  495. width: 25%;
  496. }
  497. /*ipad only*/
  498. @media only screen and (max-width: 1366px) {
  499. .panel-body {
  500. }
  501. .panel .el-button {
  502. margin-top: 5px;
  503. }
  504. .panel .el-col-4:nth-child(6) {
  505. width: 9% !important;
  506. float: right;
  507. margin-top: 25px;
  508. }
  509. .el-col-7 {
  510. width: 29%;
  511. }
  512. }
  513. </style>