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>
<div >
<el-form ref="editCusFrom" :model="form" :rules="formRules" label-width="110px">
<h3 class="h2">关联信息来源</h3>
<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.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<div>
<el-form
ref="editCusFrom"
:model="form"
:rules="formRules"
label-width="110px"
>
<h3 class="h2">关联信息来源</h3>
<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-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-form-item>
<el-form-item label="销售顾问">
<!-- <el-tag>张三</el-tag>&nbsp;<el-tag>李四</el-tag>&nbsp;<el-tag>王五</el-tag> -->
<!-- <el-tag
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>
<div class="line_box">
<h3 class="h2">客户基本信息</h3>
<div class="line_box">
<div class="left">
<div class="left">
<div class="left">
<el-form-item label="客户姓名" prop="cusName">
<el-input v-model="form.cusName" maxlength="10" class="itd" clearable/>
</el-form-item>
</div>
</div>
<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
label="客户姓名"
prop="cusName"
>
<el-input
v-model="form.cusName"
maxlength="10"
class="itd"
clearable
/>
</el-form-item>
</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">
<el-form-item label="手机号码" prop="mobile">
<el-input v-model="form.mobile" maxlength="11" class="itd" clearable/>
</el-form-item>
</div>
</div>
<div class="right">
<el-form-item label="虚拟手机号">
<a href="#" @click="getFictitiousPhone(form.mobile)" style="text-decoration:underline;font-style:italic;">点击生成自动生成虚拟手机号,无需填写</a>
<el-form-item
label="手机号码"
prop="mobile"
>
<el-input
v-model="form.mobile"
maxlength="11"
class="itd"
clearable
/>
</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" />
<div class="right">
<!-- <el-form-item label="虚拟手机号">
<a href="#" @click="getFictitiousPhone(form.mobile)" style="text-decoration:underline;font-style:italic;">点击生成自动生成虚拟手机号,无需填写</a>
</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-form-item>
<el-form-item label="客户职业" prop="cusOccupation">
<el-input v-model="form.cusOccupation" maxlength="10" class="itd" clearable/>
</el-form-item>
<el-form-item label="车辆型号" prop="deviceTypeId">
<el-select v-model="form.deviceTypeId" placeholder="请选择" class="el_select itd" @change="getDevice(form.deviceTypeId)">
<!-- <el-option value="" label="全部">全部</el-option> -->
<el-option v-for="item in deviceTypeList" :key="item.id" :value="item.id" :label="item.name" />
<el-select
v-model="form.carSmallBrand"
placeholder="请选择子品牌"
@change="changeCarSmallBrand(form.carSmallBrand)"
style="width:150px;"
>
<el-option
v-for="item in carSmallBrandOptions"
:key="item.carChildsBrandId"
:value="item.carChildsBrandId"
:label="item.carChildsBrandName"
/>
</el-select>
</el-form-item>
<el-form-item label="车架号" prop="contacts">
<el-input v-model="form.contacts" maxlength="10" class="itd" clearable/>
</el-form-item>
<el-form-item label="新车首购" prop="contacts">
<el-radio v-model="form.deviceScanType" label="Y">是</el-radio>
<el-radio v-model="form.deviceScanType" 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>
<el-select
v-model="form.carSeries"
placeholder="请选择车系"
@change="getCarType(form.carSeries)"
style="width:150px;"
>
<el-option
v-for="item in carSeriesOptions"
:key="item.carSeriesId"
:value="item.carSeriesId"
:label="item.carSeriesName"
/>
</el-select>
<el-select
v-model="form.carType"
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>
</template>
<script>
import {
Util
} from '@/common/util'
import { Util } from '@/common/util'
import util from '@/libs/util'
import { getServiceStore, getStaff, getCarInfo, getCarType, getGoods, addOrder } from '@api/editCustomer'
export default {
name: 'editCustomer',
data() {
function checkPhone(rule, value, callback) {
      if (!Util.checkPhone(value)) {
        callback(new Error("请输入正确的手机号码"));
        return false;
      }
      callback();
    }
function checkPhone(rule, value, callback) {
if (!Util.checkPhone(value)) {
callback(new Error("请输入正确的手机号码"));
return false;
}
callback();
}
return {
form: {
deviceScanType: 'Y'
newCarFlag: 'Y'
},
storeIdList: [
{
id:1,
name:'门店1'
},
{
id:2,
name:'门店2'
}
// {
// id:1,
// name:'门店1'
// },
// {
// id:2,
// name:'门店2'
// }
],
adviserList: [],
cusTypeList: [
{
id:1,
name:'类型1'
id: 1,
name: '价格敏感型'
},
{
id:2,
name:'类型2'
id: 2,
name: '价格不敏感型'
}
],
carInfoList: [],
carBrandOptions: [],
carSmallBrandOptions: [],
carSeriesOptions: [],
carTypeOptions: [],
formRules: {
storeId: [{
required: true,
message: '请选择门店',
trigger: 'change'
required: true,
message: '请选择门店',
trigger: 'change'
}],
cusName: [{
required: true,
......@@ -165,47 +322,168 @@ export default {
computed: {},
mounted() {},
mounted() {
this.getServiceStore()
this.getAllVehicleBrand()
},
methods: {
getAdviser(storeId){
if(storeId){
this.adviserList.push('张三')
this.adviserList.push('李四')
this.adviserList.push('王五')
/**
* 获取服务门店
*/
getServiceStore() {
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('是否生成虚拟手机号?', '提示', {
// 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;
      }
//获取车系
changeCarSmallBrand(id) {
this.carSeriesOptions = []
for (var i = 0; i < this.carInfoList.length; i++) {
if (this.carInfoList[i].carChildsBrandId == id) {
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;
}, []);
let o = this.carSmallBrandOptions.find(k => k.carChildsBrandId == id);
this.form.carChildsBrandName = o.carChildsBrandName;
},
//根据车系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) => {
if (!valid) {
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 {
</script>
<style lang="scss" scoped>
.addorder_page {
padding: 20px;
position: relative;
}
.line_box {
display: flex;
.addorder_page {
padding: 20px;
position: relative;
}
.left,
.right {
flex: 1;
.line_box {
display: flex;
}
.left,
.right {
flex: 1;
}
}
.el_select {
width: 100%;
}
.el_select {
width: 100%;
}
.sort_input {
width: 200px;
}
.sort_input {
width: 200px;
}
.warningFont{
font-size:14px;
color:#f00;
font-weight:normal;
}
.warningFont {
font-size: 14px;
color: #f00;
font-weight: normal;
}
.text-wrapper {
white-space: pre-wrap;
}
.text-wrapper {
white-space: pre-wrap;
}
.itd{
width:400px;
}
.itd {
width: 400px;
}
</style>
......@@ -73,6 +73,8 @@
<script>
import { getList, getType } from '@api/product'
import { BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
export default {
name: 'product',
data() {
......@@ -96,10 +98,10 @@ export default {
prop: 'thumbUrl',
addHtml: 'img'
}, {
label: '素材名称',
label: '产品名称',
prop: 'goodsName'
}, {
label: '商品ID',
label: '产品ID',
prop: 'id'
}, {
label: '分类',
......@@ -133,15 +135,20 @@ export default {
},
mounted() {
this.getProductType()
// this.getProductType()
this.getBaseData()
},
methods: {
getProductType(){
let prarms = {}
getType(prarms).then(res => {
this.baseData.productTypeList = res || []
});
// getProductType(){
// let prarms = {}
// getType(prarms).then(res => {
// this.baseData.productTypeList = res || []
// });
// },
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.productTypeList = await this.get(BaseData.productType)
},
beforeSearchFn() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!