|
...
|
...
|
@@ -13,10 +13,11 @@ Page({ |
|
|
|
total: 0,
|
|
|
|
tabType:1,
|
|
|
|
hasMore:true,
|
|
|
|
rsl:[],//推荐商家
|
|
|
|
},
|
|
|
|
tabType:1,
|
|
|
|
offset:1,
|
|
|
|
limit:10,
|
|
|
|
offset:0,
|
|
|
|
limit:3,
|
|
|
|
hasMore:true,
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
...
|
...
|
@@ -36,7 +37,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
this.getListData();
|
|
|
|
this.selectComponent('#getpos').getPos();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -53,49 +54,41 @@ Page({ |
|
|
|
|
|
|
|
},
|
|
|
|
getListData() {
|
|
|
|
App.Reserve.GetListFromScheAndRes({
|
|
|
|
flag: 1,
|
|
|
|
App.Customer.GetMyOrder({
|
|
|
|
type: this.tabType,
|
|
|
|
openid: getApp().openid,
|
|
|
|
offset:this.offset,
|
|
|
|
limit:this.limit,
|
|
|
|
}).then(res => {
|
|
|
|
let total = res.data.success.length
|
|
|
|
let total = res.data.length
|
|
|
|
let data = this.formatList(res.data);
|
|
|
|
|
|
|
|
this.hasMore=data.success.length>=this.limit
|
|
|
|
this.hasMore=res.data.length>=this.limit
|
|
|
|
if(this.hasMore){
|
|
|
|
this.offset+=this.limit
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
list: data.success,
|
|
|
|
list: this.data.list.concat(data),
|
|
|
|
hasMore:this.hasMore
|
|
|
|
})
|
|
|
|
if(res.data.length==0){
|
|
|
|
this.GetRecommendSellerLists()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
_formatList(list) {
|
|
|
|
if (!list) return {};
|
|
|
|
let dlist = {};
|
|
|
|
if (list.length > 0) {
|
|
|
|
let openid = getApp().openid;
|
|
|
|
list.forEach(row => {
|
|
|
|
row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II');
|
|
|
|
row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
|
|
|
|
let d = util.unixtoTime(row.rdate, 'MM月DD日 DAY 星期WW');
|
|
|
|
typeof dlist[d] == 'undefined' ? dlist[d] = [] : '';
|
|
|
|
dlist[d].push(row);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
formatList(list) {
|
|
|
|
if (list.length<1) return [];
|
|
|
|
let dlist = [];
|
|
|
|
let openid = getApp().openid;
|
|
|
|
list.forEach(row => {
|
|
|
|
row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II');
|
|
|
|
row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
|
|
|
|
dlist.push(row);
|
|
|
|
})
|
|
|
|
return dlist;
|
|
|
|
},
|
|
|
|
formatList(res) {
|
|
|
|
res.success = this._formatList(res.success);
|
|
|
|
res.padding = this._formatList(res.padding);
|
|
|
|
return res;
|
|
|
|
},
|
|
|
|
switchTab(e) {
|
|
|
|
this.setData({
|
|
|
|
tabFlag: util.attr(e, 'index')
|
|
|
|
tabFlag: util.attr(e, 'index'),
|
|
|
|
})
|
|
|
|
this.getListData();
|
|
|
|
},
|
|
...
|
...
|
@@ -121,10 +114,20 @@ Page({ |
|
|
|
url:url,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
gotoSellerDetail(e){
|
|
|
|
console.log(e)
|
|
|
|
let url='/pages/reserve/detail?id='+e.currentTarget.id
|
|
|
|
wx.navigateTo({
|
|
|
|
url:url,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
switchType(e){
|
|
|
|
this.hasRecommend=true
|
|
|
|
this.tabType=util.attr(e,'type')
|
|
|
|
this.setData({
|
|
|
|
tabType:this.tabType,
|
|
|
|
list: [],
|
|
|
|
hasMore:false
|
|
|
|
})
|
|
|
|
this.getListData()
|
|
|
|
},
|
|
...
|
...
|
@@ -137,4 +140,43 @@ Page({ |
|
|
|
this.getListData();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hasRecommend:true,
|
|
|
|
GetRecommendSellerLists(){
|
|
|
|
if(!this.hasRecommend) return
|
|
|
|
let param={}
|
|
|
|
if(this.location){
|
|
|
|
param={
|
|
|
|
lat:this.location.latitude,
|
|
|
|
lng:this.location.longitude
|
|
|
|
}
|
|
|
|
}
|
|
|
|
App.Customer.GetRecommendSellerLists(param).then(res=>{
|
|
|
|
this.setData({
|
|
|
|
rsl:res.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
hasGoto:false,
|
|
|
|
bindtransition(e){
|
|
|
|
console.log(e)
|
|
|
|
if('change'==e.type){
|
|
|
|
this.hasGoto=false
|
|
|
|
}
|
|
|
|
if('animationfinish'==e.type){
|
|
|
|
if(this.hasGoto && (e.detail.current+1)==this.data.rsl.length){
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/reserve/index'
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
}else{
|
|
|
|
this.hasGoto=true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
location:null,
|
|
|
|
onpos(e){
|
|
|
|
console.log('onpos',e);
|
|
|
|
this.location=e.detail
|
|
|
|
this.getListData();
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|