Commit e3c7ac11 by zhangxw

bug修复

1 parent 9a96df48
...@@ -157,9 +157,8 @@ export default { ...@@ -157,9 +157,8 @@ export default {
} }
}, },
mounted() { async mounted() {
this.routeInfo = this.$route.query this.routeInfo = this.$route.query
this.routeInfo.editType != 'add' ? this.getInfo() : ''
this.userInfo = this.$globalState.session this.userInfo = this.$globalState.session
this.isWatch = this.routeInfo.editType != 'add' this.isWatch = this.routeInfo.editType != 'add'
if (this.routeInfo.editType == 'edit') { if (this.routeInfo.editType == 'edit') {
...@@ -169,7 +168,8 @@ export default { ...@@ -169,7 +168,8 @@ export default {
let id = this.editFormData.findIndex(item => item.name == 'shopMerchantId') let id = this.editFormData.findIndex(item => item.name == 'shopMerchantId')
this.editFormData.splice(id, 1) this.editFormData.splice(id, 1)
} }
this.getServiceCenterList() await this.getServiceCenterList()
this.routeInfo.editType != 'add' ? await this.getInfo() : ''
this.findProByScene() this.findProByScene()
}, },
...@@ -183,13 +183,16 @@ export default { ...@@ -183,13 +183,16 @@ export default {
this[formName][idx][attrName] = attrValue this[formName][idx][attrName] = attrValue
}) })
}, },
getServiceCenterList() { async getServiceCenterList() {
const params = { return new Promise((resolve, reject) => {
partnerMerchantId: this.userInfo.merchantId const params = {
} partnerMerchantId: this.userInfo.merchantId
this.$apis.customer.getServiceCenterList(params).then(res => { }
this.baseData.merchantList = res this.$apis.customer.getServiceCenterList(params).then(res => {
this.$utils.getOptionsList(this, 'editFormData', false) this.baseData.merchantList = res
this.$utils.getOptionsList(this, 'editFormData', false)
resolve()
})
}) })
}, },
// 切换所属服务中心 // 切换所属服务中心
...@@ -234,50 +237,53 @@ export default { ...@@ -234,50 +237,53 @@ export default {
}) })
}) })
}, },
getInfo() { async getInfo() {
this.editForm = { return new Promise((resolve, reject) => {
...this.$common.utils.deepClone(this.routeInfo.merchantInfo), this.editForm = {
merchantName: this.routeInfo.merchantInfo.shopMerchantName || '', ...this.$common.utils.deepClone(this.routeInfo.merchantInfo),
oldPhone: this.routeInfo.merchantInfo?.phone, merchantName: this.routeInfo.merchantInfo.shopMerchantName || '',
oldMerchantName: this.routeInfo.merchantInfo.shopMerchantName || '' oldPhone: this.routeInfo.merchantInfo?.phone,
} oldMerchantName: this.routeInfo.merchantInfo.shopMerchantName || ''
this.loading = true }
this.$apis.customer this.loading = true
.getMerchantInfo({ merchantId: this.routeInfo.merchantInfo.shopMerchantId }) this.$apis.customer
.then(res => { .getMerchantInfo({ merchantId: this.routeInfo.merchantInfo.shopMerchantId })
this.editForm.provinceCode = res.provinceCode .then(res => {
this.editForm.provinceName = res.provinceName this.editForm.provinceCode = res.provinceCode
this.editForm.cityCode = res.cityCode this.editForm.provinceName = res.provinceName
this.editForm.cityName = res.cityName this.editForm.cityCode = res.cityCode
this.editForm.latitude = res.lat this.editForm.cityName = res.cityName
this.editForm.longitude = res.lng this.editForm.latitude = res.lat
this.editForm.merchantAddress = res.merchantAddress this.editForm.longitude = res.lng
this.editForm.staffUuid = res.residentManager?.userId this.editForm.merchantAddress = res.merchantAddress
const merchantBrandList = res.brandTreeList || [] this.editForm.staffUuid = res.residentManager?.userId
this.editForm.merchantBrandList = [] const merchantBrandList = res.brandTreeList || []
this.editForm.merchantBrandIds = '' this.editForm.merchantBrandList = []
merchantBrandList.forEach(item => { this.editForm.merchantBrandIds = ''
this.editForm.merchantBrandList.push({ merchantBrandList.forEach(item => {
merchantFirstBrandDetail: { this.editForm.merchantBrandList.push({
id: item.id, merchantFirstBrandDetail: {
name: item.name id: item.id,
}, name: item.name
merchantSecondBrandDetailList: item.subList },
merchantSecondBrandDetailList: item.subList
})
this.editForm.merchantBrandIds = this.editForm.merchantBrandIds + (this.editForm.merchantBrandIds ? ',' : '') + item.subList.map(k => k.id).join(',')
}) })
this.editForm.merchantBrandIds = this.editForm.merchantBrandIds + (this.editForm.merchantBrandIds ? ',' : '') + item.subList.map(k => k.id).join(',') this.editForm.merchantBrandIds = this.editForm.merchantBrandIds.split(',')
this.$refs.editFormRef.brandList()
this.$refs.provinceForm && this.$refs.provinceForm.init(this.editForm)
// 有所属服务中心获取所有员工
if (res?.merchantNo) this.getAllStaffList(res?.merchantNo)
this.$nextTick(() => {
this.editStatus = false
})
resolve()
}) })
this.editForm.merchantBrandIds = this.editForm.merchantBrandIds.split(',') .finally(() => {
this.$refs.editFormRef.brandList() this.loading = false
this.$refs.provinceForm && this.$refs.provinceForm.init(this.editForm)
// 有所属服务中心获取所有员工
if (res?.merchantNo) this.getAllStaffList(res?.merchantNo)
this.$nextTick(() => {
this.editStatus = false
}) })
}) })
.finally(() => {
this.loading = false
})
}, },
hasDuplicate(arr1, arr2) { hasDuplicate(arr1, arr2) {
const set1 = new Set(arr1) const set1 = new Set(arr1)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!