|
@@ -122,40 +122,33 @@ Page({ |
|
@@ -122,40 +122,33 @@ Page({ |
|
122
|
suggestion: []
|
122
|
suggestion: []
|
|
123
|
})
|
123
|
})
|
|
124
|
}
|
124
|
}
|
|
125
|
- qqmapsdk.getSuggestion({
|
|
|
|
126
|
- //获取输入框值并设置keyword参数
|
|
|
|
127
|
- keyword: e.detail.value, //用户输入的关键词,可设置固定值,如keyword:'KFC'
|
|
|
|
128
|
- region:this.location.city||'', //设置城市名,限制关键词所示的地域范围,非必填参数
|
|
|
|
129
|
- //region_fix:1,//锁定在本市
|
|
|
|
130
|
- //filter:'category<>美食',
|
|
|
|
131
|
- success: function (res) {//搜索成功后的回调
|
|
|
|
132
|
- console.log(res);
|
|
|
|
133
|
- var sug = [];
|
|
|
|
134
|
- for (var i = 0; i < res.data.length; i++) {
|
|
|
|
135
|
- sug.push({ // 获取返回结果,放到sug数组中
|
|
|
|
136
|
- title: res.data[i].title,
|
|
|
|
137
|
- id: res.data[i].id,
|
|
|
|
138
|
- addr: res.data[i].address,
|
|
|
|
139
|
- city: res.data[i].city,
|
|
|
|
140
|
- district: res.data[i].district,
|
|
|
|
141
|
- latitude: res.data[i].location.lat,
|
|
|
|
142
|
- longitude: res.data[i].location.lng
|
|
|
|
143
|
- });
|
|
|
|
144
|
- }
|
|
|
|
145
|
- _this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
|
|
|
|
146
|
- suggestion: sug
|
|
|
|
147
|
- });
|
|
|
|
148
|
- },
|
|
|
|
149
|
- fail: function (error) {
|
|
|
|
150
|
- _this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
|
|
|
|
151
|
- suggestion: []
|
125
|
+ App.Customer.KeywordTips({
|
|
|
|
126
|
+ keyword:this.inputVal,
|
|
|
|
127
|
+ region:this.location.city||'',
|
|
|
|
128
|
+ region_fix:0,
|
|
|
|
129
|
+ location:this.location.latitude+','+this.location.longitude,
|
|
|
|
130
|
+ page_size:20,
|
|
|
|
131
|
+ page_index:1,
|
|
|
|
132
|
+ key:map_key,
|
|
|
|
133
|
+ }).then(res=>{
|
|
|
|
134
|
+ res.data=res.data.data
|
|
|
|
135
|
+ var sug = [];
|
|
|
|
136
|
+ for (var i = 0; i < res.data.length; i++) {
|
|
|
|
137
|
+ sug.push({ // 获取返回结果,放到sug数组中
|
|
|
|
138
|
+ title: res.data[i].title,
|
|
|
|
139
|
+ id: res.data[i].id,
|
|
|
|
140
|
+ addr: res.data[i].address,
|
|
|
|
141
|
+ city: res.data[i].city,
|
|
|
|
142
|
+ district: res.data[i].district,
|
|
|
|
143
|
+ latitude: res.data[i].location.lat,
|
|
|
|
144
|
+ longitude: res.data[i].location.lng,
|
|
|
|
145
|
+ type:res.data[i].type,
|
|
152
|
});
|
146
|
});
|
|
153
|
- console.error(error);
|
|
|
|
154
|
- },
|
|
|
|
155
|
- complete: function (res) {
|
|
|
|
156
|
- console.log('getsuggest',res);
|
|
|
|
157
|
}
|
147
|
}
|
|
158
|
- });
|
148
|
+ _this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
|
|
|
|
149
|
+ suggestion: sug
|
|
|
|
150
|
+ });
|
|
|
|
151
|
+ })
|
|
159
|
},
|
152
|
},
|
|
160
|
nearby_search: function () {
|
153
|
nearby_search: function () {
|
|
161
|
App.Customer.SearchMap({
|
154
|
App.Customer.SearchMap({
|
|
@@ -167,7 +160,6 @@ Page({ |
|
@@ -167,7 +160,6 @@ Page({ |
|
167
|
orderby:'_distance',
|
160
|
orderby:'_distance',
|
|
168
|
key:map_key,
|
161
|
key:map_key,
|
|
169
|
}).then(res=>{
|
162
|
}).then(res=>{
|
|
170
|
- console.log('App.Customer.SearchMap',res)
|
|
|
|
171
|
res.data=res.data.data
|
163
|
res.data=res.data.data
|
|
172
|
var mks = []
|
164
|
var mks = []
|
|
173
|
for (var i = 0; i < res.data.length; i++) {
|
165
|
for (var i = 0; i < res.data.length; i++) {
|
|
@@ -192,7 +184,7 @@ Page({ |
|
@@ -192,7 +184,7 @@ Page({ |
|
192
|
this._getPos().then(res => {
|
184
|
this._getPos().then(res => {
|
|
193
|
console.log('wx.getLocation.then', res);
|
185
|
console.log('wx.getLocation.then', res);
|
|
194
|
this.location=res
|
186
|
this.location=res
|
|
195
|
- //this.getCity()
|
187
|
+ this.getCity()
|
|
196
|
}).catch((e) => {
|
188
|
}).catch((e) => {
|
|
197
|
console.log('wx.getLocation.catch', e);
|
189
|
console.log('wx.getLocation.catch', e);
|
|
198
|
if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
|
190
|
if ('getLocation:fail auth deny' == e.errMsg || 'getLocation:fail:auth denied' == e.errMsg) {
|