|
|
|
@ -522,7 +522,7 @@ |
|
|
|
|
alt=""> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog :title="curRow ? '编辑客户' : '创建客户'" |
|
|
|
|
<el-dialog :title="curRow ? '编辑客户' : '添加客户'" |
|
|
|
|
:visible.sync="customerVisible" |
|
|
|
|
width="300px" |
|
|
|
|
class="dialog" |
|
|
|
@ -942,10 +942,10 @@ export default { |
|
|
|
|
this.dataPermissionss = res.result.dataPermissionss |
|
|
|
|
this.getCityData() |
|
|
|
|
this.changIndustryData() |
|
|
|
|
this.getSchoolData() |
|
|
|
|
this.getSchool() |
|
|
|
|
}).catch((res) => { }) |
|
|
|
|
} else { |
|
|
|
|
this.getSchoolData() |
|
|
|
|
this.getSchool() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
@ -1064,7 +1064,6 @@ export default { |
|
|
|
|
setCustomer () { |
|
|
|
|
this.initCustomer() |
|
|
|
|
this.customerListVisible = true |
|
|
|
|
// this.customerVisible = true |
|
|
|
|
}, |
|
|
|
|
handleCurrentChangeCustomer (val) { |
|
|
|
|
this.pageCustomer = val |
|
|
|
@ -1088,6 +1087,13 @@ export default { |
|
|
|
|
// 创建客户 |
|
|
|
|
addCustomer () { |
|
|
|
|
this.curRow = null |
|
|
|
|
this.customerForm = { |
|
|
|
|
schoolName: '', |
|
|
|
|
provinceId: '', |
|
|
|
|
cityId: '', |
|
|
|
|
customerId: '', |
|
|
|
|
schoolId: '', |
|
|
|
|
} |
|
|
|
|
this.customerVisible = true |
|
|
|
|
}, |
|
|
|
|
// 编辑客户 |
|
|
|
@ -1110,6 +1116,7 @@ export default { |
|
|
|
|
}).then(async () => { |
|
|
|
|
await this.$post(`${this.api.delClientsOrSchools}?schoolId=${row.schoolId}`).then(res => { |
|
|
|
|
this.$message.success('删除成功') |
|
|
|
|
this.getSchool(row.schoolId) |
|
|
|
|
this.getCustomer() |
|
|
|
|
}) |
|
|
|
|
}).catch(() => { }) |
|
|
|
@ -1134,24 +1141,28 @@ export default { |
|
|
|
|
|
|
|
|
|
const row = this.curRow |
|
|
|
|
form.customerName = form.schoolName |
|
|
|
|
let res |
|
|
|
|
try { |
|
|
|
|
if (this.curRow) { |
|
|
|
|
if (row.bindOrNot) { |
|
|
|
|
// 编辑客户 |
|
|
|
|
await this.$post(this.api.clientSettingsEditClient, form) |
|
|
|
|
res = await this.$post(this.api.clientSettingsEditClient, form) |
|
|
|
|
} else { |
|
|
|
|
// 编辑学校 |
|
|
|
|
await this.$post(this.api.editClientsOrSchools, form) |
|
|
|
|
res = await this.$post(this.api.editClientsOrSchools, form) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 新增学校 |
|
|
|
|
await this.$get(this.api.addNewCustomersByOneself, form) |
|
|
|
|
res = await this.$get(this.api.addNewCustomersByOneself, form) |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
this.submiting = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.customerVisible = false |
|
|
|
|
this.submiting = false |
|
|
|
|
this.$message.success('添加成功') |
|
|
|
|
this.getCustomer() |
|
|
|
|
this.getSchoolData(res.schoolId) |
|
|
|
|
this.getSchool(res.schoolId || '') |
|
|
|
|
}, |
|
|
|
|
// 获取产品分类 |
|
|
|
|
getCategory () { |
|
|
|
@ -1289,12 +1300,7 @@ export default { |
|
|
|
|
this.form.customerName = '' |
|
|
|
|
}, |
|
|
|
|
// 获取学校/客户名称 |
|
|
|
|
getSchoolData (schoolId) { |
|
|
|
|
let data = { |
|
|
|
|
schoolName: '', |
|
|
|
|
provinceId: '', |
|
|
|
|
cityId: '' |
|
|
|
|
} |
|
|
|
|
getSchool (schoolId) { |
|
|
|
|
this.$get(this.api.querySchoolData).then(({ list }) => { |
|
|
|
|
this.schoolList = list |
|
|
|
|
// 有传schoolId,则需要找到这个学校然后赋值表单 |
|
|
|
@ -1305,6 +1311,8 @@ export default { |
|
|
|
|
this.form.provinceId = item.provinceId |
|
|
|
|
this.getCityData() |
|
|
|
|
this.form.cityId = item.cityId |
|
|
|
|
} else { |
|
|
|
|
this.form.schoolId = '' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }); |
|
|
|
@ -1451,12 +1459,13 @@ export default { |
|
|
|
|
}, 1500) |
|
|
|
|
this.$store.commit('schoolIdData', { schoolId: this.form.schoolId }) |
|
|
|
|
this.$message.success('添加成功') |
|
|
|
|
tab ? this.tabChange(tab, 1) : this.router.push('list') |
|
|
|
|
tab ? this.tabChange(tab, 1) : this.$router.push('/customer') |
|
|
|
|
}).catch((res) => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.submiting = false |
|
|
|
|
this.$message.warning('该客户已存在') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|