xiaohaizhao vor 1 Jahr
Ursprung
Commit
e1a39bad8f

+ 1 - 0
packageA/activity/detail.js

@@ -216,6 +216,7 @@ Page({
                     pageTotal
                 } = Component.data.content,
                 id = this.data.detail.sat_campaignid;
+            if (model == "#Files") init = true;
             if (total == null || init) {
                 Component.getList(id, init);
             } else if (pageNumber <= pageTotal) {

+ 9 - 2
project.private.config.json

@@ -11,12 +11,19 @@
         "miniprogram": {
             "list": [
                 {
-                    "name": "salesPanel/index/index",
-                    "pathName": "salesPanel/index/index",
+                    "name": "salesPanel/dataOverview/index",
+                    "pathName": "salesPanel/dataOverview/index",
                     "query": "",
                     "scene": null,
                     "launchMode": "default"
                 },
+                {
+                    "name": "salesPanel/index/index",
+                    "pathName": "salesPanel/index/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
                 {
                     "name": "数据总揽",
                     "pathName": "salesPanel/dataOverview/index",

+ 165 - 0
salesPanel/dataOverview/Clue/AnalysisOfLeadConversion.js

@@ -0,0 +1,165 @@
+const _Http = getApp().globalData.http,
+    currency = require("../../../utils/currency"),
+    CNY = (value, symbol = "¥", precision = 2) => currency(value, {
+        symbol,
+        precision
+    }).format();
+
+import * as echarts from '../../ec-canvas/echarts';
+Component({
+    properties: {
+
+    },
+    options: {
+        addGlobalClass: true
+    },
+    lifetimes: {
+        attached: function () {
+            getApp().globalData.Language.getLanguagePackage(this)
+        }
+    },
+    data: {
+        "content": {
+            dataid: wx.getStorageSync('userMsg').userid,
+            username: wx.getStorageSync('userMsg').name,
+            enddate: new Date().toISOString().split('T')[0],
+            where: {}
+        },
+    },
+    methods: {
+        async getList(init = false) {
+            let content = this.data.content
+            const {
+                dataid,
+                type,
+                username,
+                isleave
+            } = getCurrentPages()[getCurrentPages().length - 1].data;
+            if (content.dataid != dataid || content.type != type || isleave != isleave) init = true
+            content.dataid = dataid;
+            content.type = type;
+            content.username = username;
+            content.where.isleave = isleave;
+
+            _Http.basic({
+                "id": 20231015124404,
+                content
+            }).then(res => {
+                console.log("近12月线索转化分析", res)
+                if (res.code != '1') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                })
+                this.initChart(res.data.histogram.concat(res.data.lineChart), res.data.lineChart.map(v => v.date))
+            })
+        },
+        initChart(data, dates) {
+            console.log("data", data)
+            let dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000,
+                getMapText = getApp().globalData.Language.getMapText,
+                list = [{
+                    name: "转化总次数",
+                    color: "#6395F9"
+                }, {
+                    name: "转化项目次数",
+                    color: "#62DAAB"
+                }, {
+                    name: "转化客户次数",
+                    color: "#657797"
+                }, {
+                    name: "总次数同比增长率",
+                    color: "#F6C022"
+                }];
+            list.map(item => {
+                item.data = data.filter(v => v.key == item.name).map(v => v.value)
+                return item
+            })
+            console.log("list", list)
+
+            const option = {
+                tooltip: {
+                    trigger: 'axis',
+                    confine: true,
+                    formatter: function (params) {
+                        let tooltipText = '';
+                        params.forEach((item, index) => {
+                            tooltipText += `${index==0?item.axisValue+'\n':''}${item.marker}${item.seriesName}: ${item.seriesName == getMapText('总次数同比增长率') ? (item.value * 100).toFixed(2) :item.value}${item.seriesName == getMapText('总次数同比增长率') ? '%' : ''}\n`;
+                        });
+                        return tooltipText;
+                    },
+                    textStyle: {
+                        fontSize: 10,
+                    }
+                },
+                legend: {
+                    data: list.map(v => getMapText(v.name)),
+                    top: '0rpx', // Moved legend position upwards by 10rpx
+                    textStyle: {
+                        fontSize: 12 // Reduced font size for legend text
+                    }
+                },
+                grid: {
+                    top: '32%', // Adjust grid top to leave space for the legend
+                    left: '3%',
+                    right: '4%',
+                    bottom: '3%',
+                    containLabel: true
+                },
+                xAxis: {
+                    type: 'category',
+                    boundaryGap: false,
+                    data: dates,
+                    axisLabel: {
+                        interval: 0, // Force display all labels
+                        rotate: 45, // Rotate labels to prevent overlap
+                        fontSize: 10 // Reduced font size for X-axis labels
+                    }
+                },
+                yAxis: {
+                    type: 'value',
+                    axisLabel: {
+                        fontSize: 10 // Reduced font size for Y-axis labels
+                    }
+                },
+                series: list.map(v => {
+                    return {
+                        name: getMapText(v.name),
+                        type: 'line',
+                        stack: 'Total',
+                        data: v.data,
+                        itemStyle: {
+                            color: v.color
+                        },
+                        lineStyle: {
+                            color: v.color
+                        }
+                    }
+                })
+            };
+            this.chartComponent = this.selectComponent('#mychart');
+            this.chartComponent.init((canvas, width, height, dpr) => {
+                const chart = echarts.init(canvas, null, {
+                    width,
+                    height,
+                    devicePixelRatio: dpr
+                });
+                chart.setOption(option);
+                return chart;
+            });
+        },
+        changeDate({
+            detail
+        }) {
+            this.setData({
+                "content.enddate": detail
+            })
+            this.getList(true)
+        },
+        showExplain(e) {
+            const {
+                name
+            } = e.currentTarget.dataset;
+            getApp().globalData.Language.modeBoxPrompts(getApp().globalData.Language.getMapText('统计到当前查询时间为止的') + name + "(" + getApp().globalData.Language.getMapText('审核状态') + ")")
+        },
+    }
+})

+ 6 - 0
salesPanel/dataOverview/Clue/AnalysisOfLeadConversion.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "ec-canvas": "../../ec-canvas/ec-canvas"
+    }
+}

+ 19 - 0
salesPanel/dataOverview/Clue/AnalysisOfLeadConversion.scss

@@ -0,0 +1,19 @@
+@import "../../customerBlance/index.scss";
+
+.chart {
+	height: 630rpx;
+	width: 100vw;
+}
+
+.chart2 {
+	position: relative;
+
+	ec-canvas {
+		position: absolute;
+		top: -670rpx;
+		width: 700rpx;
+		height: 630rpx;
+		z-index: 2;
+		right: 20rpx;
+	}
+}

+ 7 - 0
salesPanel/dataOverview/Clue/AnalysisOfLeadConversion.wxml

@@ -0,0 +1,7 @@
+<viewDate title='分析日期' bind:onChange='changeDate' />
+<view class="global-card">
+	<view class="chart"></view>
+</view>
+<view class="chart2">
+	<ec-canvas id="mychart" canvas-id="chart" ec="{{ ec }}"></ec-canvas>
+</view>

+ 3 - 0
salesPanel/dataOverview/list/Clue.js

@@ -19,6 +19,9 @@ Component({
         tabsList: [{
             label: "数据概况",
             model: "#DataOverview"
+        }, {
+            label: "近12月线索转化分析",
+            model: "#AnalysisOfLeadConversion"
         }],
         init: false
     },

+ 2 - 1
salesPanel/dataOverview/list/Clue.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-        "DataOverview": "../Clue/dataOverview"
+        "DataOverview": "../Clue/dataOverview",
+        "AnalysisOfLeadConversion": "../Clue/AnalysisOfLeadConversion"
     }
 }

+ 1 - 0
salesPanel/dataOverview/list/Clue.wxml

@@ -1,3 +1,4 @@
 <Yl_FunTabs id='Yl_FunTabs' safety='{{false}}' list='{{tabsList}}' mode='buts' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <DataOverview slot='数据概况' id='DataOverview' />
+    <AnalysisOfLeadConversion  slot='近12月线索转化分析' id='AnalysisOfLeadConversion' />
 </Yl_FunTabs>

+ 1 - 1
salesPanel/index/index.js

@@ -57,7 +57,7 @@ Page({
             label: "财务回款分析",
             model: "#FinancialCollectionAnalysis"
         }],
-        tabsActive: 13,
+        tabsActive: 0,
         showFiltrate: false,
         dataid: wx.getStorageSync('userMsg').userid,
         username: wx.getStorageSync('userMsg').name,