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