|
|
@ -1,4 +1,4 @@ |
|
|
|
const app = getApp<IAppOption>() |
|
|
|
const app = getApp<IAppOption>(); |
|
|
|
|
|
|
|
|
|
|
|
Component({ |
|
|
|
Component({ |
|
|
|
properties: { |
|
|
|
properties: { |
|
|
@ -25,7 +25,7 @@ Component({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
observers: { |
|
|
|
observers: { |
|
|
|
show(newVal: boolean) { |
|
|
|
show(newVal: boolean) { |
|
|
|
this.triggerEvent('show', newVal) |
|
|
|
this.triggerEvent('show', newVal); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data: { |
|
|
|
data: { |
|
|
@ -224,8 +224,8 @@ Component({ |
|
|
|
|
|
|
|
|
|
|
|
scrollIntoView0: this.data.pid || '', |
|
|
|
scrollIntoView0: this.data.pid || '', |
|
|
|
scrollIntoView1: this.data.cid || '', |
|
|
|
scrollIntoView1: this.data.cid || '', |
|
|
|
}) |
|
|
|
}); |
|
|
|
this.getArea() |
|
|
|
this.getArea(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
getArea() { |
|
|
|
getArea() { |
|
|
|
wx.ajax({ |
|
|
|
wx.ajax({ |
|
|
@ -235,78 +235,78 @@ Component({ |
|
|
|
}).then((res) => { |
|
|
|
}).then((res) => { |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
area: res, |
|
|
|
area: res, |
|
|
|
}) |
|
|
|
}); |
|
|
|
this.getRangeList() |
|
|
|
this.getRangeList(); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleItem(e: any) { |
|
|
|
handleItem(e: any) { |
|
|
|
const { code, name } = e.currentTarget.dataset |
|
|
|
const { code, name } = e.currentTarget.dataset; |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
ProvinceId: code, |
|
|
|
ProvinceId: code, |
|
|
|
ProvinceName: name, |
|
|
|
ProvinceName: name, |
|
|
|
CityId: '', |
|
|
|
CityId: '', |
|
|
|
CityName: '', |
|
|
|
CityName: '', |
|
|
|
}) |
|
|
|
}); |
|
|
|
this.getRangeList() |
|
|
|
this.getRangeList(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleChangeCity(e: any) { |
|
|
|
handleChangeCity(e: any) { |
|
|
|
const { code, name } = e.currentTarget.dataset |
|
|
|
const { code, name } = e.currentTarget.dataset; |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
CityId: code, |
|
|
|
CityId: code, |
|
|
|
CityName: name, |
|
|
|
CityName: name, |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleShare() { |
|
|
|
handleShare() { |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
show: false, |
|
|
|
show: false, |
|
|
|
}) |
|
|
|
}); |
|
|
|
this.triggerEvent('ok', { |
|
|
|
this.triggerEvent('ok', { |
|
|
|
ProvinceName: this.data.ProvinceName, |
|
|
|
ProvinceName: this.data.ProvinceName, |
|
|
|
ProvinceId: this.data.ProvinceId, |
|
|
|
ProvinceId: this.data.ProvinceId, |
|
|
|
CityName: this.data.CityName, |
|
|
|
CityName: this.data.CityName, |
|
|
|
CityId: this.data.CityId, |
|
|
|
CityId: this.data.CityId, |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleSelect(e) { |
|
|
|
handleSelect(e) { |
|
|
|
const { id } = e.currentTarget.dataset |
|
|
|
const { id } = e.currentTarget.dataset; |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
word: id, |
|
|
|
word: id, |
|
|
|
scrollIntoView0: id, |
|
|
|
scrollIntoView0: id, |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
getRangeList() { |
|
|
|
getRangeList() { |
|
|
|
const { area, ProvinceId } = this.data |
|
|
|
const { area, ProvinceId } = this.data; |
|
|
|
if (!ProvinceId) return |
|
|
|
if (!ProvinceId) return; |
|
|
|
const range = area.filter((item: any) => item.value == ProvinceId)[0].children |
|
|
|
const range = area.filter((item: any) => item.value == ProvinceId)[0].children; |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
range, |
|
|
|
range, |
|
|
|
active: 1, |
|
|
|
active: 1, |
|
|
|
scrollIntoView0: '', |
|
|
|
scrollIntoView0: '', |
|
|
|
scrollIntoView1: `id${this.data.CityId}`, |
|
|
|
scrollIntoView1: `id${this.data.CityId}`, |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleProvince() { |
|
|
|
handleProvince() { |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
active: 0, |
|
|
|
active: 0, |
|
|
|
scrollIntoView0: this.data.word || `id${this.data.ProvinceId}`, |
|
|
|
scrollIntoView0: this.data.word || `id${this.data.ProvinceId}`, |
|
|
|
scrollIntoView1: '', |
|
|
|
scrollIntoView1: '', |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleCity() { |
|
|
|
handleCity() { |
|
|
|
const { ProvinceId } = this.data |
|
|
|
const { ProvinceId } = this.data; |
|
|
|
if (!ProvinceId) { |
|
|
|
if (!ProvinceId) { |
|
|
|
wx.showToast({ |
|
|
|
wx.showToast({ |
|
|
|
title: '请先选择省份', |
|
|
|
title: '请先选择省份', |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
}) |
|
|
|
}); |
|
|
|
return |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.getRangeList() |
|
|
|
this.getRangeList(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleClose() { |
|
|
|
handleClose() { |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
show: false, |
|
|
|
show: false, |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}); |
|
|
|