From dbf02638edd2889890e7fd7c79500bf368c75716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Mon, 4 Jul 2022 11:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=86=E9=85=8D=EF=BC=8C?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=9F=8E=E5=B8=82=E5=9C=B0=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/js/config.js | 2 + commons/js/utils/apiQuery.js | 7 +++ pages/customer/addCard/index.js | 90 ++++++++++++++++++++++++++++ pages/customer/addCard/index.wxml | 20 +++++++ pages/customer/allot/index.js | 62 +++++++++++++++++-- pages/customer/allot/index.wxml | 43 +++++++++---- pages/customer/editCard/index.js | 89 +++++++++++++++++++++++++++ pages/customer/editCard/index.wxml | 22 ++++++- pages/customer/filterList/index.js | 61 +++++++++++++++++-- pages/customer/filterList/index.wxml | 49 ++++++++++----- pages/customer/index.js | 60 +++++++++++++++++-- pages/customer/index.wxml | 49 ++++++++++----- 12 files changed, 496 insertions(+), 58 deletions(-) diff --git a/commons/js/config.js b/commons/js/config.js index 869d55c..474ba62 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -143,6 +143,8 @@ api = { appCustomersComments:'app/customers/comments', //用户评论 + appCityArea:'app/city/area', //获取省/市/区/街道 + diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index 544c359..b00d42a 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -861,5 +861,12 @@ apiQuery.postAppCustomersComments = function (params) { }) } +//获取省/市/区/街道 +apiQuery.getAppCityArea = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appCityArea, 2, params, "GET", resolve, reject) + }) +} + export default apiQuery; \ No newline at end of file diff --git a/pages/customer/addCard/index.js b/pages/customer/addCard/index.js index ee06997..dc0f99e 100644 --- a/pages/customer/addCard/index.js +++ b/pages/customer/addCard/index.js @@ -30,6 +30,11 @@ Page({ of2_id:'', of1Index:-1, of2Index:-1, + + cityIndex:-1, + city_id:'', + countyIndex:-1, + county_id:'', }, //生命周期函数--监听页面加载 onLoad: function (options) { @@ -283,6 +288,18 @@ Page({ icon: 'none' }) } + else if (that.data.city_id == '' ) { + wx.showToast({ + title: '请选择所在城市', + icon: 'none' + }) + } + else if (that.data.county_id == '' ) { + wx.showToast({ + title: '请选择所在地区', + icon: 'none' + }) + } else if (that.data.buy_time == '' ) { wx.showToast({ title: '请选择预计购车时间', @@ -326,6 +343,8 @@ Page({ if(this.data.of2_id != ''){ params['of2_id'] = this.data.of2_id; } + params['city_id'] = this.data.city_id; + params['county_id'] = this.data.county_id; params['buy_time'] = this.data.buy_time; _.apiQuery.postAppCustomers(params).then(res => { @@ -436,8 +455,14 @@ Page({ getAppCustomersTag(){ _.apiQuery.getAppCustomersTag().then(res => { this.setData({ + city_id:res.data.city_id, + county_id:res.data.county_id, taglList:res.data.tags&&res.data.tags.length>0?res.data.tags:[], }) + //获取城市 + this.getAppCityArea_city() + //获取地区 + this.getAppCityArea_county() }); }, @@ -460,4 +485,69 @@ Page({ }) }, + + //获取城市 + getAppCityArea_city(){ + let params = {}; + params['type'] = 'city'; + _.apiQuery.getAppCityArea(params).then(res => { + let cityArr = [] + let cityIndex = -1 + res.data.list.forEach((item,index) => { + cityArr.push(item.name) + if(this.data.city_id == item.id){ + cityIndex = index + } + }) + this.setData({ + cityIndex, + cityArr, + city:res.data.list + }) + }); + }, + + //获取行政区 + getAppCityArea_county(){ + let params = {}; + params['pid'] = this.data.city_id; + params['type'] = 'county'; + _.apiQuery.getAppCityArea(params).then(res => { + let countyArr = [] + let countyIndex = -1 + res.data.list.forEach((item,index) => { + countyArr.push(item.name) + if(this.data.county_id == item.id){ + countyIndex = index + } + }) + this.setData({ + countyIndex, + countyArr, + county:res.data.list + }) + }); + }, + + //选择城市 + changeCity(e) { + if(this.data.cityIndex!=e.detail.value){ + this.setData({ + cityIndex:e.detail.value, + city_id:this.data.city[e.detail.value].id, + }) + this.getAppCityArea_county() + } + }, + + //选择地区 + changeCounty(e) { + if(this.data.countyIndex!=e.detail.value){ + this.setData({ + countyIndex:e.detail.value, + county_id:this.data.county[e.detail.value].id, + }) + } + }, + }) \ No newline at end of file diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index d185760..d3ac558 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -94,6 +94,26 @@ + + 所在城市 + + + 请选择 + {{cityArr[cityIndex]}} + + + + + + 所在地区 + + + 请选择 + {{countyArr[countyIndex]}} + + + + 预计购车时间 diff --git a/pages/customer/allot/index.js b/pages/customer/allot/index.js index 1a04eab..d14800c 100644 --- a/pages/customer/allot/index.js +++ b/pages/customer/allot/index.js @@ -19,6 +19,12 @@ Page({ weekList:['日','一','二','三','四','五','六'], dateList:[], nextIndex:-1,//计划回访时间 + + distTabId:1, + distBizIndex:-1, + distBiz_id:'', + bizArray: [], + bizobj: [], }, onLoad(options) { for (let key in options) { @@ -108,10 +114,17 @@ Page({ res.data.list.forEach(item => { employeeArray.push(item.uname) }) + let bizArray = [] + res.data.bizs.forEach(item => { + bizArray.push(item.name) + }) this.setData({ employeeArray:employeeArray, employeeList:res.data.list, employeeIndex:-1, + distributetabs:res.data.tabs, + bizArray:bizArray, + bizobj: res.data.bizs, }) } wx.stopPullDownRefresh() @@ -134,6 +147,12 @@ Page({ optEmployees(){ this.setData({ isShowEmployees:!this.data.isShowEmployees, + employeeIndex:-1, + employee_id:'', + nextIndex:-1, + distTabId:1, + distBiz_id:'', + distBizIndex:-1, }) }, @@ -147,26 +166,37 @@ Page({ //分配客户 putAppCustomersAdmins(){ let that = this - if (that.data.employeeIndex == -1 ) { + if (that.data.distTabId==1&&that.data.employeeIndex == -1 ) { wx.showToast({ title: '请选择店员', icon: 'none' }) } - else if (that.data.nextIndex == -1 ) { + else if (that.data.distTabId==1&&that.data.nextIndex == -1 ) { wx.showToast({ title: '请选择计划回访时间', icon: 'none' }) } + else if (that.data.distTabId==2&&that.data.distBizIndex == -1 ) { + wx.showToast({ + title: '请选择门店', + icon: 'none' + }) + } else{ that.setData({ submitFlag: true, }) let params = {}; params['ids'] = that.data.ids; - params['admin_id'] = that.data.admin_id; - params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day; + if(that.data.distTabId==1){ + params['admin_id'] = that.data.admin_id; + params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day; + } + if(that.data.distTabId==2){ + params['biz_id'] = that.data.distBiz_id; + } _.apiQuery.putAppCustomersAdmins(params).then(res => { wx.showToast({ @@ -308,6 +338,30 @@ Page({ } }, + //切换分配本地,其他门店 + changeDistTab(e){ + this.setData({ + distTabId:e.currentTarget.dataset.id, + employeeIndex:-1, + employee_id:'', + nextIndex:-1, + distBiz_id:'', + distBizIndex:-1, + }) + }, + + //分配选择门店 + changeDistBiz(e) { + let distBiz_id = '' + if(e.detail.value >= 0){ + distBiz_id = this.data.bizobj[e.detail.value].id + } + this.setData({ + distBiz_id, + distBizIndex:e.detail.value, + }) + }, + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/customer/allot/index.wxml b/pages/customer/allot/index.wxml index 62f6607..d5eaea0 100644 --- a/pages/customer/allot/index.wxml +++ b/pages/customer/allot/index.wxml @@ -38,21 +38,38 @@ - - 销售顾问 - - 请选择 - {{employeeArray[employeeIndex]}} - - + + + {{item.name}} + - - 计划回访时间 - - 请选择 - {{dateList[nextIndex].year}}-{{dateList[nextIndex].month}}-{{dateList[nextIndex].day}} - + + + 销售顾问 + + 请选择 + {{employeeArray[employeeIndex]}} + + + + 计划回访时间 + + 请选择 + {{dateList[nextIndex].year}}-{{dateList[nextIndex].month}}-{{dateList[nextIndex].day}} + + + + + + 门店名称 + + + 请选择 + {{bizArray[distBizIndex]}} + + + diff --git a/pages/customer/editCard/index.js b/pages/customer/editCard/index.js index b91b756..c0acfc5 100644 --- a/pages/customer/editCard/index.js +++ b/pages/customer/editCard/index.js @@ -20,6 +20,11 @@ Page({ of2_id:'', of1Index:-1, of2Index:-1, + + cityIndex:-1, + city_id:'', + countyIndex:-1, + county_id:'', }, //生命周期函数--监听页面加载 onLoad: function (options) { @@ -350,6 +355,18 @@ Page({ icon: 'none' }) } + else if (that.data.city_id == '' ) { + wx.showToast({ + title: '请选择所在城市', + icon: 'none' + }) + } + else if (that.data.county_id == '' ) { + wx.showToast({ + title: '请选择所在地区', + icon: 'none' + }) + } // else if(that.data.car_id == '' ){ // wx.showToast({ // title: '请选择车系车型', @@ -392,6 +409,8 @@ Page({ if(that.data.of2_id != that.data.baseinfo.of_id.of2_id){ params['of2_id'] = that.data.of2_id; } + params['city_id'] = that.data.city_id; + params['county_id'] = that.data.county_id; // if(that.data.car_id != that.data.baseinfo.car_id.value){ // params['car_id'] = that.data.car_id; // } @@ -518,8 +537,14 @@ Page({ params['id'] = this.data.id; _.apiQuery.getAppCustomersTag(params).then(res => { this.setData({ + city_id:res.data.city_id, + county_id:res.data.county_id, taglList:res.data.tags&&res.data.tags.length>0?res.data.tags:[], }) + //获取城市 + this.getAppCityArea_city() + //获取地区 + this.getAppCityArea_county() }); }, @@ -542,4 +567,68 @@ Page({ }) }, + //获取城市 + getAppCityArea_city(){ + let params = {}; + params['type'] = 'city'; + _.apiQuery.getAppCityArea(params).then(res => { + let cityArr = [] + let cityIndex = -1 + res.data.list.forEach((item,index) => { + cityArr.push(item.name) + if(this.data.city_id == item.id){ + cityIndex = index + } + }) + this.setData({ + cityIndex, + cityArr, + city:res.data.list + }) + }); + }, + + //获取行政区 + getAppCityArea_county(){ + let params = {}; + params['pid'] = this.data.city_id; + params['type'] = 'county'; + _.apiQuery.getAppCityArea(params).then(res => { + let countyArr = [] + let countyIndex = -1 + res.data.list.forEach((item,index) => { + countyArr.push(item.name) + if(this.data.county_id == item.id){ + countyIndex = index + } + }) + this.setData({ + countyIndex, + countyArr, + county:res.data.list + }) + }); + }, + + //选择城市 + changeCity(e) { + if(this.data.cityIndex!=e.detail.value){ + this.setData({ + cityIndex:e.detail.value, + city_id:this.data.city[e.detail.value].id, + }) + this.getAppCityArea_county() + } + }, + + //选择地区 + changeCounty(e) { + if(this.data.countyIndex!=e.detail.value){ + this.setData({ + countyIndex:e.detail.value, + county_id:this.data.county[e.detail.value].id, + }) + } + }, + }) \ No newline at end of file diff --git a/pages/customer/editCard/index.wxml b/pages/customer/editCard/index.wxml index ad68408..cbf93a1 100644 --- a/pages/customer/editCard/index.wxml +++ b/pages/customer/editCard/index.wxml @@ -1,6 +1,6 @@ - + 客户姓名 @@ -75,6 +75,26 @@ + + 所在城市 + + + 请选择 + {{cityArr[cityIndex]}} + + + + + + 所在地区 + + + 请选择 + {{countyArr[countyIndex]}} + + + + diff --git a/pages/customer/filterList/index.js b/pages/customer/filterList/index.js index f285a5b..2499068 100644 --- a/pages/customer/filterList/index.js +++ b/pages/customer/filterList/index.js @@ -33,6 +33,12 @@ Page({ weekList:['日','一','二','三','四','五','六'], dateList:[], nextIndex:-1,//计划回访时间 + + distTabId:1, + distBizIndex:-1, + distBiz_id:'', + bizArray: [], + bizobj: [], }, onLoad(options) { for (let key in options) { @@ -253,9 +259,16 @@ Page({ res.data.list.forEach(item => { staffArray.push(item.uname) }) + let bizArray = [] + res.data.bizs.forEach(item => { + bizArray.push(item.name) + }) this.setData({ staffArray:staffArray, staffobj: res.data.list, + distributetabs:res.data.tabs, + bizArray:bizArray, + bizobj: res.data.bizs, }) }); }, @@ -277,6 +290,10 @@ Page({ employee_id:'', cid:[], optLevel:'', + nextIndex:-1, + distTabId:1, + distBiz_id:'', + distBizIndex:-1, }) } }, @@ -296,26 +313,37 @@ Page({ //分配客户 putAppCustomersAdmins(){ let that = this - if (that.data.employeeIndex == -1 ) { + if (that.data.distTabId==1&&that.data.employeeIndex == -1 ) { wx.showToast({ title: '请选择店员', icon: 'none' }) } - else if (that.data.nextIndex == -1 ) { + else if (that.data.distTabId==1&&that.data.nextIndex == -1 ) { wx.showToast({ title: '请选择计划回访时间', icon: 'none' }) } + else if (that.data.distTabId==2&&that.data.distBizIndex == -1 ) { + wx.showToast({ + title: '请选择门店', + icon: 'none' + }) + } else{ that.setData({ submitFlag: true, }) let params = {}; params['ids'] = that.data.cid; - params['admin_id'] = that.data.employee_id; - params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day; + if(that.data.distTabId==1){ + params['admin_id'] = that.data.employee_id; + params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day; + } + if(that.data.distTabId==2){ + params['biz_id'] = that.data.distBiz_id; + } _.apiQuery.putAppCustomersAdmins(params).then(res => { wx.showToast({ @@ -471,6 +499,31 @@ Page({ this.getAppCustomersList() }, + //切换分配本地,其他门店 + changeDistTab(e){ + this.setData({ + distTabId:e.currentTarget.dataset.id, + employeeIndex:-1, + employee_id:'', + nextIndex:-1, + distBiz_id:'', + distBizIndex:-1, + }) + }, + + //分配选择门店 + changeDistBiz(e) { + let distBiz_id = '' + if(e.detail.value >= 0){ + distBiz_id = this.data.bizobj[e.detail.value].id + } + this.setData({ + distBiz_id, + distBizIndex:e.detail.value, + }) + }, + + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/customer/filterList/index.wxml b/pages/customer/filterList/index.wxml index 716209d..43f2ca6 100644 --- a/pages/customer/filterList/index.wxml +++ b/pages/customer/filterList/index.wxml @@ -92,25 +92,42 @@ - - - 销售顾问 - - 请选择 - {{staffArray[employeeIndex]}} - + + + + {{item.name}} + + + + + 销售顾问 + + 请选择 + {{staffArray[employeeIndex]}} + + + + + 计划回访时间 + + 请选择 + {{dateList[nextIndex].year}}-{{dateList[nextIndex].month}}-{{dateList[nextIndex].day}} + + + + + + 门店名称 + + + 请选择 + {{bizArray[distBizIndex]}} + + - - 计划回访时间 - - 请选择 - {{dateList[nextIndex].year}}-{{dateList[nextIndex].month}}-{{dateList[nextIndex].day}} - - - - + diff --git a/pages/customer/index.js b/pages/customer/index.js index 1a80a43..32ec35d 100644 --- a/pages/customer/index.js +++ b/pages/customer/index.js @@ -81,6 +81,12 @@ Page({ weekList:['日','一','二','三','四','五','六'], dateList:[], nextIndex:-1,//计划回访时间 + + distTabId:1, + distBizIndex:-1, + distBiz_id:'', + bizArray: [], + bizobj: [], }, onLoad(options) { for (let key in options) { @@ -137,9 +143,16 @@ Page({ res.data.list.forEach(item => { staffArray.push(item.uname) }) + let bizArray = [] + res.data.bizs.forEach(item => { + bizArray.push(item.name) + }) this.setData({ staffArray:staffArray, staffobj: res.data.list, + distributetabs:res.data.tabs, + bizArray:bizArray, + bizobj: res.data.bizs, }) }); }, @@ -653,6 +666,10 @@ Page({ employee_id:'', cid:[], optLevel:'', + nextIndex:-1, + distTabId:1, + distBiz_id:'', + distBizIndex:-1, }) } }, @@ -672,26 +689,37 @@ Page({ //分配客户 putAppCustomersAdmins(){ let that = this - if (that.data.employeeIndex == -1 ) { + if (that.data.distTabId==1&&that.data.employeeIndex == -1 ) { wx.showToast({ title: '请选择店员', icon: 'none' }) } - else if (that.data.nextIndex == -1 ) { + else if (that.data.distTabId==1&&that.data.nextIndex == -1 ) { wx.showToast({ title: '请选择计划回访时间', icon: 'none' }) } + else if (that.data.distTabId==2&&that.data.distBizIndex == -1 ) { + wx.showToast({ + title: '请选择门店', + icon: 'none' + }) + } else{ that.setData({ submitFlag: true, }) let params = {}; params['ids'] = that.data.cid; - params['admin_id'] = that.data.employee_id; - params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day; + if(that.data.distTabId==1){ + params['admin_id'] = that.data.employee_id; + params['visit_time'] = that.data.dateList[that.data.nextIndex].year +'-'+ that.data.dateList[that.data.nextIndex].month +'-'+ that.data.dateList[that.data.nextIndex].day; + } + if(that.data.distTabId==2){ + params['biz_id'] = that.data.distBiz_id; + } _.apiQuery.putAppCustomersAdmins(params).then(res => { wx.showToast({ @@ -833,6 +861,30 @@ Page({ } }, + //切换分配本地,其他门店 + changeDistTab(e){ + this.setData({ + distTabId:e.currentTarget.dataset.id, + employeeIndex:-1, + employee_id:'', + nextIndex:-1, + distBiz_id:'', + distBizIndex:-1, + }) + }, + + //分配选择门店 + changeDistBiz(e) { + let distBiz_id = '' + if(e.detail.value >= 0){ + distBiz_id = this.data.bizobj[e.detail.value].id + } + this.setData({ + distBiz_id, + distBizIndex:e.detail.value, + }) + }, + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml index 70d2762..785c7db 100644 --- a/pages/customer/index.wxml +++ b/pages/customer/index.wxml @@ -276,25 +276,42 @@ - - - 销售顾问 - - 请选择 - {{staffArray[employeeIndex]}} - + + + + {{item.name}} + + + + + 销售顾问 + + 请选择 + {{staffArray[employeeIndex]}} + + + + + 计划回访时间 + + 请选择 + {{dateList[nextIndex].year}}-{{dateList[nextIndex].month}}-{{dateList[nextIndex].day}} + + + + + + 门店名称 + + + 请选择 + {{bizArray[distBizIndex]}} + + - - 计划回访时间 - - 请选择 - {{dateList[nextIndex].year}}-{{dateList[nextIndex].month}}-{{dateList[nextIndex].day}} - - - - +