diff --git a/commons/js/config.js b/commons/js/config.js index 82fd22b..508d41c 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -1,4 +1,4 @@ -const env = "d"; +const env = "p"; const version = 1, @@ -163,6 +163,7 @@ api = { appBizStats_order:'app/biz/stats_order', //订单数据 appBizStats_days:'app/biz/stats_days', //客户/订单走势图 appBizStats_customer_pid:'app/biz/stats_customer_pid', //客户数据二级 + appBizStats_order_series:'app/biz/stats_order_series', //品牌数据二级 appOptions:'app/options', //获取车辆选装包 diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index 313aa5e..fd3874d 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -938,6 +938,13 @@ apiQuery.getAppBizStats_customer_pid = function (params) { }) } +//品牌数据二级 +apiQuery.getAppBizStats_order_series = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appBizStats_order_series, 2, params, "GET", resolve, reject) + }) +} + //获取渠道经理数据分析入口数据 apiQuery.getAppStatisticsStats = function (params) { return new Promise(function (resolve, reject) { diff --git a/pages/storeData/customerData/index.js b/pages/storeData/customerData/index.js index e071b60..5eef6c2 100644 --- a/pages/storeData/customerData/index.js +++ b/pages/storeData/customerData/index.js @@ -34,7 +34,7 @@ function Pie1Chart(canvas, width, height, dpr) { let obj = {} obj.type = 1 obj.id = e.data.id - _.eventBus.emit("stats",obj) + _.eventBus.emit("customerstats",obj) } }); return chart; @@ -53,7 +53,7 @@ function Pie2Chart(canvas, width, height, dpr) { let obj = {} obj.type = 0 obj.id = e.data.id - _.eventBus.emit("stats",obj) + _.eventBus.emit("customerstats",obj) } }); return chart; @@ -89,8 +89,8 @@ Page({ let that = this //消息通讯 是否显示授权用户信息按钮 - _.eventBus.on("stats", this, function(res){ - let url = '/pages/storeData/subData/index?type=' + res.type + '&id=' + res.id + '&s_date=' + that.data.s_date + '&e_date=' + that.data.e_date + '¤t_date=' + that.data.current_date + _.eventBus.on("customerstats", this, function(res){ + let url = '/pages/storeData/subData/index?from=customer&type=' + res.type + '&id=' + res.id + '&s_date=' + that.data.s_date + '&e_date=' + that.data.e_date + '¤t_date=' + that.data.current_date _.$router.openUrlScheme(url) }) @@ -99,7 +99,7 @@ Page({ //生命周期函数--监听页面卸载 onUnload: function () { //卸载消息通讯 是否显示授权用户信息 - _.eventBus.remove('stats',this); + _.eventBus.remove("customerstats",this); }, //选择日期 diff --git a/pages/storeData/orderData/index.js b/pages/storeData/orderData/index.js index 15eb0e5..5e61089 100644 --- a/pages/storeData/orderData/index.js +++ b/pages/storeData/orderData/index.js @@ -34,7 +34,7 @@ function Pie1Chart(canvas, width, height, dpr) { let obj = {} obj.type = 2 obj.id = e.data.id - _.eventBus.emit("stats",obj) + _.eventBus.emit("orderstats",obj) } }); return chart; @@ -49,12 +49,10 @@ function Pie2Chart(canvas, width, height, dpr) { let option = Pie2ChartData chart.setOption(option); chart.on('click',function(e){ - _.eventBus.emit("stats",e.name) if(e.data.id>0){ let obj = {} - obj.type = 3 obj.id = e.data.id - _.eventBus.emit("stats",obj) + _.eventBus.emit("orderstats",obj) } }); return chart; @@ -90,9 +88,16 @@ Page({ let that = this //消息通讯 是否显示授权用户信息按钮 - _.eventBus.on("stats", this, function(res){ - let url = '/pages/storeData/subData/index?type=' + res.type + '&id=' + res.id + '&s_date=' + that.data.s_date + '&e_date=' + that.data.e_date + '¤t_date=' + that.data.current_date + _.eventBus.on("orderstats", this, function(res){ + + let url = '/pages/storeData/subData/index' + if(res.type == 2){ + url = url+'?from=customer&type=' + res.type + '&id=' + res.id + '&s_date=' + that.data.s_date + '&e_date=' + that.data.e_date + '¤t_date=' + that.data.current_date + }else{ + url = url+'?from=order&id=' + res.id + '&s_date=' + that.data.s_date + '&e_date=' + that.data.e_date + '¤t_date=' + that.data.current_date + } _.$router.openUrlScheme(url) + }) }, @@ -100,7 +105,7 @@ Page({ //生命周期函数--监听页面卸载 onUnload: function () { //卸载消息通讯 是否显示授权用户信息 - _.eventBus.remove('stats',this); + _.eventBus.remove("orderstats",this); }, diff --git a/pages/storeData/subData/index.js b/pages/storeData/subData/index.js index d10abcc..e23d5cf 100644 --- a/pages/storeData/subData/index.js +++ b/pages/storeData/subData/index.js @@ -32,7 +32,7 @@ Page({ [key]: options[key] }) } - this.getAppBizStats_customer_pid() + this.getAppBizStats() }, @@ -65,7 +65,7 @@ Page({ }) } else{ - this.getAppBizStats_customer_pid() + this.getAppBizStats() } } if(e.currentTarget.dataset.type=="e_date"){ @@ -94,109 +94,197 @@ Page({ }) } else{ - this.getAppBizStats_customer_pid() + this.getAppBizStats() } } }, + //订单数据 - getAppBizStats_customer_pid(){ + getAppBizStats(){ this.setData({ showPie1Chart:false, }) let params = {}; - params['type'] = this.data.type; + if(this.data.type){ + params['type'] = this.data.type; + } params['id'] = this.data.id; params['s_time'] = this.data.s_date; params['e_time'] = this.data.e_date; - _.apiQuery.getAppBizStats_customer_pid(params).then(res => { - wx.setNavigationBarTitle({ - title: res.data.title - }) + if(this.data.from=='customer'){ + _.apiQuery.getAppBizStats_customer_pid(params).then(res => { - // this.setData({ - // Pie1title:res.data.title, - // }) - if(res.data.series_data.length==0){ - this.setData({ - pie1noData:true, + wx.setNavigationBarTitle({ + title: res.data.title }) - }else{ - Pie1ChartData = { - tooltip: { - trigger: 'item', - formatter: '{b}: {c} ({d}%)' - }, - series: [ - { - name: 'Access From', - type: 'pie', - bottom:'15%', - radius: ['40%', '70%'], - avoidLabelOverlap: false, - itemStyle: { - borderRadius: 10, - borderColor: '#fff', - borderWidth: 2 - }, - label: { - show: false, - position: 'center' - }, - labelLine: { - fontSize:5, - length:10 - }, - label: { - formatter: '{b| {b} }{abg|}\n{hr|}\n{c| {c}({d}%) }', - backgroundColor: '#F6F8FC', - borderColor: '#8C8D8E', - borderWidth: 1, - borderRadius: 4, - rich: { - hr: { - borderColor: '#8C8D8E', - width: '100%', - borderWidth: 1, - height: 0 - }, - b: { - color: '#4C5058', - fontSize:10, - lineHeight:20, - align: 'center', - }, - c: { - color: '#4C5058', - fontSize:8, - lineHeight:20, - align: 'center', - }, - } - }, - data: [] - } - ] - }; - - Pie1ChartData.series[0].data = res.data.series_data - this.setData({ - pie1noData:false, - showPie1Chart:true, - ['ecPie1.onInit']:Pie1Chart, - }) - } - wx.stopPullDownRefresh() + + // this.setData({ + // Pie1title:res.data.title, + // }) + if(res.data.series_data.length==0){ + this.setData({ + pie1noData:true, + }) + }else{ + Pie1ChartData = { + tooltip: { + trigger: 'item', + formatter: '{b}: {c} ({d}%)' + }, + series: [ + { + name: 'Access From', + type: 'pie', + bottom:'15%', + radius: ['40%', '70%'], + avoidLabelOverlap: false, + itemStyle: { + borderRadius: 10, + borderColor: '#fff', + borderWidth: 2 + }, + label: { + show: false, + position: 'center' + }, + labelLine: { + fontSize:5, + length:10 + }, + label: { + formatter: '{b| {b} }{abg|}\n{hr|}\n{c| {c}({d}%) }', + backgroundColor: '#F6F8FC', + borderColor: '#8C8D8E', + borderWidth: 1, + borderRadius: 4, + rich: { + hr: { + borderColor: '#8C8D8E', + width: '100%', + borderWidth: 1, + height: 0 + }, + b: { + color: '#4C5058', + fontSize:10, + lineHeight:20, + align: 'center', + }, + c: { + color: '#4C5058', + fontSize:8, + lineHeight:20, + align: 'center', + }, + } + }, + data: [] + } + ] + }; + + Pie1ChartData.series[0].data = res.data.series_data + this.setData({ + pie1noData:false, + showPie1Chart:true, + ['ecPie1.onInit']:Pie1Chart, + }) + } + wx.stopPullDownRefresh() + + }); + }else if(this.data.from=='order'){ + _.apiQuery.getAppBizStats_order_series(params).then(res => { - }); + wx.setNavigationBarTitle({ + title: res.data.title + }) + + // this.setData({ + // Pie1title:res.data.title, + // }) + if(res.data.series_data.length==0){ + this.setData({ + pie1noData:true, + }) + }else{ + Pie1ChartData = { + tooltip: { + trigger: 'item', + formatter: '{b}: {c} ({d}%)' + }, + series: [ + { + name: 'Access From', + type: 'pie', + bottom:'15%', + radius: ['40%', '70%'], + avoidLabelOverlap: false, + itemStyle: { + borderRadius: 10, + borderColor: '#fff', + borderWidth: 2 + }, + label: { + show: false, + position: 'center' + }, + labelLine: { + fontSize:5, + length:10 + }, + label: { + formatter: '{b| {b} }{abg|}\n{hr|}\n{c| {c}({d}%) }', + backgroundColor: '#F6F8FC', + borderColor: '#8C8D8E', + borderWidth: 1, + borderRadius: 4, + rich: { + hr: { + borderColor: '#8C8D8E', + width: '100%', + borderWidth: 1, + height: 0 + }, + b: { + color: '#4C5058', + fontSize:10, + lineHeight:20, + align: 'center', + }, + c: { + color: '#4C5058', + fontSize:8, + lineHeight:20, + align: 'center', + }, + } + }, + data: [] + } + ] + }; + + Pie1ChartData.series[0].data = res.data.series_data + this.setData({ + pie1noData:false, + showPie1Chart:true, + ['ecPie1.onInit']:Pie1Chart, + }) + } + wx.stopPullDownRefresh() + + }); + } }, //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh: function () { - this.getAppBizStats_customer_pid() + this.getAppBizStats() }, }) diff --git a/pages/storeData/subData/index.wxml b/pages/storeData/subData/index.wxml index 299900e..9f5e5b5 100644 --- a/pages/storeData/subData/index.wxml +++ b/pages/storeData/subData/index.wxml @@ -19,9 +19,9 @@ - +