Member.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  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="4">
  17. <em>会员类型:</em>
  18. <el-select v-model="panel.vipType">
  19. <el-option
  20. v-for="item in panel.vipOptions"
  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.expDay">
  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.normalhour" :min="0" :max="99999" label="(天)"></el-input-number>
  191. </el-form-item>
  192. <el-form-item label="赠送课时">
  193. <el-input-number v-model="form.gifthour" :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.normalhour" :min="0" :max="9999" label="课时调整"></el-input-number>
  227. </div>
  228. <div v-if="dialogGift">
  229. <el-input-number v-model="form.gifthour" :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. VipUserListQuery,
  257. testTable,
  258. testSelect
  259. } from "../api/getApiRes";
  260. let qs = require('qs');
  261. export default {
  262. data() {
  263. return {
  264. dialogVisible: false,//其他dialog
  265. dialogMemberVisible: false,//新增会员dialog
  266. dialogLesson: false,//课时调整
  267. dialogGift: false,//赠送课时调整
  268. dialogExpTime: false,//有效期调整
  269. dialogLessonTable: false,//会员课程
  270. dialogTitle: '新增会员',
  271. dialogValue: [],
  272. // panel 配置项目
  273. panel: {
  274. usercode: '',
  275. username: '',
  276. compname: '',
  277. keyword: '',
  278. USERCODE: '',
  279. endType: '',
  280. taskstatus: 99,
  281. draw: 1,
  282. start: 0,
  283. recordsTotal: 0,
  284. tableData: [],
  285. allTableData: [],
  286. limit: '10',
  287. multipleSort: false,
  288. loading: false,
  289. fileList: [],
  290. multipleSelection: [],
  291. detectedmac: '',
  292. vipType: 0,
  293. expDay: 0,
  294. vipOptions:vipOptions(0),
  295. endTypeOptions:endTypeOptions(),
  296. time1: globalBt(),
  297. },
  298. multipleSelection: [],
  299. pageination: {
  300. pageItem: 100,
  301. pageoptions: pageOptions(),
  302. total: 100,
  303. pageIndex: 1,
  304. },
  305. form: {
  306. name: '',
  307. userCode: '',
  308. shopId: '',
  309. memberType: 1,
  310. normalhour: 1,
  311. gifthour: 1,
  312. btnType: 0,//0新建,1编辑编辑
  313. memo: '',
  314. expTime: '',
  315. dialogdata: [],//穿梭待选
  316. dialogValue: [],//穿梭已选
  317. },
  318. memberTypes:vipOptions(1),
  319. tableData: []
  320. }
  321. },
  322. mounted() {
  323. this.panelSelect();
  324. this.getTableQuery();
  325. },
  326. methods: {
  327. // 编辑
  328. editMember(row) {
  329. let that = this;
  330. this.clearForm();
  331. this.form.userCode = row.userCode;
  332. this.form.name = row.name;
  333. this.form.memberType = row.vipType;
  334. this.form.normalhour = row.Recovered;
  335. this.form.gifthour = row.Recovered;
  336. this.form.memo = row.memo;
  337. this.form.btnType = 1;
  338. this.form.shopId = row.Id;
  339. this.dialogMemberVisible = true
  340. this.dialogTitle = '编辑会员'
  341. },
  342. // 禁用
  343. pauseRow(row) {
  344. let that = this;
  345. this.$confirm('是否禁用用户' + row.name + '?', '禁用操作', {
  346. confirmButtonText: '确定',
  347. cancelButtonText: '取消',
  348. type: 'warning'
  349. }).then(() => {
  350. let param = {
  351. token: localStorage.token,
  352. Id: row.Id,
  353. status: 0,
  354. };
  355. let postdata = qs.stringify(param);
  356. testTable(postdata).then(res => {
  357. let json = res;
  358. if (json.Code == 0) {
  359. that.$message({
  360. showClose: true,
  361. message: row.name + '禁用成功!',
  362. type: 'success'
  363. });
  364. // table 重载
  365. that.getTableQuery();
  366. } else {
  367. that.$message.error(json.Memo);
  368. }
  369. })
  370. }).catch(() => {
  371. this.$message({
  372. type: 'info',
  373. message: '已取消禁用'
  374. });
  375. });
  376. },
  377. // 启用
  378. runRow(row) {
  379. let that = this;
  380. this.$confirm('是否启用用户' + row.name + '?', '启用操作', {
  381. confirmButtonText: '确定',
  382. cancelButtonText: '取消',
  383. type: 'warning'
  384. }).then(() => {
  385. let param = {
  386. token: localStorage.token,
  387. Id: row.Id,
  388. status: 1,
  389. };
  390. let postdata = qs.stringify(param);
  391. testTable(postdata).then(res => {
  392. let json = res;
  393. if (json.Code == 0) {
  394. that.$message({
  395. showClose: true,
  396. message: row.name + '启用成功!',
  397. type: 'success'
  398. });
  399. // table 重载
  400. that.getTableQuery();
  401. } else {
  402. that.$message.error(json.Memo);
  403. }
  404. })
  405. }).catch(() => {
  406. this.$message({
  407. type: 'info',
  408. message: '已取消启用'
  409. });
  410. });
  411. },
  412. // 关闭所有
  413. allDialogClose() {
  414. this.dialogVisible = false;
  415. this.dialogGift = false;
  416. this.dialogLesson = false;
  417. this.dialogExpTime = false;
  418. this.dialogLessonTable = false;
  419. },
  420. // 用户禁用 todo
  421. // 用户启用 todo
  422. // 有效期调整
  423. ExpTimeChange() {
  424. // 仅针对年费用户,使用日期格式
  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. if (parseInt(row.vipType) == 2) {
  444. this.$message({
  445. showClose: true,
  446. message: '错了哦,充值会员不能调整有效期',
  447. type: 'error'
  448. });
  449. return false
  450. }
  451. this.form.expTime = row.expTime;
  452. this.form.rowName = row.name;
  453. this.dialogVisible = true;
  454. this.dialogExpTime = true;
  455. },
  456. // 课时调整
  457. lessonChange() {
  458. this.allDialogClose();
  459. if (!this.multipleSelection.length) {
  460. this.$message({
  461. showClose: true,
  462. message: '错了哦,需要先选中至少一条记录',
  463. type: 'error'
  464. });
  465. return false
  466. }
  467. if (this.multipleSelection.length != 1) {
  468. this.$message({
  469. showClose: true,
  470. message: '错了哦,只能选中一条记录',
  471. type: 'error'
  472. });
  473. return false
  474. }
  475. let row = this.multipleSelection[0];
  476. this.form.normalhour = row.Recovered;
  477. this.form.rowName = row.name;
  478. this.dialogVisible = true;
  479. this.dialogLesson = true;
  480. },
  481. // 赠送调整
  482. giftChange() {
  483. this.allDialogClose();
  484. if (!this.multipleSelection.length) {
  485. this.$message({
  486. showClose: true,
  487. message: '错了哦,需要先选中至少一条记录',
  488. type: 'error'
  489. });
  490. return false
  491. }
  492. if (this.multipleSelection.length != 1) {
  493. this.$message({
  494. showClose: true,
  495. message: '错了哦,只能选中一条记录',
  496. type: 'error'
  497. });
  498. return false
  499. }
  500. let row = this.multipleSelection[0];
  501. this.form.gifthour = row.Recovered;
  502. this.form.rowName = row.name;
  503. this.dialogVisible = true;
  504. this.dialogGift = true;
  505. },
  506. // 增删会员课程
  507. lessonStudenChange() {
  508. this.allDialogClose();
  509. if (!this.multipleSelection.length) {
  510. this.$message({
  511. showClose: true,
  512. message: '错了哦,需要先选中至少一条记录',
  513. type: 'error'
  514. });
  515. return false
  516. }
  517. if (this.multipleSelection.length != 1) {
  518. this.$message({
  519. showClose: true,
  520. message: '错了哦,只能选中一条记录',
  521. type: 'error'
  522. });
  523. return false
  524. }
  525. let row = this.multipleSelection[0];
  526. this.form.gifthour = row.Recovered;
  527. this.form.rowName = row.name;
  528. this.dialogVisible = true;
  529. this.dialogLessonTable = true;
  530. },
  531. // 确认提交新增会员
  532. confirmMember() {
  533. let that = this;
  534. // checkNum
  535. if (!that.form.userCode) {
  536. this.$message.error('错了哦,手机号不能为空');
  537. return false
  538. }
  539. if (!globalCheckPhone(that.form.userCode)) {
  540. this.$message.error('错了哦,手机号格式不正确');
  541. return false
  542. }
  543. if (!that.form.name) {
  544. this.$message.error('错了哦,会员名不能为空');
  545. return false
  546. }
  547. if (that.form.name.length > 8) {
  548. this.$message.error('错了哦,会员名字数超过8个字');
  549. return false
  550. }
  551. if (that.form.memo) {
  552. if (that.form.memo.length > 200) {
  553. this.$message.error('错了哦,备注字数超过200个字');
  554. return false
  555. }
  556. }
  557. let param = {
  558. token: localStorage.token,
  559. userCode: that.form.userCode,
  560. name: that.form.name,
  561. memberType: that.form.memberType,
  562. normalhour: that.form.normalhour,
  563. gift: that.form.gifthour,
  564. memo: that.form.memo,
  565. dialogValue: that.form.dialogValue,
  566. };
  567. let postdata = qs.stringify(param);
  568. testSelect(postdata).then(res => {
  569. let json = res;
  570. if (json.Code == 0) {
  571. // 关闭弹窗
  572. that.dialogMemberVisible = false;
  573. // 重载列表
  574. that.getTableQuery();
  575. that.$message({
  576. showClose: true,
  577. message: '会员添加成功!',
  578. type: 'success'
  579. });
  580. } else {
  581. that.$message.error(json.Memo);
  582. }
  583. })
  584. },
  585. confirmEditMember() {
  586. console.log(123);
  587. let that = this;
  588. // checkNum
  589. if (!that.form.userCode) {
  590. this.$message.error('错了哦,手机号不能为空');
  591. return false
  592. }
  593. console.log(that.form.userCode);
  594. if (!globalCheckPhone(that.form.userCode)) {
  595. this.$message.error('错了哦,手机号格式不正确');
  596. return false
  597. }
  598. if (!that.form.name) {
  599. this.$message.error('错了哦,会员名不能为空');
  600. return false
  601. }
  602. if (that.form.name.length > 8) {
  603. this.$message.error('错了哦,会员名字数超过8个字');
  604. return false
  605. }
  606. if (that.form.memo) {
  607. if (that.form.memo.length > 200) {
  608. this.$message.error('错了哦,备注字数超过200个字');
  609. return false
  610. }
  611. }
  612. let param = {
  613. token: localStorage.token,
  614. userCode: that.form.userCode,
  615. name: that.form.name,
  616. memberType: that.form.memberType,
  617. lesson: that.form.lesson,
  618. gift: that.form.gifthour,
  619. memo: that.form.memo,
  620. dialogValue: that.form.dialogValue,
  621. };
  622. let postdata = qs.stringify(param);
  623. testSelect(postdata).then(res => {
  624. let json = res;
  625. if (json.Code == 0) {
  626. // 关闭弹窗
  627. that.dialogMemberVisible = false;
  628. // 重载列表
  629. that.getTableQuery();
  630. that.$message({
  631. showClose: true,
  632. message: '会员信息编辑成功!',
  633. type: 'success'
  634. });
  635. } else {
  636. that.$message.error(json.Memo);
  637. }
  638. })
  639. },
  640. // 确认提交课时
  641. confirmLesson() {
  642. let that = this;
  643. // checkNum
  644. let param = {
  645. token: localStorage.token,
  646. userCode: that.form.userCode,
  647. lesson: that.form.lesson,
  648. };
  649. let postdata = qs.stringify(param);
  650. testSelect(postdata).then(res => {
  651. let json = res;
  652. if (json.Code == 0) {
  653. // 关闭弹窗
  654. that.dialogVisible = false;
  655. // 重载列表
  656. that.getTableQuery();
  657. that.$message({
  658. showClose: true,
  659. message: '课时调整成功!',
  660. type: 'success'
  661. });
  662. } else {
  663. that.$message.error(json.Memo);
  664. }
  665. })
  666. },
  667. // 确认提交赠送
  668. confirmGift() {
  669. let that = this;
  670. // checkNum
  671. let param = {
  672. token: localStorage.token,
  673. userCode: that.form.userCode,
  674. gift: that.form.gifthour,
  675. };
  676. let postdata = qs.stringify(param);
  677. testSelect(postdata).then(res => {
  678. let json = res;
  679. if (json.Code == 0) {
  680. // 关闭弹窗
  681. that.dialogVisible = false;
  682. // 重载列表
  683. that.getTableQuery();
  684. that.$message({
  685. showClose: true,
  686. message: '赠送课时调整成功!',
  687. type: 'success'
  688. });
  689. } else {
  690. that.$message.error(json.Memo);
  691. }
  692. })
  693. },
  694. // 确认提交有效期
  695. confirmExpTime() {
  696. let that = this;
  697. // checkNum
  698. let param = {
  699. token: localStorage.token,
  700. userCode: that.form.userCode,
  701. expTime: that.form.expTime,
  702. };
  703. let postdata = qs.stringify(param);
  704. testSelect(postdata).then(res => {
  705. let json = res;
  706. if (json.Code == 0) {
  707. // 关闭弹窗
  708. that.dialogVisible = false;
  709. // 重载列表
  710. that.getTableQuery();
  711. that.$message({
  712. showClose: true,
  713. message: '赠送课时调整成功!',
  714. type: 'success'
  715. });
  716. } else {
  717. that.$message.error(json.Memo);
  718. }
  719. })
  720. },
  721. // 确认提交会员课程
  722. confirmLessonTable() {
  723. let that = this;
  724. // checkNum
  725. let param = {
  726. token: localStorage.token,
  727. userCode: that.form.userCode,
  728. dialogValue: that.form.dialogValue,
  729. };
  730. let postdata = qs.stringify(param);
  731. testSelect(postdata).then(res => {
  732. let json = res;
  733. if (json.Code == 0) {
  734. // 关闭弹窗
  735. that.dialogVisible = false;
  736. // 重载列表
  737. that.getTableQuery();
  738. that.$message({
  739. showClose: true,
  740. message: '会员课程调整成功!',
  741. type: 'success'
  742. });
  743. } else {
  744. that.$message.error(json.Memo);
  745. }
  746. })
  747. },
  748. // 加载选项
  749. panelSelect() {
  750. let that = this;
  751. let param = {
  752. token: localStorage.token,
  753. };
  754. let postdata = qs.stringify(param);
  755. testSelect(postdata).then(res => {
  756. let json = res;
  757. if (json.Code == 0) {
  758. that.form.dialogdata = json.Rs;
  759. } else {
  760. that.$message.error(json.Memo);
  761. }
  762. })
  763. },
  764. // 新增会员
  765. addMember() {
  766. this.clearForm();
  767. this.dialogMemberVisible = true
  768. this.btnType = 0;
  769. this.dialogTitle = '新增会员'
  770. },
  771. // 删除
  772. delList() {
  773. let that = this;
  774. // checkNum
  775. if (!this.multipleSelection.length) {
  776. that.$message({
  777. showClose: true,
  778. message: '错了哦,需要先选中至少一条记录',
  779. type: 'error'
  780. });
  781. return false
  782. }
  783. if (this.multipleSelection.length != 1) {
  784. that.$message({
  785. showClose: true,
  786. message: '错了哦,只能选中一条记录',
  787. type: 'error'
  788. });
  789. return false
  790. }
  791. let detectorid = that.multipleSelection[0].Id;
  792. let param = {
  793. token: localStorage.token,
  794. detectorid: detectorid,
  795. status: 9,//0禁用1启用9删除
  796. };
  797. let postdata = qs.stringify(param);
  798. this.$confirm('此操作将永久删除该会员, 是否继续?', '提示', {
  799. confirmButtonText: '确定',
  800. cancelButtonText: '取消',
  801. type: 'warning'
  802. }).then(() => {
  803. testSelect(postdata).then(res => {
  804. let json = res;
  805. if (json.Code == 0) {
  806. that.$message({
  807. showClose: true,
  808. message: '选中的会员已删除!',
  809. type: 'success'
  810. });
  811. // 重载列表
  812. that.getTableQuery();
  813. } else {
  814. that.$message.error(json.Memo);
  815. }
  816. });
  817. }).catch(() => {
  818. this.$message({
  819. type: 'info',
  820. message: '已取消删除'
  821. });
  822. });
  823. },
  824. handleSelectionChange(val) {
  825. this.multipleSelection = val;
  826. },
  827. // 查询按钮
  828. query() {
  829. // this.getTableQuery();
  830. this.$message.success('查询完毕');
  831. },
  832. clearForm() {
  833. // clear
  834. this.form.name = '';
  835. this.form.userCode = '';
  836. this.form.shopId = '';
  837. },
  838. // 页面数据查询
  839. getTableQuery() {
  840. let that = this;
  841. // this.getGetChildRegionSelect(0, 1);
  842. that.loading = true;
  843. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  844. let param = {
  845. token: localStorage.token,
  846. vipType : that.panel.vipType ,//
  847. phone : that.panel.phone ,//
  848. name : that.panel.name ,//
  849. expDay : that.panel.expDay ,//
  850. };
  851. let postdata = qs.stringify(param);
  852. VipUserListQuery(postdata).then(res => {
  853. let json = res;
  854. if (json.Code == 0) {
  855. that.loading = false;
  856. if (json.Rs) {
  857. that.allTableData = json.Rs;
  858. that.recordsTotal = json.Rs.length;
  859. } else {
  860. that.allTableData = [];
  861. that.recordsTotal = 0;
  862. }
  863. // 设置分页数据
  864. that.setPaginations();
  865. } else {
  866. that.$message.error(json.Memo);
  867. }
  868. })
  869. },
  870. // 导出excel
  871. btnExpAll() {
  872. let that = this;
  873. let url = headapi + '?ctl=ajax&mod=czgl&act=czcx_excel';//获取
  874. let bt = globaltime2String(that.panel.time1[0]);
  875. let et = globaltime2String(that.panel.time1[1]);
  876. let usercode = that.panel.usercode;
  877. window.location = url + '&bt=' + bt + '&et=' + et + '&usercode=' + usercode;
  878. },
  879. // 设置分页数据
  880. setPaginations() {
  881. // 分页属性
  882. let that = this;
  883. that.pageination.total = that.recordsTotal;
  884. // 默认分页
  885. that.tableData = that.allTableData.filter((item, index) => {
  886. return index < that.pageination.pageItem;
  887. });
  888. },
  889. // 每页显示数量
  890. handleSizeChange() {
  891. let that = this;
  892. that.tableData = that.allTableData.filter((item, index) => {
  893. return index < that.pageination.pageItem;
  894. });
  895. that.draw = that.pageination.pageItem;
  896. that.getTableQuery();
  897. },
  898. // 翻页
  899. pageChange(pageIndex) {
  900. let that = this;
  901. // 获取当前页
  902. let index = that.pageination.pageItem * (pageIndex - 1);
  903. // 数据总数
  904. let nums = that.pageination.pageItem * pageIndex;
  905. // 容器
  906. let tables = [];
  907. for (var i = index; i < nums; i++) {
  908. if (that.allTableData[i]) {
  909. tables.push(that.allTableData[i])
  910. }
  911. this.tableData = tables;
  912. }
  913. that.start = index * that.draw;
  914. that.getTableQuery();
  915. },
  916. // 自动排序
  917. sortChange(params) {
  918. console.log(params)
  919. },
  920. // 过滤时间
  921. filterFmtDate(value, row, column) {
  922. let that = this;
  923. return nonTfmtDate(column, 11);
  924. },
  925. // 过滤金额
  926. filterMoney(value, row, column) {
  927. let that = this;
  928. return parseFloat(column).toFixed(2);
  929. },
  930. },
  931. }
  932. </script>
  933. <style scoped>
  934. @import "../assets/css/panel.css";
  935. .context {
  936. overflow: hidden;
  937. display: block;
  938. margin: 0 auto;
  939. background-color: #fff !important;
  940. padding: 30px;
  941. }
  942. .panel-body {
  943. padding: 20px;
  944. background: #F0F2F5;
  945. }
  946. .change {
  947. width: 100%;
  948. overflow: hidden;
  949. display: block;
  950. margin: 0 auto;
  951. padding-top: 10px;
  952. padding-bottom: 10px;
  953. }
  954. .change button {
  955. float: left;
  956. }
  957. .change button.pull-right {
  958. float: right;
  959. }
  960. .dialogTitle {
  961. width: 100%;
  962. overflow: hidden;
  963. display: block;
  964. margin: 0 auto;
  965. color: #000000;
  966. font-size: 18px;
  967. text-align: center;
  968. }
  969. .dialogTitle em {
  970. float: none;
  971. font-style: normal;
  972. color: #3799FF;
  973. margin: 0;
  974. }
  975. /deep/ .el-transfer-panel__item .el-checkbox__input {
  976. left: 40px;
  977. }
  978. .dialogFooter {
  979. width: 90%;
  980. overflow: hidden;
  981. display: block;
  982. margin: 0 auto;
  983. margin-top: 10px;
  984. }
  985. .dialogFooter button {
  986. float: right;
  987. margin-left: 10px;
  988. }
  989. .dialogContent {
  990. width: 100%;
  991. overflow: hidden;
  992. display: block;
  993. margin: 0 auto;
  994. }
  995. .dialogContent .pull-left {
  996. width: 30%;
  997. float: left;
  998. }
  999. .dialogContent .pull-right {
  1000. width: 70%;
  1001. float: right;
  1002. }
  1003. </style>