Commit eb8c120b by 高淑倩

plus_tunnel-token

parent e314c14c
// 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({
}
})
},
}
})
......@@ -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(() => {
// })
// },
/**
* 用户点击右上角分享
*/
......
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