From 5e04eb4f35f341891a2e8e02bb031fb1d03114cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Wed, 9 Mar 2022 17:49:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=BA=BF=E7=B4=A2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/customer/addCard/index.js | 110 ++++++++++++++++++++--------- pages/customer/addCard/index.wxml | 25 ++++--- pages/customer/detail/index.js | 2 - pages/customer/detail/index.wxml | 4 +- pages/customer/editCard/index.js | 107 ++++++++++++++++++++-------- pages/customer/editCard/index.wxml | 25 ++++--- pages/customer/index.js | 77 ++++++++++++++------ pages/customer/index.wxml | 64 ++++++++++------- 8 files changed, 280 insertions(+), 134 deletions(-) diff --git a/pages/customer/addCard/index.js b/pages/customer/addCard/index.js index bae2330..57f5fa3 100644 --- a/pages/customer/addCard/index.js +++ b/pages/customer/addCard/index.js @@ -19,16 +19,13 @@ Page({ levelIndex:-1,//车辆版本索引 timeArray:[],//预计购车时间列表 timeIndex:-1,//预计购车时间索引 - cf_clues:'',//线索来源 - cluesArray:[ - '自然进店', - '外展外拓', - '转介绍', - '垂直媒体', - '自媒体', - ],//线索来源 - cluesIndex:-1,//索来源索引 submitFlag:false, + + status:'',//状态 + of_id:'', + of2_id:'', + of1Index:-1, + of2Index:-1, }, //生命周期函数--监听页面加载 onLoad: function (options) { @@ -39,6 +36,7 @@ Page({ } this.getAppSeriesBrands() this.getAppCustomersFilter() + this.getAppCustomersOffline_sources() }, //获取车型品牌 @@ -219,14 +217,6 @@ Page({ } }, - //线索来源 - changeClues(e) { - this.setData({ - cf_clues:this.data.cluesArray[e.detail.value], - cluesIndex:e.detail.value, - }) - }, - //预计购车时间 changeTime(e) { this.setData({ @@ -276,8 +266,11 @@ Page({ if(this.data.b_s_id != ''){ params['b_s_id'] = this.data.b_s_id; } - if(this.data.cf_clues != ''){ - params['cf_clues'] = this.data.cf_clues; + if(this.data.of_id != ''){ + params['of_id'] = this.data.of_id; + } + if(this.data.of2_id != ''){ + params['of2_id'] = this.data.of2_id; } if(this.data.buy_time != ''){ params['buy_time'] = this.data.buy_time; @@ -304,20 +297,30 @@ Page({ success(res) { if (res.confirm) { that.setData({ - name:'', - mobile:'', - car_id:'', - v_id:'', - color_id:'', - b_s_id:'', - cf_clues:'', - buy_time:'', - modelIndex:-1, - spareIndex:-1, - colorIndex:-1, - levelIndex:-1, - timeIndex:-1, + name:'',//名字 + mobile:'',//手机号 + brand_id:'',//品牌 + car_id:'',//车系id + v_id:'',//车辆版本id + color_id:'',//颜色id + b_s_id:'',//备选车型id + buy_time:'',//预计购车时间 + brandIndex:-1,//车辆品牌索引 + modelIndex:-1,//车系车型索引 + spareIndex:-1,//备选车型索引 + colorArray:[],//车身颜色列表 + levelArray:[],//车辆版本列表 + colorIndex:-1,//车身颜色索引 + levelIndex:-1,//车辆版本索引 + timeArray:[],//预计购车时间列表 + timeIndex:-1,//预计购车时间索引 submitFlag:false, + + status:'',//状态 + of_id:'', + of2_id:'', + of1Index:-1, + of2Index:-1, }) } else if (res.cancel) { wx.navigateBack({ @@ -335,4 +338,47 @@ Page({ } }, + //线索来源 + getAppCustomersOffline_sources(){ + let params = {}; + if(this.data.status != ''){ + params['status'] = this.data.status; + } + _.apiQuery.getAppCustomersOffline_sources(params).then(res => { + let of1Arr = [] + res.data.forEach(item => { + of1Arr.push(item.name) + }) + this.setData({ + of1Arr, + sources:res.data + }) + }); + }, + + //线索来源 + changeOf1(e) { + if(this.data.of1Index!=e.detail.value){ + let of2Arr = [] + this.data.sources[e.detail.value].list.forEach(item => { + of2Arr.push(item.name) + }) + this.setData({ + of2Arr, + of2Index:-1, + of_id:this.data.sources[e.detail.value].id, + of1Index:e.detail.value, + }) + } + }, + + changeOf2(e) { + if(this.data.of2Index!=e.detail.value){ + this.setData({ + of2_id:this.data.sources[this.data.of1Index].list[e.detail.value].id, + of2Index:e.detail.value, + }) + } + }, + }) \ No newline at end of file diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index 71a4c74..562ee68 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -25,7 +25,7 @@ 车系车型 - + 请选择 {{modelArray[modelIndex]}} @@ -35,7 +35,7 @@ 车辆版本 - + 请选择 {{levelArray[levelIndex]}} @@ -45,7 +45,7 @@ 车身颜色 - + 请选择 {{colorArray[colorIndex]}} @@ -65,13 +65,20 @@ --> 线索来源 - - - 请选择 - {{cluesArray[cluesIndex]}} + + 请选择 + {{of1Arr[of1Index]}} + + + + + + {{sources[of1Index].name}} + + + 请选择 + {{of2Arr[of2Index]}} diff --git a/pages/customer/detail/index.js b/pages/customer/detail/index.js index 35a821c..e04ad92 100644 --- a/pages/customer/detail/index.js +++ b/pages/customer/detail/index.js @@ -45,7 +45,6 @@ Page({ levelArray:[],//车辆版本列表 colorIndex:-1,//车身颜色索引 levelIndex:-1,//车辆版本索引 - cf_clues:'',//线索来源 defeat_reason:'',//战败理由 submitFlag:false, @@ -108,7 +107,6 @@ Page({ name:res.data.baseinfo.name.value?res.data.baseinfo.name.value:'', mobile:res.data.baseinfo.mobile.value?res.data.baseinfo.mobile.value:'', buy_time:res.data.baseinfo.buy_time.value?res.data.baseinfo.buy_time.value:'', - cf_clues:res.data.baseinfo.cf_clues.value?res.data.baseinfo.cf_clues.value:'', }) /*匹配数据*/ diff --git a/pages/customer/detail/index.wxml b/pages/customer/detail/index.wxml index dd2680c..850da00 100644 --- a/pages/customer/detail/index.wxml +++ b/pages/customer/detail/index.wxml @@ -89,9 +89,7 @@ 线索来源 - - {{cf_clues}} - + {{baseinfo.of_id.value}} 预计购车时间 diff --git a/pages/customer/editCard/index.js b/pages/customer/editCard/index.js index b8c9ed9..0e16b2f 100644 --- a/pages/customer/editCard/index.js +++ b/pages/customer/editCard/index.js @@ -17,16 +17,12 @@ Page({ levelIndex:-1,//车辆版本索引 timeArray:[],//预计购车时间列表 timeIndex:-1,//预计购车时间索引 - cf_clues:'',//线索来源 - cluesArray:[ - '自然进店', - '外展外拓', - '转介绍', - '垂直媒体', - '自媒体', - ],//线索来源 - cluesIndex:-1,//索来源索引 submitFlag:false, + + of_id:'', + of2_id:'', + of1Index:-1, + of2Index:-1, }, //生命周期函数--监听页面加载 onLoad: function (options) { @@ -47,23 +43,15 @@ Page({ baseinfo:res.data.baseinfo, name:res.data.baseinfo.name.value?res.data.baseinfo.name.value:'', mobile:res.data.baseinfo.mobile.value?res.data.baseinfo.mobile.value:'', - cf_clues:res.data.baseinfo.cf_clues.value?res.data.baseinfo.cf_clues.value:'', + of_id:res.data.baseinfo.of_id.of_id?res.data.baseinfo.of_id.of_id:'', + of2_id:res.data.baseinfo.of_id.of2_id?res.data.baseinfo.of_id.of2_id:'', }) - if(res.data.baseinfo.cf_clues.value){ - this.data.cluesArray.forEach((item,index) => { - if(item == res.data.baseinfo.cf_clues.value){ - this.setData({ - cluesIndex:index, - }) - } - }) - } - //编辑基础信息使用 this.getAppSeriesBrands() this.getAppSeriesedit() this.getAppCustomersFilter() + this.getAppCustomersOffline_sources() }) }, @@ -364,14 +352,6 @@ Page({ } }, - //线索来源 - changeClues(e) { - this.setData({ - cf_clues:this.data.cluesArray[e.detail.value], - cluesIndex:e.detail.value, - }) - }, - //预计购车时间 changeTime(e) { this.setData({ @@ -409,7 +389,7 @@ Page({ title: '请选择车身颜色', icon: 'none' }) - } else if(that.data.name==that.data.baseinfo.name.value&&that.data.mobile==that.data.baseinfo.mobile.value&&that.data.cf_clues==that.data.baseinfo.cf_clues.value&&that.data.car_id==that.data.baseinfo.car_id.value&&that.data.v_id==that.data.baseinfo.v_id.value&&that.data.color_id==that.data.baseinfo.color_id.value&&that.data.buy_time==that.data.baseinfo.buy_time.value){ + } else if(that.data.name==that.data.baseinfo.name.value&&that.data.mobile==that.data.baseinfo.mobile.value&&that.data.of_id==that.data.baseinfo.of_id.of_id&&that.data.of2_id==that.data.baseinfo.of_id.of2_id&&that.data.car_id==that.data.baseinfo.car_id.value&&that.data.v_id==that.data.baseinfo.v_id.value&&that.data.color_id==that.data.baseinfo.color_id.value&&that.data.buy_time==that.data.baseinfo.buy_time.value){ wx.showToast({ title: '好像没改什么', icon: 'none' @@ -427,8 +407,11 @@ Page({ if(that.data.mobile != that.data.baseinfo.mobile.value){ params['mobile'] = that.data.mobile; } - if(that.data.cf_clues != that.data.baseinfo.cf_clues.value){ - params['cf_clues'] = that.data.cf_clues; + if(that.data.of_id != that.data.baseinfo.of_id.of_id){ + params['of_id'] = that.data.of_id; + } + if(that.data.of2_id != that.data.baseinfo.of_id.of2_id){ + params['of2_id'] = that.data.of2_id; } if(that.data.car_id != that.data.baseinfo.car_id.value){ params['car_id'] = that.data.car_id; @@ -490,4 +473,66 @@ Page({ } }, + //线索来源 + getAppCustomersOffline_sources(){ + _.apiQuery.getAppCustomersOffline_sources().then(res => { + let of1Arr = [] + res.data.forEach(item => { + of1Arr.push(item.name) + }) + this.setData({ + of1Arr, + sources:res.data + }) + if(this.data.of_id != ''){ + res.data.forEach((item,index) => { + if(item.id == this.data.of_id){ + this.setData({ + of1Index:index, + }) + } + }) + if(this.data.of2Index != ''){ + let of2Arr = [] + res.data[this.data.of1Index].list.forEach((item,index) => { + of2Arr.push(item.name) + if(item.id == this.data.of2_id){ + this.setData({ + of2Index:index, + }) + } + }) + this.setData({ + of2Arr, + }) + } + } + }); + }, + + //线索来源 + changeOf1(e) { + if(this.data.of1Index!=e.detail.value){ + let of2Arr = [] + this.data.sources[e.detail.value].list.forEach(item => { + of2Arr.push(item.name) + }) + this.setData({ + of2Arr, + of2Index:-1, + of_id:this.data.sources[e.detail.value].id, + of1Index:e.detail.value, + }) + } + }, + + changeOf2(e) { + if(this.data.of2Index!=e.detail.value){ + this.setData({ + of2_id:this.data.sources[this.data.of1Index].list[e.detail.value].id, + of2Index:e.detail.value, + }) + } + }, + }) \ No newline at end of file diff --git a/pages/customer/editCard/index.wxml b/pages/customer/editCard/index.wxml index 63d1142..8dff7da 100644 --- a/pages/customer/editCard/index.wxml +++ b/pages/customer/editCard/index.wxml @@ -25,7 +25,7 @@ 车系车型 - + 请选择 {{modelArray[modelIndex]}} @@ -35,7 +35,7 @@ 车辆版本 - + 请选择 {{levelArray[levelIndex]}} @@ -45,7 +45,7 @@ 车身颜色 - + 请选择 {{colorArray[colorIndex]}} @@ -55,13 +55,20 @@ 线索来源 - - - 请选择 - {{cluesArray[cluesIndex]}} + + 请选择 + {{of1Arr[of1Index]}} + + + + + + {{sources[of1Index].name}} + + + 请选择 + {{of2Arr[of2Index]}} diff --git a/pages/customer/index.js b/pages/customer/index.js index d1cd6c6..13a2116 100644 --- a/pages/customer/index.js +++ b/pages/customer/index.js @@ -61,19 +61,15 @@ Page({ content:'',//短信内容 isRefresh:false,//判断返回是否需要刷新 isShowMobile: false, - cf_clues:'',//线索来源 - cluesArray:[ - '自然进店', - '外展外拓', - '转介绍', - '垂直媒体', - '自媒体', - ],//线索来源 - cluesIndex:-1,//索来源索引 staffArray: [], staffobj: [], staffIndex:-1, - userInfo:app.getStorageByKey("userInfo") + userInfo:app.getStorageByKey("userInfo"), + + of_id:'', + of2_id:'', + of1Index:-1, + of2Index:-1, }, onLoad(options) { for (let key in options) { @@ -85,6 +81,7 @@ Page({ this.getAppCustomersFilter() this.getAppSeriesBrands() this.getAppUserAdmins() + this.getAppCustomersOffline_sources() }, onShow(){ @@ -233,8 +230,11 @@ Page({ if(this.data.o_type != ''){ params['o_type'] = this.data.o_type; } - if(this.data.cf_clues != ''){ - params['cf_clues'] = this.data.cf_clues; + if(this.data.of_id != ''){ + params['of_id'] = this.data.of_id; + } + if(this.data.of2_id != ''){ + params['of2_id'] = this.data.of2_id; } if(this.data.staffIndex>-1){ params['admin_id'] = this.data.staffobj[this.data.staffIndex].id; @@ -484,14 +484,6 @@ Page({ }) }, - //线索来源 - changeClues(e) { - this.setData({ - cf_clues:this.data.cluesArray[e.detail.value], - cluesIndex:e.detail.value, - }) - }, - //显示高级搜索 optfilter(){ this.setData({ @@ -521,14 +513,16 @@ Page({ brand_id:'', s_id:'', cfrom:'', - cf_clues:'',//线索来源 + of_id:'', + of2_id:'', + of1Index:-1, + of2Index:-1, timeSlotIndex:-1, testDriveIndex:-1, levelIndex:-1, brandIndex:-1, modelIndex:-1, cfromIndex:-1, - cluesIndex:-1,//索来源索引 staffIndex:-1, }) }, @@ -593,6 +587,45 @@ Page({ } }, + //线索来源 + getAppCustomersOffline_sources(){ + _.apiQuery.getAppCustomersOffline_sources().then(res => { + let of1Arr = [] + res.data.forEach(item => { + of1Arr.push(item.name) + }) + this.setData({ + of1Arr, + sources:res.data + }) + }); + }, + + //线索来源 + changeOf1(e) { + if(this.data.of1Index!=e.detail.value){ + let of2Arr = [] + this.data.sources[e.detail.value].list.forEach(item => { + of2Arr.push(item.name) + }) + this.setData({ + of2Arr, + of2Index:-1, + of_id:this.data.sources[e.detail.value].id, + of1Index:e.detail.value, + }) + } + }, + + changeOf2(e) { + if(this.data.of2Index!=e.detail.value){ + this.setData({ + of2_id:this.data.sources[this.data.of1Index].list[e.detail.value].id, + of2Index:e.detail.value, + }) + } + }, + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml index 3f64a45..b51675f 100644 --- a/pages/customer/index.wxml +++ b/pages/customer/index.wxml @@ -29,9 +29,9 @@ - + - 客户建卡 + 客户建卡 @@ -95,29 +95,29 @@ - - + + 客户编号 - + 客户姓名 - + 手机号码 - + 建卡开始时间 - + 请选择 {{s_time}} @@ -127,7 +127,7 @@ 建卡结束时间 - + 请选择 {{e_time}} @@ -135,7 +135,7 @@ - + 常用时间段 @@ -145,7 +145,7 @@ - 意向等级 - + 请选择 {{filter.level[levelIndex]}} @@ -167,7 +167,7 @@ 车辆品牌 - + 请选择 {{brandArray[brandIndex]}} @@ -177,7 +177,7 @@ 车系车型 - + 请选择 {{modelArray[modelIndex]}} @@ -187,7 +187,7 @@ 客户来源 - + 请选择 {{filter.cfrom[cfromIndex]}} @@ -195,19 +195,31 @@ - - 线索来源 - - - 请选择 - {{cluesArray[cluesIndex]}} - - + + + 线索来源 + + + 请选择 + {{of1Arr[of1Index]}} + + + - + + {{sources[of1Index].name}} + + + 请选择 + {{of2Arr[of2Index]}} + + + + + 销售顾问 - + 请选择 {{staffArray[staffIndex]}}