|
|
|
// pages/reserve/indexList.js
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import App from '../../utils/api';
|
|
|
|
import DA from './data';
|
|
|
|
const {regeneratorRuntime} = global
|
|
|
|
Page({
|
|
|
|
|
|
...
|
...
|
@@ -22,10 +23,28 @@ Page({ |
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
//lat=34.21719&lng=108.89155&offset=0&rows=50&distance=100000&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":108.87545674591064,"latitude":34.204520114013846},"northeast":{"longitude":108.90764325408935,"latitude":34.229857981005225},"scale":15}&cuisine=6&tags=1,2,3
|
|
|
|
onLoad: async function (options) {
|
|
|
|
//lat=34.21719&lng=108.89155&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":108.87545674591064,"latitude":34.204520114013846},"northeast":{"longitude":108.90764325408935,"latitude":34.229857981005225},"scale":15}&multiIndex=1&tags=1,2
|
|
|
|
this.options=options;
|
|
|
|
this.getList();
|
|
|
|
let tags=[
|
|
|
|
{id:1,name:'环境好'},
|
|
|
|
{id:2,name:'菜品有特色'},
|
|
|
|
{id:3,name:'超大包间'},
|
|
|
|
];
|
|
|
|
if(options.tags){
|
|
|
|
let ts=options.tags.split(',');
|
|
|
|
tags.forEach(t=>{
|
|
|
|
if(ts._indexOf(t.id)>-1){
|
|
|
|
t.active=true;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
multiArray:[['全部菜系'].concat(await DA.getCates())],
|
|
|
|
multiIndex:[options.multiIndex],
|
|
|
|
tags:tags,
|
|
|
|
})
|
|
|
|
setTimeout(()=>{this.getList()},0)
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -67,9 +86,9 @@ Page({ |
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
this.getListMore()
|
|
|
|
},
|
|
|
|
getList(){
|
|
|
|
async getList(){
|
|
|
|
let mapParam=this.options
|
|
|
|
this.offset=1 //page
|
|
|
|
this.size=20 //page size
|
|
...
|
...
|
@@ -86,11 +105,17 @@ Page({ |
|
|
|
size:this.size,
|
|
|
|
distance:50,
|
|
|
|
};
|
|
|
|
if(mapParam.tags){
|
|
|
|
this.param.tags=mapParam.tags
|
|
|
|
if(this.data.multiIndex[0]>0){
|
|
|
|
this.param.cuisine=await DA.getCatesID(this.data.multiIndex[0]-1);
|
|
|
|
}
|
|
|
|
if(mapParam.cuisine){
|
|
|
|
this.param.cuisine=mapParam.cuisine
|
|
|
|
let tags=[];
|
|
|
|
this.data.tags.forEach(t=>{
|
|
|
|
if(t.active){
|
|
|
|
tags.push(t.id)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if(tags.length>0){
|
|
|
|
this.param.tags=tags;
|
|
|
|
}
|
|
|
|
App.Customer.SellerLists(this.param).then(res=>{
|
|
|
|
this.setData({
|
|
...
|
...
|
@@ -110,4 +135,39 @@ Page({ |
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
caixiShow(){
|
|
|
|
this.selectComponent('#caixi').show();
|
|
|
|
},
|
|
|
|
caixiActive(e){
|
|
|
|
this.bindMultiPickerChange({
|
|
|
|
detail:{
|
|
|
|
value:[e.detail]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindMultiPickerChange(e){
|
|
|
|
console.log(e);
|
|
|
|
let val=util.val(e);
|
|
|
|
this.setData({
|
|
|
|
multiIndex:val
|
|
|
|
})
|
|
|
|
setTimeout(()=>{this.getList();},0)
|
|
|
|
},
|
|
|
|
tagsChange(e){
|
|
|
|
let id=util.attr(e,'id');
|
|
|
|
let tags=this.data.tags;
|
|
|
|
let activeNum=0;
|
|
|
|
tags.forEach(t=>{
|
|
|
|
if(t.id==id){
|
|
|
|
t.active=!t.active
|
|
|
|
}
|
|
|
|
if(t.active){
|
|
|
|
activeNum++
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.setData({
|
|
|
|
tags:tags,
|
|
|
|
})
|
|
|
|
setTimeout(()=>{this.getList();},0)
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|