|
|
@@ -214,7 +214,9 @@ export default {
|
|
|
activeArea: { name: '' }, // 选中的区县
|
|
|
activeStreet: { name: '' }, // 选中的乡镇
|
|
|
// 0 1 2 3 当前正在选择 省 市 区 镇
|
|
|
- selectStatus: 0
|
|
|
+ selectStatus: 0,
|
|
|
+
|
|
|
+ regional_code: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -279,6 +281,7 @@ export default {
|
|
|
// 选择省
|
|
|
changeProvinvial(i) {
|
|
|
if (i.name !== this.address.province) {
|
|
|
+ this.regional_code[0] = i.code
|
|
|
this.activeProvinvial = i;
|
|
|
this.activeCity = {};
|
|
|
this.activeArea = {};
|
|
|
@@ -301,6 +304,7 @@ export default {
|
|
|
// 选择市
|
|
|
changeCity(i) {
|
|
|
if (i.name !== this.address.city) {
|
|
|
+ this.regional_code[1] = i.code
|
|
|
this.activeCity = i;
|
|
|
this.activeArea = {};
|
|
|
this.activeStreet = {};
|
|
|
@@ -320,12 +324,14 @@ export default {
|
|
|
// 选择区县
|
|
|
changeArea(i) {
|
|
|
if (i.name !== this.address.area) {
|
|
|
+ this.regional_code[2] = i.code
|
|
|
this.activeArea = i;
|
|
|
this.activeStreet = {};
|
|
|
const newAddress = {
|
|
|
province: this.address.province,
|
|
|
city: this.address.city,
|
|
|
- area: i.name
|
|
|
+ area: i.name,
|
|
|
+ regional_code: this.regional_code.join()
|
|
|
};
|
|
|
if ('street' in this.address) {
|
|
|
newAddress.street = '';
|
|
|
@@ -345,10 +351,12 @@ export default {
|
|
|
// 选择乡镇
|
|
|
changeStreet(i) {
|
|
|
if (i.name !== this.address.street) {
|
|
|
+ this.regional_code[3] = i.code
|
|
|
this.activeStreet = i;
|
|
|
this.$emit('change', {
|
|
|
...this.address,
|
|
|
- street: i.name
|
|
|
+ street: i.name,
|
|
|
+ regional_code: this.regional_code.join()
|
|
|
});
|
|
|
}
|
|
|
this.close();
|
|
|
@@ -357,7 +365,8 @@ export default {
|
|
|
getProvinvial() {
|
|
|
post('user/areaConfig',{type:'provinces'}).then(res=>{
|
|
|
if(res.code == 0){
|
|
|
- let da = JSON.parse(res.data.data)
|
|
|
+ let da = res.data.data
|
|
|
+ // let da = JSON.parse(res.data.data)
|
|
|
this.provinvial = da;
|
|
|
this.setActiveProvinvial();
|
|
|
this.getCity();
|
|
|
@@ -378,7 +387,8 @@ export default {
|
|
|
getCity() {
|
|
|
post('user/areaConfig',{type:'cities'}).then(res=>{
|
|
|
if(res.code == 0){
|
|
|
- let da = JSON.parse(res.data.data)
|
|
|
+ let da = res.data.data
|
|
|
+ // let da = JSON.parse(res.data.data)
|
|
|
this.cityData = da;
|
|
|
this.setActiveCity();
|
|
|
this.getArea();
|
|
|
@@ -409,7 +419,8 @@ export default {
|
|
|
getArea() {
|
|
|
post('user/areaConfig',{type:'areas'}).then(res=>{
|
|
|
if(res.code == 0){
|
|
|
- let da = JSON.parse(res.data.data)
|
|
|
+ let da = res.data.data
|
|
|
+ // let da = JSON.parse(res.data.data)
|
|
|
this.areaData = da;
|
|
|
this.setActiveArea();
|
|
|
if ('street' in this.address) {
|
|
|
@@ -440,7 +451,8 @@ export default {
|
|
|
getStreets() {
|
|
|
post('user/areaConfig',{type:'streets'}).then(res=>{
|
|
|
if(res.code == 0){
|
|
|
- let da = JSON.parse(res.data.data)
|
|
|
+ let da = res.data.data
|
|
|
+ // let da = JSON.parse(res.data.data)
|
|
|
this.streetsData = da;
|
|
|
this.setActiveStreet();
|
|
|
}
|