|
|
@ -60,13 +60,14 @@ |
|
|
|
:label="item.schoolName" |
|
|
|
:label="item.schoolName" |
|
|
|
:value="item.schoolId"></el-option> |
|
|
|
:value="item.schoolId"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
<i v-if="!isDetail" |
|
|
|
<!-- <i v-if="!isDetail" |
|
|
|
class="el-icon-circle-plus-outline plus-cus" |
|
|
|
class="el-icon-circle-plus-outline plus-cus" |
|
|
|
@click="addCustomer"></i> |
|
|
|
@click="addCustomer"></i> --> |
|
|
|
<!-- <el-button style="margin-left: 5px" |
|
|
|
<el-button v-if="!isDetail" |
|
|
|
|
|
|
|
style="margin-left: 5px" |
|
|
|
type="primary" |
|
|
|
type="primary" |
|
|
|
size="mini" |
|
|
|
size="mini" |
|
|
|
@click="addCustomer">设置</el-button> --> |
|
|
|
@click="setCustomer">设置</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="cityId" |
|
|
|
<el-form-item prop="cityId" |
|
|
@ -521,7 +522,7 @@ |
|
|
|
alt=""> |
|
|
|
alt=""> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="创建客户" |
|
|
|
<el-dialog :title="curRow ? '编辑客户' : '创建客户'" |
|
|
|
:visible.sync="customerVisible" |
|
|
|
:visible.sync="customerVisible" |
|
|
|
width="300px" |
|
|
|
width="300px" |
|
|
|
class="dialog" |
|
|
|
class="dialog" |
|
|
@ -533,24 +534,24 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="userName" |
|
|
|
<el-form-item prop="userName" |
|
|
|
label="省份"> |
|
|
|
label="省份"> |
|
|
|
<el-select v-model="customerForm.provinceName" |
|
|
|
<el-select v-model="customerForm.provinceId" |
|
|
|
placeholder="请选择省份" |
|
|
|
placeholder="请选择省份" |
|
|
|
@change="provinceChange"> |
|
|
|
@change="provinceChange"> |
|
|
|
<el-option v-for="(item,index) in provinceList" |
|
|
|
<el-option v-for="(item,index) in provinceList" |
|
|
|
:key="index" |
|
|
|
:key="index" |
|
|
|
:label="item.provinceName" |
|
|
|
:label="item.provinceName" |
|
|
|
:value="item.provinceName"></el-option> |
|
|
|
:value="item.provinceId"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="userName" |
|
|
|
<el-form-item prop="userName" |
|
|
|
label="城市"> |
|
|
|
label="城市"> |
|
|
|
<el-select v-model="customerForm.cityName" |
|
|
|
<el-select v-model="customerForm.cityId" |
|
|
|
placeholder="请选择城市" |
|
|
|
placeholder="请选择城市" |
|
|
|
:disabled="customerForm.provinceName ? false : true"> |
|
|
|
:disabled="customerForm.provinceId ? false : true"> |
|
|
|
<el-option v-for="(item,index) in cities" |
|
|
|
<el-option v-for="(item,index) in cities" |
|
|
|
:key="index" |
|
|
|
:key="index" |
|
|
|
:label="item.cityName" |
|
|
|
:label="item.cityName" |
|
|
|
:value="item.cityName"></el-option> |
|
|
|
:value="item.cityId"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
@ -568,11 +569,14 @@ |
|
|
|
class="dialog" |
|
|
|
class="dialog" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:close-on-click-modal="false" |
|
|
|
custom-class="customer-dia"> |
|
|
|
custom-class="customer-dia"> |
|
|
|
<div style="width: 300px;margin-bottom: 10px"> |
|
|
|
<div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px"> |
|
|
|
<el-input placeholder="请输入客户名称" |
|
|
|
<el-input style="width: 200px;" |
|
|
|
|
|
|
|
placeholder="请输入客户名称" |
|
|
|
prefix-icon="el-icon-search" |
|
|
|
prefix-icon="el-icon-search" |
|
|
|
v-model="customerKeyword" |
|
|
|
v-model="customerKeyword" |
|
|
|
clearable></el-input> |
|
|
|
clearable></el-input> |
|
|
|
|
|
|
|
<i class="el-icon-circle-plus plus-cus" |
|
|
|
|
|
|
|
@click="addCustomer"></i> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-table :data="customers" |
|
|
|
<el-table :data="customers" |
|
|
|
class="table" |
|
|
|
class="table" |
|
|
@ -585,12 +589,15 @@ |
|
|
|
label="序号" |
|
|
|
label="序号" |
|
|
|
align="center"> |
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
{{scope.$index + (page - 1) * pageSize + 1}} |
|
|
|
{{scope.$index + (pageCustomer - 1) * pageSizeCustomer + 1}} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="customerName" |
|
|
|
<el-table-column prop="customerName" |
|
|
|
label="客户名称" |
|
|
|
label="客户名称" |
|
|
|
align="center"> |
|
|
|
align="center"> |
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
{{ scope.row.customerName || scope.row.schoolName }} |
|
|
|
|
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="provinceName" |
|
|
|
<el-table-column prop="provinceName" |
|
|
|
label="省份" |
|
|
|
label="省份" |
|
|
@ -604,7 +611,7 @@ |
|
|
|
label="是否创建" |
|
|
|
label="是否创建" |
|
|
|
align="center"> |
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
是 |
|
|
|
{{ scope.row.bindOrNot ? '是' : '否' }} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" |
|
|
|
<el-table-column label="操作" |
|
|
@ -612,9 +619,10 @@ |
|
|
|
align="center"> |
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<i class="el-icon-edit icon" |
|
|
|
<i class="el-icon-edit icon" |
|
|
|
@click="editCustomer(item)"></i> |
|
|
|
@click="editCustomer(scope.row)"></i> |
|
|
|
<i class="el-icon-delete icon" |
|
|
|
<i v-if="!scope.row.bindOrNot" |
|
|
|
@click="delCustomer(item, i)"></i> |
|
|
|
class="el-icon-delete icon" |
|
|
|
|
|
|
|
@click="delCustomer(scope.row, i)"></i> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-table> |
|
|
@ -627,12 +635,6 @@ |
|
|
|
:page-size="pageSizeCustomer"> |
|
|
|
:page-size="pageSizeCustomer"> |
|
|
|
</el-pagination> |
|
|
|
</el-pagination> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span slot="footer" |
|
|
|
|
|
|
|
class="dialog-footer"> |
|
|
|
|
|
|
|
<el-button @click="customerListVisible = false">取消</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" |
|
|
|
|
|
|
|
@click="submitCustomer">确定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
<pdf :visible.sync="pdfVisible" |
|
|
|
<pdf :visible.sync="pdfVisible" |
|
|
|
:src.sync="fileSrc"></pdf> |
|
|
|
:src.sync="fileSrc"></pdf> |
|
|
@ -860,16 +862,17 @@ export default { |
|
|
|
cities: [], |
|
|
|
cities: [], |
|
|
|
customerForm: { |
|
|
|
customerForm: { |
|
|
|
schoolName: '', |
|
|
|
schoolName: '', |
|
|
|
provinceName: '', |
|
|
|
provinceId: '', |
|
|
|
cityName: '', |
|
|
|
cityId: '', |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
customerListVisible: false, |
|
|
|
customerListVisible: false, |
|
|
|
customers: [{}], |
|
|
|
customers: [], |
|
|
|
pageCustomer: 1, |
|
|
|
pageCustomer: 1, |
|
|
|
pageSizeCustomer: 10, |
|
|
|
pageSizeCustomer: 10, |
|
|
|
totalCustomer: 0, |
|
|
|
totalCustomer: 0, |
|
|
|
customerKeyword: '', |
|
|
|
customerKeyword: '', |
|
|
|
|
|
|
|
curRow: null |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -899,6 +902,12 @@ export default { |
|
|
|
this.getBm() |
|
|
|
this.getBm() |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
customerKeyword: function (val) { |
|
|
|
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
|
|
|
this.initCustomer() |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
mounted () { |
|
|
|
this.getIndustryClass() |
|
|
|
this.getIndustryClass() |
|
|
@ -1051,66 +1060,98 @@ export default { |
|
|
|
this.handlePage() |
|
|
|
this.handlePage() |
|
|
|
this.$router.push(`addcustomer?id=${this.customerId}&type=tab2&page=${val}`) |
|
|
|
this.$router.push(`addcustomer?id=${this.customerId}&type=tab2&page=${val}`) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 创建客户 |
|
|
|
// 设置客户 |
|
|
|
addCustomer () { |
|
|
|
setCustomer () { |
|
|
|
// this.customerListVisible = true |
|
|
|
this.initCustomer() |
|
|
|
this.customerVisible = true |
|
|
|
this.customerListVisible = true |
|
|
|
|
|
|
|
// this.customerVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleCurrentChangeCustomer (val) { |
|
|
|
handleCurrentChangeCustomer (val) { |
|
|
|
this.pageCustomer = val |
|
|
|
this.pageCustomer = val |
|
|
|
// this.getCustomer() |
|
|
|
this.getCustomer() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取客户列表 |
|
|
|
// 获取客户列表 |
|
|
|
getCustomer () { |
|
|
|
getCustomer () { |
|
|
|
this.$get(this.api.queryCity, { |
|
|
|
this.$post(this.api.customerSettingsList, { |
|
|
|
provinceId: this.provinceList.find(e => e.provinceName == name).provinceId |
|
|
|
pageNum: this.pageCustomer, |
|
|
|
}).then(({ list }) => { |
|
|
|
pageSize: this.pageSizeCustomer, |
|
|
|
this.cities = list |
|
|
|
keyword: this.customerKeyword, |
|
|
|
this.customerForm.cityName = '' |
|
|
|
}).then(({ page }) => { |
|
|
|
|
|
|
|
this.customers = page.records |
|
|
|
|
|
|
|
this.totalCustomer = page.total |
|
|
|
}).catch(res => { }); |
|
|
|
}).catch(res => { }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
initCustomer () { |
|
|
|
|
|
|
|
this.pageCustomer = 1 |
|
|
|
|
|
|
|
this.getCustomer() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 创建客户 |
|
|
|
|
|
|
|
addCustomer () { |
|
|
|
|
|
|
|
this.curRow = null |
|
|
|
|
|
|
|
this.customerVisible = true |
|
|
|
|
|
|
|
}, |
|
|
|
// 编辑客户 |
|
|
|
// 编辑客户 |
|
|
|
editCustomer (row) { |
|
|
|
editCustomer (row) { |
|
|
|
|
|
|
|
this.curRow = row |
|
|
|
this.customerVisible = true |
|
|
|
this.customerVisible = true |
|
|
|
// this.customerForm = { |
|
|
|
this.customerForm = { |
|
|
|
// schoolName: '', |
|
|
|
schoolName: row.customerName || row.schoolName, |
|
|
|
// provinceName: '', |
|
|
|
provinceId: row.provinceId, |
|
|
|
// cityName: '', |
|
|
|
cityId: row.cityId, |
|
|
|
// } |
|
|
|
customerId: row.customerId || '', |
|
|
|
|
|
|
|
schoolId: row.schoolId || '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
row.provinceId && this.provinceChange() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除客户 |
|
|
|
// 删除客户 |
|
|
|
delCustomer (row, i) { |
|
|
|
delCustomer (row, i) { |
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
type: 'warning' |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
}).then(async () => { |
|
|
|
|
|
|
|
await this.$post(`${this.api.delClientsOrSchools}?schoolId=${row.schoolId}`).then(res => { |
|
|
|
|
|
|
|
this.$message.success('删除成功') |
|
|
|
|
|
|
|
this.getCustomer() |
|
|
|
|
|
|
|
}) |
|
|
|
}).catch(() => { }) |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取城市 |
|
|
|
// 获取城市 |
|
|
|
provinceChange (name) { |
|
|
|
provinceChange (e) { |
|
|
|
this.$get(this.api.queryCity, { |
|
|
|
this.$get(this.api.queryCity, { |
|
|
|
provinceId: this.provinceList.find(e => e.provinceName == name).provinceId |
|
|
|
provinceId: this.customerForm.provinceId |
|
|
|
}).then(({ list }) => { |
|
|
|
}).then(({ list }) => { |
|
|
|
this.cities = list |
|
|
|
this.cities = list |
|
|
|
this.customerForm.cityName = '' |
|
|
|
if (e) this.customerForm.cityId = '' |
|
|
|
}).catch(res => { }); |
|
|
|
}).catch(res => { }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 客户新增提交 |
|
|
|
// 客户新增提交 |
|
|
|
submitCustomer () { |
|
|
|
async submitCustomer () { |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
const form = this.customerForm |
|
|
|
const form = this.customerForm |
|
|
|
if (!form.schoolName) return this.$message.warning('请输入客户名称') |
|
|
|
if (!form.schoolName) return this.$message.warning('请输入客户名称') |
|
|
|
if (!form.provinceName) return this.$message.warning('请选择省份') |
|
|
|
if (!form.provinceId) return this.$message.warning('请选择省份') |
|
|
|
if (!form.cityName) return this.$message.warning('请选择城市') |
|
|
|
if (!form.cityId) return this.$message.warning('请选择城市') |
|
|
|
this.submiting = true |
|
|
|
this.submiting = true |
|
|
|
this.$get(this.api.addNewCustomersByOneself, form).then(res => { |
|
|
|
|
|
|
|
|
|
|
|
const row = this.curRow |
|
|
|
|
|
|
|
form.customerName = form.schoolName |
|
|
|
|
|
|
|
if (this.curRow) { |
|
|
|
|
|
|
|
if (row.bindOrNot) { |
|
|
|
|
|
|
|
// 编辑客户 |
|
|
|
|
|
|
|
await this.$post(this.api.clientSettingsEditClient, form) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 编辑学校 |
|
|
|
|
|
|
|
await this.$post(this.api.editClientsOrSchools, form) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 新增学校 |
|
|
|
|
|
|
|
await this.$get(this.api.addNewCustomersByOneself, form) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.customerVisible = false |
|
|
|
this.customerVisible = false |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
|
this.$message.success('添加成功') |
|
|
|
this.$message.success('添加成功') |
|
|
|
|
|
|
|
this.getCustomer() |
|
|
|
this.getSchoolData(res.schoolId) |
|
|
|
this.getSchoolData(res.schoolId) |
|
|
|
}).catch((res) => { |
|
|
|
|
|
|
|
this.submiting = false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取产品分类 |
|
|
|
// 获取产品分类 |
|
|
|
getCategory () { |
|
|
|
getCategory () { |
|
|
@ -1509,7 +1550,7 @@ export default { |
|
|
|
.plus-cus { |
|
|
|
.plus-cus { |
|
|
|
margin-left: 10px; |
|
|
|
margin-left: 10px; |
|
|
|
font-size: 18px; |
|
|
|
font-size: 18px; |
|
|
|
color: #666; |
|
|
|
color: #9076ff; |
|
|
|
cursor: pointer; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
} |
|
|
|
/deep/.customer-dia { |
|
|
|
/deep/.customer-dia { |
|
|
|