Commit fd91a1a7 by cwq0219

预录客户

1 parent 59aa3320
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
:model="form" :model="form"
:rules="formRules" :rules="formRules"
label-width="110px" label-width="110px"
v-loading="$store.state.d2admin.loading.value"
> >
<p class="title">关联信息来源</p> <p class="title">关联信息来源</p>
<el-form-item label="门店名称" prop="storeId"> <el-form-item id="storeId" label="门店名称" prop="storeId">
<el-select <el-select
v-model="form.storeId" v-model="form.storeId"
placeholder="请选择" placeholder="请选择"
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="销售顾问" required> <el-form-item id="adviser" label="销售顾问" required>
<el-radio v-for="item in adviserList" :key="item.userId" v-model="form.employee" :label="item" >{{item.name}}</el-radio> <el-radio v-for="item in adviserList" :key="item.userId" v-model="form.employee" :label="item" >{{item.name}}</el-radio>
<p class="warningFont" v-if="showChooseCusError">未选择销售顾问</p> <p class="warningFont" v-if="showChooseCusError">未选择销售顾问</p>
</el-form-item> </el-form-item>
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
<div class="line_box"> <div class="line_box">
<div class="left"> <div class="left">
<div class="left"> <div class="left">
<el-form-item label="客户姓名" prop="cusName"> <el-form-item id="cusName" label="客户姓名" prop="cusName">
<el-input <el-input
v-model="form.cusName" v-model="form.cusName"
maxlength="10" maxlength="10"
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
<div class="line_box"> <div class="line_box">
<div class="left"> <div class="left">
<div class="left"> <div class="left">
<el-form-item label="手机号码" prop="mobile"> <el-form-item id="mobile" label="手机号码" prop="mobile">
<el-input <el-input
v-model="form.mobile" v-model="form.mobile"
maxlength="11" maxlength="11"
...@@ -156,6 +157,7 @@ ...@@ -156,6 +157,7 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="车架号" label="车架号"
id="contacts"
prop="contacts" prop="contacts"
> >
<el-input <el-input
...@@ -179,7 +181,7 @@ ...@@ -179,7 +181,7 @@
</el-form-item> </el-form-item>
<p class="title">装饰内容</p> <p class="title">装饰内容</p>
<el-form-item label="基础商品" required> <el-form-item id="goods" label="基础商品" required>
<!-- <el-select <!-- <el-select
v-model="searchForm.goodsType" v-model="searchForm.goodsType"
placeholder="请选择产品分类" placeholder="请选择产品分类"
...@@ -189,8 +191,16 @@ ...@@ -189,8 +191,16 @@
</el-select>&nbsp; </el-select>&nbsp;
<el-button type="primary" @click="searchGoods">搜索</el-button>&nbsp;&nbsp; --> <el-button type="primary" @click="searchGoods">搜索</el-button>&nbsp;&nbsp; -->
<span class="warningFont" v-if="showChoosePrError">未选择商品</span> <span class="warningFont" v-if="showChoosePrError">未选择商品</span>
<div>
<el-checkbox-group v-model="selectList">
<div class="base-pro-block" v-for="(item, index) in goodList" :key="index">
<img :src="item.goodsInfo.thumbUrl"/>
<el-checkbox :label="item.id">{{item.goodsInfo.goodsName}}</el-checkbox>
</div>
</el-checkbox-group>
</div>
</el-form-item> </el-form-item>
<div class="table_box"> <!-- <div class="table_box">
<el-table v-loading="tableLoading" :data="goodList" @selection-change="selectChange" stripe style="width: 50%" border> <el-table v-loading="tableLoading" :data="goodList" @selection-change="selectChange" stripe style="width: 50%" border>
<el-table-column type="selection" width="50" fixed="left" align="center" /> <el-table-column type="selection" width="50" fixed="left" align="center" />
<el-table-column align="center" label="商品缩略图"> <el-table-column align="center" label="商品缩略图">
...@@ -201,7 +211,7 @@ ...@@ -201,7 +211,7 @@
<el-table-column prop="goodsInfo.goodsName" label="商品名称" width="150" /> <el-table-column prop="goodsInfo.goodsName" label="商品名称" width="150" />
<el-table-column prop="goodsInfo.goodsTypeName" label="商品类型" width="150" /> <el-table-column prop="goodsInfo.goodsTypeName" label="商品类型" width="150" />
</el-table> </el-table>
</div> </div> -->
<el-form-item label="客户备注"> <el-form-item label="客户备注">
<el-input <el-input
v-model="form.remark" v-model="form.remark"
...@@ -215,6 +225,7 @@ ...@@ -215,6 +225,7 @@
<el-button <el-button
type="primary" type="primary"
@click="saveInfo" @click="saveInfo"
:disabled="$store.state.d2admin.loading.value"
>确认</el-button> >确认</el-button>
<el-button @click="cancel">取消</el-button> <el-button @click="cancel">取消</el-button>
</div> </div>
...@@ -232,16 +243,16 @@ export default { ...@@ -232,16 +243,16 @@ export default {
data() { data() {
function checkPhone(rule, value, callback) { function checkPhone(rule, value, callback) {
if (!Util.checkPhone(value)) { if (!Util.checkPhone(value)) {
callback(new Error("请输入正确的手机号码")); callback(new Error('请输入正确的手机号码'))
return false; return false
} }
callback(); callback()
} }
return { return {
key: new Date(), key: new Date(),
form: {}, form: {},
searchForm: { searchForm: {
goodsType: '', goodsType: ''
}, },
storeIdList: [ storeIdList: [
// { // {
...@@ -306,7 +317,7 @@ export default { ...@@ -306,7 +317,7 @@ export default {
required: true, required: true,
message: '请输入车架号', message: '请输入车架号',
trigger: 'blur' trigger: 'blur'
}], }]
// cusType: [{ // cusType: [{
// required: true, // required: true,
// message: '请选择客户类型', // message: '请选择客户类型',
...@@ -337,7 +348,7 @@ export default { ...@@ -337,7 +348,7 @@ export default {
// message: '请选择车型', // message: '请选择车型',
// trigger: 'change' // trigger: 'change'
// }], // }],
}, }
} }
}, },
...@@ -361,35 +372,37 @@ export default { ...@@ -361,35 +372,37 @@ export default {
* 获取服务门店 * 获取服务门店
*/ */
getServiceStore() { getServiceStore() {
let params = {} const params = {}
getServiceStore(params).then(res => { getServiceStore(params).then(res => {
this.storeIdList = res || [] this.storeIdList = res || []
}); })
}, },
/** /**
* 根据门店商户号获取员工列表 * 根据门店商户号获取员工列表
*/ */
getAdviser(merchantId) { getAdviser(merchantId) {
let list = this.storeIdList; const list = this.storeIdList
let o = list.find(k => k.merchantId == merchantId); const o = list.find(k => k.merchantId == merchantId)
let channelType = o.channelType; const channelType = o.channelType
/**根据门店商户号获取员工列表 */ /** 根据门店商户号获取员工列表 */
let params = { 'merchantId': merchantId, 'channelType': channelType } const params = { 'merchantId': merchantId, 'channelType': channelType }
getStaff(params).then(res => { getStaff(params).then(res => {
this.adviserList = res || [] this.adviserList = res || []
}); this.selectList = []
})
/**根据门店商户号获取基础商品列表 */ /** 根据门店商户号获取基础商品列表 */
let paramsForGood = {'merchantId': merchantId} const paramsForGood = { 'merchantId': merchantId }
getGoods(paramsForGood).then(res => { getGoods(paramsForGood).then(res => {
// console.log(res)
this.goodList = res || [] this.goodList = res || []
// if(this.goodList.length > 0){ // if(this.goodList.length > 0){
// this.TB_height = 300 // this.TB_height = 300
// }else{ // }else{
// this.TB_height = 90 // this.TB_height = 90
// } // }
}); })
}, },
// getFictitiousPhone(mobile) { // getFictitiousPhone(mobile) {
...@@ -414,21 +427,21 @@ export default { ...@@ -414,21 +427,21 @@ export default {
// } // }
// }, // },
//获取品牌车型 // 获取品牌车型
getAllVehicleBrand() { getAllVehicleBrand() {
let params = {} const params = {}
getCarInfo(params).then(res => { getCarInfo(params).then(res => {
this.carBrandOptions = res || []; this.carBrandOptions = res || []
this.carInfoList = util.deepClone(this.carBrandOptions) this.carInfoList = util.deepClone(this.carBrandOptions)
var hash = {}; var hash = {}
this.carBrandOptions = this.carBrandOptions.reduce(function (item, next) { this.carBrandOptions = this.carBrandOptions.reduce(function(item, next) {
hash[next.carBrandId] ? '' : hash[next.carBrandId] = true && item.push(next); hash[next.carBrandId] ? '' : hash[next.carBrandId] = true && item.push(next)
return item; return item
}, []); }, [])
}); })
}, },
//获取车辆子品牌 // 获取车辆子品牌
changeCarBrand(id) { changeCarBrand(id) {
this.carSmallBrandOptions = [] this.carSmallBrandOptions = []
// this.form.carSmallBrand = '' // this.form.carSmallBrand = ''
...@@ -439,80 +452,80 @@ export default { ...@@ -439,80 +452,80 @@ export default {
this.$set(this.form, 'carType', '') this.$set(this.form, 'carType', '')
for (var i = 0; i < this.carInfoList.length; i++) { for (var i = 0; i < this.carInfoList.length; i++) {
if (this.carInfoList[i].carBrandId == id) { if (this.carInfoList[i].carBrandId == id) {
this.carSmallBrandOptions.push(this.carInfoList[i]); this.carSmallBrandOptions.push(this.carInfoList[i])
} }
} }
var hash = {}; var hash = {}
this.carSmallBrandOptions = this.carSmallBrandOptions.reduce(function (item, next) { this.carSmallBrandOptions = this.carSmallBrandOptions.reduce(function(item, next) {
hash[next.carChildsBrandId] ? '' : hash[next.carChildsBrandId] = true && item.push(next); hash[next.carChildsBrandId] ? '' : hash[next.carChildsBrandId] = true && item.push(next)
return item; return item
}, []); }, [])
let o = this.carBrandOptions.find(k => k.carBrandId == id); const o = this.carBrandOptions.find(k => k.carBrandId == id)
this.form.carBrandName = o.carBrand; this.form.carBrandName = o.carBrand
}, },
//获取车系 // 获取车系
changeCarSmallBrand(id) { changeCarSmallBrand(id) {
this.$set(this.form, 'carSeries', '') this.$set(this.form, 'carSeries', '')
this.$set(this.form, 'carType', '') this.$set(this.form, 'carType', '')
this.carSeriesOptions = [] this.carSeriesOptions = []
for (var i = 0; i < this.carInfoList.length; i++) { for (var i = 0; i < this.carInfoList.length; i++) {
if (this.carInfoList[i].carChildsBrandId == id) { if (this.carInfoList[i].carChildsBrandId == id) {
this.carSeriesOptions.push(this.carInfoList[i]); this.carSeriesOptions.push(this.carInfoList[i])
} }
} }
var hash = {}; var hash = {}
this.carSeriesOptions = this.carSeriesOptions.reduce(function (item, next) { this.carSeriesOptions = this.carSeriesOptions.reduce(function(item, next) {
hash[next.carSeriesId] ? '' : hash[next.carSeriesId] = true && item.push(next); hash[next.carSeriesId] ? '' : hash[next.carSeriesId] = true && item.push(next)
return item; return item
}, []); }, [])
if(id){ if (id) {
let o = this.carSmallBrandOptions.find(k => k.carChildsBrandId == id); const o = this.carSmallBrandOptions.find(k => k.carChildsBrandId == id)
this.form.carChildsBrandName = o.carChildsBrandName; this.form.carChildsBrandName = o.carChildsBrandName
} }
}, },
//根据车系id获取车辆类型 // 根据车系id获取车辆类型
getCarType(id) { getCarType(id) {
this.$set(this.form, 'carType', '') this.$set(this.form, 'carType', '')
this.carTypeOptions = [] this.carTypeOptions = []
if(id){ if (id) {
let params = {'seriesId':id} const params = { 'seriesId': id }
getCarType(params).then(res => { getCarType(params).then(res => {
this.carTypeOptions = res || []; this.carTypeOptions = res || []
let o = this.carSeriesOptions.find(k => k.carSeriesId == id); const o = this.carSeriesOptions.find(k => k.carSeriesId == id)
this.form.carSeriesName = o.carSeriesName; this.form.carSeriesName = o.carSeriesName
}); })
} }
}, },
changeCarType(id) { changeCarType(id) {
// this.key = new Date() // this.key = new Date()
let o = this.carTypeOptions.find(k => k.id == id); const o = this.carTypeOptions.find(k => k.id == id)
this.form.carTypeName = o.name; this.form.carTypeName = o.name
}, },
searchGoods(){ searchGoods() {
/**根据门店商户号获取基础商品列表 */ /** 根据门店商户号获取基础商品列表 */
// let paramsForGood = {'merchantId': this.form.storeId,'goodsType':this.searchForm.goodsType} // let paramsForGood = {'merchantId': this.form.storeId,'goodsType':this.searchForm.goodsType}
let paramsForGood = {'merchantId': this.form.storeId} const paramsForGood = { 'merchantId': this.form.storeId }
getGoods(paramsForGood).then(res => { getGoods(paramsForGood).then(res => {
this.goodList = res || [] this.goodList = res || []
if(this.goodList.length > 0){ if (this.goodList.length > 0) {
this.TB_height = 300 this.TB_height = 300
}else{ } else {
this.TB_height = 90 this.TB_height = 90
} }
}); })
}, },
/** /**
* 复选框操作 * 复选框操作
*/ */
selectChange: function(selection){ selectChange: function(selection) {
console.log(selection) console.log(selection)
this.selectList = selection this.selectList = selection
}, },
...@@ -521,64 +534,83 @@ export default { ...@@ -521,64 +534,83 @@ export default {
// return row.id // return row.id
// }, // },
// 跳转到错误信息
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView()
},
/** /**
* 保存信息 * 保存信息
*/ */
saveInfo() { saveInfo() {
this.$refs.editCusFrom.validate((valid) => { this.$refs.editCusFrom.validate((valid, opt) => {
if (!valid) { const validAttrList = ['storeId', 'cusName', 'mobile', 'contacts']
var hasError = Object.keys(opt)
if (hasError.length) {
for (var i in validAttrList) {
if (hasError.includes(validAttrList[i])) {
this.jumpScroll(validAttrList[i])
return false return false
} }
let params = {} }
let customer = {} }
let goods = [] // if (!valid) {
/**判断是否选择销售顾问 */ // return false
if(this.form.employee){ // }
const params = {}
const customer = {}
// const goods = []
/** 判断是否选择销售顾问 */
if (this.form.employee) {
this.showChooseCusError = false this.showChooseCusError = false
}else{ } else {
this.jumpScroll('adviser')
this.showChooseCusError = true this.showChooseCusError = true
return false return false
} }
console.log(this.selectList)
/**判断是否选择商品 */ /** 判断是否选择商品 */
if(this.selectList.length > 0){ if (this.selectList.length > 0) {
this.showChoosePrError = false this.showChoosePrError = false
for(var key in this.selectList){ // for (var key in this.selectList) {
goods.push(this.selectList[key].id) // goods.push(this.selectList[key].id)
} // }
}else{ } else {
this.jumpScroll('goods')
this.showChoosePrError = true this.showChoosePrError = true
return false return false
} }
params.merchantId = this.form.storeId params.merchantId = this.form.storeId
params.userId = this.form.employee.userId params.userId = this.form.employee.userId
params.employeeName = this.form.employee.name params.employeeName = this.form.employee.name
params.baseGoodsIds = goods // params.baseGoodsIds = goods
params.baseGoodsIds = this.selectList
params.remark = this.form.remark params.remark = this.form.remark
customer.customerName = this.form.cusName customer.customerName = this.form.cusName
customer.customerPhone = this.form.mobile customer.customerPhone = this.form.mobile
if(this.form.cusSex){ if (this.form.cusSex) {
customer.customerSex = this.form.cusSex customer.customerSex = this.form.cusSex
} }
if(this.form.cusType){ if (this.form.cusType) {
customer.customerType = this.form.cusType customer.customerType = this.form.cusType
} }
if(this.form.cusOccupation){ if (this.form.cusOccupation) {
customer.customerProfession = this.form.cusOccupation customer.customerProfession = this.form.cusOccupation
} }
if(this.form.carBrand){ if (this.form.carBrand) {
customer.carBrandId = this.form.carBrand customer.carBrandId = this.form.carBrand
customer.carBrand = this.form.carBrandName customer.carBrand = this.form.carBrandName
} }
if(this.form.carSmallBrand){ if (this.form.carSmallBrand) {
customer.carChildsBrandId = this.form.carSmallBrand customer.carChildsBrandId = this.form.carSmallBrand
customer.carChildsBrandName = this.form.carChildsBrandName customer.carChildsBrandName = this.form.carChildsBrandName
} }
if(this.form.carSeries){ if (this.form.carSeries) {
customer.carSeriesId = this.form.carSeries customer.carSeriesId = this.form.carSeries
customer.carSeriesName = this.form.carSeriesName customer.carSeriesName = this.form.carSeriesName
} }
if(this.form.carType){ if (this.form.carType) {
customer.carTypeId = this.form.carType customer.carTypeId = this.form.carType
customer.carTypeName = this.form.carTypeName customer.carTypeName = this.form.carTypeName
} }
...@@ -589,7 +621,7 @@ export default { ...@@ -589,7 +621,7 @@ export default {
addOrder(params).then(res => { addOrder(params).then(res => {
this.notice.okTips() this.notice.okTips()
/**重置所有项 */ /** 重置所有项 */
this.$refs.editCusFrom.resetFields() this.$refs.editCusFrom.resetFields()
this.adviserList = [] this.adviserList = []
this.$set(this.form, 'cusSex', '') this.$set(this.form, 'cusSex', '')
...@@ -598,12 +630,13 @@ export default { ...@@ -598,12 +630,13 @@ export default {
this.$set(this.form, 'carSmallBrand', '') this.$set(this.form, 'carSmallBrand', '')
this.$set(this.form, 'carSeries', '') this.$set(this.form, 'carSeries', '')
this.$set(this.form, 'carType', '') this.$set(this.form, 'carType', '')
this.from.cusOccupation = '' this.form.cusOccupation = ''
this.$set(this.form, 'newCarFlag', '') this.$set(this.form, 'newCarFlag', '')
this.goodList = [] this.goodList = []
this.selectList = [] this.selectList = []
this.form.remark = '' this.form.remark = ''
}); this.$nextTick(() => { })
})
}) })
} }
} }
...@@ -664,4 +697,15 @@ export default { ...@@ -664,4 +697,15 @@ export default {
padding-left: 20px; padding-left: 20px;
background-color: #e1e0e0; background-color: #e1e0e0;
} }
.base-pro-block {
display: inline-block;
width: 100px;
height: 100px;
margin-right: 10px;
}
.base-pro-block img {
width: 100px;
height: 100px;
vertical-align: top;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!