record.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  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.USERCODE" placeholder="请输入姓名"></el-input>
  11. </el-col>
  12. <el-col :span="4">
  13. <em>手机号:</em>
  14. <el-input v-model="panel.keyword" 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.taskstatus">
  29. <el-option
  30. v-for="item in panel.options"
  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.taskstatus">
  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. <el-table-column
  66. type="index"
  67. label="序号"
  68. width="50">
  69. </el-table-column>
  70. <el-table-column
  71. prop="name"
  72. label="会员名"
  73. >
  74. </el-table-column>
  75. <el-table-column
  76. prop="tel"
  77. label="手机号"
  78. sortable
  79. >
  80. </el-table-column>
  81. <el-table-column
  82. prop="name"
  83. label="预约课程"
  84. sortable
  85. >
  86. </el-table-column>
  87. <el-table-column
  88. prop="Recovered"
  89. label="消耗课时"
  90. sortable
  91. >
  92. </el-table-column>
  93. <el-table-column
  94. prop="name"
  95. label="课程时间"
  96. sortable
  97. >
  98. </el-table-column>
  99. <el-table-column
  100. prop="create"
  101. label="预约时间"
  102. width="180"
  103. sortable
  104. >
  105. </el-table-column>
  106. <el-table-column
  107. prop="vipType"
  108. label="状态"
  109. sortable
  110. >
  111. <template slot-scope="scope">
  112. <span v-if="scope.row.vipType == 1">正常下课</span>
  113. <span v-if="scope.row.vipType == 2">预约取消</span>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <br>
  118. <el-pagination
  119. background
  120. :total="pageination.total"
  121. :page-size="pageination.pageItem"
  122. @current-change="pageChange"
  123. ></el-pagination>
  124. </div>
  125. <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="1200px">
  126. <div class="dialogContent">
  127. <div class="pull-left">
  128. <el-form ref="form" :model="form" label-width="160px">
  129. <el-form-item label="手机号">
  130. <el-input v-model="form.userCode"></el-input>
  131. </el-form-item>
  132. <el-form-item label="会员名">
  133. <el-input v-model="form.name"></el-input>
  134. </el-form-item>
  135. <el-form-item label="会员类型">
  136. <el-select v-model="form.memberType" placeholder="请选择所属门店">
  137. <el-option
  138. v-for="item in memberTypes"
  139. :key="item.value"
  140. :label="item.label"
  141. :value="item.value"
  142. ></el-option>
  143. </el-select>
  144. </el-form-item>
  145. <el-form-item label="课时">
  146. <el-input-number v-model="form.lesson" :min="0" :max="99999" label="(天)"></el-input-number>
  147. </el-form-item>
  148. <el-form-item label="赠送课时">
  149. <el-input-number v-model="form.gift" :min="0" :max="99999" label="(天)"></el-input-number>
  150. </el-form-item>
  151. <el-form-item label="备注">
  152. <el-input v-model="form.memo"></el-input>
  153. </el-form-item>
  154. </el-form>
  155. </div>
  156. <div class="pull-right">
  157. <el-form ref="form" :model="form" label-width="160px">
  158. <el-form-item label="会员课程">
  159. <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"></el-transfer>
  160. </el-form-item>
  161. </el-form>
  162. </div>
  163. </div>
  164. <div class="dialogFooter">
  165. <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
  166. <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
  167. </el-button>
  168. <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
  169. </div>
  170. </el-dialog>
  171. <el-dialog :visible.sync="dialogVisible">
  172. <div class="dialogTitle">
  173. <h5>
  174. 用户:
  175. <em class="blue">【 {{form.rowName}}】</em>
  176. <span v-if="dialogLesson">当前课时</span>
  177. <span v-if="dialogGift">当前赠送课时</span>
  178. <span v-if="dialogExpTime">当前到期时间</span>
  179. <span v-if="dialogLessonTable">当前会员课程</span>
  180. </h5>
  181. </div>
  182. <div v-if="dialogLesson">
  183. <el-input-number v-model="form.lesson" :min="0" :max="9999" label="课时调整"></el-input-number>
  184. </div>
  185. <div v-if="dialogGift">
  186. <el-input-number v-model="form.gift" :min="0" :max="9999" label="赠送课时调整"></el-input-number>
  187. </div>
  188. <div v-if="dialogExpTime">
  189. <el-date-picker
  190. v-model="form.expTime"
  191. type="date"
  192. placeholder="选择日期">
  193. </el-date-picker>
  194. </div>
  195. <div v-if="dialogLessonTable">
  196. <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"></el-transfer>
  197. </div>
  198. <div class="dialogFooter">
  199. <!-- 当前课时-->
  200. <el-button type="primary" size="small" @click="confirmLesson" v-if="dialogLesson">确定</el-button>
  201. <el-button type="primary" size="small" @click="confirmGift" v-if="dialogGift">确定</el-button>
  202. <el-button type="primary" size="small" @click="confirmExpTime" v-if="dialogExpTime">确定</el-button>
  203. <el-button type="primary" size="small" @click="confirmLessonTable" v-if="dialogLessonTable">确定
  204. </el-button>
  205. <el-button size="small" @click="dialogVisible = false">取消</el-button>
  206. </div>
  207. </el-dialog>
  208. </div>
  209. </template>
  210. <script>
  211. import Global from '../Global.js'
  212. import {
  213. testTable,
  214. testSelect
  215. } from "../api/getApiRes";
  216. let qs = require('qs');
  217. export default {
  218. data() {
  219. return {
  220. dialogVisible: false,//其他dialog
  221. dialogMemberVisible: false,//新增会员dialog
  222. dialogLesson: false,//课时调整
  223. dialogGift: false,//赠送课时调整
  224. dialogExpTime: false,//有效期调整
  225. dialogLessonTable: false,//会员课程
  226. dialogTitle: '新增会员',
  227. dialogValue: [],
  228. // panel 配置项目
  229. panel: {
  230. usercode: '',
  231. username: '',
  232. timeScope: globalBt2(30),
  233. compname: '',
  234. keyword: '',
  235. USERCODE: '',
  236. endType: '',
  237. taskstatus: 99,
  238. draw: 1,
  239. start: 0,
  240. recordsTotal: 0,
  241. tableData: [],
  242. allTableData: [],
  243. limit: '10',
  244. multipleSort: false,
  245. loading: false,
  246. fileList: [],
  247. multipleSelection: [],
  248. detectedmac: '',
  249. options: [
  250. {value: 99, label: '全部'},
  251. {value: 1, label: '进行中'},
  252. {value: 2, label: '已完成'},
  253. ],
  254. endTypeOptions: [
  255. {value: 99, label: '全部'},
  256. {value: 30, label: '近一个月'},
  257. {value: 7, label: '近一周'},
  258. {value: 1, label: '当日'},
  259. ],
  260. time1: globalBt(),
  261. },
  262. multipleSelection: [],
  263. pageination: {
  264. pageItem: 100,
  265. pageoptions: pageOptions(),
  266. total: 100,
  267. pageIndex: 1,
  268. },
  269. form: {
  270. name: '',
  271. userCode: '',
  272. shopId: '',
  273. memberType: 1,
  274. lesson: 1,
  275. gift: 1,
  276. btnType: 0,//0新建,1编辑编辑
  277. memo: '',
  278. expTime: '',
  279. dialogdata: [],//穿梭待选
  280. dialogValue: [],//穿梭已选
  281. },
  282. memberTypes: [
  283. {value: 1, label: '年会员'},
  284. {value: 2, label: '充值会员'},
  285. ],
  286. tableData: []
  287. }
  288. },
  289. mounted() {
  290. this.panelSelect();
  291. this.getTableQuery();
  292. },
  293. methods: {
  294. // 编辑
  295. editMember(row) {
  296. let that = this;
  297. this.clearForm();
  298. this.form.userCode = row.userCode;
  299. this.form.name = row.name;
  300. this.form.memberType = row.vipType;
  301. this.form.lesson = row.Recovered;
  302. this.form.gift = row.Recovered;
  303. this.form.memo = row.memo;
  304. this.form.btnType = 1;
  305. this.form.shopId = row.Id;
  306. this.dialogMemberVisible = true
  307. this.dialogTitle = '编辑会员'
  308. },
  309. // 禁用
  310. pauseRow(row) {
  311. let that = this;
  312. this.$confirm('是否禁用用户' + row.name + '?', '禁用操作', {
  313. confirmButtonText: '确定',
  314. cancelButtonText: '取消',
  315. type: 'warning'
  316. }).then(() => {
  317. let param = {
  318. token: localStorage.token,
  319. Id: row.Id,
  320. status: 0,
  321. };
  322. let postdata = qs.stringify(param);
  323. testTable(postdata).then(res => {
  324. let json = res;
  325. if (json.Code == 0) {
  326. that.$message({
  327. showClose: true,
  328. message: row.name + '禁用成功!',
  329. type: 'success'
  330. });
  331. // table 重载
  332. that.getTableQuery();
  333. } else {
  334. that.$message.error(json.Memo);
  335. }
  336. })
  337. }).catch(() => {
  338. this.$message({
  339. type: 'info',
  340. message: '已取消禁用'
  341. });
  342. });
  343. },
  344. // 启用
  345. runRow(row) {
  346. let that = this;
  347. this.$confirm('是否启用用户' + row.name + '?', '启用操作', {
  348. confirmButtonText: '确定',
  349. cancelButtonText: '取消',
  350. type: 'warning'
  351. }).then(() => {
  352. let param = {
  353. token: localStorage.token,
  354. Id: row.Id,
  355. status: 1,
  356. };
  357. let postdata = qs.stringify(param);
  358. testTable(postdata).then(res => {
  359. let json = res;
  360. if (json.Code == 0) {
  361. that.$message({
  362. showClose: true,
  363. message: row.name + '启用成功!',
  364. type: 'success'
  365. });
  366. // table 重载
  367. that.getTableQuery();
  368. } else {
  369. that.$message.error(json.Memo);
  370. }
  371. })
  372. }).catch(() => {
  373. this.$message({
  374. type: 'info',
  375. message: '已取消启用'
  376. });
  377. });
  378. },
  379. // 关闭所有
  380. allDialogClose() {
  381. this.dialogVisible = false;
  382. this.dialogGift = false;
  383. this.dialogLesson = false;
  384. this.dialogExpTime = false;
  385. this.dialogLessonTable = false;
  386. },
  387. // 用户禁用 todo
  388. // 用户启用 todo
  389. // 有效期调整
  390. ExpTimeChange() {
  391. // 仅针对年费用户,使用日期格式
  392. this.allDialogClose();
  393. if (!this.multipleSelection.length) {
  394. this.$message({
  395. showClose: true,
  396. message: '错了哦,需要先选中至少一条记录',
  397. type: 'error'
  398. });
  399. return false
  400. }
  401. if (this.multipleSelection.length != 1) {
  402. this.$message({
  403. showClose: true,
  404. message: '错了哦,只能选中一条记录',
  405. type: 'error'
  406. });
  407. return false
  408. }
  409. let row = this.multipleSelection[0];
  410. if (parseInt(row.vipType) == 2) {
  411. this.$message({
  412. showClose: true,
  413. message: '错了哦,充值会员不能调整有效期',
  414. type: 'error'
  415. });
  416. return false
  417. }
  418. this.form.expTime = row.expTime;
  419. this.form.rowName = row.name;
  420. this.dialogVisible = true;
  421. this.dialogExpTime = true;
  422. },
  423. // 课时调整
  424. lessonChange() {
  425. this.allDialogClose();
  426. if (!this.multipleSelection.length) {
  427. this.$message({
  428. showClose: true,
  429. message: '错了哦,需要先选中至少一条记录',
  430. type: 'error'
  431. });
  432. return false
  433. }
  434. if (this.multipleSelection.length != 1) {
  435. this.$message({
  436. showClose: true,
  437. message: '错了哦,只能选中一条记录',
  438. type: 'error'
  439. });
  440. return false
  441. }
  442. let row = this.multipleSelection[0];
  443. this.form.lesson = row.Recovered;
  444. this.form.rowName = row.name;
  445. this.dialogVisible = true;
  446. this.dialogLesson = true;
  447. },
  448. // 赠送调整
  449. giftChange() {
  450. this.allDialogClose();
  451. if (!this.multipleSelection.length) {
  452. this.$message({
  453. showClose: true,
  454. message: '错了哦,需要先选中至少一条记录',
  455. type: 'error'
  456. });
  457. return false
  458. }
  459. if (this.multipleSelection.length != 1) {
  460. this.$message({
  461. showClose: true,
  462. message: '错了哦,只能选中一条记录',
  463. type: 'error'
  464. });
  465. return false
  466. }
  467. let row = this.multipleSelection[0];
  468. this.form.gift = row.Recovered;
  469. this.form.rowName = row.name;
  470. this.dialogVisible = true;
  471. this.dialogGift = true;
  472. },
  473. // 增删会员课程
  474. lessonStudenChange() {
  475. this.allDialogClose();
  476. if (!this.multipleSelection.length) {
  477. this.$message({
  478. showClose: true,
  479. message: '错了哦,需要先选中至少一条记录',
  480. type: 'error'
  481. });
  482. return false
  483. }
  484. if (this.multipleSelection.length != 1) {
  485. this.$message({
  486. showClose: true,
  487. message: '错了哦,只能选中一条记录',
  488. type: 'error'
  489. });
  490. return false
  491. }
  492. let row = this.multipleSelection[0];
  493. this.form.gift = row.Recovered;
  494. this.form.rowName = row.name;
  495. this.dialogVisible = true;
  496. this.dialogLessonTable = true;
  497. },
  498. // 确认提交新增会员
  499. confirmMember() {
  500. let that = this;
  501. // checkNum
  502. if (!that.form.userCode) {
  503. this.$message.error('错了哦,手机号不能为空');
  504. return false
  505. }
  506. if (!globalCheckPhone(that.form.userCode)) {
  507. this.$message.error('错了哦,手机号格式不正确');
  508. return false
  509. }
  510. if (!that.form.name) {
  511. this.$message.error('错了哦,会员名不能为空');
  512. return false
  513. }
  514. if (that.form.name.length > 8) {
  515. this.$message.error('错了哦,会员名字数超过8个字');
  516. return false
  517. }
  518. if (that.form.memo) {
  519. if (that.form.memo.length > 200) {
  520. this.$message.error('错了哦,备注字数超过200个字');
  521. return false
  522. }
  523. }
  524. let param = {
  525. token: localStorage.token,
  526. userCode: that.form.userCode,
  527. name: that.form.name,
  528. memberType: that.form.memberType,
  529. lesson: that.form.lesson,
  530. gift: that.form.gift,
  531. memo: that.form.memo,
  532. dialogValue: that.form.dialogValue,
  533. };
  534. let postdata = qs.stringify(param);
  535. testSelect(postdata).then(res => {
  536. let json = res;
  537. if (json.Code == 0) {
  538. // 关闭弹窗
  539. that.dialogMemberVisible = false;
  540. // 重载列表
  541. that.getTableQuery();
  542. that.$message({
  543. showClose: true,
  544. message: '会员添加成功!',
  545. type: 'success'
  546. });
  547. } else {
  548. that.$message.error(json.Memo);
  549. }
  550. })
  551. },
  552. confirmEditMember() {
  553. console.log(123);
  554. let that = this;
  555. // checkNum
  556. if (!that.form.userCode) {
  557. this.$message.error('错了哦,手机号不能为空');
  558. return false
  559. }
  560. console.log(that.form.userCode);
  561. if (!globalCheckPhone(that.form.userCode)) {
  562. this.$message.error('错了哦,手机号格式不正确');
  563. return false
  564. }
  565. if (!that.form.name) {
  566. this.$message.error('错了哦,会员名不能为空');
  567. return false
  568. }
  569. if (that.form.name.length > 8) {
  570. this.$message.error('错了哦,会员名字数超过8个字');
  571. return false
  572. }
  573. if (that.form.memo) {
  574. if (that.form.memo.length > 200) {
  575. this.$message.error('错了哦,备注字数超过200个字');
  576. return false
  577. }
  578. }
  579. let param = {
  580. token: localStorage.token,
  581. userCode: that.form.userCode,
  582. name: that.form.name,
  583. memberType: that.form.memberType,
  584. lesson: that.form.lesson,
  585. gift: that.form.gift,
  586. memo: that.form.memo,
  587. dialogValue: that.form.dialogValue,
  588. };
  589. let postdata = qs.stringify(param);
  590. testSelect(postdata).then(res => {
  591. let json = res;
  592. if (json.Code == 0) {
  593. // 关闭弹窗
  594. that.dialogMemberVisible = false;
  595. // 重载列表
  596. that.getTableQuery();
  597. that.$message({
  598. showClose: true,
  599. message: '会员信息编辑成功!',
  600. type: 'success'
  601. });
  602. } else {
  603. that.$message.error(json.Memo);
  604. }
  605. })
  606. },
  607. // 确认提交课时
  608. confirmLesson() {
  609. let that = this;
  610. // checkNum
  611. let param = {
  612. token: localStorage.token,
  613. userCode: that.form.userCode,
  614. lesson: that.form.lesson,
  615. };
  616. let postdata = qs.stringify(param);
  617. testSelect(postdata).then(res => {
  618. let json = res;
  619. if (json.Code == 0) {
  620. // 关闭弹窗
  621. that.dialogVisible = false;
  622. // 重载列表
  623. that.getTableQuery();
  624. that.$message({
  625. showClose: true,
  626. message: '课时调整成功!',
  627. type: 'success'
  628. });
  629. } else {
  630. that.$message.error(json.Memo);
  631. }
  632. })
  633. },
  634. // 确认提交赠送
  635. confirmGift() {
  636. let that = this;
  637. // checkNum
  638. let param = {
  639. token: localStorage.token,
  640. userCode: that.form.userCode,
  641. gift: that.form.gift,
  642. };
  643. let postdata = qs.stringify(param);
  644. testSelect(postdata).then(res => {
  645. let json = res;
  646. if (json.Code == 0) {
  647. // 关闭弹窗
  648. that.dialogVisible = false;
  649. // 重载列表
  650. that.getTableQuery();
  651. that.$message({
  652. showClose: true,
  653. message: '赠送课时调整成功!',
  654. type: 'success'
  655. });
  656. } else {
  657. that.$message.error(json.Memo);
  658. }
  659. })
  660. },
  661. // 确认提交有效期
  662. confirmExpTime() {
  663. let that = this;
  664. // checkNum
  665. let param = {
  666. token: localStorage.token,
  667. userCode: that.form.userCode,
  668. expTime: that.form.expTime,
  669. };
  670. let postdata = qs.stringify(param);
  671. testSelect(postdata).then(res => {
  672. let json = res;
  673. if (json.Code == 0) {
  674. // 关闭弹窗
  675. that.dialogVisible = false;
  676. // 重载列表
  677. that.getTableQuery();
  678. that.$message({
  679. showClose: true,
  680. message: '赠送课时调整成功!',
  681. type: 'success'
  682. });
  683. } else {
  684. that.$message.error(json.Memo);
  685. }
  686. })
  687. },
  688. // 确认提交会员课程
  689. confirmLessonTable() {
  690. let that = this;
  691. // checkNum
  692. let param = {
  693. token: localStorage.token,
  694. userCode: that.form.userCode,
  695. dialogValue: that.form.dialogValue,
  696. };
  697. let postdata = qs.stringify(param);
  698. testSelect(postdata).then(res => {
  699. let json = res;
  700. if (json.Code == 0) {
  701. // 关闭弹窗
  702. that.dialogVisible = false;
  703. // 重载列表
  704. that.getTableQuery();
  705. that.$message({
  706. showClose: true,
  707. message: '会员课程调整成功!',
  708. type: 'success'
  709. });
  710. } else {
  711. that.$message.error(json.Memo);
  712. }
  713. })
  714. },
  715. // 加载选项
  716. panelSelect() {
  717. let that = this;
  718. let param = {
  719. token: localStorage.token,
  720. };
  721. let postdata = qs.stringify(param);
  722. testSelect(postdata).then(res => {
  723. let json = res;
  724. if (json.Code == 0) {
  725. that.form.dialogdata = json.Rs;
  726. } else {
  727. that.$message.error(json.Memo);
  728. }
  729. })
  730. },
  731. // 新增会员
  732. addMember() {
  733. this.clearForm();
  734. this.dialogMemberVisible = true
  735. this.btnType = 0;
  736. this.dialogTitle = '新增会员'
  737. },
  738. // 删除
  739. delList() {
  740. let that = this;
  741. // checkNum
  742. if (!this.multipleSelection.length) {
  743. that.$message({
  744. showClose: true,
  745. message: '错了哦,需要先选中至少一条记录',
  746. type: 'error'
  747. });
  748. return false
  749. }
  750. if (this.multipleSelection.length != 1) {
  751. that.$message({
  752. showClose: true,
  753. message: '错了哦,只能选中一条记录',
  754. type: 'error'
  755. });
  756. return false
  757. }
  758. let detectorid = that.multipleSelection[0].Id;
  759. let param = {
  760. token: localStorage.token,
  761. detectorid: detectorid,
  762. status: 9,//0禁用1启用9删除
  763. };
  764. let postdata = qs.stringify(param);
  765. this.$confirm('此操作将永久删除该会员, 是否继续?', '提示', {
  766. confirmButtonText: '确定',
  767. cancelButtonText: '取消',
  768. type: 'warning'
  769. }).then(() => {
  770. testSelect(postdata).then(res => {
  771. let json = res;
  772. if (json.Code == 0) {
  773. that.$message({
  774. showClose: true,
  775. message: '选中的会员已删除!',
  776. type: 'success'
  777. });
  778. // 重载列表
  779. that.getTableQuery();
  780. } else {
  781. that.$message.error(json.Memo);
  782. }
  783. });
  784. }).catch(() => {
  785. this.$message({
  786. type: 'info',
  787. message: '已取消删除'
  788. });
  789. });
  790. },
  791. handleSelectionChange(val) {
  792. this.multipleSelection = val;
  793. },
  794. // 查询按钮
  795. query() {
  796. // this.getTableQuery();
  797. this.$message.success('查询完毕');
  798. },
  799. clearForm() {
  800. // clear
  801. this.form.name = '';
  802. this.form.userCode = '';
  803. this.form.shopId = '';
  804. },
  805. // 页面数据查询
  806. getTableQuery() {
  807. let that = this;
  808. // this.getGetChildRegionSelect(0, 1);
  809. that.loading = true;
  810. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  811. let param = {
  812. token: localStorage.token,
  813. supregionid: 0,//
  814. regionid: this.panel.regionid,//
  815. comid: 1,//
  816. tagname: that.panel.tagname,//标签名
  817. start: 1,//
  818. tableMax: 9999,//
  819. };
  820. let postdata = qs.stringify(param);
  821. testTable(postdata).then(res => {
  822. let json = res;
  823. if (json.Code == 0) {
  824. that.loading = false;
  825. if (json.Rs) {
  826. that.allTableData = json.Rs;
  827. that.recordsTotal = json.Rs.length;
  828. } else {
  829. that.allTableData = [];
  830. that.recordsTotal = 0;
  831. }
  832. // 设置分页数据
  833. that.setPaginations();
  834. } else {
  835. that.$message.error(json.Memo);
  836. }
  837. })
  838. },
  839. // 导出excel
  840. btnExpAll() {
  841. let that = this;
  842. let url = headapi + '?ctl=ajax&mod=czgl&act=czcx_excel';//获取
  843. let bt = globaltime2String(that.panel.time1[0]);
  844. let et = globaltime2String(that.panel.time1[1]);
  845. let usercode = that.panel.usercode;
  846. window.location = url + '&bt=' + bt + '&et=' + et + '&usercode=' + usercode;
  847. },
  848. // 设置分页数据
  849. setPaginations() {
  850. // 分页属性
  851. let that = this;
  852. that.pageination.total = that.recordsTotal;
  853. // 默认分页
  854. that.tableData = that.allTableData.filter((item, index) => {
  855. return index < that.pageination.pageItem;
  856. });
  857. },
  858. // 每页显示数量
  859. handleSizeChange() {
  860. let that = this;
  861. that.tableData = that.allTableData.filter((item, index) => {
  862. return index < that.pageination.pageItem;
  863. });
  864. that.draw = that.pageination.pageItem;
  865. that.getTableQuery();
  866. },
  867. // 翻页
  868. pageChange(pageIndex) {
  869. let that = this;
  870. // 获取当前页
  871. let index = that.pageination.pageItem * (pageIndex - 1);
  872. // 数据总数
  873. let nums = that.pageination.pageItem * pageIndex;
  874. // 容器
  875. let tables = [];
  876. for (var i = index; i < nums; i++) {
  877. if (that.allTableData[i]) {
  878. tables.push(that.allTableData[i])
  879. }
  880. this.tableData = tables;
  881. }
  882. that.start = index * that.draw;
  883. that.getTableQuery();
  884. },
  885. // 自动排序
  886. sortChange(params) {
  887. console.log(params)
  888. },
  889. // 过滤时间
  890. filterFmtDate(value, row, column) {
  891. let that = this;
  892. return globalfmtDate(column, 11);
  893. },
  894. // 过滤金额
  895. filterMoney(value, row, column) {
  896. let that = this;
  897. return parseFloat(column).toFixed(2);
  898. },
  899. },
  900. }
  901. </script>
  902. <style scoped>
  903. @import "../assets/css/panel.css";
  904. .context {
  905. overflow: hidden;
  906. display: block;
  907. margin: 0 auto;
  908. background-color: #fff !important;
  909. padding: 30px;
  910. }
  911. .panel-body {
  912. padding: 20px;
  913. background: #F0F2F5;
  914. }
  915. .change {
  916. width: 100%;
  917. overflow: hidden;
  918. display: block;
  919. margin: 0 auto;
  920. padding-top: 10px;
  921. padding-bottom: 10px;
  922. }
  923. .change button {
  924. float: left;
  925. }
  926. .change button.pull-right {
  927. float: right;
  928. }
  929. .dialogTitle {
  930. width: 100%;
  931. overflow: hidden;
  932. display: block;
  933. margin: 0 auto;
  934. color: #000000;
  935. font-size: 18px;
  936. text-align: center;
  937. }
  938. .dialogTitle em {
  939. float: none;
  940. font-style: normal;
  941. color: #3799FF;
  942. margin: 0;
  943. }
  944. /deep/ .el-transfer-panel__item .el-checkbox__input {
  945. left: 40px;
  946. }
  947. .dialogFooter {
  948. width: 90%;
  949. overflow: hidden;
  950. display: block;
  951. margin: 0 auto;
  952. margin-top: 10px;
  953. }
  954. .dialogFooter button {
  955. float: right;
  956. margin-left: 10px;
  957. }
  958. .dialogContent {
  959. width: 100%;
  960. overflow: hidden;
  961. display: block;
  962. margin: 0 auto;
  963. }
  964. .dialogContent .pull-left {
  965. width: 30%;
  966. float: left;
  967. }
  968. .dialogContent .pull-right {
  969. width: 70%;
  970. float: right;
  971. }
  972. .panel /deep/ .el-date-editor--daterange {
  973. /*width: 260px;*/
  974. }
  975. /deep/ .el-col-4 {
  976. width: 15% !important;
  977. }
  978. .panel /deep/ .el-input__inner {
  979. /*width: 130px;*/
  980. }
  981. .panel /deep/ .el-input {
  982. /*width: 130px;*/
  983. }
  984. .panel /deep/ .el-select {
  985. width: 130px;
  986. }
  987. /deep/ .el-date-editor .el-range-separator {
  988. line-height: 22px;
  989. }
  990. </style>