...
|
...
|
@@ -135,8 +135,10 @@ Page({ |
|
|
record: '',
|
|
|
showcountry: false,
|
|
|
showcity: false,
|
|
|
showregin:false,
|
|
|
countrylist: [],
|
|
|
citylist: [],
|
|
|
reginlist:[],
|
|
|
sort_id: '',
|
|
|
country: '',
|
|
|
city: "",
|
...
|
...
|
@@ -163,6 +165,8 @@ Page({ |
|
|
sle: false
|
|
|
|
|
|
}],
|
|
|
currentCity:''
|
|
|
|
|
|
|
|
|
|
|
|
},
|
...
|
...
|
@@ -176,8 +180,68 @@ Page({ |
|
|
})
|
|
|
console.log(this.data.url)
|
|
|
this.getshailist();
|
|
|
this.gethomeindex()
|
|
|
this.gethomeindex();
|
|
|
this.getcity()
|
|
|
},
|
|
|
|
|
|
|
|
|
//获取用户当前位置
|
|
|
getcity() {
|
|
|
let that = this;
|
|
|
wx.getLocation({
|
|
|
type: 'gcj02',
|
|
|
success: function (res) {
|
|
|
// 经纬度
|
|
|
var latitude = res.latitude
|
|
|
var longitude = res.longitude
|
|
|
|
|
|
// that.setData({
|
|
|
// wd: latitude,
|
|
|
// jd: longitude
|
|
|
// })
|
|
|
|
|
|
// that.gethostipallist()
|
|
|
var aK = that.data.aK
|
|
|
wx.request({
|
|
|
url: 'https://api.map.baidu.com/geocoder/v2/?ak=y8jPDTMIuAnaVscUztce1RKfNx8v5sok&location=' + latitude + ',' + longitude + '&output=json',
|
|
|
data: {},
|
|
|
header: {
|
|
|
'content-type': 'application/json'
|
|
|
},
|
|
|
success: function (res) {
|
|
|
console.log('1234567890', res)
|
|
|
var province = res.data.result.addressComponent.province;
|
|
|
let district = res.data.result.addressComponent.district
|
|
|
that.setData({
|
|
|
currentCity: province
|
|
|
})
|
|
|
wx.request({
|
|
|
// url: 'xxx' + city,
|
|
|
// data: {},
|
|
|
// header: {
|
|
|
// 'content-type': 'application/json'
|
|
|
// },
|
|
|
// success: function (res) {
|
|
|
// that.setData({
|
|
|
// county: res.data,
|
|
|
// })
|
|
|
// },
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
fail: function () {
|
|
|
wx.showToast({
|
|
|
title: '授权失败,请打开GPS重新进入页面授权',
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
letterTap(e) {
|
|
|
console.log(e)
|
|
|
const Item = e.currentTarget.dataset.item;
|
...
|
...
|
@@ -198,14 +262,15 @@ Page({ |
|
|
app.post(url, params).then((res) => {
|
|
|
|
|
|
that.setData({
|
|
|
record: res.wine_count.dataset,
|
|
|
citylist: res.region
|
|
|
record: res.wine_count,
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
if (that.data.type == 1) {
|
|
|
that.setData({
|
|
|
shaikind: res.sort
|
|
|
shaikind: res.sort,
|
|
|
|
|
|
})
|
|
|
} else if (that.data.type == 2) {
|
|
|
that.setData({
|
...
|
...
|
@@ -216,11 +281,31 @@ Page({ |
|
|
for (var obj of newcountrylist) {
|
|
|
obj.sel = false
|
|
|
}
|
|
|
|
|
|
that.setData({
|
|
|
countrylist:newcountrylist
|
|
|
})
|
|
|
} else if (that.data.type == 3) {
|
|
|
if(that.data.kindlist[1].name=='中国'){
|
|
|
that.setData({
|
|
|
citylist: res.region
|
|
|
})
|
|
|
}else{
|
|
|
that.setData({
|
|
|
citylist: []
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
let newcitylist = that.data.citylist;
|
|
|
for (var obj of newcitylist) {
|
|
|
obj.sel = false
|
|
|
}
|
|
|
|
|
|
that.setData({
|
|
|
shaikind: res.region
|
|
|
citylist:newcitylist
|
|
|
})
|
|
|
|
|
|
} else if (that.data.type == 4) {
|
|
|
that.setData({
|
|
|
shaikind: res.odor
|
...
|
...
|
@@ -280,6 +365,19 @@ Page({ |
|
|
showcountry: true
|
|
|
|
|
|
})
|
|
|
}else if(type==3){
|
|
|
that.setData({
|
|
|
shai: false,
|
|
|
showcity: true
|
|
|
|
|
|
})
|
|
|
}else{
|
|
|
that.setData({
|
|
|
shai: true,
|
|
|
showcity: false,
|
|
|
showcountry: false
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
let newkindlist = that.data.kindlist;
|
...
|
...
|
@@ -326,7 +424,14 @@ Page({ |
|
|
if (this.data.type == 1) {
|
|
|
if (obj.sel == true) {
|
|
|
this.setData({
|
|
|
sort_id: obj.id
|
|
|
sort_id: obj.id,
|
|
|
|
|
|
})
|
|
|
|
|
|
let newkindlist=this.data.kindlist;
|
|
|
newkindlist[0].name = obj.sort_name;
|
|
|
this.setData({
|
|
|
kindlist:newkindlist
|
|
|
})
|
|
|
}
|
|
|
} else if (this.data.type == 4) {
|
...
|
...
|
@@ -334,6 +439,12 @@ Page({ |
|
|
this.setData({
|
|
|
odor_id: obj.id
|
|
|
})
|
|
|
|
|
|
let newkindlist = this.data.kindlist;
|
|
|
newkindlist[3].name = obj.odor_name;
|
|
|
this.setData({
|
|
|
kindlist: newkindlist
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -362,6 +473,8 @@ Page({ |
|
|
this.setData({
|
|
|
kindlist: newkindlist
|
|
|
})
|
|
|
|
|
|
this.gethomeindex()
|
|
|
},
|
|
|
|
|
|
//筛选首页内容
|
...
|
...
|
@@ -389,7 +502,7 @@ Page({ |
|
|
|
|
|
})
|
|
|
},
|
|
|
// 选择城市
|
|
|
// 选择国家
|
|
|
selectcountry(e) {
|
|
|
let countryid = e.currentTarget.dataset.id;
|
|
|
|
...
|
...
|
@@ -403,9 +516,9 @@ Page({ |
|
|
|
|
|
newkindlist[1].name = obj.country_name
|
|
|
this.setData({
|
|
|
kindlist: newkindlist
|
|
|
kindlist: newkindlist,
|
|
|
country: obj.country_name
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
obj.sel = false
|
|
|
}
|
...
|
...
|
@@ -419,12 +532,107 @@ Page({ |
|
|
})
|
|
|
|
|
|
},
|
|
|
//选择城市
|
|
|
selectcity(e){
|
|
|
let cityindex = e.currentTarget.dataset.index;
|
|
|
console.log(cityindex)
|
|
|
|
|
|
|
|
|
let newcitylist = this.data.citylist;
|
|
|
|
|
|
|
|
|
for (var i=0;i<newcitylist.length;i++) {
|
|
|
|
|
|
|
|
|
if (i == cityindex) {
|
|
|
|
|
|
this.setData({
|
|
|
reginlist: newcitylist[i].region_list,
|
|
|
showregin:true,
|
|
|
showcity:false,
|
|
|
city: newcitylist[i].city
|
|
|
})
|
|
|
|
|
|
}
|
|
|
}
|
|
|
let newreginlist=this.data.reginlist;
|
|
|
for (var obj of newreginlist){
|
|
|
obj.sel=false
|
|
|
}
|
|
|
this.setData({
|
|
|
reginlist:newreginlist
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择区
|
|
|
selectregin(e){
|
|
|
let reginindex=e.currentTarget.dataset.index;
|
|
|
let newreginlist=this.data.reginlist;
|
|
|
for(var i=0;i<newreginlist.length;i++){
|
|
|
// newreginlist[i].sel = !newreginlist[i].sel
|
|
|
if(i==reginindex){
|
|
|
console.log(243782347)
|
|
|
newreginlist[i].sel=true;
|
|
|
let newkindlist = this.data.kindlist;
|
|
|
newkindlist[2].name = newreginlist[i].name;
|
|
|
this.setData({
|
|
|
kindlist: newkindlist,
|
|
|
region: newreginlist[i].name
|
|
|
})
|
|
|
|
|
|
console.log(this.data.kindlist)
|
|
|
|
|
|
}else{
|
|
|
newreginlist[i].sel=false
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
reginlist:newreginlist
|
|
|
})
|
|
|
|
|
|
console.log(this.data.reginlist)
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
//确定选择国家
|
|
|
countrysure() {
|
|
|
this.setData({
|
|
|
showcountry: false,
|
|
|
shai:false
|
|
|
})
|
|
|
|
|
|
this.gethomeindex()
|
|
|
},
|
|
|
//确定选择省
|
|
|
citysure(){
|
|
|
this.setData({
|
|
|
showregin: false,
|
|
|
shai: false,
|
|
|
showcity: false
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
this.gethomeindex()
|
|
|
},
|
|
|
|
|
|
//选择区
|
|
|
|
|
|
sureregin(){
|
|
|
this.setData({
|
|
|
showregin:false,
|
|
|
shai:false,
|
|
|
showcity:false
|
|
|
})
|
|
|
|
|
|
this.gethomeindex()
|
|
|
},
|
|
|
|
|
|
//筛选
|
|
|
shai(){
|
|
|
this.gethomeindex()
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
|