diff --git a/commons/js/config.js b/commons/js/config.js index 52c949c..dd56116 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -66,7 +66,7 @@ api = { appStatisticsHorder: "app/statistics/horder", //首页-订单图表数据 appUserResetbiz: "app/user/resetbiz", //更新用户店铺id appXzStat: "app/xz/stat", //获取电话统计数据 - + appCity: "app/city", //获取系统配置城市 } diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index 63e4eb1..14873c7 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -439,4 +439,11 @@ apiQuery.getAppXzStat = function(params){ }) } +//获取系统配置城市 +apiQuery.getAppCity = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appCity, 2, params, "GET", resolve, reject) + }) +} + export default apiQuery; \ No newline at end of file diff --git a/components/channel-tab-bar/index.wxml b/components/channel-tab-bar/index.wxml index 874a831..4e33241 100644 --- a/components/channel-tab-bar/index.wxml +++ b/components/channel-tab-bar/index.wxml @@ -1,9 +1,9 @@ - - + + - - - {{item.title}} - + + + {{item.title}} + - \ No newline at end of file + \ No newline at end of file diff --git a/components/shop-tab-bar/index.wxml b/components/shop-tab-bar/index.wxml index 874a831..4e33241 100644 --- a/components/shop-tab-bar/index.wxml +++ b/components/shop-tab-bar/index.wxml @@ -1,9 +1,9 @@ - - + + - - - {{item.title}} - + + + {{item.title}} + - \ No newline at end of file + \ No newline at end of file diff --git a/pages/channel/index.js b/pages/channel/index.js index 4bb2c4d..24e07a1 100644 --- a/pages/channel/index.js +++ b/pages/channel/index.js @@ -47,10 +47,8 @@ Page({ } this.getUserInfo() - this.getAppUserBizs() - - this.getAppStatisticsCust() - this.getAppStatisticsOrders() + this.getAppCity() + }, onShow: function () { @@ -83,15 +81,53 @@ Page({ }); }, + //获取系统配置城市 + getAppCity(){ + _.apiQuery.getAppCity().then(res => { + let cityArray = [] + res.data.list.forEach((item,index) => { + cityArray.push(item.name) + if(item.city_id==res.data.default){ + this.setData({ + cityIndex:index, + }) + } + }) + this.setData({ + city_id:res.data.default, + cityArray:cityArray, + cityList:res.data.list, + }) + + this.getAppUserBizs() + this.getAppStatisticsCust() + this.getAppStatisticsOrders() + + }); + }, + //获取管理门店 getAppUserBizs(){ - _.apiQuery.getAppUserBizs().then(res => { + let params = {}; + params['city_id'] = this.data.city_id; + _.apiQuery.getAppUserBizs(params).then(res => { this.setData({ shoplist: res.data.list, }) }); }, + //选择城市 + changeCity(e) { + this.setData({ + city_id:this.data.cityList[e.detail.value].city_id, + cityIndex: e.detail.value + }) + this.getAppUserBizs() + this.getAppStatisticsCust() + this.getAppStatisticsOrders() + }, + //客户选择季度 changeCust(e) { this.setData({ @@ -114,6 +150,7 @@ Page({ showBarChart:false, }) let params = {}; + params['city_id'] = this.data.city_id; if(this.data.custSeasonKey){ params['season'] = this.data.custSeasonKey; } @@ -146,6 +183,7 @@ Page({ showLineChart:false, }) let params = {}; + params['city_id'] = this.data.city_id; if(this.data.orderSeasonKey){ params['season'] = this.data.orderSeasonKey; } diff --git a/pages/channel/index.wxml b/pages/channel/index.wxml index e330023..bca74e6 100644 --- a/pages/channel/index.wxml +++ b/pages/channel/index.wxml @@ -13,8 +13,16 @@ - - 管辖门店 + + + 管辖门店 + + + {{cityArray[cityIndex]}} + + + + diff --git a/pages/dataAnalysis/index.js b/pages/dataAnalysis/index.js index 36f385a..f8f22d5 100644 --- a/pages/dataAnalysis/index.js +++ b/pages/dataAnalysis/index.js @@ -68,34 +68,61 @@ Page({ }) }) - this.getAppUserBizs() + this.getAppCity() }, onShow: function () { + + }, + //获取系统配置城市 + getAppCity(){ + _.apiQuery.getAppCity().then(res => { + let cityArray = [] + res.data.list.forEach((item,index) => { + cityArray.push(item.name) + if(item.city_id==res.data.default){ + this.setData({ + cityIndex:index, + }) + } + }) + this.setData({ + city_id:res.data.default, + cityArray:cityArray, + cityList:res.data.list, + }) + + this.getAppUserBizs() + + }); }, //获取管理门店 getAppUserBizs(){ - _.apiQuery.getAppUserBizs().then(res => { - let storeArray = [] - res.data.list.forEach(item => { - storeArray.push(item.name) - }) - this.setData({ - storeArray:storeArray, - storeobj:res.data.list, - storeIndex:0, - staffIndex:-1, - }) + let params = {}; + params['city_id'] = this.data.city_id; + _.apiQuery.getAppUserBizs(params).then(res => { + if(res.data.list.length>0){ + let storeArray = [] + res.data.list.forEach(item => { + storeArray.push(item.name) + }) + this.setData({ + storeArray:storeArray, + storeobj:res.data.list, + storeIndex:0, + staffIndex:-1, + }) - this.getAppUserAdmins() - if(this.data.tabId==1){ - this.getAppXzStat() - this.getAppStatisticsScust() - }else if(this.data.tabId==2){ - this.getAppStatisticsOcust() + this.getAppUserAdmins() + if(this.data.tabId==1){ + this.getAppXzStat() + this.getAppStatisticsScust() + }else if(this.data.tabId==2){ + this.getAppStatisticsOcust() + } } }); @@ -186,6 +213,15 @@ Page({ }); }, + //选择城市 + changeCity(e) { + this.setData({ + city_id:this.data.cityList[e.detail.value].city_id, + cityIndex: e.detail.value + }) + this.getAppUserBizs() + }, + //选择门店 changeStore(e) { this.setData({ diff --git a/pages/dataAnalysis/index.wxml b/pages/dataAnalysis/index.wxml index 616fd49..6896754 100644 --- a/pages/dataAnalysis/index.wxml +++ b/pages/dataAnalysis/index.wxml @@ -4,6 +4,15 @@ + 城市 + + + {{cityArray[cityIndex]}} + + + + + 门店