/* * 手太欠 * 愿这世界都如故事里一样 美好而动人~ */ Page({ /** * 页面的初始数据 */ data: { identities : '', //身份信息 userData : '', //用户信息 tabType : 'season', //会员标签 can : '', //操作按钮 buttonText : '', //按钮名字 notRules : '', //权益 couponPrice : '' ,//抵值券 newId : '' //会员id }, /** * 生命周期函数--监听页面加载 */ onLoad(options) {}, /** * 生命周期函数--监听页面显示 */ onShow() { // 获取用户信息 this.userInfo(); // 获取身份前置 this.identityInfo(); }, /** * 用户信息 */ userInfo() { wx.$api.user.userIndex().then(res => { this.setData({ userData: res.data }) }).catch(err => {}) }, /** * 身份前置 */ identityInfo(){ // 3为季卡,4为年卡 let identityId = '' if(this.data.tabType == 'season') { identityId = 3 } else { identityId = 4 } wx.$api.member.identitySee(identityId).then(res => { this.setData({ identities : res.data, couponPrice : res.data.coupon_price, notRules : res.data.not_rules, can : res.data.can, buttonText : res.data.buttonText, newId : res.data.identity_id }) }).catch(err => {}) }, /** * 切换身份 */ typeClick(e) { this.setData({ tabType: e.currentTarget.dataset.type }) // 获取身份前置 this.identityInfo(); } })