diff --git a/app.json b/app.json
index 8e60141..b82ceb9 100644
--- a/app.json
+++ b/app.json
@@ -59,7 +59,8 @@
"pages/storeData/orderData/index",
"pages/order/editDeliveryckimg/index",
"pages/order/editQVImg/index",
- "pages/order/editVoucherImg/index"
+ "pages/order/editVoucherImg/index",
+ "pages/dataAnalysis/detail/index"
],
"echarts": [
{
diff --git a/commons/js/config.js b/commons/js/config.js
index e8b5f94..e9c0c3a 100644
--- a/commons/js/config.js
+++ b/commons/js/config.js
@@ -65,6 +65,12 @@ api = {
appStatisticsOcust: "app/statistics/ocust", //数据分析-订单数据
appStatisticsHcust: "app/statistics/hcust", //首页-客户图标数据
appStatisticsHorder: "app/statistics/horder", //首页-订单图表数据
+
+ appStatisticsStats: "app/statistics/stats", //获取渠道经理数据分析入口数据
+ appStatisticsStats_days: "app/statistics/stats_days", //获取渠道经理数据分析数据
+ appStatisticsStats_customer: "app/statistics/stats_customer", //获取渠道经理数据分析数据
+
+
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 f77a29f..6ca84a4 100644
--- a/commons/js/utils/apiQuery.js
+++ b/commons/js/utils/apiQuery.js
@@ -931,4 +931,25 @@ apiQuery.getAppBizStats_days = function (params) {
})
}
+//获取渠道经理数据分析入口数据
+apiQuery.getAppStatisticsStats = function (params) {
+ return new Promise(function (resolve, reject) {
+ HttpRequest(false, Config.api.appStatisticsStats, 2, params, "GET", resolve, reject)
+ })
+}
+
+//获取渠道经理数据分析数据
+apiQuery.getAppStatisticsStats_days = function (params) {
+ return new Promise(function (resolve, reject) {
+ HttpRequest(false, Config.api.appStatisticsStats_days, 2, params, "GET", resolve, reject)
+ })
+}
+
+//获取渠道经理数据分析数据
+apiQuery.getAppStatisticsStats_customer = function (params) {
+ return new Promise(function (resolve, reject) {
+ HttpRequest(false, Config.api.appStatisticsStats_customer, 2, params, "GET", resolve, reject)
+ })
+}
+
export default apiQuery;
\ No newline at end of file
diff --git a/pages/customer/index.js b/pages/customer/index.js
index 0c7e764..0a253df 100644
--- a/pages/customer/index.js
+++ b/pages/customer/index.js
@@ -87,6 +87,7 @@ Page({
distBiz_id:'',
bizArray: [],
bizobj: [],
+ tag_ids:'',
},
onLoad(options) {
for (let key in options) {
@@ -112,6 +113,8 @@ Page({
this.getTimePicker()
+ this.getAppCustomersTag()
+
},
onShow(){
@@ -287,6 +290,9 @@ Page({
if(admin_ids!=''){
params['admin_ids'] = admin_ids;
}
+ if(this.data.tag_ids!=''){
+ params['tag_ids'] = this.data.tag_ids;
+ }
// if(this.data.staffIndex>-1){
// params['admin_id'] = this.data.staffobj[this.data.staffIndex].id;
// }
@@ -575,7 +581,9 @@ Page({
modelIndex:-1,
cfromIndex:-1,
staffIndex:-1,
+ tag_ids:'',
})
+ this.getAppCustomersTag()
},
//显示短信弹框
@@ -920,6 +928,58 @@ Page({
})
},
+ //客户标签
+ getAppCustomersTag(){
+ _.apiQuery.getAppCustomersTag().then(res => {
+ this.setData({
+ taglList:res.data.tags&&res.data.tags.length>0?res.data.tags:[],
+ })
+ });
+ },
+
+ //单选
+ tagRadioPicker(e){
+ let taglList = this.data.taglList
+ taglList[e.currentTarget.dataset.i].list.forEach(item => {
+ item.checked=false
+ })
+ taglList[e.currentTarget.dataset.i].list[e.currentTarget.dataset.j].checked=true
+ this.setData({
+ taglList,
+ })
+ this.tagforEach()
+ },
+
+ //多选
+ tagCheckPicker(e){
+ this.setData({
+ ['taglList['+e.currentTarget.dataset.i+'].list['+e.currentTarget.dataset.j+'].checked']:!this.data.taglList[e.currentTarget.dataset.i].list[e.currentTarget.dataset.j].checked,
+ })
+ this.tagforEach()
+ },
+
+ //tag遍历
+ tagforEach(){
+ let taglList = this.data.taglList
+ let tag_ids = ''
+ taglList.forEach(itemA => {
+ itemA.list.forEach(itemB => {
+ if(itemB.checked){
+ itemA.have=true
+ if(tag_ids==''){
+ tag_ids=itemB.id
+ }else{
+ tag_ids=tag_ids+','+itemB.id
+ }
+ }
+ })
+ })
+ this.setData({
+ tag_ids,
+ taglList,
+ })
+ },
+
//页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh(){
this.setData({
diff --git a/pages/customer/index.wxml b/pages/customer/index.wxml
index 3ac80a5..b5a8e9f 100644
--- a/pages/customer/index.wxml
+++ b/pages/customer/index.wxml
@@ -51,6 +51,11 @@
{{item.uname}}
+
+
+ {{option.name}}
+
+
@@ -168,7 +173,7 @@
跟进时间
-
+
{{item.title}}
@@ -260,12 +265,33 @@
销售顾问
-
+
{{item.uname}}
+
+
+
+
+ {{list.name}}
+ (单选)
+ (多选)
+
+
+
+ {{option.name}}
+
+
+
+
+ {{option.name}}
+
+
+
+
+
diff --git a/pages/dataAnalysis/detail/index.js b/pages/dataAnalysis/detail/index.js
new file mode 100644
index 0000000..72fb428
--- /dev/null
+++ b/pages/dataAnalysis/detail/index.js
@@ -0,0 +1,755 @@
+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 Pie1ChartData;
+let Pie2ChartData;
+let Pie3ChartData;
+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);
+ chart.on('click',function(e){
+ console.log(e)
+ });
+ return chart;
+}
+function Pie1Chart(canvas, width, height, dpr) {
+ const chart = echarts.init(canvas, null, {
+ width: width,
+ height: height,
+ devicePixelRatio: dpr // new
+ });
+ canvas.setChart(chart);
+ let option = Pie1ChartData
+ chart.setOption(option);
+ chart.on('click',function(e){
+ console.log(e)
+ });
+ return chart;
+}
+function Pie2Chart(canvas, width, height, dpr) {
+ const chart = echarts.init(canvas, null, {
+ width: width,
+ height: height,
+ devicePixelRatio: dpr // new
+ });
+ canvas.setChart(chart);
+ let option = Pie2ChartData
+ chart.setOption(option);
+ chart.on('click',function(e){
+ //_.eventBus.emit("pinpai",e.name)
+ });
+ return chart;
+}
+function Pie3Chart(canvas, width, height, dpr) {
+ const chart = echarts.init(canvas, null, {
+ width: width,
+ height: height,
+ devicePixelRatio: dpr // new
+ });
+ canvas.setChart(chart);
+ let option = Pie3ChartData
+ chart.setOption(option);
+ chart.on('click',function(e){
+ //_.eventBus.emit("pinpai",e.name)
+ });
+ return chart;
+}
+
+Page({
+ data: {
+ imgUrl: _.config.imgUrl,//静态图片路径
+ showPie1Chart:false,//是否显示Pie1图表
+ ecPie1:{},
+ showPie2Chart:false,//是否显示Pie2图表
+ ecPie2:{},
+ showPie3Chart:false,//是否显示Pie3图表
+ ecPie3:{},
+ showBarChart:false,//是否显示Bar图表
+ ecBar:{},
+ Pie1title:'',
+ Pie2title:'',
+ Pie3title:'',
+ Bartitle:'',
+ },
+
+ onLoad: function (options) {
+ for (let key in options) {
+ this.setData({
+ [key]: options[key]
+ })
+ }
+
+ this.getAppCity()
+
+ },
+
+ //获取系统配置城市
+ getAppCity(){
+ _.apiQuery.getAppCity().then(res => {
+ this.setData({
+ city_id:this.data.city_id?this.data.city_id:res.data.default,
+ })
+ let cityArray = []
+ res.data.list.forEach((item,index) => {
+ cityArray.push(item.name)
+ if(item.city_id==this.data.city_id){
+ this.setData({
+ cityIndex:index,
+ })
+ }
+ })
+ this.setData({
+ cityArray:cityArray,
+ cityList:res.data.list,
+ })
+
+ this.getAppStatisticsStats_customer()
+
+ });
+ },
+
+
+ //选择日期
+ changeDate(e){
+ if(e.currentTarget.dataset.type=="s_date"){
+ let begin = new Date(e.detail.value).getTime();
+ let end = new Date(this.data.e_date).getTime();
+ let day = 0
+ if(end>=begin){
+ day = (end - begin)/(24*60*60*1000);
+ this.setData({
+ s_date: e.detail.value,
+ })
+ }
+ else{
+ day = (begin - end)/(24*60*60*1000);
+ let s_date = this.data.e_date
+ let e_date = e.detail.value
+ this.setData({
+ s_date,
+ e_date,
+ })
+ }
+ if (day > 365) {
+ wx.showToast({
+ title: '请选择一年时间内',
+ icon: 'none'
+ })
+ }
+ else{
+ this.getAppStatisticsStats_customer()
+ }
+ }
+ if(e.currentTarget.dataset.type=="e_date"){
+ let begin = new Date(this.data.s_date).getTime();
+ let end = new Date(e.detail.value).getTime();
+ let day = 0
+ if(end>=begin){
+ day = (end - begin)/(24*60*60*1000);
+ this.setData({
+ e_date: e.detail.value,
+ })
+ }
+ else{
+ day = (begin - end)/(24*60*60*1000);
+ let e_date = this.data.s_date
+ let s_date = e.detail.value
+ this.setData({
+ s_date,
+ e_date,
+ })
+ }
+ if (day > 365) {
+ wx.showToast({
+ title: '请选择一年时间内',
+ icon: 'none'
+ })
+ }
+ else{
+ this.getAppStatisticsStats_customer()
+ }
+ }
+
+ },
+
+ //订单数据
+ getAppStatisticsStats_customer(){
+ this.setData({
+ showPie1Chart:false,
+ showPie2Chart:false,
+ showPie3Chart:false,
+ showBarChart:false,
+ })
+
+ let params = {};
+ params['type'] = this.data.type;
+ params['city_id'] = this.data.city_id;
+ params['s_time'] = this.data.s_date;
+ params['e_time'] = this.data.e_date;
+ _.apiQuery.getAppStatisticsStats_customer(params).then(res => {
+
+ wx.setNavigationBarTitle({
+ title: res.data.title
+ })
+
+ this.setData({
+ Pie1title:res.data.pie1?res.data.pie1.title:'',
+ Pie2title:res.data.pie2?res.data.pie2.title:'',
+ Pie3title:res.data.pie3?res.data.pie3.title:'',
+ Bartitle:res.data.bar?res.data.bar.title:'',
+ })
+
+ //Pie1ChartData = getPie1Option()
+ if(res.data.pie1){
+ if(res.data.pie1.series_data_1.length==0){
+ this.setData({
+ pie1noData:true,
+ })
+ }else{
+ Pie1ChartData = {
+ tooltip: {
+ trigger: 'item',
+ formatter: '{b}: {c} ({d}%)'
+ },
+ series: [
+ {
+ name: 'Access From',
+ type: 'pie',
+ selectedMode: 'single',
+ radius: [0, '30%'],
+ label: {
+ position: 'inner',
+ fontSize: 10
+ },
+ labelBar: {
+ show: false
+ },
+ data: []
+ },
+ {
+ name: 'Access From',
+ type: 'pie',
+ radius: ['45%', '65%'],
+ 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.pie1.series_data_1
+ Pie1ChartData.series[1].data = res.data.pie1.series_data_2
+ this.setData({
+ pie1noData:false,
+ showPie1Chart:true,
+ ['ecPie1.onInit']:Pie1Chart,
+ })
+ }
+ }
+
+ //Pie2ChartData = getPie2Option()
+ if(res.data.pie2){
+ if(res.data.pie2.series_data_1.length==0){
+ this.setData({
+ pie2noData:true,
+ })
+ }else{
+ Pie2ChartData = {
+ 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: []
+ }
+ ]
+ };
+ Pie2ChartData.series[0].data = res.data.pie2.series_data_1
+ this.setData({
+ pie2noData:false,
+ showPie2Chart:true,
+ ['ecPie2.onInit']:Pie2Chart,
+ pie2Bottom:res.data.pie2.bottom,
+ })
+ }
+ }
+
+ //Pie3ChartData = getPie3Option()
+ if(res.data.pie3){
+ if(res.data.pie3.series_data_1.length==0){
+ this.setData({
+ pie3noData:true,
+ })
+ }else{
+ Pie3ChartData = {
+ 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: []
+ }
+ ]
+ };
+ Pie3ChartData.series[0].data = res.data.pie3.series_data_1
+ this.setData({
+ pie3noData:false,
+ showPie3Chart:true,
+ ['ecPie3.onInit']:Pie3Chart,
+ pie3Bottom:res.data.pie3.bottom,
+ })
+ }
+ }
+
+ //BarChartData = getBarOption()
+ if(res.data.bar){
+ BarChartData = {
+ tooltip: {
+ trigger: 'axis'
+ },
+ grid: {
+ top: '1%',
+ left: '5%',
+ right: '5%',
+ bottom: '1%',
+ containLabel: true
+ },
+ calculable: true,
+ xAxis: {
+ type: 'value',
+ data: [],
+ },
+ yAxis: {
+ type: 'category',
+ data: [],
+ // axisLabel: {
+ // lineHeight: 16,
+ // width: '60',
+ // overflow: 'break',
+ // },
+ },
+ series: []
+ };
+
+ let xAxis_data = res.data.bar.xAxis_data
+ let yAxis_data = []
+ xAxis_data.forEach(item => {
+ if(item.length > 6){
+ yAxis_data.push(item.substring(0,6)+'...')
+ }else{
+ yAxis_data.push(item)
+ }
+ })
+
+ BarChartData.yAxis.data = yAxis_data
+ BarChartData.series = res.data.bar.series
+ this.setData({
+ Barheight:100 + 100*(res.data.bar.xAxis_data.length),
+ showBarChart:true,
+ ['ecBar.onInit']:BarChart,
+ })
+ }
+
+ wx.stopPullDownRefresh()
+
+ });
+ },
+
+ //推送链接
+ pushLink(e) {
+ if(e.currentTarget.dataset.url){
+ _.$router.openUrlScheme(e.currentTarget.dataset.url)
+ }
+ },
+
+ //选择城市
+ changeCity(e) {
+ this.setData({
+ city_id:this.data.cityList[e.detail.value].city_id,
+ cityIndex: e.detail.value
+ })
+ this.getAppStatisticsStats_customer()
+ },
+
+ //页面相关事件处理函数--监听用户下拉动作
+ onPullDownRefresh: function () {
+ this.getAppStatisticsStats_customer()
+ },
+
+})
+
+function getPie1Option() {
+ return {
+ tooltip: {
+ trigger: 'item',
+ formatter: '{b}: {c} ({d}%)'
+ },
+ series: [
+ {
+ name: 'Access From',
+ type: 'pie',
+ selectedMode: 'single',
+ radius: [0, '30%'],
+ label: {
+ position: 'inner',
+ fontSize: 10
+ },
+ labelBar: {
+ show: false
+ },
+ data: [
+ { value: 1548, name: 'H' },
+ { value: 775, name: 'A' },
+ { value: 679, name: 'B', }
+ ]
+ },
+ {
+ name: 'Access From',
+ type: 'pie',
+ radius: ['45%', '65%'],
+ 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: [
+ { value: 1048, name: '转介绍' },
+ { value: 335, name: '网络推广' },
+ { value: 310, name: '外展外拓' },
+ { value: 251, name: '自媒体' },
+ ]
+ },
+ ]
+ };
+}
+
+function getPie2Option() {
+ return {
+ // tooltip: {
+ // trigger: 'item',
+ // formatter: '{b}: {c} ({d}%)'
+ // },
+ series: [
+ {
+ name: 'Access From',
+ type: 'pie',
+ bottom:'10%',
+ 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: [
+ { value: 48, name: '转介绍' },
+ { value: 35, name: '网络推广' },
+ { value: 30, name: '外展外拓' },
+ { value: 21, name: '自媒体' },
+ ]
+ }
+ ]
+ };
+}
+
+function getPie3Option() {
+ return {
+ // tooltip: {
+ // trigger: 'item',
+ // formatter: '{b}: {c} ({d}%)'
+ // },
+ series: [
+ {
+ name: 'Access From',
+ type: 'pie',
+ bottom:'10%',
+ 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: [
+ { value: 48, name: '转介绍' },
+ { value: 35, name: '网络推广' },
+ { value: 30, name: '外展外拓' },
+ { value: 21, name: '自媒体' },
+ ]
+ }
+ ]
+ };
+}
+
+function getBarOption() {
+
+ return{
+ tooltip: {
+ trigger: 'axis'
+ },
+ grid: {
+ top: '8%',
+ left: '5%',
+ right: '5%',
+ bottom: '5%',
+ containLabel: true
+ },
+ calculable: true,
+ xAxis: {
+ type: 'value',
+ data: []
+ },
+ yAxis: {
+ type: 'category',
+ data: ['张三', '李四', '也可以直也可以直接使用图片', '赵六', '孙七', '周八', '吴九','郑十'],
+ axisLabel: {
+ align:'right',
+ lineHeight: 16,
+ width: '60',
+ overflow: 'breakAll',
+ },
+ },
+ series: [
+ {
+ name: '客户数',
+ type: 'bar',
+ data: [
+ 2, 4, 7, 76, 135, 162, 6, 3
+ ],
+ },
+ {
+ name: '订单数',
+ type: 'bar',
+ data: [
+ 1, 2, 5, 70, 115.6, 122, 3, 2
+ ],
+ }
+ ]
+ };
+}
\ No newline at end of file
diff --git a/pages/dataAnalysis/detail/index.json b/pages/dataAnalysis/detail/index.json
new file mode 100644
index 0000000..bd827f7
--- /dev/null
+++ b/pages/dataAnalysis/detail/index.json
@@ -0,0 +1,10 @@
+{
+ "navigationBarTitleText": "订单数据",
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#ff7052",
+ "backgroundColor": "#ffffff",
+ "backgroundColorTop": "#ff7052",
+ "usingComponents": {
+ "ec-canvas": "../../../ecCanvas/components/ec-canvas/ec-canvas"
+ }
+}
\ No newline at end of file
diff --git a/pages/dataAnalysis/detail/index.wxml b/pages/dataAnalysis/detail/index.wxml
new file mode 100644
index 0000000..711f4cd
--- /dev/null
+++ b/pages/dataAnalysis/detail/index.wxml
@@ -0,0 +1,87 @@
+
+
+
+
+
+ {{cityArray[cityIndex]}}
+
+
+
+
+
+
+
+ {{s_date}}
+
+
+
+ 至
+
+
+ {{e_date}}
+
+
+
+
+
+
+
+
+
+ {{Pie1title}}
+
+
+
+
+
+
+ {{pie1Bottom}}
+
+
+
+
+
+
+
+ {{Pie2title}}
+
+
+
+
+
+
+ {{pie2Bottom}}
+
+
+
+
+
+
+
+ {{Pie3title}}
+
+
+
+
+
+
+ {{pie3Bottom}}
+
+
+
+
+
+
+
+ {{Bartitle}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/dataAnalysis/detail/index.wxss b/pages/dataAnalysis/detail/index.wxss
new file mode 100644
index 0000000..1b81f79
--- /dev/null
+++ b/pages/dataAnalysis/detail/index.wxss
@@ -0,0 +1 @@
+/* pages/storeData/index.wxss */
\ No newline at end of file
diff --git a/pages/dataAnalysis/index.js b/pages/dataAnalysis/index.js
index 9f188bd..0a4d101 100644
--- a/pages/dataAnalysis/index.js
+++ b/pages/dataAnalysis/index.js
@@ -1,21 +1,10 @@
-import _ from '../../commons/js/commons'
+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;
-}
+let FunnelChartData;
function lineChart(canvas, width, height, dpr) {
const chart = echarts.init(canvas, null, {
width: width,
@@ -27,52 +16,50 @@ function lineChart(canvas, width, height, dpr) {
chart.setOption(option);
return chart;
}
+function FunnelChart(canvas, width, height, dpr) {
+ const chart = echarts.init(canvas, null, {
+ width: width,
+ height: height,
+ devicePixelRatio: dpr // new
+ });
+ canvas.setChart(chart);
+ let option = FunnelChartData
+ chart.setOption(option);
+ return chart;
+}
Page({
data: {
- imgUrl:_.config.imgUrl,
- showBarChart:false,//是否显示Bar图表
- ecBar:{},
+ imgUrl: _.config.imgUrl,//静态图片路径
+ showFunnelChart:false,//是否显示Funnel图表
+ ecFunnel:{},
showLineChart:false,//是否显示Line图表
ecLine:{},
- storeArray: [],
- storeobj: [],
- storeIndex:0,
- staffArray: [],
- staffobj: [],
- staffIndex:-1,
- tabId:'1',
- tab:[
- {
- id: 1,
- title: '客户数据'
- },
- {
- id: 2,
- title: '订单数据'
- },
- ],
- custom:[],//客户数据
- order:[],//订单数据
+ daysIndex:0,
+ daysArray:['近一周','近30日'],
+ isShowTip:false,
+ tipIndex:0,
},
- onLoad(options) {
+ onLoad: function (options) {
for (let key in options) {
this.setData({
[key]: options[key]
})
}
+
popularData.getDateLater(0,0).then(res => {
+ let s_date = res[0]
+ s_date= s_date.split('-')[0]+'-'+s_date.split('-')[1]+'-01'
this.setData({
- dateTime:res[2],
+ s_date,
+ e_date:res[1],
+ current_date:res[1],
})
+
+ this.getAppCity()
+
})
-
- this.getAppCity()
-
- },
-
- onShow: function () {
},
@@ -94,93 +81,150 @@ Page({
cityList:res.data.list,
})
- this.getAppUserBizs()
+ this.getAppStatisticsStats()
+ this.getAppStatisticsStats_days()
});
},
- //获取管理门店
- getAppUserBizs(){
+ //选择日期
+ changeDate(e){
+ if(e.currentTarget.dataset.type=="s_date"){
+ let begin = new Date(e.detail.value).getTime();
+ let end = new Date(this.data.e_date).getTime();
+ let day = 0
+ if(end>=begin){
+ day = (end - begin)/(24*60*60*1000);
+ this.setData({
+ s_date: e.detail.value,
+ })
+ }
+ else{
+ day = (begin - end)/(24*60*60*1000);
+ let s_date = this.data.e_date
+ let e_date = e.detail.value
+ this.setData({
+ s_date,
+ e_date,
+ })
+ }
+ if (day > 365) {
+ wx.showToast({
+ title: '请选择一年时间内',
+ icon: 'none'
+ })
+ }
+ else{
+ this.getAppStatisticsStats()
+ }
+ }
+ if(e.currentTarget.dataset.type=="e_date"){
+ let begin = new Date(this.data.s_date).getTime();
+ let end = new Date(e.detail.value).getTime();
+ let day = 0
+ if(end>=begin){
+ day = (end - begin)/(24*60*60*1000);
+ this.setData({
+ e_date: e.detail.value,
+ })
+ }
+ else{
+ day = (begin - end)/(24*60*60*1000);
+ let e_date = this.data.s_date
+ let s_date = e.detail.value
+ this.setData({
+ s_date,
+ e_date,
+ })
+ }
+ if (day > 365) {
+ wx.showToast({
+ title: '请选择一年时间内',
+ icon: 'none'
+ })
+ }
+ else{
+ this.getAppStatisticsStats()
+ }
+ }
+
+ },
+
+ //数据看板-漏斗
+ getAppStatisticsStats(){
+ this.setData({
+ showFunnelChart:false,
+ })
+
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,
- })
+ params['s_time'] = this.data.s_date;
+ params['e_time'] = this.data.e_date;
+ _.apiQuery.getAppStatisticsStats(params).then(res => {
- this.getAppUserAdmins()
- if(this.data.tabId==1){
- this.getAppXzStat()
- this.getAppStatisticsScust()
- }else if(this.data.tabId==2){
- this.getAppStatisticsOcust()
- }
+ wx.setNavigationBarTitle({
+ title: res.data.title
+ })
+
+ this.setData({
+ tabs:res.data.tabs,
+ })
+
+ //FunnelChartData = getFunnelOption()
+ FunnelChartData = {
+ series: [
+ {
+ name: 'Expected',
+ type: 'funnel',
+ top: '1%',
+ bottom:'5%',
+ left: '2%',
+ width: '72%',
+ label: {
+ position: 'right',
+ formatter: '{b}'
+ },
+ labelLine: {
+ show: false
+ },
+ itemStyle: {
+ opacity: 0.7
+ },
+ data: []
+ },
+ {
+ name: 'Actual',
+ type: 'funnel',
+ top:'1%',
+ bottom:'5%',
+ left: '7%',
+ width: '62%',
+ maxSize: '62%',
+ label: {
+ position: 'inside',
+ formatter: '{c}',
+ color: '#000'
+ },
+ itemStyle: {
+ opacity: 0.4,
+ borderColor: '#fff',
+ borderWidth:1
+ },
+ data: [],
+ z: 100
+ }
+ ]
+ };
+ if(res.data.funnel.actual_data[0].value==0&&res.data.funnel.actual_data[1].value==0&&res.data.funnel.actual_data[2].value==0){
+ FunnelChartData.series[1].itemStyle.opacity = 0
}
-
- });
- },
-
- //获取管理门店
- 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)
- })
+
+ FunnelChartData.series[0].data = res.data.funnel.expected_data
+ FunnelChartData.series[1].data = res.data.funnel.actual_data
this.setData({
- staffArray:staffArray,
- staffobj: res.data.list,
- })
- });
- },
-
- //获取电话统计数据
- getAppXzStat(){
- 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.getAppXzStat(params).then(res => {
- this.setData({
- xzstat:res.data,
- })
- });
- },
-
- //数据分析-客户数据
- 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
- //barChartData.tooltip.position=['10', '10']
- this.setData({
- custom:res.data.custom,
- showBarChart:true,
- ['ecBar.onInit']:barChart,
+ funneltitle:res.data.funnel.title,
+ showFunnelChart:true,
+ ['ecFunnel.onInit']:FunnelChart,
})
wx.stopPullDownRefresh()
@@ -188,24 +232,49 @@ Page({
});
},
- //数据分析-订单数据
- getAppStatisticsOcust(){
+ //客户/订单走势图
+ getAppStatisticsStats_days(){
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
- //lineChartData.tooltip.position=['10', '10']
+ let params = {};
+ params['city_id'] = this.data.city_id;
+ params['days'] = this.data.daysIndex == 0?'7':'30';
+ _.apiQuery.getAppBizStats_days(params).then(res => {
+
+ //lineChartData = getLineOption()
+ lineChartData = {
+ tooltip: {
+ trigger: 'axis'
+ },
+ legend: {
+ top: 'bottom',
+ data: []
+ },
+ grid: {
+ top: '3%',
+ left: '2%',
+ right: '5%',
+ bottom: '20%',
+ containLabel: true
+ },
+ xAxis: {
+ type: 'category',
+ boundaryGap: false,
+ data: []
+ },
+ yAxis: {
+ type: 'value'
+ },
+ series: []
+ };
+
+ lineChartData.legend.data = res.data.legend_data
+ lineChartData.xAxis.data = res.data.xAxis
+ lineChartData.series = res.data.series
this.setData({
- order:res.data.custom,
+ linetitle:res.data.title,
showLineChart:true,
['ecLine.onInit']:lineChart,
})
@@ -213,64 +282,29 @@ Page({
wx.stopPullDownRefresh()
});
+
},
- //选择城市
- changeCity(e) {
+ //选择天数
+ changeDays(e) {
this.setData({
- city_id:this.data.cityList[e.detail.value].city_id,
- cityIndex: e.detail.value
+ daysIndex: e.detail.value
})
- this.getAppUserBizs()
+ this.getAppStatisticsStats_days()
},
- //选择门店
- changeStore(e) {
+ //显示隐藏提示
+ optShowTip(e) {
this.setData({
- storeIndex: e.detail.value
+ isShowTip:!this.data.isShowTip,
})
- if(this.data.tabId==1){
- this.getAppStatisticsScust()
- }else if(this.data.tabId==2){
- this.getAppStatisticsOcust()
+ if(e.currentTarget.dataset.index){
+ this.setData({
+ tipIndex:e.currentTarget.dataset.index
+ })
}
},
- //日期选择
- changeDate(e){
- this.setData({
- dateTime: e.detail.value,
- })
- if(this.data.tabId==1){
- this.getAppStatisticsScust()
- }else if(this.data.tabId==2){
- this.getAppStatisticsOcust()
- }
- },
-
- //选择人员
- changeStaff(e) {
- this.setData({
- staffIndex: e.detail.value
- })
- if(this.data.tabId==1){
- this.getAppStatisticsScust()
- }else if(this.data.tabId==2){
- this.getAppStatisticsOcust()
- }
- },
-
- //切换tab
- changeTab(e){
- this.setData({
- tabId:e.currentTarget.dataset.id,
- })
- if(this.data.tabId==1){
- this.getAppStatisticsScust()
- }else if(this.data.tabId==2){
- this.getAppStatisticsOcust()
- }
- },
//推送链接
pushLink(e) {
@@ -279,52 +313,85 @@ Page({
}
},
+ //选择城市
+ changeCity(e) {
+ this.setData({
+ city_id:this.data.cityList[e.detail.value].city_id,
+ cityIndex: e.detail.value
+ })
+ this.getAppStatisticsStats()
+ this.getAppStatisticsStats_days()
+ },
+
//页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh: function () {
- this.getAppUserBizs()
+ this.getAppStatisticsStats()
+ this.getAppStatisticsStats_days()
},
})
-function getBarOption() {
+function getFunnelOption() {
return {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- grid: {
- top: '10%',
- left: '2%',
- right: '5%',
- bottom: '5%',
- containLabel: true
- },
- xAxis: {
- type: 'value',
- boundaryGap: [0, 0.01]
- },
- yAxis: {
- type: 'category',
- data: ['1月', '2月', '3月',],
- },
+ // legend: {
+ // top: 'bottom',
+ // data: ['客户量', '到店数', '成交数']
+ // },
series: [
{
- type: 'bar',
- itemStyle: {
- color:'#2e3246',
- borderRadius: [0, 20, 20, 0],
- },
- barWidth:'15',
- data: [33, 23, 29,],
+ name: 'Expected',
+ type: 'funnel',
+ top: '1%',
+ bottom:'5%',
+ left: '2%',
+ width: '72%',
label: {
- show: true,
- position: 'right',
- formatter: '{@[n]}',
- valueAnimation: true
- }
+ position: 'right',
+ formatter: '{b}'
+ },
+ labelLine: {
+ show: false
+ },
+ itemStyle: {
+ opacity: 0.7
+ },
+ data: [
+ { value: 33.3, name: '成交数(10%)' },
+ { value: 66.6, name: '到店数(25%)' },
+ { value: 100, name: '客户数(100%)' }
+ ]
},
+ {
+ name: 'Actual',
+ type: 'funnel',
+ top:'1%',
+ bottom:'5%',
+ left: '7%',
+ width: '62%',
+ maxSize: '62%',
+ label: {
+ position: 'inside',
+ formatter: '{c}',
+ color: '#000'
+ },
+ itemStyle: {
+ opacity: 0.4,
+ borderColor: '#fff',
+ borderWidth:1
+ },
+ // emphasis: {
+ // label: {
+ // position: 'inside',
+ // formatter: '{b}: {c}'
+ // }
+ // },
+ data: [
+ { value: 20, name: '成交数' },
+ { value: 50, name: '到店数' },
+ { value:200, name: '客户量' }
+ ],
+ z: 100
+ }
]
};
}
@@ -332,24 +399,43 @@ function getBarOption() {
function getLineOption() {
return{
+ tooltip: {
+ trigger: 'axis'
+ },
+ legend: {
+ top: 'bottom',
+ data: ['客户数', '订单数',]
+ },
grid: {
- top: '15%',
+ top: '3%',
left: '2%',
right: '5%',
- bottom: '5%',
+ bottom: '20%',
containLabel: true
},
xAxis: {
- type: 'category',
- data: ['1月', '2月', '3月',]
+ type: 'category',
+ boundaryGap: false,
+ data: ['1', '2', '3','4','5','6','7',]
},
yAxis: {
- type: 'value'
+ type: 'value'
},
- series: [{
- data: [20, 932, 901,],
- type: 'line',
- smooth: true
- }]
+ series: [
+ {
+ name: '客户数',
+ type: 'line',
+ //stack: '总量',//累加
+ data: [20, 30, 50, 60, 66, 70, 73, ],
+ smooth: true,
+ },
+ {
+ name: '订单数',
+ type: 'line',
+ //stack: '总量',//累加
+ data: [10, 10, 10,1, 1, 1, 1,],
+ smooth: true,
+ },
+ ]
};
}
\ No newline at end of file
diff --git a/pages/dataAnalysis/index.json b/pages/dataAnalysis/index.json
index f00c9e7..7ad33c4 100644
--- a/pages/dataAnalysis/index.json
+++ b/pages/dataAnalysis/index.json
@@ -1,10 +1,8 @@
{
- "navigationBarTitleText": "数据分析",
- "enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#1a1c26",
+ "navigationBarBackgroundColor": "#ff7052",
"backgroundColor": "#ffffff",
- "backgroundColorTop": "#1a1c26",
+ "backgroundColorTop": "#ff7052",
"usingComponents": {
"ec-canvas": "../../ecCanvas/components/ec-canvas/ec-canvas"
}
diff --git a/pages/dataAnalysis/index.wxml b/pages/dataAnalysis/index.wxml
index b57855f..9c35ae0 100644
--- a/pages/dataAnalysis/index.wxml
+++ b/pages/dataAnalysis/index.wxml
@@ -1,132 +1,100 @@
-
-
-
-
-
-
- 城市
-
-
- {{cityArray[cityIndex]}}
-
-
-
-
-
- 门店
-
-
- {{storeArray[storeIndex]}}
-
-
-
-
-
- 月份选择
-
-
- {{dateTime}}
-
-
-
-
-
- 人员选择
-
-
- 全部
- {{staffArray[staffIndex]}}
-
-
-
-
+
+
+
+
+
+ {{cityArray[cityIndex]}}
+
+
+
-
-
-
-
-
-
-
-
-
-
-
- {{item.value}}
- {{item.title}}
-
-
-
+
+
+
+ {{s_date}}
+
-
- 通话数据
-
-
- 通话总时长/min
- {{xzstat.call_time}}
-
-
- 平均通话/min
- {{xzstat.avg_time}}
-
-
- 未接通/次
- {{xzstat.unget_num}}
-
-
+
+ 至
+
+
+ {{e_date}}
+
-
-
-
-
-
-
-
-
-
- {{item.value}}
- {{item.title}}
-
-
-
-
-
+
-
-
-
-
- 数据分析·客户
-
-
-
-
-
-
-
-
-
-
-
-
- 数据分析·订单
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{item.value_1}}
+
+
+ {{item.title}}
+
+
+
+
+
+
-
+
+
+
+ {{funneltitle}}
+
+
+
+
+
+
+
+ 注:时间跨度越大越具参考性
+
+
+
+
+
+
+ {{linetitle}}
+
+
+ {{daysArray[daysIndex]}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 发生在时间周期内的\n [客户建档] / [进店客户]
+ 发生在时间周期内的\n [企微添加好友] / [企微好友完善手机号码]
+ 发生在时间周期内的\n [下定订单] / [退款订单]
+
+
+
+ 知道了
+
+
+
\ No newline at end of file
diff --git a/pages/dataAnalysis/index.wxss b/pages/dataAnalysis/index.wxss
index b68631e..1b81f79 100644
--- a/pages/dataAnalysis/index.wxss
+++ b/pages/dataAnalysis/index.wxss
@@ -1,6 +1 @@
-.bg-ffedeb{background-color:#ffedeb;}
-.height-0{
- position:relative;
- height:0;
- overflow:hidden;
-}
\ No newline at end of file
+/* pages/storeData/index.wxss */
\ No newline at end of file