Commit fd91a1a7 by cwq0219

预录客户

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