cost.vue 40 KB

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