Commit eb27aea0 by wangql

提交联调接口代码

1 parent a98c8277
import request from './request'
const path = 'dj.api.'
/**获取服务门店列表 */
export function getServiceStore(data) {
data.method = `${path}servicemerchantref.list`
return request(data)
}
/**根据门店商户号获取员工列表 */
export function getStaff(data) {
data.method = `${path}employee.getByMerchantId`
return request(data)
}
/**获取车型车系 */
export function getCarInfo(data) {
data.method = `${path}car.series.list`
return request(data)
}
/**根据车系id获取车辆类型 */
export function getCarType(data) {
data.method = `${path}car.type.list`
return request(data)
}
/**根据门店商户号获取基础商品列表 */
export function getGoods(data) {
data.method = `${path}basegoods.list.byServiceMerchantId`
return request(data)
}
/**预录订单 */
export function addOrder(data) {
data.method = `${path}order.advanceCreate`
return request(data, 'post')
}
<!-- 客户预录 --> <!-- 客户预录 -->
<template> <template>
<div > <div>
<el-form ref="editCusFrom" :model="form" :rules="formRules" label-width="110px"> <el-form
<h3 class="h2">关联信息来源</h3> ref="editCusFrom"
<el-form-item label="门店名称" prop="storeId"> :model="form"
<el-select v-model="form.storeId" placeholder="请选择" class="el_select itd" @change="getAdviser(form.storeId)"> :rules="formRules"
<!-- <el-option value="" label="全部">全部</el-option> --> label-width="110px"
<el-option v-for="item in storeIdList" :key="item.id" :value="item.id" :label="item.name" /> >
</el-select> <h3 class="h2">关联信息来源</h3>
</el-form-item> <el-form-item
label="门店名称"
prop="storeId"
>
<el-select
v-model="form.storeId"
placeholder="请选择"
class="el_select itd"
@change="getAdviser(form.storeId)"
>
<!-- <el-option value="" label="全部">全部</el-option> -->
<el-option
v-for="item in storeIdList"
:key="item.merchantId"
:value="item.merchantId"
:label="item.merchantName"
/>
</el-select>
</el-form-item>
<el-form-item label="销售顾问"> <el-form-item label="销售顾问">
<!-- <el-tag>张三</el-tag>&nbsp;<el-tag>李四</el-tag>&nbsp;<el-tag>王五</el-tag> --> <!-- <el-tag>张三</el-tag>&nbsp;<el-tag>李四</el-tag>&nbsp;<el-tag>王五</el-tag> -->
<el-tag v-for="item in adviserList" :key="item">{{ item }}</el-tag> <!-- <el-tag
</el-form-item> v-for="item in adviserList"
:key="item.userId"
>{{ item.name }}</el-tag> -->
<el-radio v-for="item in adviserList" :key="item.userId" v-model="form.employee" :label="item" >{{item.name}}</el-radio>
</el-form-item>
<h3 class="h2">客户基本信息</h3> <h3 class="h2">客户基本信息</h3>
<div class="line_box"> <div class="line_box">
<div class="left">
<div class="left"> <div class="left">
<div class="left"> <el-form-item
<el-form-item label="客户姓名" prop="cusName"> label="客户姓名"
<el-input v-model="form.cusName" maxlength="10" class="itd" clearable/> prop="cusName"
</el-form-item> >
</div> <el-input
</div> v-model="form.cusName"
<div class="right"> maxlength="10"
<el-form-item label="客户性别" prop="cusSex"> class="itd"
<el-select v-model="form.cusSex" placeholder="请选择" class="el_select itd"> clearable
<el-option value="1" label="男" /> />
<el-option value="2" label="女" />
</el-select>
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
<div class="line_box"> <div class="right">
<el-form-item
label="客户性别"
prop="cusSex"
>
<el-select
v-model="form.cusSex"
placeholder="请选择"
class="el_select itd"
>
<el-option
value="1"
label="男"
/>
<el-option
value="2"
label="女"
/>
</el-select>
</el-form-item>
</div>
</div>
<div class="line_box">
<div class="left">
<div class="left"> <div class="left">
<div class="left"> <el-form-item
<el-form-item label="手机号码" prop="mobile"> label="手机号码"
<el-input v-model="form.mobile" maxlength="11" class="itd" clearable/> prop="mobile"
</el-form-item> >
</div> <el-input
</div> v-model="form.mobile"
<div class="right"> maxlength="11"
<el-form-item label="虚拟手机号"> class="itd"
<a href="#" @click="getFictitiousPhone(form.mobile)" style="text-decoration:underline;font-style:italic;">点击生成自动生成虚拟手机号,无需填写</a> clearable
/>
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
<el-form-item label="客户类型" prop="cusType"> <div class="right">
<el-select v-model="form.cusType" placeholder="请选择" class="el_select itd"> <!-- <el-form-item label="虚拟手机号">
<!-- <el-option value="" label="全部">全部</el-option> --> <a href="#" @click="getFictitiousPhone(form.mobile)" style="text-decoration:underline;font-style:italic;">点击生成自动生成虚拟手机号,无需填写</a>
<el-option v-for="item in cusTypeList" :key="item.id" :value="item.id" :label="item.name" /> </el-form-item> -->
</div>
</div>
<el-form-item
label="客户类型"
prop="cusType"
>
<el-select
v-model="form.cusType"
placeholder="请选择"
class="el_select itd"
>
<!-- <el-option value="" label="全部">全部</el-option> -->
<el-option
v-for="item in cusTypeList"
:key="item.id"
:value="item.id"
:label="item.name"
/>
</el-select>
</el-form-item>
<el-form-item
label="客户职业"
prop="cusOccupation"
>
<el-input
v-model="form.cusOccupation"
class="itd"
clearable
/>
</el-form-item>
<el-form-item
label="车辆型号"
prop="deviceTypeId"
>
<div class="wo-span">
<el-select
v-model="form.carBrand"
placeholder="请选择品牌"
filterable
@change="changeCarBrand(form.carBrand)"
style="width:150px;"
>
<el-option
v-for="item in carBrandOptions"
:key="item.carBrandId"
:value="item.carBrandId"
:label="item.carBrand"
/>
</el-select> </el-select>
</el-form-item>
<el-form-item label="客户职业" prop="cusOccupation"> <el-select
<el-input v-model="form.cusOccupation" maxlength="10" class="itd" clearable/> v-model="form.carSmallBrand"
</el-form-item> placeholder="请选择子品牌"
<el-form-item label="车辆型号" prop="deviceTypeId"> @change="changeCarSmallBrand(form.carSmallBrand)"
<el-select v-model="form.deviceTypeId" placeholder="请选择" class="el_select itd" @change="getDevice(form.deviceTypeId)"> style="width:150px;"
<!-- <el-option value="" label="全部">全部</el-option> --> >
<el-option v-for="item in deviceTypeList" :key="item.id" :value="item.id" :label="item.name" /> <el-option
v-for="item in carSmallBrandOptions"
:key="item.carChildsBrandId"
:value="item.carChildsBrandId"
:label="item.carChildsBrandName"
/>
</el-select> </el-select>
</el-form-item>
<el-form-item label="车架号" prop="contacts"> <el-select
<el-input v-model="form.contacts" maxlength="10" class="itd" clearable/> v-model="form.carSeries"
</el-form-item> placeholder="请选择车系"
<el-form-item label="新车首购" prop="contacts"> @change="getCarType(form.carSeries)"
<el-radio v-model="form.deviceScanType" label="Y">是</el-radio> style="width:150px;"
<el-radio v-model="form.deviceScanType" label="N">否</el-radio> >
</el-form-item> <el-option
v-for="item in carSeriesOptions"
<h3 class="h2">装饰内容</h3> :key="item.carSeriesId"
<el-form-item label="客户备注"> :value="item.carSeriesId"
<el-input v-model="form.remark" type="textarea" rows="3" style="width:600px"/> :label="item.carSeriesName"
</el-form-item> />
</el-form> </el-select>
<div slot="footer">
<el-button type="primary" @click="saveInfo">确认</el-button> <el-select
<el-button @click="cancel">取消</el-button> v-model="form.carType"
</div> placeholder="请选择车型"
@change="changeCarType(form.carType)"
style="width:150px;"
>
<el-option
v-for="item in carTypeOptions"
:key="item.id"
:value="item.id"
:label="item.name"
/>
</el-select>
</div>
</el-form-item>
<el-form-item
label="车架号"
prop="contacts"
>
<el-input
v-model="form.contacts"
maxlength="17"
class="itd"
clearable
/>
</el-form-item>
<el-form-item
label="新车首购"
prop="contacts"
>
<el-radio
v-model="form.newCarFlag"
label="Y"
>是</el-radio>
<el-radio
v-model="form.newCarFlag"
label="N"
>否</el-radio>
</el-form-item>
<h3 class="h2">装饰内容</h3>
<el-form-item label="客户备注">
<el-input
v-model="form.remark"
type="textarea"
rows="3"
style="width:600px"
/>
</el-form-item>
</el-form>
<div slot="footer">
<el-button
type="primary"
@click="saveInfo"
>确认</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</div> </div>
</template> </template>
<script> <script>
import { import { Util } from '@/common/util'
Util import util from '@/libs/util'
} from '@/common/util' import { getServiceStore, getStaff, getCarInfo, getCarType, getGoods, addOrder } from '@api/editCustomer'
export default { export default {
name: 'editCustomer', name: 'editCustomer',
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 {
form: { form: {
deviceScanType: 'Y' newCarFlag: 'Y'
}, },
storeIdList: [ storeIdList: [
{ // {
id:1, // id:1,
name:'门店1' // name:'门店1'
}, // },
{ // {
id:2, // id:2,
name:'门店2' // name:'门店2'
} // }
], ],
adviserList: [], adviserList: [],
cusTypeList: [ cusTypeList: [
{ {
id:1, id: 1,
name:'类型1' name: '价格敏感型'
}, },
{ {
id:2, id: 2,
name:'类型2' name: '价格不敏感型'
} }
], ],
carInfoList: [],
carBrandOptions: [],
carSmallBrandOptions: [],
carSeriesOptions: [],
carTypeOptions: [],
formRules: { formRules: {
storeId: [{ storeId: [{
required: true, required: true,
message: '请选择门店', message: '请选择门店',
trigger: 'change' trigger: 'change'
}], }],
cusName: [{ cusName: [{
required: true, required: true,
...@@ -165,47 +322,168 @@ export default { ...@@ -165,47 +322,168 @@ export default {
computed: {}, computed: {},
mounted() {}, mounted() {
this.getServiceStore()
this.getAllVehicleBrand()
},
methods: { methods: {
getAdviser(storeId){ /**
if(storeId){ * 获取服务门店
this.adviserList.push('张三') */
this.adviserList.push('李四') getServiceStore() {
this.adviserList.push('王五') let 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 }
getStaff(params).then(res => {
this.adviserList = res || []
});
/**根据门店商户号获取基础商品列表 */
let paramsForGood = {'merchantId': merchantId}
getGoods(paramsForGood).then(res => {
// this.adviserList = res || []
console.log(res);
});
},
// getFictitiousPhone(mobile) {
// // this.$confirm('是否生成虚拟手机号?', '提示', {
// // confirmButtonText: '确定',
// // cancelButtonText: '取消',
// // type: 'warning'
// // }).then(() => {
// // this.$message({
// // type: 'success',
// // message: '删除成功!'
// // });
// // }).catch(err => {
// // console.log(err)
// // })
// if (!Util.checkPhone(mobile)) {
// this.$message({
// type: 'error',
// message: '请输入正确的手机号码!'
// });
// return false;
// }
// },
//获取品牌车型
getAllVehicleBrand() {
let params = {}
getCarInfo(params).then(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;
}, []);
});
},
//获取车辆子品牌
changeCarBrand(id) {
this.carSmallBrandOptions = []
for (var i = 0; i < this.carInfoList.length; i++) {
if (this.carInfoList[i].carBrandId == id) {
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;
}, },
getFictitiousPhone(mobile){ //获取车系
// this.$confirm('是否生成虚拟手机号?', '提示', { changeCarSmallBrand(id) {
// confirmButtonText: '确定', this.carSeriesOptions = []
// cancelButtonText: '取消', for (var i = 0; i < this.carInfoList.length; i++) {
// type: 'warning' if (this.carInfoList[i].carChildsBrandId == id) {
// }).then(() => { this.carSeriesOptions.push(this.carInfoList[i]);
// this.$message({ }
// type: 'success', }
// message: '删除成功!' var hash = {};
// }); this.carSeriesOptions = this.carSeriesOptions.reduce(function (item, next) {
// }).catch(err => { hash[next.carSeriesId] ? '' : hash[next.carSeriesId] = true && item.push(next);
// console.log(err) return item;
// }) }, []);
if (!Util.checkPhone(mobile)) {
        this.$message({ let o = this.carSmallBrandOptions.find(k => k.carChildsBrandId == id);
type: 'error', this.form.carChildsBrandName = o.carChildsBrandName;
message: '请输入正确的手机号码!' },
});
        return false; //根据车系id获取车辆类型
      } getCarType(id) {
let params = {'seriesId':id}
getCarType(params).then(res => {
this.carTypeOptions = res || [];
let o = this.carSeriesOptions.find(k => k.carSeriesId == id);
this.form.carSeriesName = o.carSeriesName;
});
}, },
changeCarType(id) {
let o = this.carTypeOptions.find(k => k.id == id);
this.form.carTypeName = o.name;
},
/** /**
* 保存信息 * 保存信息
*/ */
saveInfo(){ saveInfo() {
this.$refs.editCusFrom.validate((valid) => { this.$refs.editCusFrom.validate((valid) => {
if (!valid) { if (!valid) {
return false return false
} }
let params = {}
let customer = {}
let goods = ['2011051953545051','2011051952253987']
params.merchantId = this.form.storeId
params.userId = this.form.employee.userId
params.employeeName = this.form.employee.name
params.baseGoodsIds = goods
customer.customerName = this.form.cusName
customer.customerPhone = this.form.mobile
customer.customerSex = this.form.cusSex
customer.customerType = this.form.cusType
customer.customerProfession = this.form.cusOccupation
customer.carBrandId = this.form.carBrand
customer.carBrand = this.form.carBrandName
customer.carChildsBrandId = this.form.carSmallBrand
customer.carChildsBrandName = this.form.carChildsBrandName
customer.carSeriesId = this.form.carSeries
customer.carSeriesName = this.form.carSeriesName
customer.carTypeId = this.form.carType
customer.carTypeName = this.form.carTypeName
customer.standNo = this.form.contacts
customer.newCarFlag = this.form.newCarFlag
params.customer = customer
addOrder(params).then(res => {
this.notice.okTips()
});
}) })
} }
} }
...@@ -213,40 +491,39 @@ export default { ...@@ -213,40 +491,39 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.addorder_page { .addorder_page {
padding: 20px; padding: 20px;
position: relative; position: relative;
} }
.line_box {
display: flex;
.left, .line_box {
.right { display: flex;
flex: 1;
} .left,
.right {
flex: 1;
} }
}
.el_select { .el_select {
width: 100%; width: 100%;
} }
.sort_input { .sort_input {
width: 200px; width: 200px;
} }
.warningFont{ .warningFont {
font-size:14px; font-size: 14px;
color:#f00; color: #f00;
font-weight:normal; font-weight: normal;
} }
.text-wrapper { .text-wrapper {
white-space: pre-wrap; white-space: pre-wrap;
} }
.itd{ .itd {
width:400px; width: 400px;
} }
</style> </style>
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
<script> <script>
import { getList, getType } from '@api/product' import { getList, getType } from '@api/product'
import { BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
export default { export default {
name: 'product', name: 'product',
data() { data() {
...@@ -96,10 +98,10 @@ export default { ...@@ -96,10 +98,10 @@ export default {
prop: 'thumbUrl', prop: 'thumbUrl',
addHtml: 'img' addHtml: 'img'
}, { }, {
label: '素材名称', label: '产品名称',
prop: 'goodsName' prop: 'goodsName'
}, { }, {
label: '商品ID', label: '产品ID',
prop: 'id' prop: 'id'
}, { }, {
label: '分类', label: '分类',
...@@ -133,15 +135,20 @@ export default { ...@@ -133,15 +135,20 @@ export default {
}, },
mounted() { mounted() {
this.getProductType() // this.getProductType()
this.getBaseData()
}, },
methods: { methods: {
getProductType(){ // getProductType(){
let prarms = {} // let prarms = {}
getType(prarms).then(res => { // getType(prarms).then(res => {
this.baseData.productTypeList = res || [] // this.baseData.productTypeList = res || []
}); // });
// },
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.productTypeList = await this.get(BaseData.productType)
}, },
beforeSearchFn() { beforeSearchFn() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!