parent
b10f8d3181
commit
d1162d8552
|
@ -167,19 +167,25 @@
|
||||||
}
|
}
|
||||||
state.model = data;
|
state.model = data;
|
||||||
}
|
}
|
||||||
// 情况二:微信导入 TODO 芋艿:待接入
|
// 情况二:微信导入
|
||||||
if (options.data) {
|
if (options.data) {
|
||||||
let data = JSON.parse(options.data);
|
let data = JSON.parse(options.data);
|
||||||
const areaData = uni.getStorageSync('areaData');
|
const areaData = uni.getStorageSync('areaData');
|
||||||
let provinceArr = areaData.filter(item => item.name == data.province_name);
|
const findAreaByName = (areas, name) => areas.find(item => item.name === name);
|
||||||
data.province_id = provinceArr[0].id;
|
|
||||||
let provinceArr2 = provinceArr[0].children.filter(item => item.name == data.city_name);
|
let provinceObj = findAreaByName(areaData, data.province_name);
|
||||||
data.city_id = provinceArr2[0].id;
|
let cityObj = provinceObj ? findAreaByName(provinceObj.children, data.city_name) : undefined;
|
||||||
let provinceArr3 = provinceArr2[0].children.filter(item => item.name == data.district_name);
|
let districtObj = cityObj ? findAreaByName(cityObj.children, data.district_name) : undefined;
|
||||||
data.district_id = provinceArr3[0].id;
|
let areaId = (districtObj || cityObj || provinceObj).id;
|
||||||
|
|
||||||
state.model = {
|
state.model = {
|
||||||
...state.model,
|
...state.model,
|
||||||
...data,
|
areaId,
|
||||||
|
areaName: [data.province_name, data.city_name, data.district_name].filter(Boolean).join(" "),
|
||||||
|
defaultStatus: false,
|
||||||
|
detailAddress: data.address,
|
||||||
|
mobile: data.mobile,
|
||||||
|
name: data.consignee,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue