|
|
@@ -9,16 +9,27 @@ Page({ |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
lists: [], |
|
|
|
merchantVoList:[], |
|
|
|
indexId: 0, |
|
|
|
businessId:0, |
|
|
|
page:1, |
|
|
|
isFirstPage:false, |
|
|
|
isLastPage:false, |
|
|
|
teljpgUrl: imgurl.teljpg.url, |
|
|
|
}, |
|
|
|
// 左侧点击事件 |
|
|
|
jumpIndex(e) { |
|
|
|
let index = e.currentTarget.dataset.menuindex |
|
|
|
let that = this |
|
|
|
let that = this; |
|
|
|
let index = e.currentTarget.dataset.menuindex; |
|
|
|
console.log(index) |
|
|
|
that.setData({ |
|
|
|
indexId: index |
|
|
|
indexId: index, |
|
|
|
businessId: index |
|
|
|
}); |
|
|
|
that.setData({ |
|
|
|
page:1 |
|
|
|
}) |
|
|
|
that.getList(1, that.data.businessId); |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
@@ -33,21 +44,13 @@ Page({ |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
|
*/ |
|
|
|
onReady: function () { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow: function () { |
|
|
|
let that = this; |
|
|
|
that.getBussiness(); |
|
|
|
that.getList(1); |
|
|
|
that.getList(1,0); |
|
|
|
}, |
|
|
|
getBussiness:function(){ |
|
|
|
let that = this; |
|
|
@@ -64,7 +67,7 @@ Page({ |
|
|
|
that.setData({ |
|
|
|
lists: res.data.list.concat(businessObj).sort(compare("id")) |
|
|
|
}); |
|
|
|
console.log(that.data.lists) |
|
|
|
console.log(that.data.lists); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
wx.showToast({ |
|
|
@@ -75,18 +78,37 @@ Page({ |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getList: function (pageNum) { |
|
|
|
getList: function (page, businessId) { |
|
|
|
let that = this; |
|
|
|
Http.get({ |
|
|
|
url: config.api.merchantList, |
|
|
|
data: { |
|
|
|
pageNum: pageNum, |
|
|
|
let data; |
|
|
|
if(businessId == 0){ |
|
|
|
data = { |
|
|
|
pageNum: page, |
|
|
|
pageSize: 15 |
|
|
|
} |
|
|
|
}else{ |
|
|
|
data = { |
|
|
|
pageNum: page, |
|
|
|
pageSize: 15, |
|
|
|
businessId: businessId |
|
|
|
} |
|
|
|
} |
|
|
|
Http.get({ |
|
|
|
url: config.api.merchantList, |
|
|
|
data: data |
|
|
|
}).then(res => { |
|
|
|
console.log(res) |
|
|
|
if (page == 1) { |
|
|
|
that.setData({ |
|
|
|
merchantVoList: [], |
|
|
|
}) |
|
|
|
} |
|
|
|
var tmpArr = that.data.merchantVoList; |
|
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
|
console.log(tmpArr) |
|
|
|
that.setData({ |
|
|
|
merchantVoList: res.data.list |
|
|
|
merchantVoList: tmpArr, |
|
|
|
isFirstPage: res.data.isFirstPage, |
|
|
|
isLastPage: res.data.isLastPage |
|
|
|
}) |
|
|
|
console.log(that.data.merchantVoList) |
|
|
|
}) |
|
|
@@ -107,32 +129,21 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面隐藏 |
|
|
|
*/ |
|
|
|
onHide: function () { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
*/ |
|
|
|
onUnload: function () { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
|
*/ |
|
|
|
onPullDownRefresh: function () { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面上拉触底事件的处理函数 |
|
|
|
*/ |
|
|
|
onReachBottom: function () { |
|
|
|
|
|
|
|
let that = this; |
|
|
|
that.data.page++; |
|
|
|
that.setData({ |
|
|
|
page: that.data.page |
|
|
|
}); |
|
|
|
console.log(that.data.page); |
|
|
|
// 如果是最后一页 |
|
|
|
//就不发送请求 |
|
|
|
if (!that.data.isLastPage || that.data.isFirstPage && that.data.isLastPage){ |
|
|
|
that.getList(that.data.page, that.data.businessId); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
function compare(pro) { |
|
|
|