Commit 1fe325aa54260a706c10f3259ec6ed3e3b45e39b

Authored by wangfan
1 parent 38ac791a

golist

... ... @@ -722,7 +722,13 @@ Page({
listShow(){
//this.selectComponent('#list').show();
wx.navigateTo({
url:util.http_build_query(this.param,'./indexList')
url:util.http_build_query({
lat:this.param.lat,
lng:this.param.lng,
map:this.param.map,
multiIndex:this.data.multiIndex,
tags:this.param.tags,
},'./indexList')
});
},
})
\ No newline at end of file
... ...
// 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
... ...
... ... @@ -6,6 +6,7 @@
"formids":"/components/formids/formids",
"nav":"/components/nav/nav",
"getpos":"/components/userinfo/getpos",
"sb-tr":"/components/reserve/seller-box-transverse/seller-box"
"sb-tr":"/components/reserve/seller-box-transverse/seller-box",
"caixi":"/components/reserve/caixi"
}
}
\ No newline at end of file
... ...
... ... @@ -27,6 +27,9 @@
hasActivity="{{true}}" hasAverage="{{false}}"
hasSlogan="{{true}}" ></sb-tr>
</view>
<view class="flex-vc" wx:if="{{!hasMore}}">没有更多了</view>
<view class="flex-vc nomore" wx:if="{{!hasMore}}">没有更多了</view>
</view>
</view>
\ No newline at end of file
</view>
<caixi multiArray="{{multiArray}}" multiIndex="{{multiIndex}}"
bindactive="caixiActive" id="caixi"
></caixi>
\ No newline at end of file
... ...
... ... @@ -62,3 +62,7 @@
border-radius: 6rpx;
overflow: hidden;
}
.nomore{
color: #999;
font-size: 28rpx;
}
... ...
... ... @@ -43,7 +43,7 @@
"list": []
},
"miniprogram": {
"current": 32,
"current": 52,
"list": [
{
"id": 0,
... ... @@ -432,6 +432,13 @@
"pathName": "pages/reserve/discount",
"query": "latitude=34.215637&longitude=108.891264&scale=16&height=397",
"scene": null
},
{
"id": -1,
"name": "pages/reserve/indexList",
"pathName": "pages/reserve/indexList",
"query": "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",
"scene": null
}
]
}
... ...