buyDetails.js 2.08 KB
const app = getApp();
let self = null;

Page({

  /**
   * 页面的初始数据
   */
  data: {
		tabArr: ['购买', '续费'],
		currentIndex: 0,
		
		list: null,
		isLoading: false, // 检测是否已经发送请求,防止重复发送请求
		noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据
		pageNum: 1, // 当前页数
  },
	

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
		self = this;
		app.isLogin().then(function(data) {//进入页面前已经授权登录成功
			self.setData({
				userInfo: data,
			});
		});
  },

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

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
		if(app.globalData.userInfo) {
			if(!this.data.isLogin) {
				this.setData({
					userInfo: app.globalData.userInfo,
					imghost: app.globalData.setting.imghost,
					isLogin: true,
				});
				
				// this.getData(true, '/api/weshop/plus/vip/mem/listBuyRecord', {
				// 	storeId: app.globalData.setting.stoid,
				// 	userId: app.globalData.user_id,
				// });	
				
				
				app.request.promiseGet('/api/weshop/plus/vip/mem/listBuyRecord', {
					data: {
						storeId: app.globalData.setting.stoid,
						userId: app.globalData.user_id,
					},
					isShowLoading: true,
				}).then(function(res) {
					self.setData({
						list: res.data.data,
					});
				});
							
							
				
			};
		};
  },

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

  },

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

  },

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

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
		this.scrollToLower('/api/weshop/plus/vip/mem/listBuyRecord', {
			store_id: app.globalData.setting.stoid,
			user_id: app.globalData.user_id,
		});
  },

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

  },
	
})