cost.vue 49 KB

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