94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
1
2
3
4
5
6
|
<template>
<div>
<div class="person-bg">
<div class="person-ifo">
<div class="person-pic"></div>
<ul class="person-con">
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
7
8
9
|
<li>{{ phoneNum }}</li>
<li>账户余额: <span>¥ {{ acctBalance }}</span></li>
<li>我的卡券:<span>{{couponNum}} 张</span></li>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
10
11
12
13
|
</ul>
</div>
</div>
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
14
|
<mt-cell title="会员卡" is-link :to="{ name: 'Toast' }"></mt-cell>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
15
|
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
16
|
<mt-cell title="车辆管理" is-link :to="{ name: 'Toast' }"></mt-cell>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
17
|
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
18
|
<mt-cell title="停车记录" is-link :to="{ name: 'parkNotes' }"></mt-cell>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
19
|
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
20
|
<mt-cell title="建议反馈" is-link :to="{ name: 'suggestionBack' }"></mt-cell>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
21
22
|
<div class="leftRightPadding" style="margin-top: 34px">
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
23
|
<mt-button type="danger" size="large" @click="toBinDing">退出账户</mt-button>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
24
25
26
27
28
29
|
</div>
</div>
</template>
<script>
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
30
31
|
import { getOpenIdByCode, getTokenByOpenId, queryUserInfo } from '@/api/selfNav/selfNav'
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
32
|
export default {
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
name: 'selfNav',
data(){
return {
couponNum:'3', // 卡券数量
acctBalance: '420.00', // 账户余额
phoneNum:'',// 用户手机号
}
},
created() {
if (this.$utils.clientBrowser() == "微信") {
var appID = this.$utils.myVxAppId;
var code = this.getUrlParam('code');
var local = window.location.href;
if (code == null || code === '') {
window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid='+appID+'&redirect_uri='+encodeURIComponent(local)+'&response_type=code&scope=snsapi_userinfo&state=1,0#wechat_redirect'
} else {
return code;
}
}
},
mounted() {
if(this.$utils.GetOpenid()){
this.getTokenByOpenId(this.$utils.GetOpenid())
}else{
this.getOpenId()
}
},
methods: {
getUrlParam(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
var r = window.location.search.substr(1).match(reg)
if (r != null) return unescape(r[2])
return null
},
getOpenId: function () { // 第一步获取openid
let getCode = location.href
console.log(getCode)
let dataCode = getCode.split('?')[1]
let wxCode = dataCode.split('&')[0].split('=')[1]
let jsondata = {
appId: this.$utils.myVxAppId,
code: wxCode
};
getOpenIdByCode(jsondata).then(data => {
console.log(data)
// SetOpenid
if(data.code=='0'){
let openid = data.data;
this.$utils.SetOpenid(openid);
// mUrl.setApporWX('wx');
console.log("用户 openid "+openid);
this.getTokenByOpenId(openid)
}
})
},
getTokenByOpenId: function (openid) { // 获取token和手机号
let jsondata = {
openid: openid,
deviceInfo: this.$utils.myDeviceInfo
}
getTokenByOpenId(jsondata).then(data => {
console.log('执行获取token的接口 '+JSON.stringify(data));
if(data.code==0){
console.log("用户 token "+data.data.token);
this.$utils.SetToken(data.data.token)
this.$utils.SetPhone(data.data.phoneNum)
this.phoneNum = data.data.phoneNum
// 用户已经绑定手机号,获取用户信息
this.getInfoSelf()
}else{
// 用户未绑定手机号
this.$router.push({
path: 'binDing'
})
}
})
},
getInfoSelf: function () { // 获取用户信息
let salt = this.$utils.myCommonSalt(32);
var jsondata = {
app_id: this.$utils.myVarAppid,
deviceInfo: this.$utils.myDeviceInfo,
salt: salt,
sign_type: "md5",
token: this.$utils.GetToken(),
}
jsondata.sign = this.$utils.signObject(jsondata)
queryUserInfo(jsondata).then(data => {
console.log(data)
if(data.code == '0'){
let datas = data.data
this.couponNum = datas.couponNum;//卡券数量
this.acctBalance = (datas.acctBalance/100).toFixed(2);//账户余额 单位:分
}
})
},
toBinDing: function () { // 退出账户 去绑定页面
this.$router.push({
path:'binDing'
})
}
}
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
}
</script>
<style scoped lang="scss">
.person-bg {
height: 160px;
background: url("../../assets/images/mySelf/selfNavBg.png") no-repeat;
background-size: 100% 100%;
}
.person-ifo {
padding: $commonLeftRightPadding;
padding-top: 45px;
display: flex;
color: #ffbfbf;
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
157
|
.person-pic {
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
158
159
160
161
162
163
|
width: 64px;
height: 64px;
margin-right: 15px;
background: url("../../assets/images/mySelf/photoBG.png") no-repeat;
}
}
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
164
165
166
|
.person-con {
span {
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
167
168
169
170
171
|
font-size: 16px;
font-weight: bold;
}
}
|
49f85de6
liuqimichale
黄石微信公众号 -- 临停支付
|
172
|
.mint-cell {
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
173
174
175
|
border-bottom: 1px solid #EFEDED;
}
</style>
|