123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import { getBargainList } from '../../../api/activity.js';
- import { openBargainSubscribe } from '../../../utils/SubscribeMessage.js';
- const app = getApp();
- Page({
-
- data: {
- bargainList:[],
- page:0,
- limit:20,
- loading:false,
- loadend:false,
- userInfo:{},
- navH:''
- },
-
- onLoad: function (options) {
- this.setData({
- navH: app.globalData.navHeight
- });
- },
- goBack:function(){
- wx.navigateBack({ delta: 1 })
- },
- onLoadFun: function (e) {
- this.getBargainList();
- this.setData({
- userInfo: e.detail
- })
- },
- openSubscribe:function(e){
- let page = e.currentTarget.dataset.url;
- wx.showLoading({
- title: '正在加载',
- })
- openBargainSubscribe().then(res => {
- wx.hideLoading();
- wx.navigateTo({
- url: page,
- });
- }).catch(() => {
- wx.hideLoading();
- });
- },
- getBargainList:function(){
- var that = this;
- if (that.data.loadend) return;
- if (that.data.loading) return;
- that.setData({loading:true});
- getBargainList({page:that.data.page,limit:that.data.limit}).then(function (res) {
- that.setData({
- bargainList: that.data.bargainList.concat(res.data),
- page: that.data.page+1,
- loadend: that.data.limit > res.data.length,
- loading:false
- });
- }).catch(res=>{
- that.setData({loading:false});
- });
- },
-
- onReady: function () {
- },
-
- onShow: function () {
- },
-
- onHide: function () {
- },
-
- onUnload: function () {
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- this.getBargainList();
- },
- })
|