|
@@ -11,6 +11,8 @@ Page({ |
|
|
data: { |
|
|
data: { |
|
|
searchData: [], |
|
|
searchData: [], |
|
|
paginate: null, |
|
|
paginate: null, |
|
|
|
|
|
p: 1, |
|
|
|
|
|
total: 0, |
|
|
}, |
|
|
}, |
|
|
skipSearch: function () { |
|
|
skipSearch: function () { |
|
|
wx.navigateTo({ |
|
|
wx.navigateTo({ |
|
@@ -22,26 +24,40 @@ Page({ |
|
|
* 生命周期函数--监听页面加载 |
|
|
* 生命周期函数--监听页面加载 |
|
|
*/ |
|
|
*/ |
|
|
onLoad: function (options) { |
|
|
onLoad: function (options) { |
|
|
this.init(JSON.parse(options.param)) |
|
|
|
|
|
|
|
|
this.data.finData = (JSON.parse(options.param)) |
|
|
|
|
|
this.init() |
|
|
wx.setNavigationBarTitle({ |
|
|
wx.setNavigationBarTitle({ |
|
|
title: JSON.parse(options.param).name |
|
|
title: JSON.parse(options.param).name |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
init: function (params) { |
|
|
|
|
|
|
|
|
init: function () { |
|
|
|
|
|
|
|
|
utils.http({ |
|
|
utils.http({ |
|
|
url: '/manicureApi/Index/finishedProduct', |
|
|
url: '/manicureApi/Index/finishedProduct', |
|
|
method: 'GET', |
|
|
method: 'GET', |
|
|
data: { |
|
|
data: { |
|
|
color_id: params.id, |
|
|
|
|
|
|
|
|
color_id: this.data.finData.id, |
|
|
|
|
|
p: this.data.p, |
|
|
|
|
|
limit: 40, |
|
|
} |
|
|
} |
|
|
}).then(res => { |
|
|
}).then(res => { |
|
|
this.setData({ |
|
|
|
|
|
searchData: res.data.lists, |
|
|
|
|
|
}, () => { |
|
|
|
|
|
this.data.paginate = res.data.paginate |
|
|
|
|
|
this.data.finData = params |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.data.p >= 2) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
searchData: this.data.searchData.concat(res.data.lists), |
|
|
|
|
|
}, () => { |
|
|
|
|
|
this.data.paginate = res.data.paginate |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
searchData: res.data.lists, |
|
|
|
|
|
total: res.data.paginate.total |
|
|
|
|
|
}, () => { |
|
|
|
|
|
this.data.paginate = res.data.paginate |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@@ -105,7 +121,16 @@ Page({ |
|
|
* 页面上拉触底事件的处理函数 |
|
|
* 页面上拉触底事件的处理函数 |
|
|
*/ |
|
|
*/ |
|
|
onReachBottom: function () { |
|
|
onReachBottom: function () { |
|
|
|
|
|
|
|
|
|
|
|
if (this.data.searchData.length < this.data.total ) { |
|
|
|
|
|
this.data.p ++ |
|
|
|
|
|
this.init() |
|
|
|
|
|
} else { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '已经到底了~', |
|
|
|
|
|
duration: 2000, |
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|