Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
eb8c120b
Commit
eb8c120b
authored
Sep 11, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plus_tunnel-token
parent
e314c14c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
27 deletions
+65
-27
plus.js
src/component/plus/plus.js
+52
-14
userCenter.js
src/pages/userCenter/userCenter.js
+13
-13
No files found.
src/component/plus/plus.js
View file @
eb8c120b
// component/plus/plus.js
const
app
=
getApp
()
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
...
...
@@ -11,34 +12,71 @@ Component({
type
:
Array
,
value
:
[],
},
plusBgi
:{
plusBgi
:
{
type
:
Object
,
value
:
null
},
currentHasUserInfo
:{
currentHasUserInfo
:
{
type
:
Boolean
,
type
:
false
}
},
ready
()
{
this
.
getPlusPurchase
()
},
/**
* 组件的初始数据
*/
data
:
{
currentTab
:
'999'
,
currentPrice
:
0
currentTab
:
'999'
,
currentPrice
:
0
},
/**
* 组件的方法列表
*/
methods
:
{
// 获取plus购买信息
getPlusPurchase
()
{
wx
.
showLoading
({
title
:
'加载中'
})
wxService
.
request
({
url
:
app
.
globalData
.
ctx
+
'/sale/premium/query'
,
header
:
{
'tunnel-token'
:
'aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588feD'
},
success
:
(
res
)
=>
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
this
.
setData
({
skuVOList
:
data
})
}
wx
.
hideLoading
()
}
})
// wxService.get(`/sale/premium/query`).then(res => {
// const { result, data } = res.data
// if (result == 0) {
// this.setData({
// skuVOList: data
// })
// }
// }).finally(() => {
// })
},
_getUserInfo
(
res
=
{})
{
const
userInfo
=
res
.
detail
||
{}
console
.
log
(
'userInfo'
,
userInfo
)
console
.
log
(
'userInfo'
,
userInfo
)
// 先授权再领卡
if
(
res
.
detail
.
userInfo
)
{
utils
.
getUserInfoByBtn
(
userInfo
).
then
(
(
data
=
{}
)
=>
{
const
{
token
}
=
data
utils
.
getUserInfoByBtn
(
userInfo
).
then
(
(
data
=
{}
)
=>
{
const
{
token
}
=
data
wx
.
setStorageSync
(
'_accreditUserInfo'
,
userInfo
)
wx
.
hideNavigationBarLoading
()
if
(
token
)
{
...
...
@@ -48,7 +86,7 @@ Component({
}
wx
.
setStorageSync
(
'_baseUserInfo'
,
data
)
// 缓存用户信息
this
.
setUserInfo
()
// 判断有无开卡
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
if
(
err
)
{
wx
.
showToast
({
title
:
`会员系统异常请稍后重试!`
,
...
...
@@ -58,14 +96,14 @@ Component({
})
}
},
setUserInfo
()
{
setUserInfo
()
{
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// 新用户去激活领卡
if
(
userInfo
&&
userInfo
.
member
&&
!
userInfo
.
member
.
mobile
)
{
console
.
log
(
'去开'
)
wxService
.
openCard
()
return
false
}
else
{
}
else
{
console
.
log
(
'已开'
)
}
// 跳转
...
...
@@ -84,7 +122,7 @@ Component({
}
},
200
)
},
switchNav
(
e
){
switchNav
(
e
)
{
console
.
log
(
e
)
this
.
setData
({
currentTab
:
e
.
currentTarget
.
dataset
.
current
,
...
...
@@ -93,7 +131,7 @@ Component({
})
},
payPlus
()
{
if
(
!
this
.
data
.
id
){
if
(
!
this
.
data
.
id
)
{
wx
.
showToast
({
title
:
'请先选择会员卡'
,
icon
:
'none'
,
...
...
@@ -137,6 +175,6 @@ Component({
}
})
},
}
})
src/pages/userCenter/userCenter.js
View file @
eb8c120b
...
...
@@ -119,7 +119,7 @@ wxService.page({
// })
// }
// 获取plus购买信息
this
.
getPlusPurchase
()
//
this.getPlusPurchase()
// 获取手机信息
wxService
.
getSystemInfo
().
then
(
res
=>
{
this
.
setData
({
...
...
@@ -211,18 +211,18 @@ wxService.page({
},
// 获取plus购买信息
getPlusPurchase
()
{
wxService
.
get
(
`/sale/premium/query`
).
then
(
res
=>
{
if
(
!
res
)
return
false
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
this
.
setData
({
skuVOList
:
data
})
}
}).
finally
(()
=>
{
})
},
//
getPlusPurchase() {
//
wxService.get(`/sale/premium/query`).then(res => {
//
if(!res) return false
//
const { result, data } = res.data
//
if (result == 0) {
//
this.setData({
//
skuVOList: data
//
})
//
}
//
}).finally(() => {
//
})
//
},
/**
* 用户点击右上角分享
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment