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