...
|
...
|
@@ -12,23 +12,24 @@ Page({ |
|
|
data: {
|
|
|
tabSelected: 0,
|
|
|
refreshText: '下拉刷新',
|
|
|
footText: '内容加载中...',
|
|
|
userInfo: {},
|
|
|
tabBarArr: [
|
|
|
{
|
|
|
icon: '../../static/images/icon_rmfs_n@3x.png',
|
|
|
iconSelected: '../../static/images/icon_rmfs_p@3x.png',
|
|
|
icon: '../../static/images/limit/icon_rmfs_n@3x.png',
|
|
|
iconSelected: '../../static/images/limit/icon_rmfs_p@3x.png',
|
|
|
name: '热门发售',
|
|
|
method: 'app.limitProduct.hotLimitProduct'
|
|
|
},
|
|
|
{
|
|
|
icon: '../../static/images/icon_jjfs_n@3x.png',
|
|
|
iconSelected: '../../static/images/icon_jjfs_p@3x.png',
|
|
|
icon: '../../static/images/limit/icon_jjfs_n@3x.png',
|
|
|
iconSelected: '../../static/images/limit/icon_jjfs_p@3x.png',
|
|
|
name: '即将发售',
|
|
|
method: 'app.limitProduct.soonToSaleLimitProduct'
|
|
|
},
|
|
|
{
|
|
|
icon: '../../static/images/icon_yjfs_n@3x.png',
|
|
|
iconSelected: '../../static/images/icon_yjfs_p@3x.png',
|
|
|
icon: '../../static/images/limit/icon_yjfs_n@3x.png',
|
|
|
iconSelected: '../../static/images/limit/icon_yjfs_p@3x.png',
|
|
|
name: '已经发售',
|
|
|
method: 'app.limitProduct.alreadySaleLimitProduct'
|
|
|
}
|
...
|
...
|
@@ -37,18 +38,12 @@ Page({ |
|
|
{}, {}, {}
|
|
|
],
|
|
|
icon: {
|
|
|
clock: '../../static/images/clock_left.png'
|
|
|
clock: '../../static/images/limit/clock_left.png'
|
|
|
}
|
|
|
},
|
|
|
onLoad: function() {
|
|
|
yas = new Yas(app);
|
|
|
console.log(app.getUserInfo());
|
|
|
if (app.getUserInfo().nickName) {
|
|
|
this.setData({
|
|
|
userInfo: app.getUserInfo(),
|
|
|
hasUserInfo: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.getList(0, 1, 20, false);
|
|
|
},
|
|
|
onShow: function() {
|
...
|
...
|
@@ -62,6 +57,9 @@ Page({ |
|
|
|
|
|
this.getList(this.data.tabSelected, 1, 20, false).then(() => {
|
|
|
wx.stopPullDownRefresh();
|
|
|
this.setData({
|
|
|
refreshText: '下拉刷新'
|
|
|
});
|
|
|
});
|
|
|
|
|
|
},
|
...
|
...
|
@@ -73,12 +71,11 @@ Page({ |
|
|
page += 1;
|
|
|
this.getList(this.data.tabSelected, page, 20, true);
|
|
|
}
|
|
|
|
|
|
},
|
|
|
getUserInfo: function(e) {
|
|
|
console.log(e);
|
|
|
if (e.detail.errMsg === 'getUserInfo:ok') {
|
|
|
// AccountModel.decodeUserInfo();
|
|
|
// AccountModel.decodeUserInfo();
|
|
|
}
|
|
|
app.setUserInfo(e.detail.userInfo);
|
|
|
this.setData({
|
...
|
...
|
@@ -86,13 +83,15 @@ Page({ |
|
|
hasUserInfo: true
|
|
|
});
|
|
|
},
|
|
|
tabChange: function(e) {
|
|
|
tabChange: function(e) { // 切换TAB
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
|
|
|
if (index !== this.data.tabSelected) {
|
|
|
this.setData({
|
|
|
tabSelected: index
|
|
|
});
|
|
|
|
|
|
// 如果listData没有数据,或者数据为空,则调用接口
|
|
|
if (!this.data.listData[index].limitProductVoList || this.data.listData[index].limitProductVoList.length === 0) {
|
|
|
this.getList(index, 1, 20, false);
|
|
|
}
|
...
|
...
|
@@ -100,12 +99,20 @@ Page({ |
|
|
},
|
|
|
|
|
|
/**
|
|
|
* index: tab的index,page:分页,limit: 每页数量, isBottom:是否是到达底部后触发
|
|
|
* 获取限定发售列表
|
|
|
* index: tab的index,
|
|
|
* page:分页,
|
|
|
* limit: 每页数量,
|
|
|
* isBottom:是否是到达底部后触发
|
|
|
*/
|
|
|
getList: function(index, page, limit, isBottom) { // 获取限定发售列表
|
|
|
getList: function(index, page, limit, isBottom) {
|
|
|
let method = this.data.tabBarArr[index].method;
|
|
|
let that = this;
|
|
|
|
|
|
this.setData({
|
|
|
footText: '内容加载中...'
|
|
|
});
|
|
|
|
|
|
return LimitModel.getLimitSaleList({
|
|
|
method: method,
|
|
|
page: page,
|
...
|
...
|
@@ -113,16 +120,19 @@ Page({ |
|
|
}).then(res => {
|
|
|
console.log(res.data);
|
|
|
if (res.data && res.data.limitProductVoList) {
|
|
|
// 获取到已有的data数据,对某部分数据进行赋值后再setData
|
|
|
let list = that.data.listData;
|
|
|
|
|
|
if (isBottom) {
|
|
|
list[index].page = page;
|
|
|
list[index].limitProductVoList = list[index].limitProductVoList.concat(res.data.limitProductVoList);
|
|
|
list[index].limitProductVoList =
|
|
|
list[index].limitProductVoList.concat(res.data.limitProductVoList);
|
|
|
} else {
|
|
|
list[index] = res.data;
|
|
|
}
|
|
|
that.setData({
|
|
|
listData: list
|
|
|
listData: list,
|
|
|
footText: '暂无更多内容'
|
|
|
});
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -133,6 +143,8 @@ Page({ |
|
|
let limitProductCode = e.currentTarget.dataset.code;
|
|
|
|
|
|
router.go('productDetail', {limitProductCode});
|
|
|
|
|
|
},
|
|
|
navigateToHome: function(e) { // 跳转到我的限购码
|
|
|
router.go('userCenter');
|
|
|
}
|
|
|
}); |
...
|
...
|
|