|
|
|
@ -38,7 +38,6 @@ addresslist:{}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
consigneeRegionInput: function (e) {
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
consigneeRegion: e.detail.value
|
|
|
|
|
})
|
|
|
|
@ -95,6 +94,7 @@ addresslist:{}
|
|
|
|
|
addresslist.name=this.data.consigneeName
|
|
|
|
|
addresslist.phone=this.data.phone
|
|
|
|
|
addresslist.address=this.data.consigneeRegion
|
|
|
|
|
console.log(this.data.consigneeRegion)
|
|
|
|
|
addresslist.detailedAddress=this.data.detailedAddress
|
|
|
|
|
addresslist.check=check
|
|
|
|
|
this.setData({
|
|
|
|
@ -171,43 +171,58 @@ addresslist:{}
|
|
|
|
|
var that = this
|
|
|
|
|
var city = that.data.city
|
|
|
|
|
var value = that.data.value
|
|
|
|
|
this.startAddressAnimation(false)
|
|
|
|
|
that.startAddressAnimation(false)
|
|
|
|
|
console.log(value)
|
|
|
|
|
// 将选择的城市信息显示到输入框
|
|
|
|
|
var consigneeRegion = that.data.provinces[value[0]].name + '-' + that.data.citys[value[1]].name + '-' + that.data.areas[value[2]].name
|
|
|
|
|
console.log(consigneeRegion)
|
|
|
|
|
that.setData({
|
|
|
|
|
consigneeRegion: consigneeRegion,
|
|
|
|
|
consigneeRegion: consigneeRegion
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 处理省市县联动逻辑
|
|
|
|
|
cityChange: function (e) {
|
|
|
|
|
var value = e.detail.value
|
|
|
|
|
console.log(value)
|
|
|
|
|
var provinces = this.data.provinces
|
|
|
|
|
var citys = this.data.citys
|
|
|
|
|
var areas = this.data.areas
|
|
|
|
|
var provinceNum = value[0]
|
|
|
|
|
var cityNum = value[1]
|
|
|
|
|
var countyNum = value[2]
|
|
|
|
|
console.log(provinceNum)
|
|
|
|
|
|
|
|
|
|
// 如果省份选择项和之前不一样,表示滑动了省份,此时市默认是省的第一组数据,
|
|
|
|
|
if (this.data.value[0] != provinceNum) {
|
|
|
|
|
var id = provinces[provinceNum].id
|
|
|
|
|
var pid = provinces[provinceNum].id
|
|
|
|
|
console.log(pid)
|
|
|
|
|
console.log(address._citys[pid][0])
|
|
|
|
|
console.log(address._citys[pid][0].id)
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
value: [provinceNum, 0, 0],
|
|
|
|
|
citys: _citys[id],
|
|
|
|
|
areas: _areas[_citys[id][0].id],
|
|
|
|
|
citys: address._citys[pid],
|
|
|
|
|
areas: address._areas[address._citys[pid][0].id],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} else if (this.data.value[1] != cityNum) {
|
|
|
|
|
// 滑动选择了第二项数据,即市,此时区显示省市对应的第一组数据
|
|
|
|
|
var id = citys[cityNum].id
|
|
|
|
|
this.setData({
|
|
|
|
|
value: [provinceNum, cityNum, 0],
|
|
|
|
|
areas: _areas[citys[cityNum].id],
|
|
|
|
|
areas: address.areas[citys[cityNum].id],
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(provinceNum)
|
|
|
|
|
console.log(cityNum)
|
|
|
|
|
console.log(countyNum)
|
|
|
|
|
// 滑动选择了区
|
|
|
|
|
this.setData({
|
|
|
|
|
value: [provinceNum, cityNum, countyNum]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|