diff --git a/commons/js/config.js b/commons/js/config.js index 1ada742..bab50b5 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -56,6 +56,17 @@ api = { appFinance: "app/finance", //获取金融产品列表 appFinanceNums: "app/finance/nums", //获取金融分期期数 + appUserBizs: "app/user/bizs", //获取管理门店 + appStatisticsCust: "app/statistics/cust", //获取渠道客户统计 + appStatisticsOrders: "app/statistics/orders", //获取渠道订单统计 + appUserAdmins: "app/user/admins", //获取门店管理员 + appStatisticsScust: "app/statistics/scust", //数据分析-客户数据 + appStatisticsOcust: "app/statistics/ocust", //数据分析-订单数据 + appStatisticsHcust: "app/statistics/hcust", //首页-客户图标数据 + appStatisticsHorder: "app/statistics/horder", //首页-订单图表数据 + appUserResetbiz: "app/user/resetbiz", //更新用户店铺id + + } diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index 2630d17..74dea2e 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -5,7 +5,7 @@ let apiQuery = Object.assign({}); apiQuery.asyncLogin = asyncLogin; -apiQuery.getUserInfo = function (params,isLoading=true) { +apiQuery.getUserInfo = function (params,isLoading=false) { return new Promise(function (resolve, reject) { HttpRequest(isLoading, Config.api.appUser, 2, params, "GET", function (res) { app.setStorage("userInfo", res.data); @@ -369,4 +369,67 @@ apiQuery.getAppFinanceNums = function(params){ }) } +//获取管理门店 +apiQuery.getAppUserBizs = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appUserBizs, 2, params, "GET", resolve, reject) + }) +} + +//获取渠道客户统计 +apiQuery.getAppStatisticsCust = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appStatisticsCust, 2, params, "GET", resolve, reject) + }) +} + +//获取渠道订单统计 +apiQuery.getAppStatisticsOrders = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appStatisticsOrders, 2, params, "GET", resolve, reject) + }) +} + +//获取门店管理员 +apiQuery.getAppUserAdmins = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appUserAdmins, 2, params, "GET", resolve, reject) + }) +} + +//数据分析-客户数据 +apiQuery.getAppStatisticsScust = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appStatisticsScust, 2, params, "GET", resolve, reject) + }) +} + +//数据分析-订单数据 +apiQuery.getAppStatisticsOcust = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appStatisticsOcust, 2, params, "GET", resolve, reject) + }) +} + +//首页-客户图标数据 +apiQuery.getAppStatisticsHcust = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appStatisticsHcust, 2, params, "GET", resolve, reject) + }) +} + +//首页-订单图表数据 +apiQuery.getAppStatisticsHorder = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appStatisticsHorder, 2, params, "GET", resolve, reject) + }) +} + +//更新用户店铺id +apiQuery.putAppUserResetbiz = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appUserResetbiz, 2, params, "PUT", resolve, reject) + }) +} + export default apiQuery; \ No newline at end of file diff --git a/components/backChannel/index.js b/components/backChannel/index.js index 1ef33a5..f1d83c1 100644 --- a/components/backChannel/index.js +++ b/components/backChannel/index.js @@ -18,7 +18,7 @@ Component({ lifetimes: { //在组件实例进入页面节点树时执行 attached: function () { - if(app.getStorageByKey("userInfo").group_id==2){ + if(app.getStorageByKey("userInfo").group_id==4){ this.setData({ isAdmin:true, }) diff --git a/components/channel-tab-bar/index.js b/components/channel-tab-bar/index.js index 7b7b77a..8c20fcd 100644 --- a/components/channel-tab-bar/index.js +++ b/components/channel-tab-bar/index.js @@ -15,20 +15,20 @@ Component({ list: [ { "url": "/pages/channel/index", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home-ac.png", + "icon": "tab-home", + "activeIcon": "tab-home-ac", "title": "首页", }, { "url": "/pages/dataAnalysis/index", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-dataAnalysis.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-dataAnalysis-ac.png", + "icon": "tab-dataAnalysis", + "activeIcon": "tab-dataAnalysis-ac", "title": "数据分析", }, { "url": "/pages/mine/index?source=channel", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine-ac.png", + "icon": "tab-mine", + "activeIcon": "tab-mine-ac", "title": "我的", }, ], diff --git a/components/channel-tab-bar/index.wxml b/components/channel-tab-bar/index.wxml index c645bbc..874a831 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 diff --git a/components/channel-tab-bar/index.wxss b/components/channel-tab-bar/index.wxss index a26b7a3..18d740c 100644 --- a/components/channel-tab-bar/index.wxss +++ b/components/channel-tab-bar/index.wxss @@ -1,2 +1,9 @@ @import "../../commons/css/common.wxss"; -.z-index-4{z-index:9999999999;} \ No newline at end of file +.z-index-4{z-index:9999999999;} +.icon-menu{background:url("https://qs.haodian.cn/wechat_app/lichebao/common/icon-menu.png") no-repeat;background-size:750rpx auto;} +.tab-home{background-position:0 5rpx;} +.tab-home-ac{background-position:0 -55rpx;} +.tab-dataAnalysis{background-position:-60rpx 5rpx;} +.tab-dataAnalysis-ac{background-position:-60rpx -55rpx;} +.tab-mine{background-position:-120rpx 5rpx;} +.tab-mine-ac{background-position:-120rpx -55rpx;} \ No newline at end of file diff --git a/components/navBar/navBar.js b/components/navBar/navBar.js index 1a76cb1..f964697 100644 --- a/components/navBar/navBar.js +++ b/components/navBar/navBar.js @@ -1,4 +1,5 @@ import Utils from '../../commons/js/utils/util' +const app = getApp() Component({ /** * 组件的属性列表 @@ -88,9 +89,19 @@ Component({ }) }, home: function () { - wx.switchTab({ - url: '/pages/index/index' - }) + // wx.switchTab({ + // url: '/pages/index/index' + // }) + if(app.getStorageByKey("userInfo").group_id==4){ + wx.reLaunch({ + url: '/pages/channel/index' + }) + }else{ + wx.reLaunch({ + url: '/pages/index/index' + }) + } + } } }) \ No newline at end of file diff --git a/components/shop-tab-bar/index.js b/components/shop-tab-bar/index.js index d89d60b..19ff3ec 100644 --- a/components/shop-tab-bar/index.js +++ b/components/shop-tab-bar/index.js @@ -15,26 +15,26 @@ Component({ list: [ { "url": "/pages/index/index", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-home-ac.png", + "icon": "tab-home", + "activeIcon": "tab-home-ac", "title": "首页", }, { "url": "/pages/customer/index", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-customer.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-customer-ac.png", + "icon": "tab-customer", + "activeIcon": "tab-customer-ac", "title": "客户", }, { "url": "/pages/order/index", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-order.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-order-ac.png", + "icon": "tab-order", + "activeIcon": "tab-order-ac", "title": "订单", }, { "url": "/pages/mine/index?source=shop", - "iconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine.png", - "selectedIconPath": "https://qs.haodian.cn/wechat_app/lichebao/common/tab-mine-ac.png", + "icon": "tab-mine", + "activeIcon": "tab-mine-ac", "title": "我的", }, ], diff --git a/components/shop-tab-bar/index.wxml b/components/shop-tab-bar/index.wxml index c645bbc..874a831 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 diff --git a/components/shop-tab-bar/index.wxss b/components/shop-tab-bar/index.wxss index a26b7a3..6a4d2af 100644 --- a/components/shop-tab-bar/index.wxss +++ b/components/shop-tab-bar/index.wxss @@ -1,2 +1,11 @@ @import "../../commons/css/common.wxss"; -.z-index-4{z-index:9999999999;} \ No newline at end of file +.z-index-4{z-index:9999999999;} +.icon-menu{background:url("https://qs.haodian.cn/wechat_app/lichebao/common/icon-menu.png") no-repeat;background-size:750rpx auto;} +.tab-home{background-position:0 5rpx;} +.tab-home-ac{background-position:0 -55rpx;} +.tab-mine{background-position:-120rpx 5rpx;} +.tab-mine-ac{background-position:-120rpx -55rpx;} +.tab-customer{background-position:-180rpx 5rpx;} +.tab-customer-ac{background-position:-180rpx -55rpx;} +.tab-order{background-position:-240rpx 5rpx;} +.tab-order-ac{background-position:-240rpx -55rpx;} \ No newline at end of file diff --git a/pages/channel/index.js b/pages/channel/index.js index 12e4633..cac5ea2 100644 --- a/pages/channel/index.js +++ b/pages/channel/index.js @@ -1,53 +1,42 @@ import _ from '../../commons/js/commons' import * as echarts from '../../ecCanvas/components/ec-canvas/echarts'; const app = getApp() + +let barChartData; +let lineChartData; +function barChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + canvas.setChart(chart); + let option = barChartData + chart.setOption(option); + return chart; +} +function lineChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + canvas.setChart(chart); + let option = lineChartData + chart.setOption(option); + return chart; +} + Page({ data: { imgUrl:_.config.imgUrl, - - shoplist:[ - { - id:'1', - title:'泉州鲤城区4s店', - tag:[ - '东风EX·1', - '雷丁', - ], - }, - { - id:'1', - title:'泉州鲤城区4s店', - tag:[ - '东风EX·1', - '雷丁', - ], - }, - ], - + shoplist:[],//管理门店 + showBarChart:false,//是否显示Bar图表 + ecBar:{}, + showLineChart:false,//是否显示Line图表 + ecLine:{}, deallist:'', hoursTip:'', - - quarterarray: ['第一季度', '第二季度', '第三季度','第四季度', ], - quarterobj: [ - { - id: 0, - name: '第一季度' - }, - { - id: 1, - name: '第二季度' - }, - { - id: 2, - name: '第三季度' - }, - { - id: 3, - name: '第四季度' - }, - ], - quarterIndex: 0, - }, onLoad(options) { @@ -58,17 +47,16 @@ Page({ } this.getUserInfo() - + this.getAppUserBizs() - this.getBar() - this.getLine() + this.getAppStatisticsCust() + this.getAppStatisticsOrders() }, onShow: function () { this.getHoursTip() }, - //候取时间 getHoursTip(){ let hoursTip = ''; @@ -95,44 +83,76 @@ Page({ }); }, - //选择季度 - changeQuarter(e) { + //获取管理门店 + getAppUserBizs(){ + _.apiQuery.getAppUserBizs().then(res => { + this.setData({ + shoplist: res.data.list, + }) + }); + }, + + //客户选择季度 + changeCust(e) { this.setData({ - quarterIndex: e.detail.value + custSeasonKey: e.detail.value + }) + this.getAppStatisticsCust() + }, + + //订单选择季度 + changeOrder(e) { + this.setData({ + orderSeasonKey: e.detail.value + }) + this.getAppStatisticsOrders() + }, + + //获取渠道客户统计 + getAppStatisticsCust(){ + this.setData({ + showBarChart:false, + }) + let params = {}; + if(this.data.custSeasonKey){ + params['season'] = this.data.custSeasonKey; + } + _.apiQuery.getAppStatisticsCust(params).then(res => { + + barChartData = res.data.stat_data + this.setData({ + custSeasonKey:this.data.custSeasonKey?this.data.custSeasonKey:res.data.season, + custSeason:this.data.custSeason?this.data.custSeason:res.data.season_data, + showBarChart:true, + ['ecBar.onInit']:barChart, + }) + + wx.stopPullDownRefresh() + }) }, - getBar(){ + //获取渠道订单统计 + getAppStatisticsOrders(){ this.setData({ - ecBar: { - onInit: function (canvas, width, height, dpr) { - const barChart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: dpr // new - }); - canvas.setChart(barChart); - barChart.setOption(getBarOption()); - return barChart; - } - }, + showLineChart:false, }) - }, + let params = {}; + if(this.data.orderSeasonKey){ + params['season'] = this.data.orderSeasonKey; + } + _.apiQuery.getAppStatisticsOrders(params).then(res => { + + lineChartData = res.data.stat_data + this.setData({ + orderSeasonKey:this.data.orderSeasonKey?this.data.orderSeasonKey:res.data.season, + orderSeason:this.data.orderSeason?this.data.orderSeason:res.data.season_data, + showLineChart:true, + ['ecLine.onInit']:lineChart, + }) + + wx.stopPullDownRefresh() - getLine(){ - this.setData({ - ecLine: { - onInit: function (canvas, width, height, dpr) { - const lineChart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: dpr // new - }); - canvas.setChart(lineChart); - lineChart.setOption(getLineOption()); - return lineChart; - } - } }) }, @@ -153,7 +173,9 @@ Page({ //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh: function () { - + this.getAppUserBizs() + this.getAppStatisticsCust() + this.getAppStatisticsOrders() }, }) diff --git a/pages/channel/index.wxml b/pages/channel/index.wxml index 093cea1..fef20af 100644 --- a/pages/channel/index.wxml +++ b/pages/channel/index.wxml @@ -13,15 +13,15 @@ - + 管辖门店 - - {{item.title}} + + {{item.name}} - - {{tag}} + + {{auto_brands}} @@ -32,15 +32,15 @@ 数据分析·客户 - + - {{quarterarray[quarterIndex]}} + {{custSeason[custSeasonKey]}} - + @@ -49,15 +49,15 @@ 数据分析·订单 - + - {{quarterarray[quarterIndex]}} + {{orderSeason[orderSeasonKey]}} - + diff --git a/pages/customer/addCard/index.wxml b/pages/customer/addCard/index.wxml index 67a5e31..e8cb4b1 100644 --- a/pages/customer/addCard/index.wxml +++ b/pages/customer/addCard/index.wxml @@ -94,4 +94,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/customer/allot/index.wxml b/pages/customer/allot/index.wxml index a5b8c6f..90e5609 100644 --- a/pages/customer/allot/index.wxml +++ b/pages/customer/allot/index.wxml @@ -25,6 +25,7 @@ + diff --git a/pages/customer/detail/index.wxml b/pages/customer/detail/index.wxml index 8f5d083..179e052 100644 --- a/pages/customer/detail/index.wxml +++ b/pages/customer/detail/index.wxml @@ -197,6 +197,7 @@ + diff --git a/pages/customer/editCard/index.wxml b/pages/customer/editCard/index.wxml index 03e22b2..a4fce3c 100644 --- a/pages/customer/editCard/index.wxml +++ b/pages/customer/editCard/index.wxml @@ -84,4 +84,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/customer/filterList/index.wxml b/pages/customer/filterList/index.wxml index 92311ea..cd17aa8 100644 --- a/pages/customer/filterList/index.wxml +++ b/pages/customer/filterList/index.wxml @@ -42,6 +42,7 @@ + diff --git a/pages/dataAnalysis/index.js b/pages/dataAnalysis/index.js index 90510a1..eec952d 100644 --- a/pages/dataAnalysis/index.js +++ b/pages/dataAnalysis/index.js @@ -2,44 +2,45 @@ import _ from '../../commons/js/commons' import popularData from '../../commons/js/lib/popularData'; import * as echarts from '../../ecCanvas/components/ec-canvas/echarts'; const app = getApp() + +let barChartData; +let lineChartData; +function barChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + canvas.setChart(chart); + let option = barChartData + chart.setOption(option); + return chart; +} +function lineChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + canvas.setChart(chart); + let option = lineChartData + chart.setOption(option); + return chart; +} + Page({ data: { imgUrl:_.config.imgUrl, - - storearray: ['厦门店', '泉州店', '福州店', ], - storeobj: [ - { - id: 0, - name: '厦门店' - }, - { - id: 1, - name: '泉州店' - }, - { - id: 2, - name: '福州店' - }, - ], + showBarChart:false,//是否显示Bar图表 + ecBar:{}, + showLineChart:false,//是否显示Line图表 + ecLine:{}, + storeArray: [], + storeobj: [], storeIndex:0, - - staffarray: ['张三', '李四', '王五', ], - staffobj: [ - { - id: 0, - name: '张三' - }, - { - id: 1, - name: '李四' - }, - { - id: 2, - name: '王五' - }, - ], + staffArray: [], + staffobj: [], staffIndex:-1, - tabId:'1', tab:[ { @@ -51,72 +52,8 @@ Page({ title: '订单数据' }, ], - - custom:[ - { - title:'订单客户', - value:'12.23w', - icon:'icon-statistics-custom-1', - }, - { - title:'到店客户', - value:'15', - icon:'icon-statistics-custom-2', - }, - { - title:'未见客户', - value:'12.2', - icon:'icon-statistics-custom-3', - }, - { - title:'未联潜客', - value:'12.23', - icon:'icon-statistics-custom-4', - }, - { - title:'战败客户', - value:'9996', - icon:'icon-statistics-custom-5', - }, - ], - order:[ - { - title:'合同签订', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - { - title:'分期办理', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - { - title:'车辆确认', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - { - title:'申请开票', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - { - title:'待办服务', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - { - title:'交付确认', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - { - title:'交付完成', - value:'12.23w', - icon:'icon-statistics-order-1', - }, - ], - + custom:[],//客户数据 + order:[],//订单数据 }, onLoad(options) { @@ -130,20 +67,119 @@ Page({ dateTime:res[0], }) }) + + this.getAppUserBizs() - this.getBar() - this.getLine() }, onShow: function () { }, + //获取管理门店 + 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, + }) + + this.getAppUserAdmins() + if(this.data.tabId==1){ + this.getAppStatisticsScust() + }else if(this.data.tabId==2){ + this.getAppStatisticsOcust() + } + + }); + }, + + //获取管理门店 + getAppUserAdmins(){ + let params = {}; + params['biz_id'] = this.data.storeobj[this.data.storeIndex].id; + params['page'] = 1; + params['size'] = 1000; + _.apiQuery.getAppUserAdmins(params).then(res => { + let staffArray = [] + res.data.list.forEach(item => { + staffArray.push(item.uname) + }) + this.setData({ + staffArray:staffArray, + staffobj: res.data.list, + }) + }); + }, + + //数据分析-客户数据 + getAppStatisticsScust(){ + this.setData({ + ecBar:{}, + showBarChart:false, + }) + let params = {}; + params['biz_id'] = this.data.storeobj[this.data.storeIndex].id; + params['day'] = this.data.dateTime; + if(this.data.staffIndex>-1){ + params['admin_id'] = this.data.staffobj[this.data.staffIndex].id; + } + _.apiQuery.getAppStatisticsScust(params).then(res => { + + barChartData = res.data.stat_data + this.setData({ + custom:res.data.custom, + showBarChart:true, + ['ecBar.onInit']:barChart, + }) + + wx.stopPullDownRefresh() + + }); + }, + + //数据分析-订单数据 + getAppStatisticsOcust(){ + this.setData({ + ecLine:{}, + showLineChart:false, + }) + let params = {}; + params['biz_id'] = this.data.storeobj[this.data.storeIndex].id; + params['day'] = this.data.dateTime; + if(this.data.staffIndex>-1){ + params['admin_id'] = this.data.staffobj[this.data.staffIndex].id; + } + _.apiQuery.getAppStatisticsOcust(params).then(res => { + + lineChartData = res.data.stat_data + this.setData({ + order:res.data.custom, + showLineChart:true, + ['ecLine.onInit']:lineChart, + }) + + wx.stopPullDownRefresh() + + }); + }, + //选择门店 changeStore(e) { this.setData({ storeIndex: e.detail.value }) + if(this.data.tabId==1){ + this.getAppStatisticsScust() + }else if(this.data.tabId==2){ + this.getAppStatisticsOcust() + } }, //日期选择 @@ -151,6 +187,11 @@ Page({ this.setData({ dateTime: e.detail.value, }) + if(this.data.tabId==1){ + this.getAppStatisticsScust() + }else if(this.data.tabId==2){ + this.getAppStatisticsOcust() + } }, //选择人员 @@ -158,6 +199,11 @@ Page({ this.setData({ staffIndex: e.detail.value }) + if(this.data.tabId==1){ + this.getAppStatisticsScust() + }else if(this.data.tabId==2){ + this.getAppStatisticsOcust() + } }, //切换tab @@ -165,41 +211,11 @@ Page({ this.setData({ tabId:e.currentTarget.dataset.id, }) - //this.searchSubmit() - }, - - getBar(){ - this.setData({ - ecBar: { - onInit: function (canvas, width, height, dpr) { - const barChart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: dpr // new - }); - canvas.setChart(barChart); - barChart.setOption(getBarOption()); - return barChart; - } - }, - }) - }, - - getLine(){ - this.setData({ - ecLine: { - onInit: function (canvas, width, height, dpr) { - const lineChart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: dpr // new - }); - canvas.setChart(lineChart); - lineChart.setOption(getLineOption()); - return lineChart; - } - } - }) + if(this.data.tabId==1){ + this.getAppStatisticsScust() + }else if(this.data.tabId==2){ + this.getAppStatisticsOcust() + } }, //推送链接 @@ -211,7 +227,7 @@ Page({ //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh: function () { - + this.getAppUserBizs() }, }) @@ -274,7 +290,7 @@ function getLineOption() { data: ['1月', '2月', '3月',] }, yAxis: { - type: 'value' + type: 'value' }, series: [{ data: [20, 932, 901,], diff --git a/pages/dataAnalysis/index.wxml b/pages/dataAnalysis/index.wxml index 75426a1..93c40d5 100644 --- a/pages/dataAnalysis/index.wxml +++ b/pages/dataAnalysis/index.wxml @@ -5,9 +5,9 @@ 门店 - + - {{storearray[storeIndex]}} + {{storeArray[storeIndex]}} @@ -23,10 +23,10 @@ 人员选择 - + 全部 - {{staffarray[staffIndex]}} + {{staffArray[staffIndex]}} @@ -55,7 +55,7 @@ - + 通话数据 @@ -95,7 +95,7 @@ 数据分析·客户 - + @@ -106,7 +106,7 @@ 数据分析·订单 - + diff --git a/pages/distribute/assets/index.wxml b/pages/distribute/assets/index.wxml index 63c813d..94a01e1 100644 --- a/pages/distribute/assets/index.wxml +++ b/pages/distribute/assets/index.wxml @@ -65,4 +65,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/distribute/cashout/index.wxml b/pages/distribute/cashout/index.wxml index 2d54b4d..5002187 100644 --- a/pages/distribute/cashout/index.wxml +++ b/pages/distribute/cashout/index.wxml @@ -26,6 +26,7 @@ + diff --git a/pages/distribute/index.wxml b/pages/distribute/index.wxml index b04f100..245c2da 100644 --- a/pages/distribute/index.wxml +++ b/pages/distribute/index.wxml @@ -34,6 +34,7 @@ + diff --git a/pages/distribute/reward/index.wxml b/pages/distribute/reward/index.wxml index 976f53e..34acd47 100644 --- a/pages/distribute/reward/index.wxml +++ b/pages/distribute/reward/index.wxml @@ -33,4 +33,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/distribute/statistics/index.wxml b/pages/distribute/statistics/index.wxml index 63c813d..94a01e1 100644 --- a/pages/distribute/statistics/index.wxml +++ b/pages/distribute/statistics/index.wxml @@ -65,4 +65,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 28cd91f..6cdc152 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,12 +1,42 @@ import _ from '../../commons/js/commons' import * as echarts from '../../ecCanvas/components/ec-canvas/echarts'; const app = getApp() + +let barChartData; +let pieChartData; +function barChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + canvas.setChart(chart); + let option = barChartData + chart.setOption(option); + return chart; +} +function pieChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + canvas.setChart(chart); + let option = pieChartData + chart.setOption(option); + return chart; +} + Page({ data: { imgUrl:_.config.imgUrl, userCal:'', deallist:'', hoursTip:'', + showBarChart:false,//是否显示Bar图表 + ecBar:{}, + showPieChart:false,//是否显示Pie图表 + ecPie:{}, }, onLoad(options) { @@ -15,11 +45,15 @@ Page({ [key]: options[key] }) } + + if(this.data.biz_id){ + this.putAppUserResetbiz() + } this.getUserInfo() - - this.getPie() - this.getBar() + this.getAppStatisticsHcust() + this.getAppStatisticsHorder() + }, onShow: function () { @@ -27,7 +61,6 @@ Page({ this.getHoursTip() }, - //候取时间 getHoursTip(){ let hoursTip = ''; @@ -44,6 +77,14 @@ Page({ }) }, + //更新用户店铺id + putAppUserResetbiz(){ + let params = {}; + params['biz_id'] = this.data.biz_id; + _.apiQuery.putAppUserResetbiz(params).then(res => { + this.getAppUserCal() + }); + }, //获取用户信息 getUserInfo(){ @@ -56,7 +97,11 @@ Page({ //获取用户统计 getAppUserCal(){ - _.apiQuery.getAppUserCal().then(res => { + let params = {}; + if(this.data.biz_id){ + params['biz_id'] = this.data.biz_id; + } + _.apiQuery.getAppUserCal(params).then(res => { this.setData({ userCal:res.data, }) @@ -80,38 +125,54 @@ Page({ }); }, - getPie(){ + //数据分析-客户数据 + getAppStatisticsHcust(){ this.setData({ - ecPie: { - onInit: function (canvas, width, height, dpr) { - const pieChart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: dpr // new - }); - canvas.setChart(pieChart); - pieChart.setOption(getPieOption()); - return pieChart; - } - }, + showPieChart:false, }) + let params = {}; + if(this.data.biz_id){ + params['biz_id'] = this.data.biz_id; + } + _.apiQuery.getAppStatisticsHcust(params).then(res => { + + pieChartData = res.data.stat_data + pieChartData.series.label.formatter = '\n{b|{b}}\n{c|{c}}\n{per|{d}%} ', + + this.setData({ + cust_total:res.data.total, + cust_cont_total:res.data.cont_total, + cust_top_total:res.data.top_total, + showPieChart:true, + ['ecPie.onInit']:pieChart, + }) + + wx.stopPullDownRefresh() + + }); }, - getBar(){ + //数据分析-订单数据 + getAppStatisticsHorder(){ this.setData({ - ecBar: { - onInit: function (canvas, width, height, dpr) { - const barChart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: dpr // new - }); - canvas.setChart(barChart); - barChart.setOption(getBarOption()); - return barChart; - } - }, + showBarChart:false, }) + let params = {}; + if(this.data.biz_id){ + params['biz_id'] = this.data.biz_id; + } + _.apiQuery.getAppStatisticsHorder(params).then(res => { + + barChartData = res.data.stat_data + this.setData({ + order_total:res.data.total, + showBarChart:true, + ['ecBar.onInit']:barChart, + }) + + wx.stopPullDownRefresh() + + }); }, //推送链接 @@ -131,6 +192,8 @@ Page({ //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh: function () { this.getAppUserCal() + this.getAppStatisticsHcust() + this.getAppStatisticsHorder() }, }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 57009da..4d86e9e 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -66,18 +66,18 @@ 客户数据 - 累计线索总量 12,456条 + 累计线索总量 {{cust_total}} 条 - 234 + {{cust_cont_total}} 狸车客户 未联系潜客(人) - 1.26w + {{cust_top_total}} 订单潜客 特别关注客户(人) @@ -85,7 +85,7 @@ - + @@ -94,10 +94,10 @@ 订单数据 - 累计订单总量 12,456条 + 累计订单总量 {{order_total}} 条 - + diff --git a/pages/login/index.js b/pages/login/index.js index b1bd169..2cb85e6 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -24,8 +24,11 @@ Page({ if (pages.length > 1) { wx.navigateBack(); }else{ - _.$router.openUrlScheme('/pages/index/index') - //_.$router.switchTab('/pages/index/index') + if(app.getStorageByKey("userInfo").group_id==4){ + _.$router.openUrlScheme('/pages/channel/index') + }else{ + _.$router.openUrlScheme('/pages/index/index') + } } }else{ this.setData({ @@ -102,6 +105,8 @@ Page({ params['code'] =resc.code; params['sms_code'] = this.data.sms_code; _.apiQuery.getUserUkey(params).then(res => { + console.log('111111111111') + console.log(res) wx.setStorage({ key: "ukey", data: res.data.ukey @@ -110,8 +115,13 @@ Page({ if (pages.length > 1) { wx.navigateBack(); }else{ - _.$router.openUrlScheme('/pages/index/index') - //_.$router.switchTab('/pages/index/index') + _.apiQuery.getUserInfo().then(res => { + if(res.group_id==4){ + _.$router.openUrlScheme('/pages/channel/index') + }else{ + _.$router.openUrlScheme('/pages/index/index') + } + }); } }); diff --git a/pages/order/detail/index.wxml b/pages/order/detail/index.wxml index 30ce1d0..8b7ae6c 100644 --- a/pages/order/detail/index.wxml +++ b/pages/order/detail/index.wxml @@ -139,7 +139,7 @@ - + @@ -147,6 +147,7 @@ + diff --git a/pages/order/filterList/index.wxml b/pages/order/filterList/index.wxml index 456c1b9..2d6f7ae 100644 --- a/pages/order/filterList/index.wxml +++ b/pages/order/filterList/index.wxml @@ -36,6 +36,7 @@ + diff --git a/pages/order/register/index.wxml b/pages/order/register/index.wxml index 08567c2..a83ce3b 100644 --- a/pages/order/register/index.wxml +++ b/pages/order/register/index.wxml @@ -334,6 +334,7 @@ +