diff --git a/app.js b/app.js index 37499cc..ce8d956 100644 --- a/app.js +++ b/app.js @@ -43,7 +43,6 @@ App({ this.errorPageRedirect('/pages/index/index', '抱歉,该页面已迁移,请在搜索页查询...') } else if (res.path == 'pages/card/card' || res.path == 'pages/mine/mine') { - console.log(1) this.errorPageRedirect('/pages/mine/index') } else { this.errorPageRedirect('/pages/index/index', '抱歉,该页面无法访问,正在回到首页...') @@ -67,7 +66,6 @@ App({ try { wx.setStorageSync(key, data); this.globalData[key] = data; - // console.log(`Method:setStorage(success)`); callback(data) } catch (e) { reject(e) @@ -134,7 +132,6 @@ App({ const updateManager = wx.getUpdateManager() updateManager.onCheckForUpdate(function (res) { // 请求完新版本信息的回调 - console.log(res.hasUpdate) }) updateManager.onUpdateReady(function () { wx.showModal({ diff --git a/app.json b/app.json index ab7571c..bb34e2d 100644 --- a/app.json +++ b/app.json @@ -75,7 +75,7 @@ }, "plugins": { "contactPlugin": { - "version": "1.4.0", + "version": "1.4.1", "provider": "wx104a1a20c3f81ec2" } } diff --git a/commons/js/lib/popularData.js b/commons/js/lib/popularData.js new file mode 100644 index 0000000..a74042c --- /dev/null +++ b/commons/js/lib/popularData.js @@ -0,0 +1,18 @@ +//常用时间 /start 距离当前时间几天前,later往前延续几天 +let getDateLater = function(start=0,later=0) { + return new Promise(function (resolve, reject) { + let dateArr = []; + let date = new Date(); + date.setDate(date.getDate() - start); + let todate = date.getFullYear() + "-" + ((date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : date.getMonth()+1) + "-" + (date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()); + date.setDate(date.getDate() - later); + let laterdate = date.getFullYear() + "-" + ((date.getMonth() + 1) < 10 ? ("0" + (date.getMonth() + 1)) : date.getMonth()+1) + "-" + (date.getDate() < 10 ? ("0" + date.getDate()) : date.getDate()); + dateArr.push(laterdate) + dateArr.push(todate) + resolve(dateArr); + }) +} + +module.exports = { + getDateLater, +} \ No newline at end of file diff --git a/commons/js/utils/httpRequest.js b/commons/js/utils/httpRequest.js index b2f4b2a..6c27a20 100644 --- a/commons/js/utils/httpRequest.js +++ b/commons/js/utils/httpRequest.js @@ -28,7 +28,6 @@ function HttpNoUkeyRequest(loading, url, sessionChoose, params, method, callBack header: paramSession, method: method, success: function (res) { - // console.log(res.data); if (loading == true) { wx.hideLoading(); //隐藏提示框 } @@ -94,7 +93,6 @@ function HttpRequest(loading, url, sessionChoose, params, method, callBack, reje header: paramSession, method: method, success: function (res) { - // console.log(res.data); if (loading == true) { wx.hideLoading(); //隐藏提示框 } diff --git a/pages/customer/index.js b/pages/customer/index.js index 1a9592c..7170a3a 100644 --- a/pages/customer/index.js +++ b/pages/customer/index.js @@ -1,4 +1,5 @@ import _ from '../../commons/js/commons' +import popularData from '../../commons/js/lib/popularData'; const app = getApp() Page({ data: { @@ -21,7 +22,7 @@ Page({ isShowMessage:false, - isShowSort:true, + isShowfilter:true, timeSlotIndex:-1, timeSlot:[ @@ -53,8 +54,12 @@ Page({ sortList:['建卡日期','最近联系','特别关注',], sortListIndex:0, + + levelIndex:-1, + modelIndex:-1, + cfromlndex:-1, }, - onLoad: function (options) { + onLoad(options) { for (let key in options) { this.setData({ [key]: options[key] @@ -62,6 +67,12 @@ Page({ } this.getAppCustomersTabs() this.getAppCustomersFilter() + this.getAppSeriesCars() + + }, + + onShow(){ + this.getDateLater() }, //客户-tab @@ -87,6 +98,22 @@ Page({ }); }, + //获取车型库 + getAppSeriesCars(){ + _.apiQuery.getAppSeriesCars().then(res => { + if(res.data.length>0){ + let modelArray = [] + res.data.forEach(item => { + modelArray.push(item.title) + }) + this.setData({ + modelArray:modelArray, + modelList:res.data, + }) + } + }); + }, + //获取客户列表 getAppCustomers() { this.setData({ @@ -147,6 +174,29 @@ Page({ }); }, + getDateLater(){ + popularData.getDateLater(0,0).then(res => { + this.setData({ + today:res, + }) + }) + popularData.getDateLater(1,0).then(res => { + this.setData({ + tomorrow:res, + }) + }) + popularData.getDateLater(0,6).then(res => { + this.setData({ + last7:res, + }) + }) + popularData.getDateLater(0,29).then(res => { + this.setData({ + last30:res, + }) + }) + }, + //切换tab changeTab(e){ this.setData({ @@ -207,61 +257,44 @@ Page({ //建卡时间 startDate(e){ this.setData({ - s_time: e.detail.value + s_time: e.detail.value, }) - this.searchSubmit() + this.matchDate() }, - - bindEndDateChange: function(e) { + //建卡时间 + endDate(e){ this.setData({ - r_time: e.detail.value + e_time: e.detail.value, }) - this.searchSubmit() + this.matchDate() }, - //状态tab - getCustomerStatus(){ - let params = {}; - params['type'] = this.data.type; - _.apiQuery.getCustomerStatus(params).then(res=>{ - + //匹配选择时间是否等于常用时间 + matchDate(){ + this.setData({ + timeSlotIndex:-1, + }) + if(this.data.s_time == this.data.today[0] && this.data.e_time == this.data.today[1] ){ this.setData({ - if_ub:res.data.rolevel, - tab:res.data.list, - status_pid: this.data.status_pid == -2?res.data.list[0].id:this.data.status_pid + timeSlotIndex:0, }) - - this.searchSubmit() - }) - }, - - //选择标签 - changeTag(e){ - this.setData({ - tag_id: e.currentTarget.dataset.id, - }) - this.searchSubmit() - }, - - bindUserPicker(e) { - this.setData({ - userindex: e.detail.value - }) - }, - - //隐藏高级搜索 - hidesearch() { - this.setData({ - isShowSort: false - }) - }, - - //显示高级搜索 - showSort(){ - this.setData({ - isShowSort: !this.data.isShowSort - }) + } + if(this.data.s_time == this.data.tomorrow[0] && this.data.e_time == this.data.tomorrow[1] ){ + this.setData({ + timeSlotIndex:1, + }) + } + if(this.data.s_time == this.data.last7[0] && this.data.e_time == this.data.last7[1] ){ + this.setData({ + timeSlotIndex:2, + }) + } + if(this.data.s_time == this.data.last30[0] && this.data.e_time == this.data.last30[1] ){ + this.setData({ + timeSlotIndex:3, + }) + } }, //单选 @@ -270,13 +303,118 @@ Page({ this.setData({ timeSlotIndex:e.currentTarget.dataset.index, }) + switch (e.currentTarget.dataset.index) { + case 0: + this.setData({ + s_time:this.data.today[0], + e_time:this.data.today[1], + }) + break; + case 1: + this.setData({ + s_time:this.data.tomorrow[0], + e_time:this.data.tomorrow[1], + }) + break; + case 2: + this.setData({ + s_time:this.data.last7[0], + e_time:this.data.last7[1], + }) + break; + case 3: + this.setData({ + s_time:this.data.last30[0], + e_time:this.data.last30[1], + }) + break; + } } else if(e.currentTarget.dataset.type == 'testDrive'){ + let if_driver = '' + if(e.currentTarget.dataset.index == 1){ + if_driver = 1 + }else if(e.currentTarget.dataset.index == 2){ + if_driver = 0 + } this.setData({ + if_driver:if_driver, testDriveIndex:e.currentTarget.dataset.index, }) } }, + //客户顶级 + changeLevel(e){ + + let level = '' + if(e.detail.value >= 0){ + level = this.data.filter.level[e.detail.value] + } + + this.setData({ + level:level, + levelIndex: e.detail.value, + }) + }, + + //选择车型 + changeModel(e) { + let s_id = '' + if(e.detail.value >= 0){ + s_id = this.data.modelList[e.detail.value].id + } + this.setData({ + s_id:s_id, + modelIndex:e.detail.value, + }) + }, + + //客户来源 + changeCfrom(e){ + + let cfrom = '' + if(e.detail.value >= 0){ + cfrom = this.data.filter.cfrom[e.detail.value] + } + + this.setData({ + cfrom:cfrom, + cfromIndex: e.detail.value, + }) + }, + + //显示高级搜索 + showfilter(){ + this.setData({ + isShowfilter: !this.data.isShowfilter + }) + }, + + //确定高级搜索 + submitFilter() { + this.setData({ + isShowfilter:false, + }) + this.searchSubmit() + }, + + //重置高级搜索 + resetFilter() { + this.setData({ + s_time:'', + e_time:'', + if_driver:'', + level:'', + s_id:'', + cfrom:'', + timeSlotIndex:-1, + testDriveIndex:-1, + levelIndex:-1, + modelIndex:-1, + cfromlndex:-1, + }) + }, + //显示短信弹框 showMessage(e){ this.setData({ diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml index 4c715e3..215f5fc 100644 --- a/pages/customer/index.wxml +++ b/pages/customer/index.wxml @@ -29,7 +29,7 @@ - + 客户建卡 @@ -89,7 +89,7 @@ - + @@ -105,9 +105,9 @@ 建卡结束时间 - - 请选择 - {{c_time}} + + 请选择 + {{e_time}} @@ -135,34 +135,34 @@ 意向等级 - - 请选择 - {{c_time}} - + + 请选择 + {{filter.level[levelIndex]}} + 品牌车型 - - 请选择 - {{c_time}} - + + 请选择 + {{modelArray[modelIndex]}} + 客户来源 - - 请选择 - {{c_time}} - + + 请选择 + {{filter.cfrom[cfromlndex]}} + - + - 重置 - 确定 + 重置 + 确定 - \ No newline at end of file + \ No newline at end of file