cost.vue 48 KB

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