|
|
@@ -50,6 +50,7 @@ Page({ |
|
|
|
// 隐藏返回图标 |
|
|
|
wx.hideHomeButton(); |
|
|
|
let positionParams = wx.getStorageSync('positionParams') |
|
|
|
console.log(positionParams); |
|
|
|
let options = this.data.provinceOptions |
|
|
|
if(options.length === 0) { |
|
|
|
let provinceOptions = wx.getStorageSync('provinceOptions') |
|
|
@@ -88,10 +89,6 @@ Page({ |
|
|
|
districtCurrent: positionParams.districtCurrent, |
|
|
|
districtOptions: positionParams.districtOptions |
|
|
|
}) |
|
|
|
wx.setStorage({ |
|
|
|
key: 'positionParams', |
|
|
|
data: positionParams |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.getUserLocation() |
|
|
|
} |
|
|
@@ -170,7 +167,7 @@ Page({ |
|
|
|
*/ |
|
|
|
getListByName(obj) { |
|
|
|
let provinceOptions = this.data.provinceOptions |
|
|
|
let provinceCurrent, cityCurrent, districtCurrent, cityOptions, districtOptions |
|
|
|
let provinceCurrent,provinceName, cityCurrent, cityName,districtCurrent,districtName, cityOptions, districtOptions |
|
|
|
let params = this.data.params |
|
|
|
params.provinceCode = obj.provinceCode |
|
|
|
params.cityCode = obj.cityCode |
|
|
@@ -179,16 +176,19 @@ Page({ |
|
|
|
provinceOptions.forEach((item,index)=> { |
|
|
|
if(item.citycode === obj.provinceCode) { |
|
|
|
provinceCurrent = index |
|
|
|
provinceName = item.name |
|
|
|
cityOptions = item?.itemList || [] |
|
|
|
if(cityOptions.length) { |
|
|
|
cityOptions.forEach((i, j)=> { |
|
|
|
if(i.citycode === obj.cityCode) { |
|
|
|
cityCurrent = j |
|
|
|
cityName = i.name |
|
|
|
districtOptions = i?.itemList || [] |
|
|
|
if (districtOptions.length) { |
|
|
|
districtOptions.forEach((m, n) => { |
|
|
|
if(m.citycode === obj.districtCode) { |
|
|
|
districtCurrent = n |
|
|
|
districtName = m.name |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
@@ -198,7 +198,7 @@ Page({ |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
this.setData({provinceCurrent, cityCurrent, districtCurrent, cityOptions, districtOptions, params}) |
|
|
|
this.setData({provinceCurrent, provinceName, cityCurrent,cityName, districtCurrent,districtName, cityOptions, districtOptions, params}) |
|
|
|
}, |
|
|
|
|
|
|
|
/* 获取省市区 */ |
|
|
@@ -229,9 +229,11 @@ Page({ |
|
|
|
let params = this.data.params |
|
|
|
let code = this.data[type+'Options'][current].citycode |
|
|
|
params[type+'Code'] = code |
|
|
|
let name = this.data[type+'Options'][current].name |
|
|
|
let itemList = this.data[type+'Options'][current].itemList || [] |
|
|
|
if(type === 'province') { |
|
|
|
this.setData({ |
|
|
|
provinceName: name, |
|
|
|
provinceCurrent: current, |
|
|
|
cityOptions: itemList, |
|
|
|
cityCurrent: -1, |
|
|
@@ -241,13 +243,17 @@ Page({ |
|
|
|
params.districtCode = "" |
|
|
|
} else if(type === 'city') { |
|
|
|
this.setData({ |
|
|
|
cityName: name, |
|
|
|
districtOptions: itemList, |
|
|
|
cityCurrent: current, |
|
|
|
districtCurrent: -1 |
|
|
|
}) |
|
|
|
params.districtCode = "" |
|
|
|
} else if(type === 'district') { |
|
|
|
this.setData({districtCurrent: current}) |
|
|
|
this.setData({ |
|
|
|
districtCurrent: current, |
|
|
|
districtName: name |
|
|
|
}) |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
params: params |
|
|
@@ -285,10 +291,29 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 存储省市区信息 |
|
|
|
setAreaInfo() { |
|
|
|
let positionParams = {} |
|
|
|
positionParams.provinceCurrent = this.data.provinceCurrent |
|
|
|
positionParams.provinceName = this.data.provinceName |
|
|
|
positionParams.cityCurrent = this.data.cityCurrent |
|
|
|
positionParams.cityName = this.data.cityName |
|
|
|
positionParams.districtCurrent = this.data.districtCurrent |
|
|
|
positionParams.districtName = this.data.districtName |
|
|
|
positionParams.cityOptions = this.data.cityOptions |
|
|
|
positionParams.districtOptions = this.data.districtOptions |
|
|
|
positionParams.areaName = this.data.districtName || this.data.cityName || this.data.provinceName || '' |
|
|
|
positionParams = { |
|
|
|
...positionParams, |
|
|
|
...this.data.params |
|
|
|
} |
|
|
|
wx.setStorageSync('positionParams', positionParams) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 进入首页 |
|
|
|
*/ |
|
|
|
goHome() { |
|
|
|
this.setAreaInfo() |
|
|
|
this.validateForm().then(res => { |
|
|
|
if(res) { |
|
|
|
enterMini({openid: this.data.openid, unionid: this.data.unionid, tenantId: this.data.tenantId}).then(item=> { |