From 95bfc1f07503b7b7a572eea4a77db67d8a1744b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Fri, 20 May 2022 18:01:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E8=AE=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/css/base/layout.wxss | 6 +- commons/js/config.js | 2 +- pages/customer/addCard/index.js | 8 ++ pages/customer/addCard/index.wxml | 2 +- pages/customer/detail/index.js | 228 ++++++++++++++++++++++++++++-- pages/customer/detail/index.wxml | 105 ++++++++++---- 6 files changed, 302 insertions(+), 49 deletions(-) diff --git a/commons/css/base/layout.wxss b/commons/css/base/layout.wxss index 78f56f3..61efddd 100644 --- a/commons/css/base/layout.wxss +++ b/commons/css/base/layout.wxss @@ -44,7 +44,6 @@ .fn-flex-wrap{flex-wrap:wrap}/*多行*/ .fn-flex-around{justify-content: space-around;}/*各项周围留有空白*/ -.wp20{width:20%;box-sizing:border-box;} .wp25{width:25%;box-sizing:border-box;} .wp31{width:31%;box-sizing:border-box;} .wp33{width:33%;box-sizing:border-box;} @@ -130,4 +129,7 @@ .tabmenu{line-height:80rpx;} .tabmenu.active::before{display:block;position:absolute;bottom:0;left:50%;width:30rpx;height:4rpx;margin-left:-15rpx;content:"";background-color:#36afa2;} -.safe-pb{padding-bottom:calc(constant(safe-area-inset-bottom) - 15px );padding-bottom:calc(env(safe-area-inset-bottom) - 15px);} \ No newline at end of file +.safe-pb{padding-bottom:calc(constant(safe-area-inset-bottom) - 15px );padding-bottom:calc(env(safe-area-inset-bottom) - 15px);} + +.datecell{width:14.28%;padding:30rpx 0;text-align:center;box-sizing:border-box;} +.datecell.active{background-color:#36afa2;color:#fff;} \ No newline at end of file diff --git a/commons/js/config.js b/commons/js/config.js index 3faaa85..dae53ac 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -1,4 +1,4 @@ -const env = "p"; +const env = "d"; const version = 1, diff --git a/pages/customer/addCard/index.js b/pages/customer/addCard/index.js index 6e3af42..0753ca9 100644 --- a/pages/customer/addCard/index.js +++ b/pages/customer/addCard/index.js @@ -46,6 +46,13 @@ Page({ this.getAppCustomersOffline_sources() //客户标签 this.getAppCustomersTag() + + if(this.data.status == 1){ + this.setData({ + buy_time:3, + }) + } + }, //获取车型品牌 @@ -156,6 +163,7 @@ Page({ of2Index:-1, of2Arr:[], status:e.detail.value, + buy_time:e.detail.value==1?'3':'', }) this.getAppCustomersOffline_sources() } diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index 4f85559..6149402 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -92,7 +92,7 @@ - + 预计购车时间 diff --git a/pages/customer/detail/index.js b/pages/customer/detail/index.js index b895892..aa4d905 100644 --- a/pages/customer/detail/index.js +++ b/pages/customer/detail/index.js @@ -37,7 +37,14 @@ Page({ order:[],//客户订单 levelIndex:-1, - level: ["H", "A", "B", "C", "D"]//等级 + level: [],//等级 + + followIndex:-1, + follow: [],//跟进渠道 + isShowTimePicker:false, + weekList:['日','一','二','三','四','五','六'], + dateList:[], + nextIndex:-1,//下次回访时间 }, onLoad(options) { for (let key in options) { @@ -50,11 +57,14 @@ Page({ this.getAppCustomerData() this.getAppCustomerlogs() this.getAppCustomersTag() + this.getAppCustomersFilter() innerAudioContext.onEnded(() => { this.offaudio() }) + this.getTimePicker() + }, onshow() { @@ -70,6 +80,83 @@ Page({ this.offaudio() }, + //候取当前月日历 + getTimePicker(){ + let date = new Date(); + let cYear = date.getFullYear(); //年份 + let cMonth = date.getMonth()+1; //当前月份 + let cDay = date.getDate();//当前日期 + let fweek = new Date(cYear,cMonth-1,1).getDay();//本月第一天星期几 + let days = new Date(cYear,cMonth,-1) + let cn = days.getDate()+1 //当月天数 + let rn = ''//上个月天数 + if (cMonth === 1) { + rn = 31 + } else { + rn = new Date(cYear,cMonth-1,-1).getDate()+1 + } + + let dateList = [] + for(let i=0;i13){//相差14天以上不用特意补下个月 + let lweek = new Date(cYear,cMonth-1,cn).getDay();//本月最后天星期几 + let sbu = 6 - lweek //最后一周补齐 + for(let i=1;i<=sbu;i++){ + dateList.push({ + isopt:false, + checked:false, + year:cMonth == 12?cYear+1:cYear, + month:cMonth == 12?1:cMonth+1, + day:i + }) + } + }else{ + let zbu = 14 - (cn-cDay) //至少要补多少天 + let bweek = ''//至少要补的最后一天星期几 + if(cMonth==12){ + bweek = new Date(cYear+1,1,zbu).getDay() + }else{ + bweek = new Date(cYear,cMonth,zbu).getDay() + } + let sbu = zbu + 6 - bweek //最后一周补齐 + for(let i=1;i<=sbu;i++){ + dateList.push({ + isopt:false, + checked:false, + year:cMonth == 12?cYear+1:cYear, + month:cMonth == 12?1:cMonth+1, + day:i + }) + } + } + + this.setData({ + cYear, + cMonth, + cDay, + dateList, + }) + + }, + //获取客户详情 getAppCustomersDetails(){ let params = {}; @@ -77,17 +164,23 @@ Page({ _.apiQuery.getAppCustomersDetails(params).then(res=>{ this.setData({ detailinfo:res.data, - statuskey:res.data.status, + statuskey:res.data.status!=3?res.data.status:-10, }) if(res.data.level){ - this.data.level.forEach((item,index) => { - if(item == res.data.level){ - this.setData({ - levelIndex:index, - }) - } - }) + _.apiQuery.getAppCustomersFilter().then(res2 => { + let level = res2.data.level + this.setData({ + level:res2.data.level, + }) + level.forEach((item,index) => { + if(item == res.data.level){ + this.setData({ + levelIndex:index, + }) + } + }) + }); } if(res.data.status==2){ @@ -112,7 +205,6 @@ Page({ //获取客户订单 getAppCusorderV2Customer(){ - console.log('获取客户订单') let params = {}; params['customer_id'] = this.data.id; _.apiQuery.getAppCusorderV2Customer(params).then(res=>{ @@ -227,6 +319,8 @@ Page({ if(e.currentTarget.dataset.key != this.data.statuskey){ this.setData({ statuskey:e.currentTarget.dataset.key, + levelIndex:-1, + followIndex:-1, }) if(e.currentTarget.dataset.key == 0){ this.setData({ @@ -238,12 +332,22 @@ Page({ this.setData({ defeat_reason:'',//战败理由 }) + if(this.data.detailinfo.status==0){ + this.data.level.forEach((item,index) => { + if(item == 'H'){ + this.setData({ + levelIndex:index, + }) + } + }) + } }else if(e.currentTarget.dataset.key == 3){ this.setData({ a_num:'',//到店次数 t_num:'',//试驾次数 note:'',//日志 photos:[], + nextIndex:-1, }) } } @@ -272,17 +376,37 @@ Page({ //修改状态和到店次数、试驾次数 putAppCustomers(e){ - if(this.data.statuskey == -10 && this.data.photos.length == 0 && this.data.note == ''&& this.data.levelIndex>-1&&this.data.level[this.data.levelIndex]==this.data.detailinfo.level){ + if(this.data.statuskey == -10){ wx.showToast({ - title: '您还没进行任何操作', + title: '请选择状态', icon: 'none' }) - }else if(this.data.photos.length>0&&this.data.note == ''){ + } + else if((this.data.statuskey==0||this.data.statuskey==1)&&this.data.followIndex == -1){ + wx.showToast({ + title: '请选择跟进渠道', + icon: 'none' + }) + } + else if((this.data.statuskey==0||this.data.statuskey==1)&&this.data.followIndex == -1){ + wx.showToast({ + title: '请选择客户等级', + icon: 'none' + }) + } + else if((this.data.statuskey==0||this.data.statuskey==1)&&this.data.nextIndex == -1){ + wx.showToast({ + title: '请选择下次回访时间', + icon: 'none' + }) + } + else if(this.data.statuskey != 3&&this.data.note == ''){ wx.showToast({ title: '请填写小记', icon: 'none' }) - }else if(this.data.statuskey == 3&&this.data.defeat_reason == ''){ + } + else if(this.data.statuskey == 3&&this.data.defeat_reason == ''){ wx.showToast({ title: '请填写战败理由', icon: 'none' @@ -316,6 +440,12 @@ Page({ if(this.data.levelIndex>-1){ params['level'] = this.data.level[this.data.levelIndex]; } + if(this.data.followIndex>-1){ + params['follow_channel'] = this.data.follow[this.data.followIndex]; + } + if(this.data.nextIndex>-1){ + params['visit_time'] = this.data.dateList[this.data.nextIndex].year +'-'+ this.data.dateList[this.data.nextIndex].month +'-'+ this.data.dateList[this.data.nextIndex].day; + } _.apiQuery.putAppCustomers(params).then(res=>{ this.setData({ isShowNote:false,//新增日志弹窗 @@ -607,8 +737,76 @@ Page({ //客户等级 changeLevel(e) { if(this.data.levelIndex != e.detail.value && e.detail.value >= 0){ + if(this.data.detailinfo.level == 'H'&&e.detail.value==2){ + wx.showToast({ + title: 'H级客户不可直接降为B级', + icon: 'none' + }) + }else{ + this.setData({ + levelIndex:e.detail.value, + }) + } + } + }, + + //跟进渠道 + changeFollow(e) { + if(this.data.followIndex != e.detail.value && e.detail.value >= 0){ this.setData({ - levelIndex:e.detail.value, + followIndex:e.detail.value, + }) + } + }, + + //获取跟进渠道、客户等级 + getAppCustomersFilter(){ + _.apiQuery.getAppCustomersFilter().then(res => { + this.setData({ + follow:res.data.follow_channel, + level:res.data.level, + }) + }); + }, + + + //显示隐藏时间选择器 + optShowTimePicker(){ + this.setData({ + isShowTimePicker:!this.data.isShowTimePicker, + }) + + let kd = '' //可操作天数 + if(this.data.level[this.data.levelIndex]=='H'){ + kd = 3 + }else if(this.data.level[this.data.levelIndex]=='A'){ + kd = 7 + }else if(this.data.level[this.data.levelIndex]=='B'){ + kd = 15 + } + let cindex = '' + let dateList = this.data.dateList + dateList.forEach((item,index) => { + if(item.day == this.data.cDay){ + cindex = index + } + }) + dateList.forEach((item,index) => { + if(cindex<=index&&index + + + + 下次回访时间 + + + + + {{item}} + + + + + + {{item.day}} + + + + + + @@ -161,47 +193,57 @@ - - - - 未见客户 - 到店客户 + + 未见客户 + 到店客户 + + + 未见客户 + 到店客户 + 战败客户 + + + + 跟进渠道 + + 请选择 + {{follow[followIndex]}} + + - -