From 456e47f649d754a307a89071d53592aa91660c5f Mon Sep 17 00:00:00 2001 From: lcc Date: Mon, 2 Sep 2024 15:51:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E5=93=81?= =?UTF-8?q?=E7=89=8C=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/customer/addCard/index.js | 98 +++++++++++++++++++----------- pages/customer/addCard/index.json | 2 +- pages/customer/addCard/index.wxml | 38 +++++++++++- pages/customer/editCard/index.js | 75 +++++++++++++---------- pages/customer/editCard/index.json | 2 +- pages/customer/editCard/index.wxml | 27 +++++++- 6 files changed, 168 insertions(+), 74 deletions(-) diff --git a/pages/customer/addCard/index.js b/pages/customer/addCard/index.js index e8b3964..d30c823 100644 --- a/pages/customer/addCard/index.js +++ b/pages/customer/addCard/index.js @@ -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() + } + } }) \ No newline at end of file diff --git a/pages/customer/addCard/index.json b/pages/customer/addCard/index.json index a58dd1c..03f7bcd 100644 --- a/pages/customer/addCard/index.json +++ b/pages/customer/addCard/index.json @@ -1,6 +1,6 @@ { "navigationBarTitleText": "客户建卡", "usingComponents": { - + "brandSelect": "/components/brandSelect/index" } } \ No newline at end of file diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index b50bc07..0299c2f 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -150,7 +150,39 @@ - + + + 重点关注车型 + + + {{brand_name||'请选择'}} + 请选择 + + + + + + 车系车型 + + + 请选择 + {{modelArray[modelIndex]}} + + + + + @@ -199,4 +231,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/customer/editCard/index.js b/pages/customer/editCard/index.js index b31fa98..e4196ef 100644 --- a/pages/customer/editCard/index.js +++ b/pages/customer/editCard/index.js @@ -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() + }, }) \ No newline at end of file diff --git a/pages/customer/editCard/index.json b/pages/customer/editCard/index.json index e2eb1b7..f121a6f 100644 --- a/pages/customer/editCard/index.json +++ b/pages/customer/editCard/index.json @@ -1,6 +1,6 @@ { "navigationBarTitleText": "客户编辑", "usingComponents": { - + "brandSelect": "/components/brandSelect/index" } } \ No newline at end of file diff --git a/pages/customer/editCard/index.wxml b/pages/customer/editCard/index.wxml index e58bf43..82f44a4 100644 --- a/pages/customer/editCard/index.wxml +++ b/pages/customer/editCard/index.wxml @@ -10,7 +10,7 @@ 手机号码 - + + + 重点关注车型 + + + {{brand_name||'请选择'}} + 请选择 + + + + + + 车系车型 + + + 请选择 + {{modelArray[modelIndex]}} + + + + @@ -172,4 +192,5 @@ - \ No newline at end of file + + \ No newline at end of file