修改客户品牌选择

This commit is contained in:
lcc
2024-09-02 15:51:01 +08:00
parent 1fba42b037
commit 456e47f649
6 changed files with 168 additions and 74 deletions
+64 -34
View File
@@ -4,8 +4,6 @@ Page({
data: {
name: '', //名字
mobile: '', //手机号
// brand_id:'',//品牌
// car_id:'',//车系id
// v_id:'',//车辆版本id
// color_id:'',//颜色id
// b_s_id:'',//备选车型id
@@ -19,6 +17,7 @@ Page({
// levelIndex:-1,//车辆版本索引
timeArray: [], //预计购车时间列表
timeIndex: -1, //预计购车时间索引
submitFlag: false,
status: 0, //状态
@@ -52,6 +51,16 @@ Page({
wxgr: 0, //是否添加个微
wxgrimg: '', //个微
wxgrimg_url: '', //个微
brand_name: '', //品牌名称
brand_id: 0,
brand_page_show: false,
brandIndex: -1, //车辆品牌索引
series_id: '', //车系id
modelArray: [],
modelIndex: -1, //车系车型索引
car_id: '', //车型id
carIndex: -1, //车型索引
carArray: [],
},
//生命周期函数--监听页面加载
onLoad: function (options) {
@@ -217,44 +226,39 @@ Page({
changeModel(e) {
if (this.data.modelIndex != e.detail.value && e.detail.value >= 0) {
this.setData({
car_id: this.data.modelList[e.detail.value].id,
series_id: this.data.modelList[e.detail.value].id,
modelIndex: e.detail.value,
v_id: '', //车辆版本id
color_id: '', //车身颜色id
incolor_id: '', //内饰颜色id
b_s_id: '', //备选车型id
spareIndex: -1, //备选车型索引
colorArray: [], //车身颜色列表
levelArray: [], //车辆版本列表
interiorArray: [], //内饰颜色
colorIndex: -1, //车身颜色索引
levelIndex: -1, //车辆版本索引
interiorIndex: -1, //内饰颜色索引
// car_id: '', //车辆版本id
// carArray: [], //车辆版本列表
// business_type: 0,
})
this.getAppSeriesAttrslevel()
// this.getAppSeriesCarlevel()
}
},
//获取车辆版本
getAppSeriesCarlevel() {
let params = {};
params['series_id'] = this.data.series_id;
_.apiQuery.getAppSeriesCars(params).then(res => {
if (res.data.total > 0) {
let carArray = []
res.data.list.forEach(item => {
carArray.push(item.name)
})
this.setData({
carArray: carArray,
carList: res.data.list,
carIndex: -1,
})
}
});
},
//车辆版本
changeLevel(e) {
changeCar(e) {
if (this.data.levelIndex != e.detail.value && e.detail.value >= 0) {
this.setData({
v_id: this.data.levelList[e.detail.value].id,
levelIndex: e.detail.value,
color_id: '', //车身颜色id
colorArray: [], //车身颜色列表
colorIndex: -1, //车身颜色索引
})
this.getAppSeriesAttrscolor()
}
},
//车身颜色
changeColor(e) {
if (this.data.colorIndex != e.detail.value && e.detail.value >= 0) {
this.setData({
color_id: this.data.colorList[e.detail.value].id,
colorIndex: e.detail.value,
car_id: this.data.carList[e.detail.value].id,
carIndex: e.detail.value,
})
}
},
@@ -366,6 +370,9 @@ Page({
params['city_id'] = this.data.city_id;
params['county_id'] = this.data.county_id;
params['buy_time'] = this.data.buy_time;
params['brand_id'] = this.data.brand_id;
params['series_id'] = this.data.series_id;
params['car_id'] = this.data.car_id;
_.apiQuery.postAppCustomers(params).then(res => {
//刷新列表页
@@ -693,5 +700,28 @@ Page({
})
}
},
//显示选择品牌
bindShowBrand() {
this.setData({
brand_page_show: true
})
},
//获取品牌信息
getBrandData(e) {
console.log(e.detail)
if (e.detail.index > -1 && e.detail.item) {
this.setData({
brand_id: e.detail.item.id,
brand_name: e.detail.item.name,
brandIndex: e.detail.index,
series_id: '', //车系id
modelArray: [],
modelIndex: -1, //车系车型索引
car_id: '', //车系id
carArray: [], //车辆版本列表
carIndex: -1, //车辆版本索引
})
this.getAppSeries()
}
}
})
+1 -1
View File
@@ -1,6 +1,6 @@
{
"navigationBarTitleText": "客户建卡",
"usingComponents": {
"brandSelect": "/components/brandSelect/index"
}
}
+36 -2
View File
@@ -150,7 +150,39 @@
</block>
</view>
</view>
<!--车型库品牌-->
<view class="relative bbs-1-eb last-b-none pl190" wx:if="{{status==0}}">
<view class="absolute left-0 box-middle font-28 color-333">重点关注车型</view>
<view class="pt30 pb30 text-right font-28 color-666">
<view class="pt30 pb30 text-right font-28 color-666" bindtap="bindShowBrand">
<text wx:if="{{brand_name}}}">{{brand_name||'请选择'}}</text>
<text class="color-ccc" wx:else>请选择</text>
<i class="iconfont ml5 icon-gengduo"></i>
</view>
</view>
</view>
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{brandIndex != -1}}">
<view class="absolute left-0 box-middle font-28 color-333">车系车型</view>
<view class="pt30 pb30 text-right font-28 color-666">
<picker bindchange="changeModel" value="{{modelIndex}}" range="{{modelArray}}">
<text class="color-ccc" wx:if="{{modelIndex == -1}}">请选择</text>
<text wx:else>{{modelArray[modelIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
</view>
</view>
<!--
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{modelIndex != -1}}">
<view class="absolute left-0 box-middle font-28 color-333">车辆版本</view>
<view class="pt30 pb30 text-right font-28 color-666">
<picker bindchange="changeCar" value="{{carIndex}}" range="{{carArray}}">
<text class="color-ccc" wx:if="{{carIndex == -1}}">请选择</text>
<text wx:else>{{carArray[carIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
</view>
</view>
-->
<block wx:for='{{taglList}}' wx:for-item='list' wx:for-index='i' wx:key='i'>
<view class="relative mt30">
<view class="font-28">
@@ -199,4 +231,6 @@
</button>
</view>
</view>
</lcb-msg>
</lcb-msg>
<brandSelect show="{{brand_page_show}}" bindleave="getBrandData"></brandSelect>
+42 -33
View File
@@ -45,6 +45,13 @@ Page({
wxgrimg_url: '', //个微
cf_title: '',
cf_edit_status: false,
brand_name: '', //品牌名称
brand_id: 0,
brand_page_show: false,
brandIndex: -1, //车辆品牌索引
series_id: '', //车系id
modelArray: [],
modelIndex: -1, //车系车型索引
},
//生命周期函数--监听页面加载
onLoad: function (options) {
@@ -73,6 +80,9 @@ Page({
wxgr: res.data.baseinfo.wxgr,
wxgrimg: res.data.baseinfo.wxgrimg,
wxgrimg_url: res.data.baseinfo.wxgrimg_url,
brand_id: res.data.baseinfo.brand.id ? res.data.baseinfo.brand.id : 0,
brand_name: res.data.baseinfo.brand.name ? res.data.baseinfo.brand.name : '',
series_id: res.data.baseinfo.series_id ? res.data.baseinfo.series_id : '',
})
// this.data.c_brandArray.forEach((item,index) => {
@@ -87,7 +97,7 @@ Page({
//获取车型品牌
//this.getAppSeriesBrands()
//匹配车系车型
//this.getAppSeriesedit()
this.getAppSeriesedit()
if (this.data.cf_edit_status) {
this.getAppCustomersOffline_sources()
}
@@ -126,34 +136,22 @@ Page({
//匹配车系车型
getAppSeriesedit() {
let params = {};
params['brand_id'] = this.data.baseinfo.brand_id.value;
params['brand_id'] = this.data.brand_id;
_.apiQuery.getAppSeries(params).then(res => {
if (res.data.list.length > 0) {
let modelIndex = -1
let modelArray = []
res.data.list.forEach(item => {
res.data.list.forEach((item, key) => {
modelArray.push(item.name)
if (item.id === this.data.series_id) {
modelIndex = key
}
})
this.setData({
modelArray: modelArray,
modelList: res.data.list,
modelIndex: -1,
modelIndex: modelIndex,
})
if (this.data.baseinfo.car_id.value != '') {
res.data.list.forEach((item, index) => {
if (item.id == this.data.baseinfo.car_id.value) {
this.setData({
car_id: this.data.baseinfo.car_id.value,
modelIndex: index,
})
}
})
//匹配颜色 车辆版本
this.getAppSeriesAttrsleveledit()
}
}
});
},
@@ -330,20 +328,9 @@ Page({
changeModel(e) {
if (this.data.modelIndex != e.detail.value && e.detail.value >= 0) {
this.setData({
car_id: this.data.modelList[e.detail.value].id,
series_id: this.data.modelList[e.detail.value].id,
modelIndex: e.detail.value,
v_id: '', //车辆版本id
color_id: '', //车身颜色id
incolor_id: '', //内饰颜色id
colorArray: [], //车身颜色列表
levelArray: [], //车辆版本列表
interiorArray: [], //内饰颜色
colorIndex: -1, //车身颜色索引
levelIndex: -1, //车辆版本索引
interiorIndex: -1, //内饰颜色索引
priceinfo: '',
})
this.getAppSeriesAttrslevel()
}
},
@@ -476,6 +463,8 @@ Page({
if (this.data.wxgr == 1) {
params['wxgrimg'] = this.data.wxgrimg;
}
params['brand_id'] = that.data.brand_id;
params['series_id'] = that.data.series_id;
_.apiQuery.putAppCustomerData(params).then(res => {
//刷新列表页
@@ -764,5 +753,25 @@ Page({
})
}
},
//显示选择品牌
bindShowBrand() {
this.setData({
brand_page_show: true
})
},
//获取品牌信息
getBrandData(e) {
// console.log(e.detail)
if (e.detail.index > -1 && e.detail.item) {
this.setData({
brand_id: e.detail.item.id,
brand_name: e.detail.item.name,
brandIndex: e.detail.index,
series_id: '', //车系id
modelArray: [],
modelIndex: -1, //车系车型索引
})
}
this.getAppSeries()
},
})
+1 -1
View File
@@ -1,6 +1,6 @@
{
"navigationBarTitleText": "客户编辑",
"usingComponents": {
"brandSelect": "/components/brandSelect/index"
}
}
+24 -3
View File
@@ -10,7 +10,7 @@
<view class="relative bbs-1-eb last-b-none pl140 font-28">
<view class="absolute left-0 box-middle">手机号码</view>
<view>
<input class="wp100 height-100 text-right font-28" placeholder-class="color-ccc" type="number" placeholder="请输入客户手机号" bindinput='inputTx' data-key="mobile" name='mobile' value='{{mobile}}' disabled="disabled"/>
<input class="wp100 height-100 text-right font-28" placeholder-class="color-ccc" type="number" placeholder="请输入客户手机号" bindinput='inputTx' data-key="mobile" name='mobile' value='{{mobile}}' disabled="disabled" />
</view>
</view>
<!--
@@ -139,7 +139,27 @@
</block>
</view>
</view>
<!--车型库品牌-->
<view class="relative bbs-1-eb last-b-none pl190">
<view class="absolute left-0 box-middle font-28 color-333">重点关注车型</view>
<view class="pt30 pb30 text-right font-28 color-666">
<view class="pt30 pb30 text-right font-28 color-666" bindtap="bindShowBrand">
<text wx:if="{{brand_name}}}">{{brand_name||'请选择'}}</text>
<text class="color-ccc" wx:else>请选择</text>
<i class="iconfont ml5 icon-gengduo"></i>
</view>
</view>
</view>
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{brand_id}}">
<view class="absolute left-0 box-middle font-28 color-333">车系车型</view>
<view class="pt30 pb30 text-right font-28 color-666">
<picker bindchange="changeModel" value="{{modelIndex}}" range="{{modelArray}}">
<text class="color-ccc" wx:if="{{modelIndex == -1}}">请选择</text>
<text wx:else>{{modelArray[modelIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
</view>
</view>
<block wx:for='{{taglList}}' wx:for-item='list' wx:for-index='i' wx:key='i'>
<view class="relative mt30">
<view class="font-28">
@@ -172,4 +192,5 @@
</view>
</view>
<lcb-footer></lcb-footer>
<lcb-backChannel></lcb-backChannel>
<lcb-backChannel></lcb-backChannel>
<brandSelect show="{{brand_page_show}}" bindleave="getBrandData"></brandSelect>