52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
|
|
import memberApi from "../../../api/memberApi"
|
||
|
|
import tool from '../../../utils/tool'
|
||
|
|
|
||
|
|
Page({
|
||
|
|
|
||
|
|
data: {
|
||
|
|
current: 0,
|
||
|
|
userInfo: {},
|
||
|
|
vipLevel: [],
|
||
|
|
vipTypeList: [],
|
||
|
|
userMemberInfo: {}
|
||
|
|
},
|
||
|
|
goback(){
|
||
|
|
wx.navigateBack(1)
|
||
|
|
},
|
||
|
|
switchActive(e){
|
||
|
|
this.setData({
|
||
|
|
current: e.currentTarget.dataset.index
|
||
|
|
})
|
||
|
|
},
|
||
|
|
add(e){
|
||
|
|
let vipId = this.data.vipTypeList[this.data.current].id
|
||
|
|
memberApi.add({vipId}).then(res=>{
|
||
|
|
if (res.code===200) {
|
||
|
|
wx.showToast({
|
||
|
|
title: '兑换成功~',
|
||
|
|
icon: 'none'
|
||
|
|
})
|
||
|
|
this.onLoad()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
jihuo(){
|
||
|
|
wx.navigateTo({
|
||
|
|
url: '/pages/subpages/activation/activation',
|
||
|
|
})
|
||
|
|
},
|
||
|
|
onLoad(){
|
||
|
|
const userInfo = tool.data.get('USER_INFO')
|
||
|
|
const clientConfig = tool.data.get('CLIENT_CONFIG')
|
||
|
|
const userMemberInfo = tool.data.get('USER_MEMBER_INFO')
|
||
|
|
|
||
|
|
let vipTypeList = JSON.parse(clientConfig.CLIENT_MEMBER_CATEGORY)
|
||
|
|
this.setData({
|
||
|
|
vipTypeList,
|
||
|
|
userInfo,
|
||
|
|
userMemberInfo
|
||
|
|
})
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
})
|