mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <div class="pages">
  3. <img src="../static/images/main/banner.png" height="121" width="414"/>
  4. <div class="context">
  5. <span class="num">
  6. 会员卡信息
  7. </span>
  8. <div class="user">
  9. <img src="../static/images/mine/User.png" height="53" width="53"/>
  10. <span>{{ user.Name }}</span>
  11. <em>{{ user.Phone | hidePhone}}</em>
  12. </div>
  13. <div class="value" v-for="s in schools">
  14. <div class="vTitle year" v-if="s.VipType == 1"><i></i>年会员</div>
  15. <div class="vTitle price" v-if="s.VipType == 2"><i></i>充值会员</div>
  16. <div class="vNum">
  17. <span> {{ s.ShopName }}</span>
  18. <div class="center">
  19. 总计{{ s.ClassHourToatal }}课时
  20. </div>
  21. <em v-if="s.VipType == 1">(有效期至{{ s.ExpTime |fmtTime }})</em>
  22. </div>
  23. <mu-flex class="linear-progress">
  24. <mu-linear-progress mode="determinate" :value="s.ClassHourRemain / s.ClassHourToatal *100"
  25. :size="10"
  26. color="secondary"></mu-linear-progress>
  27. </mu-flex>
  28. <div class="limit">
  29. <em>剩余 {{ s.ClassHourRemain }} 课时</em>
  30. <span>完成 {{ s.ClassHourConsume }} 课时</span>
  31. </div>
  32. </div>
  33. <div class="dataSum">
  34. <div class="row">
  35. <em>卡路里(月度)</em>
  36. <span>{{ ckRs.CleMonth }}</span>
  37. </div>
  38. </div>
  39. <div class="dataSum">
  40. <div class="row">
  41. <em>总卡路里</em>
  42. <span>{{ ckRs.Cle }}</span>
  43. </div>
  44. </div>
  45. <div class="dataSum">
  46. <div class="row">
  47. <em>CK(月度)</em>
  48. <span>{{ ckRs.CkMonth }}</span>
  49. </div>
  50. </div>
  51. <div class="dataSum">
  52. <div class="row">
  53. <em>总CK</em>
  54. <span>{{ ckRs.Ck }}</span>
  55. </div>
  56. </div>
  57. <div class="btn_center">
  58. <span class="btn btn-md login_btn" @click="logoutBtn">退出</span>
  59. </div>
  60. </div>
  61. <bottomTab :curTab="thisTab"></bottomTab>
  62. </div>
  63. </template>
  64. <script>
  65. import axios from 'axios';
  66. import bottomTab from '../components/bottomTab'
  67. import {
  68. VipUserSelfQuery,
  69. OrderShopQuery,
  70. VipUserCleCkSum,
  71. MyShopQuery,
  72. testSelect,
  73. testTable,
  74. } from '../api/getApiRes.js'
  75. let qs = require('qs');
  76. import Global from '../Global.js'
  77. export default {
  78. data() {
  79. return {
  80. num: 0,
  81. thisTab: '我的',
  82. active: 0,
  83. sum: 0,
  84. openAlert: false,
  85. list: [],
  86. dialog: {
  87. id: '',
  88. name: '',
  89. timeLong: '',
  90. },
  91. user: {
  92. Ck: 0,
  93. CKMonth: 0,
  94. Cle: 0,
  95. CleMonth: 0,
  96. CalorieMonth: 0,
  97. CalorieTotal: 0,
  98. ClassFinish: 0,
  99. ClassRemain: 0,
  100. ClassTotal: 0,
  101. ExpTime: 0,
  102. Name: '',
  103. Phone: '',
  104. VipType: 0,
  105. },
  106. ckRs: {
  107. Ck: 0,
  108. CKMonth: 0,
  109. Cle: 0,
  110. CleMonth: 0,
  111. },
  112. schools: [],
  113. }
  114. },
  115. mounted() {
  116. this.getInfo();
  117. this.getOrderShopQuery();
  118. this.getCalorie()
  119. },
  120. methods: {
  121. // 获得卡路里
  122. getCalorie() {
  123. let that = this;
  124. let param = {
  125. token: localStorage.token,
  126. };
  127. let postdata = qs.stringify(param);
  128. VipUserCleCkSum(postdata).then(res => {
  129. let json = res;
  130. if (json.Code == 0) {
  131. that.ckRs = json;
  132. } else {
  133. that.$toast.message(json.Memo);
  134. }
  135. })
  136. },
  137. getOrderShopQuery() {
  138. let that = this;
  139. let param = {
  140. token: localStorage.token,
  141. };
  142. let postdata = qs.stringify(param);
  143. // OrderShopQuery(postdata).then(res => {
  144. MyShopQuery(postdata).then(res => {
  145. let json = res;
  146. if (json.Code == 0) {
  147. that.schools = json.Rs;
  148. } else {
  149. that.$toast.message(json.Memo);
  150. }
  151. })
  152. },
  153. logoutBtn() {
  154. let that = this;
  155. this.$confirm('是否退出账号?', '提示', {
  156. type: 'warning'
  157. }).then(({result}) => {
  158. if (result) {
  159. localStorage.token = '';
  160. that.$router.push({path: '/login'});
  161. } else {
  162. that.$toast.message('点击了取消');
  163. }
  164. });
  165. },
  166. getInfo() {
  167. let that = this;
  168. let param = {
  169. token: localStorage.token,
  170. active: this.active
  171. };
  172. let postdata = qs.stringify(param);
  173. VipUserSelfQuery(postdata).then(res => {
  174. let json = res;
  175. if (json.Code == 0) {
  176. that.user = json.Rs;
  177. } else {
  178. that.$toast.message(json.Memo);
  179. }
  180. })
  181. },
  182. },
  183. filters: {
  184. hidePhone: function (val) {
  185. var str = String(val)
  186. var len = str.length;
  187. if (len >= 7) {
  188. var reg = str.slice(-8, -4)
  189. return str.replace(reg, "****")
  190. } else if (len < 7 && len >= 6) {
  191. var reg = str.slice(-4, -2)
  192. return str.replace(reg, "**")
  193. }
  194. },
  195. fmtTime: function (value) {
  196. if (!value) {
  197. return 0
  198. } else {
  199. // js默认使用毫秒
  200. value = value * 1000
  201. let date = new Date(value);
  202. let y = date.getFullYear();
  203. let MM = date.getMonth() + 1;
  204. MM = MM < 10 ? ('0' + MM) : MM;
  205. let d = date.getDate();
  206. d = d < 10 ? ('0' + d) : d;
  207. let h = date.getHours();
  208. h = h < 10 ? ('0' + h) : h;
  209. let m = date.getMinutes();
  210. m = m < 10 ? ('0' + m) : m;
  211. let s = date.getSeconds();
  212. s = s < 10 ? ('0' + s) : s;
  213. return y + '-' + MM + '-' + d;
  214. }
  215. },
  216. },
  217. beforeRouteEnter(to, from, next) {
  218. next(vm => {
  219. //因为当钩子执行前,组件实例还没被创建
  220. // vm 就是当前组件的实例相当于上面的 this,所以在 next 方法里你就可以把 vm 当 this 来用了。
  221. if (to.name == 'mine') {
  222. vm.getInfo();
  223. }
  224. });
  225. },
  226. watch: {
  227. 'active'() {
  228. console.log(123);
  229. this.getList();
  230. }
  231. },
  232. components: {
  233. bottomTab
  234. }
  235. }
  236. </script>
  237. <style scoped>
  238. .pages {
  239. overflow: hidden;
  240. display: block;
  241. margin: 0 auto;
  242. background: #F2F2F2;
  243. }
  244. .num {
  245. width: 100%;
  246. overflow: hidden;
  247. display: block;
  248. margin: 0 auto;
  249. font-family: "PingFang SC";
  250. font-weight: 300;
  251. font-size: 14px;
  252. text-align: center;
  253. color: #909090;
  254. padding: 13px 0;
  255. }
  256. .user {
  257. width: 100%;
  258. overflow: hidden;
  259. display: block;
  260. margin: 0 auto;
  261. height: 58px;
  262. background: #fff;
  263. padding: 17px 3%;
  264. margin-bottom: 10px;
  265. }
  266. .user img {
  267. width: 26.29px;
  268. height: 26.29px;
  269. float: left;
  270. margin-right: 11px;
  271. }
  272. .user span {
  273. font-family: "PingFang SC";
  274. font-weight: 500;
  275. font-size: 18px;
  276. text-align: left;
  277. color: #3b3b3b;
  278. }
  279. .user em {
  280. font-family: "PingFang SC";
  281. font-weight: normal;
  282. font-size: 18px;
  283. text-align: left;
  284. color: #3b3b3b;
  285. float: right;
  286. }
  287. .user p {
  288. font-family: "PingFang SC";
  289. font-weight: normal;
  290. font-size: 14px;
  291. text-align: left;
  292. color: #ffb43c;
  293. float: right;
  294. padding: 0;
  295. margin: 0;
  296. margin-left: 3px;
  297. line-height: 26px;
  298. }
  299. .value {
  300. width: 100%;
  301. /*height: 131px;*/
  302. background: #fff;
  303. padding: 13px 0;
  304. }
  305. .value .vTitle {
  306. width: 100%;
  307. overflow: hidden;
  308. display: block;
  309. margin: 0 auto;
  310. text-align: center;
  311. font-family: "PingFang SC";
  312. font-weight: 300;
  313. font-size: 15px;
  314. }
  315. .vTitle i {
  316. width: 8px;
  317. height: 8px;
  318. display: inline-block;
  319. border-radius: 250px;
  320. margin-right: 3px;
  321. }
  322. .vTitle.year {
  323. color: #E75296;
  324. }
  325. .vTitle.year i {
  326. background: #e75296;
  327. }
  328. .vTitle.price {
  329. color: #FFB43C;
  330. }
  331. .vTitle.price i {
  332. background: #FFB43C;
  333. }
  334. .vNum {
  335. width: 100%;
  336. /*height: 25px;*/
  337. overflow: hidden;
  338. display: block;
  339. margin: 5px auto;
  340. margin-bottom: 0;
  341. }
  342. .center {
  343. width: 100%;
  344. overflow: hidden;
  345. display: block;
  346. margin: 0 auto;
  347. text-align: center;
  348. }
  349. .vNum em {
  350. position: relative;
  351. float: right;
  352. bottom: 20px;
  353. font-family: "PingFang SC";
  354. font-weight: 500;
  355. font-size: 12px;
  356. color: #c9c9c9;
  357. padding-right: 3%;
  358. }
  359. /deep/ .linear-progress {
  360. width: 90%;
  361. overflow: hidden;
  362. display: block;
  363. margin: 0 auto;
  364. border-radius: 250px;
  365. }
  366. .limit {
  367. width: 90%;
  368. overflow: hidden;
  369. display: block;
  370. margin: 0 auto;
  371. margin-top: 8px;
  372. }
  373. .limit em {
  374. font-family: "PingFang SC";
  375. font-weight: 300;
  376. font-size: 12px;
  377. text-align: right;
  378. color: #e75296;
  379. padding-left: 10px;
  380. }
  381. .limit span {
  382. font-family: "PingFang SC";
  383. font-weight: 300;
  384. font-size: 12px;
  385. text-align: right;
  386. color: #909090;
  387. float: right;
  388. text-align: right;
  389. padding-right: 10px;
  390. }
  391. .dataSum {
  392. width: 100%;
  393. overflow: hidden;
  394. display: block;
  395. margin: 0 auto;
  396. background: #fff;
  397. margin-top: 10px;
  398. }
  399. .dataSum .row {
  400. width: 90%;
  401. overflow: hidden;
  402. display: block;
  403. margin: 0 auto;
  404. padding: 2% 0;
  405. }
  406. .dataSum .row em {
  407. float: left;
  408. font-family: "PingFang SC";
  409. font-weight: 300;
  410. font-size: 18px;
  411. text-align: right;
  412. color: #3b3b3b;
  413. }
  414. .dataSum .row span {
  415. font-family: "PingFang SC";
  416. font-weight: 500;
  417. font-size: 18px;
  418. text-align: right;
  419. color: #3b3b3b;
  420. float: right;
  421. }
  422. .row .mid {
  423. width: 66%;
  424. height: 0px;
  425. background: transparent;
  426. border: 1px dotted #e0e0e0;
  427. float: left;
  428. margin-top: 11px;
  429. margin-right: 5px;
  430. margin-left: 10px;
  431. }
  432. .row .midl {
  433. width: 54%;
  434. height: 0px;
  435. }
  436. .login_btn {
  437. width: 96%;
  438. height: 50px;
  439. line-height: 50px;
  440. overflow: hidden;
  441. display: block;
  442. margin: 0 auto;
  443. margin-top: 10px;
  444. margin-bottom: 30px;
  445. padding-left: 3%;
  446. padding-right: 3%;
  447. background: #E75296;
  448. color: #fff;
  449. font-size: 14px;
  450. text-align: center;
  451. border: none;
  452. padding: 0;
  453. font-size: 24px;
  454. }
  455. /deep/ .mu-warning-text-color {
  456. float: left;
  457. }
  458. .vNum span {
  459. width: 100%;
  460. overflow: hidden;
  461. display: block;
  462. margin: 0 auto;
  463. text-align: center;
  464. }
  465. @media only screen and (max-width: 640px) {
  466. }
  467. @media only screen and (max-width: 480px) {
  468. }
  469. @media only screen and (max-width: 375px) {
  470. .vNum em {
  471. padding-right: 0 !important;
  472. }
  473. .row .mid {
  474. width: 49%;
  475. }
  476. .row .midl {
  477. width: 44%;
  478. height: 0px;
  479. }
  480. }
  481. @media only screen and (max-width: 360px) {
  482. .vNum em {
  483. padding-right: 0 !important;
  484. }
  485. .row .mid {
  486. width: 49%;
  487. }
  488. .row .midl {
  489. width: 44%;
  490. height: 0px;
  491. }
  492. }
  493. @media only screen and (max-width: 320px) {
  494. }
  495. @media only screen and (min-width: 641px) {
  496. }
  497. </style>