|
|
|
@ -75,10 +75,10 @@ |
|
|
|
|
<el-input placeholder="请输入联系人姓名" v-model="form.name"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
|
<el-input placeholder="请输入联系人手机号" v-model="form.phone" maxlength="11"></el-input> |
|
|
|
|
<el-input placeholder="请输入联系人手机号" v-model="form.phone" maxlength="11" @blur="phoneChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
|
<el-input placeholder="请输入邮箱" v-model="form.email"></el-input> |
|
|
|
|
<el-input placeholder="请输入邮箱" v-model="form.email" @blur="emailChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-form> |
|
|
|
@ -272,6 +272,7 @@ export default { |
|
|
|
|
showImg:false, |
|
|
|
|
fileSrc:'', |
|
|
|
|
form: { |
|
|
|
|
customerId: "", |
|
|
|
|
customerName: '', |
|
|
|
|
countries: '中国', |
|
|
|
|
industryClassId: '', |
|
|
|
@ -362,7 +363,6 @@ export default { |
|
|
|
|
storeName: '1个月', |
|
|
|
|
total: '2019.01.02 11:00', |
|
|
|
|
payamount: '2019.01.02 11:00', |
|
|
|
|
payamount: '700d12h1min', |
|
|
|
|
swtich: true, |
|
|
|
|
Intranet: '10.20.202.1', |
|
|
|
|
extranet: '10.20.202.1' |
|
|
|
@ -373,12 +373,13 @@ export default { |
|
|
|
|
storeName: '1个月', |
|
|
|
|
total: '2019.01.02 11:00', |
|
|
|
|
payamount: '2019.01.02 11:00', |
|
|
|
|
payamount: '700d12h1min', |
|
|
|
|
swtich: true, |
|
|
|
|
Intranet: '', |
|
|
|
|
extranet: '' |
|
|
|
|
}], |
|
|
|
|
NoAdd: true |
|
|
|
|
NoAdd: true, |
|
|
|
|
phoneRepeat: false, |
|
|
|
|
emailRepeat: false, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
@ -389,6 +390,7 @@ export default { |
|
|
|
|
}).then((res) => { |
|
|
|
|
let customer = res.result.customer |
|
|
|
|
this.form = { |
|
|
|
|
customerId: customer.customerId, |
|
|
|
|
schoolId: customer.schoolId, |
|
|
|
|
countries: customer.countries, |
|
|
|
|
industryClassId: customer.industryClassId, |
|
|
|
@ -494,9 +496,60 @@ export default { |
|
|
|
|
this.$message.success(val ? '启用成功' : '禁用成功') |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
phoneChange() { // 切换手机号 |
|
|
|
|
let regex = /^1[3456789]\d{9}$/; |
|
|
|
|
if (regex.test(this.form.phone)) { |
|
|
|
|
let url = ""; |
|
|
|
|
if (!this.form.customerId) { |
|
|
|
|
url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`; |
|
|
|
|
} else { |
|
|
|
|
url = `${this.api.checkEmailOrPhone}?customerId=${this.form.customerId}&phone=${this.form.phone}&email=`; |
|
|
|
|
} |
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
if (res.status === 200) { |
|
|
|
|
this.phoneRepeat = false; |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning("该手机号已存在") |
|
|
|
|
this.phoneRepeat = true; |
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.phoneRepeat = true; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
async emailChange() { // 切换邮箱 |
|
|
|
|
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; |
|
|
|
|
if (regex.test(this.form.email)) { |
|
|
|
|
let url = ""; |
|
|
|
|
if (!this.form.customerId) { |
|
|
|
|
url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`; |
|
|
|
|
} else { |
|
|
|
|
url = `${this.api.checkEmailOrPhone}?customerId=${this.form.customerId}&email=${this.form.email}&phone=`; |
|
|
|
|
} |
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
if (res.status === 200) { |
|
|
|
|
this.emailRepeat = false; |
|
|
|
|
} else { |
|
|
|
|
this.$message.warning("该邮箱已存在") |
|
|
|
|
this.emailRepeat = true; |
|
|
|
|
} |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.emailRepeat = true; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
saveAdd(formName){ |
|
|
|
|
this.$refs[formName].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
console.log(this.phoneRepeat); |
|
|
|
|
if (this.phoneRepeat) { |
|
|
|
|
this.$message.warning("该手机号已存在"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.emailRepeat) { |
|
|
|
|
this.$message.warning("该邮箱已存在"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if(this.NoAdd){ |
|
|
|
|
let obj = {}; |
|
|
|
|
obj = this.schoolList.find((item)=>{ |
|
|
|
@ -530,24 +583,24 @@ export default { |
|
|
|
|
}).catch((res) => {}) |
|
|
|
|
}else{ |
|
|
|
|
this.$post(this.api.addCustomer,data).then((res) => { |
|
|
|
|
// let customerId = res.customerId |
|
|
|
|
// this.$store.commit('schoolIdData',{schoolId: this.form.schoolId}) |
|
|
|
|
// this.$post(this.api.saveOrUpdate,{ |
|
|
|
|
// clientId: 0, |
|
|
|
|
// id: '', |
|
|
|
|
// roleName: '超级管理员', |
|
|
|
|
// remark: '拥有一切权限', |
|
|
|
|
// isPort: 2 |
|
|
|
|
// }).then(res => { |
|
|
|
|
// let roleId = res.roleId |
|
|
|
|
// let perData = { |
|
|
|
|
// roleId, |
|
|
|
|
// permissionId: ["1408370117262635009","1409351488911056897","1409351867862228993","1408370186435096578","1409352518310699009","1409352550615228418","1409352584240963585","1409352623344459778","1409352647054860289","1409352682471563266","1409352720786530305","1409352742290726913","1408370244584927233","1409352872662278146","1409352903574298626","1409352923509825538","1409352940068937730","1409353018443702273"], |
|
|
|
|
// isPort: 2 |
|
|
|
|
// } |
|
|
|
|
// this.$post(this.api.doAssign,perData).then(res => {}).catch(res => {}) |
|
|
|
|
// this.$post(`${this.api.updateCustomerByRoleId}?customerId=${customerId}&roleId=${roleId}`).then(res => {}).catch(res => {}) |
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
let customerId = res.customerId |
|
|
|
|
this.$store.commit('schoolIdData',{schoolId: this.form.schoolId}) |
|
|
|
|
this.$post(this.api.saveOrUpdate,{ |
|
|
|
|
clientId: 0, |
|
|
|
|
id: '', |
|
|
|
|
roleName: '超级管理员', |
|
|
|
|
remark: '拥有一切权限', |
|
|
|
|
isPort: 2 |
|
|
|
|
}).then(res => { |
|
|
|
|
let roleId = res.roleId |
|
|
|
|
let perData = { |
|
|
|
|
roleId, |
|
|
|
|
permissionId: ["1408370117262635009","1409351488911056897","1409351867862228993","1408370186435096578","1409352518310699009","1409352550615228418","1409352584240963585","1409352623344459778","1409352647054860289","1409352682471563266","1409352720786530305","1409352742290726913","1408370244584927233","1409352872662278146","1409352903574298626","1409352923509825538","1409352940068937730","1409353018443702273"], |
|
|
|
|
isPort: 2 |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.doAssign,perData).then(res => {}).catch(res => {}) |
|
|
|
|
this.$post(`${this.api.updateCustomerByRoleId}?customerId=${customerId}&roleId=${roleId}`).then(res => {}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
|
|
this.$message.success('添加成功') |
|
|
|
|
this.goback() |
|
|
|
|