门店信息地址回显
This commit is contained in:
parent
9ded6affa3
commit
466d1e4d2e
|
|
@ -331,8 +331,48 @@
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取用户信息(原有,未变)
|
// 兼容接口里门店地址字段的不同命名
|
||||||
getUserInfo() {
|
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('开始获取用户信息...');
|
console.log('开始获取用户信息...');
|
||||||
const type = 3;
|
const type = 3;
|
||||||
|
|
||||||
|
|
@ -347,23 +387,13 @@
|
||||||
|
|
||||||
this.userId = userData.id;
|
this.userId = userData.id;
|
||||||
|
|
||||||
this.originalData = {
|
this.originalData = this.normalizeStoreInfo(userData);
|
||||||
head_photo: userData.head_photo || '',
|
|
||||||
name: userData.name || '',
|
this.dependency_code = this.originalData.dependency_code || '';
|
||||||
dependency: userData.dependency || '',
|
this.dependency_province = this.originalData.dependency_province || '';
|
||||||
address: userData.address || '',
|
this.dependency_city = this.originalData.dependency_city || '';
|
||||||
dependency_code: userData.dependency_code || '',
|
this.longitude = this.originalData.longitude || '';
|
||||||
dependency_province: userData.dependency_province || '',
|
this.latitude = this.originalData.latitude || '';
|
||||||
dependency_city: userData.dependency_city || '',
|
|
||||||
longitude: userData.longitude || '',
|
|
||||||
latitude: userData.latitude || ''
|
|
||||||
};
|
|
||||||
|
|
||||||
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.pendingData = {
|
this.pendingData = {
|
||||||
...this.originalData
|
...this.originalData
|
||||||
|
|
@ -444,18 +474,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.auditStatus === 1 || this.auditStatus === 3) {
|
if (this.auditStatus === 1 || this.auditStatus === 3) {
|
||||||
this.pendingData = {
|
this.pendingData = this.mergeStoreInfoWithOriginal(detail);
|
||||||
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
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.auditStatus === 2) {
|
if (this.auditStatus === 2) {
|
||||||
|
|
@ -1679,4 +1698,4 @@
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue