Commit eb8c120b by 高淑倩

plus_tunnel-token

parent e314c14c
// component/plus/plus.js // component/plus/plus.js
const app = getApp()
const wxService = require('../../utils/wxService') const wxService = require('../../utils/wxService')
const utils = require('../../utils/util') const utils = require('../../utils/util')
...@@ -11,34 +12,71 @@ Component({ ...@@ -11,34 +12,71 @@ Component({
type: Array, type: Array,
value: [], value: [],
}, },
plusBgi:{ plusBgi: {
type: Object, type: Object,
value: null value: null
}, },
currentHasUserInfo:{ currentHasUserInfo: {
type: Boolean, type: Boolean,
type: false type: false
} }
}, },
ready() {
this.getPlusPurchase()
},
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
currentTab:'999', currentTab: '999',
currentPrice:0 currentPrice: 0
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { 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 = {}) { _getUserInfo(res = {}) {
const userInfo = res.detail || {} const userInfo = res.detail || {}
console.log('userInfo',userInfo) console.log('userInfo', userInfo)
// 先授权再领卡 // 先授权再领卡
if (res.detail.userInfo) { if (res.detail.userInfo) {
utils.getUserInfoByBtn(userInfo).then( (data = {} ) => { utils.getUserInfoByBtn(userInfo).then((data = {}) => {
const {token} = data const { token } = data
wx.setStorageSync('_accreditUserInfo', userInfo) wx.setStorageSync('_accreditUserInfo', userInfo)
wx.hideNavigationBarLoading() wx.hideNavigationBarLoading()
if (token) { if (token) {
...@@ -48,7 +86,7 @@ Component({ ...@@ -48,7 +86,7 @@ Component({
} }
wx.setStorageSync('_baseUserInfo', data) // 缓存用户信息 wx.setStorageSync('_baseUserInfo', data) // 缓存用户信息
this.setUserInfo() // 判断有无开卡 this.setUserInfo() // 判断有无开卡
}).catch(err=> { }).catch(err => {
if (err) { if (err) {
wx.showToast({ wx.showToast({
title: `会员系统异常请稍后重试!`, title: `会员系统异常请稍后重试!`,
...@@ -58,14 +96,14 @@ Component({ ...@@ -58,14 +96,14 @@ Component({
}) })
} }
}, },
setUserInfo () { setUserInfo() {
const userInfo = wx.getStorageSync('_baseUserInfo') const userInfo = wx.getStorageSync('_baseUserInfo')
// 新用户去激活领卡 // 新用户去激活领卡
if (userInfo && userInfo.member && !userInfo.member.mobile) { if (userInfo && userInfo.member && !userInfo.member.mobile) {
console.log('去开') console.log('去开')
wxService.openCard() wxService.openCard()
return false return false
}else { } else {
console.log('已开') console.log('已开')
} }
// 跳转 // 跳转
...@@ -84,7 +122,7 @@ Component({ ...@@ -84,7 +122,7 @@ Component({
} }
}, 200) }, 200)
}, },
switchNav(e){ switchNav(e) {
console.log(e) console.log(e)
this.setData({ this.setData({
currentTab: e.currentTarget.dataset.current, currentTab: e.currentTarget.dataset.current,
...@@ -93,7 +131,7 @@ Component({ ...@@ -93,7 +131,7 @@ Component({
}) })
}, },
payPlus() { payPlus() {
if (!this.data.id){ if (!this.data.id) {
wx.showToast({ wx.showToast({
title: '请先选择会员卡', title: '请先选择会员卡',
icon: 'none', icon: 'none',
......
...@@ -119,7 +119,7 @@ wxService.page({ ...@@ -119,7 +119,7 @@ wxService.page({
// }) // })
// } // }
// 获取plus购买信息 // 获取plus购买信息
this.getPlusPurchase() // this.getPlusPurchase()
// 获取手机信息 // 获取手机信息
wxService.getSystemInfo().then(res => { wxService.getSystemInfo().then(res => {
this.setData({ this.setData({
...@@ -211,18 +211,18 @@ wxService.page({ ...@@ -211,18 +211,18 @@ wxService.page({
}, },
// 获取plus购买信息 // 获取plus购买信息
getPlusPurchase() { // getPlusPurchase() {
wxService.get(`/sale/premium/query`).then(res => { // wxService.get(`/sale/premium/query`).then(res => {
if(!res) return false // if(!res) return false
const { result, data } = res.data // const { result, data } = res.data
if (result == 0) { // if (result == 0) {
this.setData({ // this.setData({
skuVOList: data // skuVOList: data
}) // })
} // }
}).finally(() => { // }).finally(() => {
}) // })
}, // },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment