diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index 87349de..5098555 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -104,7 +104,7 @@ - + 所在地区 diff --git a/pages/customer/editCard/index.wxml b/pages/customer/editCard/index.wxml index 104b356..b553caa 100644 --- a/pages/customer/editCard/index.wxml +++ b/pages/customer/editCard/index.wxml @@ -85,7 +85,7 @@ - + 所在地区 diff --git a/pages/customer/index.js b/pages/customer/index.js index c737d66..b0494b0 100644 --- a/pages/customer/index.js +++ b/pages/customer/index.js @@ -88,6 +88,11 @@ Page({ bizArray: [], bizobj: [], tag_ids:'', + + cityIndex:-1, + city_id:'', + countyIndex:-1, + county_id:'', }, onLoad(options) { for (let key in options) { @@ -115,6 +120,9 @@ Page({ this.getAppCustomersTag() + //获取城市列表 + this.getAppCityArea_city() + }, onShow(){ @@ -296,6 +304,12 @@ Page({ // if(this.data.staffIndex>-1){ // params['admin_id'] = this.data.staffobj[this.data.staffIndex].id; // } + if(this.data.city_id!=''){ + params['city_id'] = this.data.city_id; + } + if(this.data.county_id!=''){ + params['county_id'] = this.data.county_id; + } if(this.data.s_visit_time != ''&&this.data.e_visit_time != ''){ params['s_visit_time'] = this.data.s_visit_time; params['e_visit_time'] = this.data.e_visit_time; @@ -582,6 +596,10 @@ Page({ cfromIndex:-1, staffIndex:-1, tag_ids:'', + cityIndex:-1, + city_id:'', + countyIndex:-1, + county_id:'', }) this.getAppCustomersTag() }, @@ -980,6 +998,70 @@ 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, + }) + } + }, + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml index b5a8e9f..007aebc 100644 --- a/pages/customer/index.wxml +++ b/pages/customer/index.wxml @@ -39,6 +39,12 @@ {{cus_id}} {{name}} {{mobile}} + + {{item.name}} + + + {{item.name}} + {{s_time}} {{e_time}} @@ -149,6 +155,26 @@ + + 所在城市 + + + 请选择 + {{cityArr[cityIndex]}} + + + + + + 所在地区 + + + 请选择 + {{countyArr[countyIndex]}} + + + + 建卡开始时间 @@ -295,7 +321,7 @@ - + 重置 确定 diff --git a/pages/order/index.wxml b/pages/order/index.wxml index a45c8cd..3ebb8f2 100644 --- a/pages/order/index.wxml +++ b/pages/order/index.wxml @@ -220,7 +220,7 @@ - + 重置 确定