record.vue 13 KB

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