|
1
|
// pages/reserve/indexList.js
|
1
|
// pages/reserve/indexList.js
|
|
2
|
import util from '../../utils/util';
|
2
|
import util from '../../utils/util';
|
|
3
|
import App from '../../utils/api';
|
3
|
import App from '../../utils/api';
|
|
|
|
4
|
+import DA from './data';
|
|
4
|
const {regeneratorRuntime} = global
|
5
|
const {regeneratorRuntime} = global
|
|
5
|
Page({
|
6
|
Page({
|
|
6
|
|
7
|
|
|
@@ -22,10 +23,28 @@ Page({ |
|
@@ -22,10 +23,28 @@ Page({ |
|
22
|
/**
|
23
|
/**
|
|
23
|
* 生命周期函数--监听页面加载
|
24
|
* 生命周期函数--监听页面加载
|
|
24
|
*/
|
25
|
*/
|
|
25
|
- onLoad: function (options) {
|
|
|
|
26
|
- //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
|
26
|
+ onLoad: async function (options) {
|
|
|
|
27
|
+ //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
|
|
27
|
this.options=options;
|
28
|
this.options=options;
|
|
28
|
- this.getList();
|
29
|
+ let tags=[
|
|
|
|
30
|
+ {id:1,name:'环境好'},
|
|
|
|
31
|
+ {id:2,name:'菜品有特色'},
|
|
|
|
32
|
+ {id:3,name:'超大包间'},
|
|
|
|
33
|
+ ];
|
|
|
|
34
|
+ if(options.tags){
|
|
|
|
35
|
+ let ts=options.tags.split(',');
|
|
|
|
36
|
+ tags.forEach(t=>{
|
|
|
|
37
|
+ if(ts._indexOf(t.id)>-1){
|
|
|
|
38
|
+ t.active=true;
|
|
|
|
39
|
+ }
|
|
|
|
40
|
+ })
|
|
|
|
41
|
+ }
|
|
|
|
42
|
+ this.setData({
|
|
|
|
43
|
+ multiArray:[['全部菜系'].concat(await DA.getCates())],
|
|
|
|
44
|
+ multiIndex:[options.multiIndex],
|
|
|
|
45
|
+ tags:tags,
|
|
|
|
46
|
+ })
|
|
|
|
47
|
+ setTimeout(()=>{this.getList()},0)
|
|
29
|
},
|
48
|
},
|
|
30
|
|
49
|
|
|
31
|
/**
|
50
|
/**
|
|
@@ -67,9 +86,9 @@ Page({ |
|
@@ -67,9 +86,9 @@ Page({ |
|
67
|
* 页面上拉触底事件的处理函数
|
86
|
* 页面上拉触底事件的处理函数
|
|
68
|
*/
|
87
|
*/
|
|
69
|
onReachBottom: function () {
|
88
|
onReachBottom: function () {
|
|
70
|
-
|
89
|
+ this.getListMore()
|
|
71
|
},
|
90
|
},
|
|
72
|
- getList(){
|
91
|
+ async getList(){
|
|
73
|
let mapParam=this.options
|
92
|
let mapParam=this.options
|
|
74
|
this.offset=1 //page
|
93
|
this.offset=1 //page
|
|
75
|
this.size=20 //page size
|
94
|
this.size=20 //page size
|
|
@@ -86,11 +105,17 @@ Page({ |
|
@@ -86,11 +105,17 @@ Page({ |
|
86
|
size:this.size,
|
105
|
size:this.size,
|
|
87
|
distance:50,
|
106
|
distance:50,
|
|
88
|
};
|
107
|
};
|
|
89
|
- if(mapParam.tags){
|
|
|
|
90
|
- this.param.tags=mapParam.tags
|
108
|
+ if(this.data.multiIndex[0]>0){
|
|
|
|
109
|
+ this.param.cuisine=await DA.getCatesID(this.data.multiIndex[0]-1);
|
|
91
|
}
|
110
|
}
|
|
92
|
- if(mapParam.cuisine){
|
|
|
|
93
|
- this.param.cuisine=mapParam.cuisine
|
111
|
+ let tags=[];
|
|
|
|
112
|
+ this.data.tags.forEach(t=>{
|
|
|
|
113
|
+ if(t.active){
|
|
|
|
114
|
+ tags.push(t.id)
|
|
|
|
115
|
+ }
|
|
|
|
116
|
+ })
|
|
|
|
117
|
+ if(tags.length>0){
|
|
|
|
118
|
+ this.param.tags=tags;
|
|
94
|
}
|
119
|
}
|
|
95
|
App.Customer.SellerLists(this.param).then(res=>{
|
120
|
App.Customer.SellerLists(this.param).then(res=>{
|
|
96
|
this.setData({
|
121
|
this.setData({
|
|
@@ -110,4 +135,39 @@ Page({ |
|
@@ -110,4 +135,39 @@ Page({ |
|
110
|
})
|
135
|
})
|
|
111
|
})
|
136
|
})
|
|
112
|
},
|
137
|
},
|
|
|
|
138
|
+ caixiShow(){
|
|
|
|
139
|
+ this.selectComponent('#caixi').show();
|
|
|
|
140
|
+ },
|
|
|
|
141
|
+ caixiActive(e){
|
|
|
|
142
|
+ this.bindMultiPickerChange({
|
|
|
|
143
|
+ detail:{
|
|
|
|
144
|
+ value:[e.detail]
|
|
|
|
145
|
+ }
|
|
|
|
146
|
+ })
|
|
|
|
147
|
+ },
|
|
|
|
148
|
+ bindMultiPickerChange(e){
|
|
|
|
149
|
+ console.log(e);
|
|
|
|
150
|
+ let val=util.val(e);
|
|
|
|
151
|
+ this.setData({
|
|
|
|
152
|
+ multiIndex:val
|
|
|
|
153
|
+ })
|
|
|
|
154
|
+ setTimeout(()=>{this.getList();},0)
|
|
|
|
155
|
+ },
|
|
|
|
156
|
+ tagsChange(e){
|
|
|
|
157
|
+ let id=util.attr(e,'id');
|
|
|
|
158
|
+ let tags=this.data.tags;
|
|
|
|
159
|
+ let activeNum=0;
|
|
|
|
160
|
+ tags.forEach(t=>{
|
|
|
|
161
|
+ if(t.id==id){
|
|
|
|
162
|
+ t.active=!t.active
|
|
|
|
163
|
+ }
|
|
|
|
164
|
+ if(t.active){
|
|
|
|
165
|
+ activeNum++
|
|
|
|
166
|
+ }
|
|
|
|
167
|
+ })
|
|
|
|
168
|
+ this.setData({
|
|
|
|
169
|
+ tags:tags,
|
|
|
|
170
|
+ })
|
|
|
|
171
|
+ setTimeout(()=>{this.getList();},0)
|
|
|
|
172
|
+ },
|
|
113
|
}) |
173
|
}) |