Member.vue 40 KB

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