统计二级数据

This commit is contained in:
老叶
2023-06-14 11:36:47 +08:00
parent e989f664a5
commit 9dd8f5e358
15 changed files with 374 additions and 88 deletions
+1 -1
View File
@@ -62,7 +62,7 @@
"pages/order/editVoucherImg/index", "pages/order/editVoucherImg/index",
"pages/dataAnalysis/detail/index", "pages/dataAnalysis/detail/index",
"pages/order/editBuyer/index", "pages/order/editBuyer/index",
"pages/storeData/orderData/subData/index" "pages/storeData/subData/index"
], ],
"echarts": [ "echarts": [
{ {
+2 -1
View File
@@ -1,4 +1,4 @@
const env = "p"; const env = "d";
const version = 1, const version = 1,
@@ -162,6 +162,7 @@ api = {
appBizStats_wxqy:'app/biz/stats_wxqy', //企微数据 appBizStats_wxqy:'app/biz/stats_wxqy', //企微数据
appBizStats_order:'app/biz/stats_order', //订单数据 appBizStats_order:'app/biz/stats_order', //订单数据
appBizStats_days:'app/biz/stats_days', //客户/订单走势图 appBizStats_days:'app/biz/stats_days', //客户/订单走势图
appBizStats_customer_pid:'app/biz/stats_customer_pid', //客户数据二级
appOptions:'app/options', //获取车辆选装包 appOptions:'app/options', //获取车辆选装包
+7
View File
@@ -931,6 +931,13 @@ apiQuery.getAppBizStats_days = function (params) {
}) })
} }
//客户数据二级
apiQuery.getAppBizStats_customer_pid = function (params) {
return new Promise(function (resolve, reject) {
HttpRequest(false, Config.api.appBizStats_customer_pid, 2, params, "GET", resolve, reject)
})
}
//获取渠道经理数据分析入口数据 //获取渠道经理数据分析入口数据
apiQuery.getAppStatisticsStats = function (params) { apiQuery.getAppStatisticsStats = function (params) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
+25 -2
View File
@@ -30,7 +30,12 @@ function Pie1Chart(canvas, width, height, dpr) {
let option = Pie1ChartData let option = Pie1ChartData
chart.setOption(option); chart.setOption(option);
chart.on('click',function(e){ chart.on('click',function(e){
console.log(e) if(e.data.id>0){
let obj = {}
obj.type = 1
obj.id = e.data.id
_.eventBus.emit("stats",obj)
}
}); });
return chart; return chart;
} }
@@ -44,7 +49,12 @@ function Pie2Chart(canvas, width, height, dpr) {
let option = Pie2ChartData let option = Pie2ChartData
chart.setOption(option); chart.setOption(option);
chart.on('click',function(e){ chart.on('click',function(e){
console.log(e) if(e.data.id>0){
let obj = {}
obj.type = 0
obj.id = e.data.id
_.eventBus.emit("stats",obj)
}
}); });
return chart; return chart;
} }
@@ -76,9 +86,22 @@ Page({
// }) // })
this.getAppBizStats_customer() this.getAppBizStats_customer()
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 + '&current_date=' + that.data.current_date
_.$router.openUrlScheme(url)
})
}, },
//生命周期函数--监听页面卸载
onUnload: function () {
//卸载消息通讯 是否显示授权用户信息
_.eventBus.remove('stats',this);
},
//选择日期 //选择日期
changeDate(e){ changeDate(e){
if(e.currentTarget.dataset.type=="s_date"){ if(e.currentTarget.dataset.type=="s_date"){
+2
View File
@@ -28,6 +28,7 @@
<ec-canvas class="absolute top-0 bottom-0 left-0 right-0" ec="{{ ecPie1 }}"></ec-canvas> <ec-canvas class="absolute top-0 bottom-0 left-0 right-0" ec="{{ ecPie1 }}"></ec-canvas>
</view> </view>
</view> </view>
<view class="text-center font-22 color-f9394d" wx:if='{{!pie1noData}}'>点击分类卡片查看具体数据</view>
</view> </view>
</view> </view>
@@ -42,6 +43,7 @@
<ec-canvas class="absolute top-0 bottom-0 left-0 right-0" ec="{{ ecPie2 }}"></ec-canvas> <ec-canvas class="absolute top-0 bottom-0 left-0 right-0" ec="{{ ecPie2 }}"></ec-canvas>
</view> </view>
</view> </view>
<view class="text-center font-22 color-f9394d" wx:if='{{!pie2noData}}'>点击分类卡片查看具体数据</view>
</view> </view>
</view> </view>
+22 -10
View File
@@ -30,7 +30,12 @@ function Pie1Chart(canvas, width, height, dpr) {
let option = Pie1ChartData let option = Pie1ChartData
chart.setOption(option); chart.setOption(option);
chart.on('click',function(e){ chart.on('click',function(e){
console.log(e) if(e.data.id>0){
let obj = {}
obj.type = 2
obj.id = e.data.id
_.eventBus.emit("stats",obj)
}
}); });
return chart; return chart;
} }
@@ -44,8 +49,13 @@ function Pie2Chart(canvas, width, height, dpr) {
let option = Pie2ChartData let option = Pie2ChartData
chart.setOption(option); chart.setOption(option);
chart.on('click',function(e){ chart.on('click',function(e){
_.eventBus.emit("pinpai",e.name) _.eventBus.emit("stats",e.name)
console.log(e) if(e.data.id>0){
let obj = {}
obj.type = 3
obj.id = e.data.id
_.eventBus.emit("stats",obj)
}
}); });
return chart; return chart;
} }
@@ -78,18 +88,20 @@ Page({
this.getAppBizStats_order() this.getAppBizStats_order()
let that = this
//消息通讯 是否显示授权用户信息按钮 //消息通讯 是否显示授权用户信息按钮
_.eventBus.on("pinpai", this, function(res){ _.eventBus.on("stats", this, function(res){
console.log(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 + '&current_date=' + that.data.current_date
_.$router.openUrlScheme(url)
}) })
}, },
// //生命周期函数--监听页面卸载 //生命周期函数--监听页面卸载
// onUnload: function () { onUnload: function () {
// //卸载消息通讯 是否显示授权用户信息 //卸载消息通讯 是否显示授权用户信息
// _.eventBus.remove('pinpai',this); _.eventBus.remove('stats',this);
// }, },
//选择日期 //选择日期
+2 -2
View File
@@ -29,7 +29,7 @@
</view> </view>
<view class="absolute left-0 bottom-0 right-0 text-center font-22 color-888">{{pie1Bottom}}</view> <view class="absolute left-0 bottom-0 right-0 text-center font-22 color-888">{{pie1Bottom}}</view>
</view> </view>
<!-- <view class="text-center font-22 color-f9394d" wx:if='{{!pie1noData}}'>点击分类卡片查看具体数据</view> --> <view class="text-center font-22 color-f9394d" wx:if='{{!pie1noData}}'>点击分类卡片查看具体数据</view>
</view> </view>
</view> </view>
@@ -45,7 +45,7 @@
</view> </view>
<view class="absolute left-0 bottom-0 right-0 text-center font-22 color-888">{{pie2Bottom}}</view> <view class="absolute left-0 bottom-0 right-0 text-center font-22 color-888">{{pie2Bottom}}</view>
</view> </view>
<!-- <view class="text-center font-22 color-f9394d" wx:if='{{!pie2noData}}'>点击分类卡片查看具体数据</view> --> <view class="text-center font-22 color-f9394d" wx:if='{{!pie2noData}}'>点击分类卡片查看具体数据</view>
</view> </view>
</view> </view>
@@ -1,66 +0,0 @@
// pages/storeData/orderData/subData/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
@@ -1,3 +0,0 @@
{
"usingComponents": {}
}
@@ -1,2 +0,0 @@
<!--pages/storeData/orderData/subData/index.wxml-->
<text>pages/storeData/orderData/subData/index.wxml</text>
@@ -1 +0,0 @@
/* pages/storeData/orderData/subData/index.wxss */
+266
View File
@@ -0,0 +1,266 @@
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 Pie1ChartData;
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;
}
Page({
data: {
imgUrl: _.config.imgUrl,//静态图片路径
showPie1Chart:false,//是否显示Pie1图表
ecPie1:{},
},
onLoad: function (options) {
for (let key in options) {
this.setData({
[key]: options[key]
})
}
this.getAppBizStats_customer_pid()
},
//选择日期
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.getAppBizStats_customer_pid()
}
}
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.getAppBizStats_customer_pid()
}
}
},
//订单数据
getAppBizStats_customer_pid(){
this.setData({
showPie1Chart:false,
})
let params = {};
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
})
// 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()
},
})
function getPie1Option() {
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: '自媒体' },
]
}
]
};
}
+10
View File
@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "数据看板",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#ff7052",
"backgroundColor": "#ffffff",
"backgroundColorTop": "#ff7052",
"usingComponents": {
"ec-canvas": "../../../ecCanvas/components/ec-canvas/ec-canvas"
}
}
+36
View File
@@ -0,0 +1,36 @@
<view class="container img-top-cover" style="background-image:url({{imgUrl}}storedata/theme.png);">
<view class="text-center pt30 pb30">
<view class="inline-block bg-fff-op20 pt5 pb5 pl20 pr20 font-22 color-fff ulib-r750">
<picker class="inline-block" mode="date" value="{{s_date}}" end="{{current_date}}" bindchange="changeDate" data-type="s_date">
<view>
<text>{{s_date}}</text>
<i class="iconfont ml5 icon-xuanze"></i>
</view>
</picker>
<text class="pl10 pr10">至</text>
<picker class="inline-block" mode="date" value="{{e_date}}" end="{{current_date}}" bindchange="changeDate" data-type="e_date">
<view>
<text>{{e_date}}</text>
<i class="iconfont ml5 icon-xuanze"></i>
</view>
</picker>
</view>
</view>
<view class="mb30 pl30 pr30">
<view class="inner30 pt40 bg-fff box-shadow-000-10-10 ulib-r10">
<!-- <view class="relative">
<view class="font-36">{{Pie1title}}</view>
</view> -->
<lcb-listmore isNoData='{{pie1noData}}' noDataMsg='暂无数据'></lcb-listmore>
<view class="mt50 mb20 relative height-400 z-index-0" wx:if="{{!pie1noData}}">
<view class="absolute wp100 height-400" wx:if="{{showPie1Chart}}">
<ec-canvas class="absolute top-0 bottom-0 left-0 right-0" ec="{{ ecPie1 }}"></ec-canvas>
</view>
<view class="absolute left-0 bottom-0 right-0 text-center font-22 color-888">{{pie1Bottom}}</view>
</view>
</view>
</view>
</view>
<lcb-footer></lcb-footer>
+1
View File
@@ -0,0 +1 @@
/* pages/storeData/index.wxss */