123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- var app = getApp();
- var util = require('../../utils/util.js');
- Page({
-
- data: {
- info: [],
- member_info: {}
- },
-
- onLoad: function (options) {
- var that = this;
- if (!util.check_login()) {
- this.setData({
- needAuth: true
- })
- } else {
- this.getUser();
- this.getData();
- }
- },
-
- authSuccess: function () {
- let that = this;
- this.setData({
- needAuth: false
- }, () => {
- that.getData();
- })
- },
- getData: function () {
- wx.showLoading();
- var token = wx.getStorageSync('token');
- let that = this;
- app.util.request({
- url: 'entry/wxapp/user',
- data: {
- controller: 'distribution.get_commission_info',
- token: token
- },
- dataType: 'json',
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == 0) {
- that.setData({ info: res.data.data })
- } else {
- wx.showModal({
- title: '提示',
- content: res.data.msg,
- showCancel: false,
- success(res) {
- if (res.confirm) {
- console.log('用户点击确定')
- wx.reLaunch({
- url: '/lionfish_comshop/pages/user/me',
- })
- }
- }
- })
- }
- }
- })
- },
- getUser: function(){
- var token = wx.getStorageSync('token');
- let that = this;
- app.util.request({
- url: 'entry/wxapp/user',
- data: {
- controller: 'user.get_user_info',
- token: token
- },
- dataType: 'json',
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == 0) {
- let commiss_diy_name = res.data.commiss_diy_name || '分销';
- wx.setNavigationBarTitle({
- title: `会员${commiss_diy_name}`,
- })
- that.setData({ member_info: res.data.data })
- } else {
-
- that.setData({ needAuth: true })
- wx.setStorage({
- key: "member_id",
- data: null
- })
- }
- }
- })
- },
-
- onShow: function () {
- }
- })
|