|
|
|
|
|
|
|
|
provinceIndex:0, |
|
|
provinceIndex:0, |
|
|
cityIndex:0, |
|
|
cityIndex:0, |
|
|
inputVal:"", |
|
|
inputVal:"", |
|
|
initialize:false,//检测是不是通过条件搜索 |
|
|
|
|
|
scrollHig:0, |
|
|
scrollHig:0, |
|
|
getDataArr:[ |
|
|
|
|
|
// { |
|
|
|
|
|
// "bigImg": "../images/shop.png", |
|
|
|
|
|
// "name":"北京东城区金宝店", |
|
|
|
|
|
// "address":"北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)", |
|
|
|
|
|
// "phone":"010-8388-6698", |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// "bigImg": "../images/shop.png", |
|
|
|
|
|
// "name": "北京东城区金宝店", |
|
|
|
|
|
// "address": "北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)", |
|
|
|
|
|
// "phone": "010-8388-6698", |
|
|
|
|
|
// }, |
|
|
|
|
|
// { |
|
|
|
|
|
// "bigImg": "../images/shop.png", |
|
|
|
|
|
// "name": "北京东城区金宝店", |
|
|
|
|
|
// "address": "北京市东城区金宝大雅宝59号(鄂尔多斯酒店对面)", |
|
|
|
|
|
// "phone": "010-8388-6698", |
|
|
|
|
|
// } |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
pageNum:1,//页码 |
|
|
|
|
|
count:2,//每页条数 |
|
|
|
|
|
showDataArr:[],//展示的数据列表 |
|
|
|
|
|
dataArr: [],//搜索的数据列表 |
|
|
|
|
|
getDataArr:[],//每次下拉获取的数据 |
|
|
}, |
|
|
}, |
|
|
bindchange:function(e){ |
|
|
bindchange:function(e){ |
|
|
console.log("确定") |
|
|
|
|
|
|
|
|
wx.pageScrollTo({ |
|
|
|
|
|
scrollTop: 0, |
|
|
|
|
|
duration: 300 |
|
|
|
|
|
}) |
|
|
|
|
|
this.data.pageNum = 1; |
|
|
|
|
|
this.data.dataArr = []; |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
inputVal:"" |
|
|
inputVal:"" |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
bindcolumnchange: function (e) { |
|
|
bindcolumnchange: function (e) { |
|
|
console.log(e) |
|
|
console.log(e) |
|
|
this.data.initialize = true; |
|
|
|
|
|
|
|
|
if (this.data.provinceCityArr[0][0] == "") { |
|
|
|
|
|
this.data.provinceCityArr[0][0] = "全部" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.data.provinceCityArr[1][0] == "") { |
|
|
|
|
|
this.data.provinceCityArr[1][0] = "全部"; |
|
|
|
|
|
} |
|
|
var clo = e.detail.column;//指移动的哪一列 |
|
|
var clo = e.detail.column;//指移动的哪一列 |
|
|
var value = e.detail.value;//指列中的哪一个 |
|
|
var value = e.detail.value;//指列中的哪一个 |
|
|
var activeArr = [this.data.provinceArr, this.data.cityArr[value]] |
|
|
var activeArr = [this.data.provinceArr, this.data.cityArr[value]] |
|
|
|
|
|
|
|
|
provinceCityArr: activeArr, |
|
|
provinceCityArr: activeArr, |
|
|
index:0, |
|
|
index:0, |
|
|
provinceIndex: value, |
|
|
provinceIndex: value, |
|
|
|
|
|
cityIndex:0, |
|
|
}) |
|
|
}) |
|
|
}else{ |
|
|
}else{ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
index: value, |
|
|
index: value, |
|
|
cityIndex:value |
|
|
cityIndex:value |
|
|
}) |
|
|
}) |
|
|
|
|
|
// console.log(this.data.provinceCityArr) |
|
|
} |
|
|
} |
|
|
console.log(activeArr) |
|
|
|
|
|
console.log(clo, value) |
|
|
|
|
|
|
|
|
// console.log(activeArr) |
|
|
|
|
|
// console.log(clo, value) |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面加载 |
|
|
* 生命周期函数--监听页面加载 |
|
|
*/ |
|
|
*/ |
|
|
onLoad: function (options) { |
|
|
onLoad: function (options) { |
|
|
this.getShopList(); |
|
|
this.getShopList(); |
|
|
this.searchShop(); |
|
|
|
|
|
|
|
|
this.searchShop(true); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getShopList:function(){//获取所有门店省市 |
|
|
getShopList:function(){//获取所有门店省市 |
|
|
app.wxRequest(app.globalData.httpUrl + 'shop/shop_province', {}, e => { |
|
|
app.wxRequest(app.globalData.httpUrl + 'shop/shop_province', {}, e => { |
|
|
console.log(e) |
|
|
|
|
|
|
|
|
// console.log(e) |
|
|
var shopProvince = ["全部"];//省份 |
|
|
var shopProvince = ["全部"];//省份 |
|
|
var shopCity = [];//城市 |
|
|
var shopCity = [];//城市 |
|
|
var shopCityAll = ["全部"];//全部城市 |
|
|
var shopCityAll = ["全部"];//全部城市 |
|
|
|
|
|
|
|
|
cityArr: shopCity, |
|
|
cityArr: shopCity, |
|
|
provinceCityArr: provinceCity, |
|
|
provinceCityArr: provinceCity, |
|
|
}) |
|
|
}) |
|
|
console.log(this.data.provinceArr) |
|
|
|
|
|
console.log(this.data.cityArr) |
|
|
|
|
|
console.log(this.data.provinceCityArr) |
|
|
|
|
|
|
|
|
// console.log(this.data.provinceArr) |
|
|
|
|
|
// console.log(this.data.cityArr) |
|
|
|
|
|
// console.log(this.data.provinceCityArr) |
|
|
} |
|
|
} |
|
|
}, this) |
|
|
}, this) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
searchShop:function(){//搜索 |
|
|
|
|
|
var province = ""; |
|
|
|
|
|
var city = ""; |
|
|
|
|
|
if (this.data.initialize){ |
|
|
|
|
|
if (this.data.provinceCityArr[0][this.data.provinceIndex] == "全部"){ |
|
|
|
|
|
|
|
|
searchShop: function (search){//搜索 |
|
|
|
|
|
if (search) { |
|
|
|
|
|
var province = ""; |
|
|
|
|
|
var city = ""; |
|
|
|
|
|
var activeArr = [this.data.provinceArr, this.data.cityArr[0]]; |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
provinceIndex: 0, |
|
|
|
|
|
cityIndex: 0, |
|
|
|
|
|
index: 0, |
|
|
|
|
|
provinceCityArr: activeArr, |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
if (this.data.provinceCityArr[0][this.data.provinceIndex] == "全部") { |
|
|
this.data.provinceCityArr[0][this.data.provinceIndex] = ""; |
|
|
this.data.provinceCityArr[0][this.data.provinceIndex] = ""; |
|
|
} |
|
|
|
|
|
if (this.data.provinceCityArr[1][this.data.cityIndex] == "全部"){ |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (this.data.provinceCityArr[1][this.data.cityIndex] == "全部") { |
|
|
this.data.provinceCityArr[1][this.data.cityIndex] = ""; |
|
|
this.data.provinceCityArr[1][this.data.cityIndex] = ""; |
|
|
} |
|
|
} |
|
|
province = this.data.provinceCityArr[0][this.data.provinceIndex]; |
|
|
province = this.data.provinceCityArr[0][this.data.provinceIndex]; |
|
|
|
|
|
|
|
|
"shop_province": province, |
|
|
"shop_province": province, |
|
|
"shop_city": city, |
|
|
"shop_city": city, |
|
|
"key": this.data.inputVal, |
|
|
"key": this.data.inputVal, |
|
|
"cur_page":1, |
|
|
|
|
|
"show_num":10, |
|
|
|
|
|
|
|
|
"cur_page": this.data.pageNum, |
|
|
|
|
|
"show_num":this.data.count, |
|
|
} |
|
|
} |
|
|
app.wxRequest(app.globalData.httpUrl + 'shop/search', params, e => { |
|
|
app.wxRequest(app.globalData.httpUrl + 'shop/search', params, e => { |
|
|
console.log(e) |
|
|
console.log(e) |
|
|
if (e.code == 200) { |
|
|
if (e.code == 200) { |
|
|
wx.pageScrollTo({ |
|
|
|
|
|
scrollTop: 0, |
|
|
|
|
|
duration: 300 |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
for (var i = 0; i < e.data.length;i++){ |
|
|
|
|
|
this.data.dataArr.push(e.data[i]); |
|
|
|
|
|
} |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
getDataArr:e.data |
|
|
|
|
|
|
|
|
showDataArr: this.data.dataArr, |
|
|
|
|
|
getDataArr: e.data, |
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log(this.data.showDataArr) |
|
|
} |
|
|
} |
|
|
}, this) |
|
|
}, this) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
onReachBottom: function () { |
|
|
onReachBottom: function () { |
|
|
console.log("到底了") |
|
|
console.log("到底了") |
|
|
|
|
|
if (this.data.getDataArr!=""){ |
|
|
|
|
|
this.data.pageNum++; |
|
|
|
|
|
this.searchShop(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '没有更多数据了', |
|
|
|
|
|
icon:"none", |
|
|
|
|
|
duration:1000 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
searchFn:function(){//点击搜索按钮 |
|
|
searchFn:function(){//点击搜索按钮 |
|
|
this.setData({ |
|
|
|
|
|
index:0 |
|
|
|
|
|
|
|
|
wx.pageScrollTo({ |
|
|
|
|
|
scrollTop: 0, |
|
|
|
|
|
duration: 300 |
|
|
}) |
|
|
}) |
|
|
this.searchShop(); |
|
|
|
|
|
|
|
|
console.log(this.data.provinceIndex) |
|
|
|
|
|
console.log(this.data.cityIndex) |
|
|
|
|
|
console.log(this.data.index) |
|
|
|
|
|
this.data.pageNum = 1; |
|
|
|
|
|
this.data.dataArr = []; |
|
|
|
|
|
this.searchShop(true); |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |