门店信息地址回显
This commit is contained in:
parent
9ded6affa3
commit
466d1e4d2e
|
|
@ -331,7 +331,47 @@
|
|||
} catch (e) {}
|
||||
},
|
||||
|
||||
// 获取用户信息(原有,未变)
|
||||
// 兼容接口里门店地址字段的不同命名
|
||||
pickFirst(data, fields) {
|
||||
for (const field of fields) {
|
||||
const value = data && data[field];
|
||||
if (value !== undefined && value !== null && String(value).trim() !== '') {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
normalizeStoreInfo(data = {}) {
|
||||
return {
|
||||
head_photo: this.pickFirst(data, ['head_photo', 'shop_head_photo']),
|
||||
name: this.pickFirst(data, ['name', 'shop_name']),
|
||||
dependency: this.pickFirst(data, ['dependency', 'shop_dependency', 'uscc_dependency']),
|
||||
address: this.pickFirst(data, ['address', 'shop_address', 'uscc_address']),
|
||||
dependency_code: this.pickFirst(data, ['dependency_code', 'shop_dependency_code', 'uscc_area']),
|
||||
dependency_province: this.pickFirst(data, ['dependency_province', 'shop_dependency_province', 'uscc_province']),
|
||||
dependency_city: this.pickFirst(data, ['dependency_city', 'shop_dependency_city', 'uscc_city']),
|
||||
longitude: this.pickFirst(data, ['longitude', 'shop_longitude']),
|
||||
latitude: this.pickFirst(data, ['latitude', 'shop_latitude'])
|
||||
};
|
||||
},
|
||||
|
||||
mergeStoreInfoWithOriginal(data = {}) {
|
||||
const storeInfo = this.normalizeStoreInfo(data);
|
||||
return {
|
||||
head_photo: storeInfo.head_photo || this.originalData.head_photo,
|
||||
name: storeInfo.name || this.originalData.name,
|
||||
dependency: storeInfo.dependency || this.originalData.dependency,
|
||||
address: storeInfo.address || this.originalData.address,
|
||||
dependency_code: storeInfo.dependency_code || this.originalData.dependency_code,
|
||||
dependency_province: storeInfo.dependency_province || this.originalData.dependency_province,
|
||||
dependency_city: storeInfo.dependency_city || this.originalData.dependency_city,
|
||||
longitude: storeInfo.longitude || this.originalData.longitude,
|
||||
latitude: storeInfo.latitude || this.originalData.latitude
|
||||
};
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
getUserInfo() {
|
||||
console.log('开始获取用户信息...');
|
||||
const type = 3;
|
||||
|
|
@ -347,23 +387,13 @@
|
|||
|
||||
this.userId = userData.id;
|
||||
|
||||
this.originalData = {
|
||||
head_photo: userData.head_photo || '',
|
||||
name: userData.name || '',
|
||||
dependency: userData.dependency || '',
|
||||
address: userData.address || '',
|
||||
dependency_code: userData.dependency_code || '',
|
||||
dependency_province: userData.dependency_province || '',
|
||||
dependency_city: userData.dependency_city || '',
|
||||
longitude: userData.longitude || '',
|
||||
latitude: userData.latitude || ''
|
||||
};
|
||||
this.originalData = this.normalizeStoreInfo(userData);
|
||||
|
||||
this.dependency_code = userData.dependency_code || '';
|
||||
this.dependency_province = userData.dependency_province || '';
|
||||
this.dependency_city = userData.dependency_city || '';
|
||||
this.longitude = userData.longitude || '';
|
||||
this.latitude = userData.latitude || '';
|
||||
this.dependency_code = this.originalData.dependency_code || '';
|
||||
this.dependency_province = this.originalData.dependency_province || '';
|
||||
this.dependency_city = this.originalData.dependency_city || '';
|
||||
this.longitude = this.originalData.longitude || '';
|
||||
this.latitude = this.originalData.latitude || '';
|
||||
|
||||
this.pendingData = {
|
||||
...this.originalData
|
||||
|
|
@ -444,18 +474,7 @@
|
|||
}
|
||||
|
||||
if (this.auditStatus === 1 || this.auditStatus === 3) {
|
||||
this.pendingData = {
|
||||
head_photo: detail.head_photo || this.originalData.head_photo,
|
||||
name: detail.name || this.originalData.name,
|
||||
dependency: detail.dependency || this.originalData.dependency,
|
||||
address: detail.address || this.originalData.address,
|
||||
dependency_code: detail.dependency_code || this.originalData.dependency_code,
|
||||
dependency_province: detail.dependency_province || this.originalData
|
||||
.dependency_province,
|
||||
dependency_city: detail.dependency_city || this.originalData.dependency_city,
|
||||
longitude: detail.longitude || this.originalData.longitude,
|
||||
latitude: detail.latitude || this.originalData.latitude
|
||||
};
|
||||
this.pendingData = this.mergeStoreInfoWithOriginal(detail);
|
||||
}
|
||||
|
||||
if (this.auditStatus === 2) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue