Member.vue 43 KB

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