record.vue 16 KB

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