VipRecharge.js 1.8 KB
// pages/VipRecharge/VipRecharge.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    viplist: [],
    toplist: [],
    mainlist: []
  },

  //选择支付方式
  buyWay(e) {
    wx.navigateTo({
      url: '../payWay/payWay?id=' + e.currentTarget.id + '&moneyt=' + e.currentTarget.dataset.moneyt + '&money=' + e.currentTarget.dataset.money,
    })
  },

  getvip() {
    let that = this;
    let url = 'counselor/vip';
    app.post(url, {}).then((res) => {
      console.log(res)
      if (res.data.code == 200) {
        let viplist = res.data.data.viplist;
        let toplist = [];
        let mainlist = [];
        for (let obj of viplist) {
          if (obj.status == 1) {
            mainlist.push(obj)
          } else if (obj.status == 2) {
            toplist.push(obj)
          }
        }
        that.setData({
          viplist: viplist,
          toplist: toplist,
          mainlist: mainlist
        })

      }
    }).catch((err) => {
      console.log(err)
    })

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    let that = this;
    that.getvip();

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})