|
@@ -135,8 +135,10 @@ Page({ |
|
@@ -135,8 +135,10 @@ Page({ |
135
|
record: '',
|
135
|
record: '',
|
136
|
showcountry: false,
|
136
|
showcountry: false,
|
137
|
showcity: false,
|
137
|
showcity: false,
|
|
|
138
|
+ showregin:false,
|
138
|
countrylist: [],
|
139
|
countrylist: [],
|
139
|
citylist: [],
|
140
|
citylist: [],
|
|
|
141
|
+ reginlist:[],
|
140
|
sort_id: '',
|
142
|
sort_id: '',
|
141
|
country: '',
|
143
|
country: '',
|
142
|
city: "",
|
144
|
city: "",
|
|
@@ -163,6 +165,8 @@ Page({ |
|
@@ -163,6 +165,8 @@ Page({ |
163
|
sle: false
|
165
|
sle: false
|
164
|
|
166
|
|
165
|
}],
|
167
|
}],
|
|
|
168
|
+ currentCity:''
|
|
|
169
|
+
|
166
|
|
170
|
|
167
|
|
171
|
|
168
|
},
|
172
|
},
|
|
@@ -176,8 +180,68 @@ Page({ |
|
@@ -176,8 +180,68 @@ Page({ |
176
|
})
|
180
|
})
|
177
|
console.log(this.data.url)
|
181
|
console.log(this.data.url)
|
178
|
this.getshailist();
|
182
|
this.getshailist();
|
179
|
- this.gethomeindex()
|
183
|
+ this.gethomeindex();
|
|
|
184
|
+ this.getcity()
|
|
|
185
|
+ },
|
|
|
186
|
+
|
|
|
187
|
+
|
|
|
188
|
+ //获取用户当前位置
|
|
|
189
|
+ getcity() {
|
|
|
190
|
+ let that = this;
|
|
|
191
|
+ wx.getLocation({
|
|
|
192
|
+ type: 'gcj02',
|
|
|
193
|
+ success: function (res) {
|
|
|
194
|
+ // 经纬度
|
|
|
195
|
+ var latitude = res.latitude
|
|
|
196
|
+ var longitude = res.longitude
|
|
|
197
|
+
|
|
|
198
|
+ // that.setData({
|
|
|
199
|
+ // wd: latitude,
|
|
|
200
|
+ // jd: longitude
|
|
|
201
|
+ // })
|
|
|
202
|
+
|
|
|
203
|
+ // that.gethostipallist()
|
|
|
204
|
+ var aK = that.data.aK
|
|
|
205
|
+ wx.request({
|
|
|
206
|
+ url: 'https://api.map.baidu.com/geocoder/v2/?ak=y8jPDTMIuAnaVscUztce1RKfNx8v5sok&location=' + latitude + ',' + longitude + '&output=json',
|
|
|
207
|
+ data: {},
|
|
|
208
|
+ header: {
|
|
|
209
|
+ 'content-type': 'application/json'
|
|
|
210
|
+ },
|
|
|
211
|
+ success: function (res) {
|
|
|
212
|
+ console.log('1234567890', res)
|
|
|
213
|
+ var province = res.data.result.addressComponent.province;
|
|
|
214
|
+ let district = res.data.result.addressComponent.district
|
|
|
215
|
+ that.setData({
|
|
|
216
|
+ currentCity: province
|
|
|
217
|
+ })
|
|
|
218
|
+ wx.request({
|
|
|
219
|
+ // url: 'xxx' + city,
|
|
|
220
|
+ // data: {},
|
|
|
221
|
+ // header: {
|
|
|
222
|
+ // 'content-type': 'application/json'
|
|
|
223
|
+ // },
|
|
|
224
|
+ // success: function (res) {
|
|
|
225
|
+ // that.setData({
|
|
|
226
|
+ // county: res.data,
|
|
|
227
|
+ // })
|
|
|
228
|
+ // },
|
|
|
229
|
+ })
|
|
|
230
|
+ }
|
|
|
231
|
+ })
|
|
|
232
|
+
|
|
|
233
|
+ },
|
|
|
234
|
+ fail: function () {
|
|
|
235
|
+ wx.showToast({
|
|
|
236
|
+ title: '授权失败,请打开GPS重新进入页面授权',
|
|
|
237
|
+ icon: 'none',
|
|
|
238
|
+ duration: 2000
|
|
|
239
|
+ })
|
|
|
240
|
+ }
|
|
|
241
|
+ })
|
180
|
},
|
242
|
},
|
|
|
243
|
+
|
|
|
244
|
+
|
181
|
letterTap(e) {
|
245
|
letterTap(e) {
|
182
|
console.log(e)
|
246
|
console.log(e)
|
183
|
const Item = e.currentTarget.dataset.item;
|
247
|
const Item = e.currentTarget.dataset.item;
|
|
@@ -198,14 +262,15 @@ Page({ |
|
@@ -198,14 +262,15 @@ Page({ |
198
|
app.post(url, params).then((res) => {
|
262
|
app.post(url, params).then((res) => {
|
199
|
|
263
|
|
200
|
that.setData({
|
264
|
that.setData({
|
201
|
- record: res.wine_count.dataset,
|
|
|
202
|
- citylist: res.region
|
265
|
+ record: res.wine_count,
|
|
|
266
|
+
|
203
|
})
|
267
|
})
|
204
|
|
268
|
|
205
|
|
269
|
|
206
|
if (that.data.type == 1) {
|
270
|
if (that.data.type == 1) {
|
207
|
that.setData({
|
271
|
that.setData({
|
208
|
- shaikind: res.sort
|
272
|
+ shaikind: res.sort,
|
|
|
273
|
+
|
209
|
})
|
274
|
})
|
210
|
} else if (that.data.type == 2) {
|
275
|
} else if (that.data.type == 2) {
|
211
|
that.setData({
|
276
|
that.setData({
|
|
@@ -216,11 +281,31 @@ Page({ |
|
@@ -216,11 +281,31 @@ Page({ |
216
|
for (var obj of newcountrylist) {
|
281
|
for (var obj of newcountrylist) {
|
217
|
obj.sel = false
|
282
|
obj.sel = false
|
218
|
}
|
283
|
}
|
|
|
284
|
+
|
|
|
285
|
+ that.setData({
|
|
|
286
|
+ countrylist:newcountrylist
|
|
|
287
|
+ })
|
219
|
} else if (that.data.type == 3) {
|
288
|
} else if (that.data.type == 3) {
|
|
|
289
|
+ if(that.data.kindlist[1].name=='中国'){
|
|
|
290
|
+ that.setData({
|
|
|
291
|
+ citylist: res.region
|
|
|
292
|
+ })
|
|
|
293
|
+ }else{
|
|
|
294
|
+ that.setData({
|
|
|
295
|
+ citylist: []
|
|
|
296
|
+ })
|
|
|
297
|
+ }
|
|
|
298
|
+
|
|
|
299
|
+
|
|
|
300
|
+ let newcitylist = that.data.citylist;
|
|
|
301
|
+ for (var obj of newcitylist) {
|
|
|
302
|
+ obj.sel = false
|
|
|
303
|
+ }
|
220
|
|
304
|
|
221
|
that.setData({
|
305
|
that.setData({
|
222
|
- shaikind: res.region
|
306
|
+ citylist:newcitylist
|
223
|
})
|
307
|
})
|
|
|
308
|
+
|
224
|
} else if (that.data.type == 4) {
|
309
|
} else if (that.data.type == 4) {
|
225
|
that.setData({
|
310
|
that.setData({
|
226
|
shaikind: res.odor
|
311
|
shaikind: res.odor
|
|
@@ -280,6 +365,19 @@ Page({ |
|
@@ -280,6 +365,19 @@ Page({ |
280
|
showcountry: true
|
365
|
showcountry: true
|
281
|
|
366
|
|
282
|
})
|
367
|
})
|
|
|
368
|
+ }else if(type==3){
|
|
|
369
|
+ that.setData({
|
|
|
370
|
+ shai: false,
|
|
|
371
|
+ showcity: true
|
|
|
372
|
+
|
|
|
373
|
+ })
|
|
|
374
|
+ }else{
|
|
|
375
|
+ that.setData({
|
|
|
376
|
+ shai: true,
|
|
|
377
|
+ showcity: false,
|
|
|
378
|
+ showcountry: false
|
|
|
379
|
+
|
|
|
380
|
+ })
|
283
|
}
|
381
|
}
|
284
|
|
382
|
|
285
|
let newkindlist = that.data.kindlist;
|
383
|
let newkindlist = that.data.kindlist;
|
|
@@ -326,7 +424,14 @@ Page({ |
|
@@ -326,7 +424,14 @@ Page({ |
326
|
if (this.data.type == 1) {
|
424
|
if (this.data.type == 1) {
|
327
|
if (obj.sel == true) {
|
425
|
if (obj.sel == true) {
|
328
|
this.setData({
|
426
|
this.setData({
|
329
|
- sort_id: obj.id
|
427
|
+ sort_id: obj.id,
|
|
|
428
|
+
|
|
|
429
|
+ })
|
|
|
430
|
+
|
|
|
431
|
+ let newkindlist=this.data.kindlist;
|
|
|
432
|
+ newkindlist[0].name = obj.sort_name;
|
|
|
433
|
+ this.setData({
|
|
|
434
|
+ kindlist:newkindlist
|
330
|
})
|
435
|
})
|
331
|
}
|
436
|
}
|
332
|
} else if (this.data.type == 4) {
|
437
|
} else if (this.data.type == 4) {
|
|
@@ -334,6 +439,12 @@ Page({ |
|
@@ -334,6 +439,12 @@ Page({ |
334
|
this.setData({
|
439
|
this.setData({
|
335
|
odor_id: obj.id
|
440
|
odor_id: obj.id
|
336
|
})
|
441
|
})
|
|
|
442
|
+
|
|
|
443
|
+ let newkindlist = this.data.kindlist;
|
|
|
444
|
+ newkindlist[3].name = obj.odor_name;
|
|
|
445
|
+ this.setData({
|
|
|
446
|
+ kindlist: newkindlist
|
|
|
447
|
+ })
|
337
|
}
|
448
|
}
|
338
|
}
|
449
|
}
|
339
|
|
450
|
|
|
@@ -362,6 +473,8 @@ Page({ |
|
@@ -362,6 +473,8 @@ Page({ |
362
|
this.setData({
|
473
|
this.setData({
|
363
|
kindlist: newkindlist
|
474
|
kindlist: newkindlist
|
364
|
})
|
475
|
})
|
|
|
476
|
+
|
|
|
477
|
+ this.gethomeindex()
|
365
|
},
|
478
|
},
|
366
|
|
479
|
|
367
|
//筛选首页内容
|
480
|
//筛选首页内容
|
|
@@ -389,7 +502,7 @@ Page({ |
|
@@ -389,7 +502,7 @@ Page({ |
389
|
|
502
|
|
390
|
})
|
503
|
})
|
391
|
},
|
504
|
},
|
392
|
- // 选择城市
|
505
|
+ // 选择国家
|
393
|
selectcountry(e) {
|
506
|
selectcountry(e) {
|
394
|
let countryid = e.currentTarget.dataset.id;
|
507
|
let countryid = e.currentTarget.dataset.id;
|
395
|
|
508
|
|
|
@@ -403,9 +516,9 @@ Page({ |
|
@@ -403,9 +516,9 @@ Page({ |
403
|
|
516
|
|
404
|
newkindlist[1].name = obj.country_name
|
517
|
newkindlist[1].name = obj.country_name
|
405
|
this.setData({
|
518
|
this.setData({
|
406
|
- kindlist: newkindlist
|
519
|
+ kindlist: newkindlist,
|
|
|
520
|
+ country: obj.country_name
|
407
|
})
|
521
|
})
|
408
|
-
|
|
|
409
|
} else {
|
522
|
} else {
|
410
|
obj.sel = false
|
523
|
obj.sel = false
|
411
|
}
|
524
|
}
|
|
@@ -419,12 +532,107 @@ Page({ |
|
@@ -419,12 +532,107 @@ Page({ |
419
|
})
|
532
|
})
|
420
|
|
533
|
|
421
|
},
|
534
|
},
|
|
|
535
|
+ //选择城市
|
|
|
536
|
+ selectcity(e){
|
|
|
537
|
+ let cityindex = e.currentTarget.dataset.index;
|
|
|
538
|
+ console.log(cityindex)
|
|
|
539
|
+
|
|
|
540
|
+
|
|
|
541
|
+ let newcitylist = this.data.citylist;
|
|
|
542
|
+
|
|
|
543
|
+
|
|
|
544
|
+ for (var i=0;i<newcitylist.length;i++) {
|
|
|
545
|
+
|
|
|
546
|
+
|
|
|
547
|
+ if (i == cityindex) {
|
|
|
548
|
+
|
|
|
549
|
+ this.setData({
|
|
|
550
|
+ reginlist: newcitylist[i].region_list,
|
|
|
551
|
+ showregin:true,
|
|
|
552
|
+ showcity:false,
|
|
|
553
|
+ city: newcitylist[i].city
|
|
|
554
|
+ })
|
|
|
555
|
+
|
|
|
556
|
+ }
|
|
|
557
|
+ }
|
|
|
558
|
+ let newreginlist=this.data.reginlist;
|
|
|
559
|
+ for (var obj of newreginlist){
|
|
|
560
|
+ obj.sel=false
|
|
|
561
|
+ }
|
|
|
562
|
+ this.setData({
|
|
|
563
|
+ reginlist:newreginlist
|
|
|
564
|
+ })
|
|
|
565
|
+ },
|
|
|
566
|
+
|
|
|
567
|
+ //选择区
|
|
|
568
|
+ selectregin(e){
|
|
|
569
|
+ let reginindex=e.currentTarget.dataset.index;
|
|
|
570
|
+ let newreginlist=this.data.reginlist;
|
|
|
571
|
+ for(var i=0;i<newreginlist.length;i++){
|
|
|
572
|
+ // newreginlist[i].sel = !newreginlist[i].sel
|
|
|
573
|
+ if(i==reginindex){
|
|
|
574
|
+ console.log(243782347)
|
|
|
575
|
+ newreginlist[i].sel=true;
|
|
|
576
|
+ let newkindlist = this.data.kindlist;
|
|
|
577
|
+ newkindlist[2].name = newreginlist[i].name;
|
|
|
578
|
+ this.setData({
|
|
|
579
|
+ kindlist: newkindlist,
|
|
|
580
|
+ region: newreginlist[i].name
|
|
|
581
|
+ })
|
|
|
582
|
+
|
|
|
583
|
+ console.log(this.data.kindlist)
|
|
|
584
|
+
|
|
|
585
|
+ }else{
|
|
|
586
|
+ newreginlist[i].sel=false
|
|
|
587
|
+ }
|
|
|
588
|
+ }
|
|
|
589
|
+
|
|
|
590
|
+ this.setData({
|
|
|
591
|
+ reginlist:newreginlist
|
|
|
592
|
+ })
|
|
|
593
|
+
|
|
|
594
|
+ console.log(this.data.reginlist)
|
|
|
595
|
+
|
|
|
596
|
+ },
|
|
|
597
|
+
|
422
|
|
598
|
|
|
|
599
|
+//确定选择国家
|
423
|
countrysure() {
|
600
|
countrysure() {
|
424
|
this.setData({
|
601
|
this.setData({
|
425
|
showcountry: false,
|
602
|
showcountry: false,
|
426
|
shai:false
|
603
|
shai:false
|
427
|
})
|
604
|
})
|
|
|
605
|
+
|
|
|
606
|
+ this.gethomeindex()
|
|
|
607
|
+ },
|
|
|
608
|
+ //确定选择省
|
|
|
609
|
+ citysure(){
|
|
|
610
|
+ this.setData({
|
|
|
611
|
+ showregin: false,
|
|
|
612
|
+ shai: false,
|
|
|
613
|
+ showcity: false
|
|
|
614
|
+
|
|
|
615
|
+
|
|
|
616
|
+ })
|
|
|
617
|
+
|
|
|
618
|
+ this.gethomeindex()
|
|
|
619
|
+ },
|
|
|
620
|
+
|
|
|
621
|
+ //选择区
|
|
|
622
|
+
|
|
|
623
|
+ sureregin(){
|
|
|
624
|
+ this.setData({
|
|
|
625
|
+ showregin:false,
|
|
|
626
|
+ shai:false,
|
|
|
627
|
+ showcity:false
|
|
|
628
|
+ })
|
|
|
629
|
+
|
|
|
630
|
+ this.gethomeindex()
|
|
|
631
|
+ },
|
|
|
632
|
+
|
|
|
633
|
+ //筛选
|
|
|
634
|
+ shai(){
|
|
|
635
|
+ this.gethomeindex()
|
428
|
},
|
636
|
},
|
429
|
|
637
|
|
430
|
|
638
|
|