| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545 |
- <template>
- <div class="pages">
- <img src="../static/images/main/banner.png" height="121" width="414"/>
- <div class="context">
- <span class="num">
- 会员卡信息
- </span>
- <div class="user">
- <img src="../static/images/mine/User.png" height="53" width="53"/>
- <span>{{ user.Name }}</span>
- <em>{{ user.Phone | hidePhone}}</em>
- </div>
- <div class="value" v-for="s in schools">
- <div class="vTitle year" v-if="s.VipType == 1"><i></i>年会员</div>
- <div class="vTitle price" v-if="s.VipType == 2"><i></i>充值会员</div>
- <div class="vNum">
- <span> {{ s.ShopName }}</span>
- <div class="center">
- 总计{{ s.ClassHourToatal }}课时
- </div>
- <em v-if="s.VipType == 1">(有效期至{{ s.ExpTime |fmtTime }})</em>
- </div>
- <mu-flex class="linear-progress">
- <mu-linear-progress mode="determinate" :value="s.ClassHourRemain / s.ClassHourToatal *100"
- :size="10"
- color="secondary"></mu-linear-progress>
- </mu-flex>
- <div class="limit">
- <em>剩余 {{ s.ClassHourRemain }} 课时</em>
- <span>完成 {{ s.ClassHourConsume }} 课时</span>
- </div>
- </div>
- <div class="dataSum">
- <div class="row">
- <em>卡路里(月度)</em>
- <span>{{ ckRs.CleMonth }}</span>
- </div>
- </div>
- <div class="dataSum">
- <div class="row">
- <em>总卡路里</em>
- <span>{{ ckRs.Cle }}</span>
- </div>
- </div>
- <div class="dataSum">
- <div class="row">
- <em>CK(月度)</em>
- <span>{{ ckRs.CkMonth }}</span>
- </div>
- </div>
- <div class="dataSum">
- <div class="row">
- <em>总CK</em>
- <span>{{ ckRs.Ck }}</span>
- </div>
- </div>
- <div class="btn_center">
- <span class="btn btn-md login_btn" @click="logoutBtn">退出</span>
- </div>
- </div>
- <bottomTab :curTab="thisTab"></bottomTab>
- </div>
- </template>
- <script>
- import axios from 'axios';
- import bottomTab from '../components/bottomTab'
- import {
- VipUserSelfQuery,
- OrderShopQuery,
- VipUserCleCkSum,
- MyShopQuery,
- testSelect,
- testTable,
- } from '../api/getApiRes.js'
- let qs = require('qs');
- import Global from '../Global.js'
- export default {
- data() {
- return {
- num: 0,
- thisTab: '我的',
- active: 0,
- sum: 0,
- openAlert: false,
- list: [],
- dialog: {
- id: '',
- name: '',
- timeLong: '',
- },
- user: {
- Ck: 0,
- CKMonth: 0,
- Cle: 0,
- CleMonth: 0,
- CalorieMonth: 0,
- CalorieTotal: 0,
- ClassFinish: 0,
- ClassRemain: 0,
- ClassTotal: 0,
- ExpTime: 0,
- Name: '',
- Phone: '',
- VipType: 0,
- },
- ckRs: {
- Ck: 0,
- CKMonth: 0,
- Cle: 0,
- CleMonth: 0,
- },
- schools: [],
- }
- },
- mounted() {
- this.getInfo();
- this.getOrderShopQuery();
- this.getCalorie()
- },
- methods: {
- // 获得卡路里
- getCalorie() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- VipUserCleCkSum(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.ckRs = json;
- } else {
- that.$toast.message(json.Memo);
- }
- })
- },
- getOrderShopQuery() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- // OrderShopQuery(postdata).then(res => {
- MyShopQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.schools = json.Rs;
- } else {
- that.$toast.message(json.Memo);
- }
- })
- },
- logoutBtn() {
- let that = this;
- this.$confirm('是否退出账号?', '提示', {
- type: 'warning'
- }).then(({result}) => {
- if (result) {
- localStorage.token = '';
- that.$router.push({path: '/login'});
- } else {
- that.$toast.message('点击了取消');
- }
- });
- },
- getInfo() {
- let that = this;
- let param = {
- token: localStorage.token,
- active: this.active
- };
- let postdata = qs.stringify(param);
- VipUserSelfQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.user = json.Rs;
- } else {
- that.$toast.message(json.Memo);
- }
- })
- },
- },
- filters: {
- hidePhone: function (val) {
- var str = String(val)
- var len = str.length;
- if (len >= 7) {
- var reg = str.slice(-8, -4)
- return str.replace(reg, "****")
- } else if (len < 7 && len >= 6) {
- var reg = str.slice(-4, -2)
- return str.replace(reg, "**")
- }
- },
- fmtTime: function (value) {
- if (!value) {
- return 0
- } else {
- // js默认使用毫秒
- value = value * 1000
- let date = new Date(value);
- let y = date.getFullYear();
- let MM = date.getMonth() + 1;
- MM = MM < 10 ? ('0' + MM) : MM;
- let d = date.getDate();
- d = d < 10 ? ('0' + d) : d;
- let h = date.getHours();
- h = h < 10 ? ('0' + h) : h;
- let m = date.getMinutes();
- m = m < 10 ? ('0' + m) : m;
- let s = date.getSeconds();
- s = s < 10 ? ('0' + s) : s;
- return y + '-' + MM + '-' + d;
- }
- },
- },
- beforeRouteEnter(to, from, next) {
- next(vm => {
- //因为当钩子执行前,组件实例还没被创建
- // vm 就是当前组件的实例相当于上面的 this,所以在 next 方法里你就可以把 vm 当 this 来用了。
- if (to.name == 'mine') {
- vm.getInfo();
- }
- });
- },
- watch: {
- 'active'() {
- console.log(123);
- this.getList();
- }
- },
- components: {
- bottomTab
- }
- }
- </script>
- <style scoped>
- .pages {
- overflow: hidden;
- display: block;
- margin: 0 auto;
- background: #F2F2F2;
- }
- .num {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- font-family: "PingFang SC";
- font-weight: 300;
- font-size: 14px;
- text-align: center;
- color: #909090;
- padding: 13px 0;
- }
- .user {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- height: 58px;
- background: #fff;
- padding: 17px 3%;
- margin-bottom: 10px;
- }
- .user img {
- width: 26.29px;
- height: 26.29px;
- float: left;
- margin-right: 11px;
- }
- .user span {
- font-family: "PingFang SC";
- font-weight: 500;
- font-size: 18px;
- text-align: left;
- color: #3b3b3b;
- }
- .user em {
- font-family: "PingFang SC";
- font-weight: normal;
- font-size: 18px;
- text-align: left;
- color: #3b3b3b;
- float: right;
- }
- .user p {
- font-family: "PingFang SC";
- font-weight: normal;
- font-size: 14px;
- text-align: left;
- color: #ffb43c;
- float: right;
- padding: 0;
- margin: 0;
- margin-left: 3px;
- line-height: 26px;
- }
- .value {
- width: 100%;
- /*height: 131px;*/
- background: #fff;
- padding: 13px 0;
- }
- .value .vTitle {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: center;
- font-family: "PingFang SC";
- font-weight: 300;
- font-size: 15px;
- }
- .vTitle i {
- width: 8px;
- height: 8px;
- display: inline-block;
- border-radius: 250px;
- margin-right: 3px;
- }
- .vTitle.year {
- color: #E75296;
- }
- .vTitle.year i {
- background: #e75296;
- }
- .vTitle.price {
- color: #FFB43C;
- }
- .vTitle.price i {
- background: #FFB43C;
- }
- .vNum {
- width: 100%;
- /*height: 25px;*/
- overflow: hidden;
- display: block;
- margin: 5px auto;
- margin-bottom: 0;
- }
- .center {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: center;
- }
- .vNum em {
- position: relative;
- float: right;
- bottom: 20px;
- font-family: "PingFang SC";
- font-weight: 500;
- font-size: 12px;
- color: #c9c9c9;
- padding-right: 3%;
- }
- /deep/ .linear-progress {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- border-radius: 250px;
- }
- .limit {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 8px;
- }
- .limit em {
- font-family: "PingFang SC";
- font-weight: 300;
- font-size: 12px;
- text-align: right;
- color: #e75296;
- padding-left: 10px;
- }
- .limit span {
- font-family: "PingFang SC";
- font-weight: 300;
- font-size: 12px;
- text-align: right;
- color: #909090;
- float: right;
- text-align: right;
- padding-right: 10px;
- }
- .dataSum {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- background: #fff;
- margin-top: 10px;
- }
- .dataSum .row {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding: 2% 0;
- }
- .dataSum .row em {
- float: left;
- font-family: "PingFang SC";
- font-weight: 300;
- font-size: 18px;
- text-align: right;
- color: #3b3b3b;
- }
- .dataSum .row span {
- font-family: "PingFang SC";
- font-weight: 500;
- font-size: 18px;
- text-align: right;
- color: #3b3b3b;
- float: right;
- }
- .row .mid {
- width: 66%;
- height: 0px;
- background: transparent;
- border: 1px dotted #e0e0e0;
- float: left;
- margin-top: 11px;
- margin-right: 5px;
- margin-left: 10px;
- }
- .row .midl {
- width: 54%;
- height: 0px;
- }
- .login_btn {
- width: 96%;
- height: 50px;
- line-height: 50px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- margin-bottom: 30px;
- padding-left: 3%;
- padding-right: 3%;
- background: #E75296;
- color: #fff;
- font-size: 14px;
- text-align: center;
- border: none;
- padding: 0;
- font-size: 24px;
- }
- /deep/ .mu-warning-text-color {
- float: left;
- }
- .vNum span {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: center;
- }
- @media only screen and (max-width: 640px) {
- }
- @media only screen and (max-width: 480px) {
- }
- @media only screen and (max-width: 375px) {
- .vNum em {
- padding-right: 0 !important;
- }
- .row .mid {
- width: 49%;
- }
- .row .midl {
- width: 44%;
- height: 0px;
- }
- }
- @media only screen and (max-width: 360px) {
- .vNum em {
- padding-right: 0 !important;
- }
- .row .mid {
- width: 49%;
- }
- .row .midl {
- width: 44%;
- height: 0px;
- }
- }
- @media only screen and (max-width: 320px) {
- }
- @media only screen and (min-width: 641px) {
- }
- </style>
|