xiaohaizhao há 11 meses atrás
pai
commit
86603473fd

+ 217 - 0
salesPanel/biddingAnalysis/index.js

@@ -0,0 +1,217 @@
+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;
+            let dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000,
+                getMapText = getApp().globalData.Language.getMapText;
+
+            _Http.basic({
+                "id": 20231011201004,
+                content
+            }).then(res => {
+                console.log("报价分析", res)
+                if (res.code != '1') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                })
+                this.setData({
+                    list: [{
+                        name: getMapText("报价总次数"),
+                        value: res.data.totalqty
+                    }, {
+                        name: getMapText("客户报价次数"),
+                        text: getMapText("客户报价总次数"),
+                        value: res.data.cusqty
+                    }, {
+                        name: getMapText("项目报价次数"),
+                        text: getMapText("客户报价总次数"),
+                        value: res.data.proqty
+                    }, {
+                        name: getMapText("报价总金额"),
+                        value: CNY(res.data.totalamount >= dividend ? (res.data.totalamount / dividend) : res.data.totalamount),
+                        suffix: res.data.totalamount >= dividend ? getMapText("万") : ""
+                    }, {
+                        name: getMapText("客户报价金额"),
+                        value: CNY(res.data.cusamount >= dividend ? (res.data.cusamount / dividend) : res.data.cusamount),
+                        suffix: res.data.cusamount >= dividend ? getMapText("万") : ""
+                    }, {
+                        name: getMapText("项目报价金额"),
+                        value: CNY(res.data.proamount >= dividend ? (res.data.proamount / dividend) : res.data.proamount),
+                        suffix: res.data.proamount >= dividend ? getMapText("万") : ""
+                    }]
+                })
+            })
+
+            _Http.basic({
+                "id": 20231011154704,
+                content
+            }).then(res => {
+                console.log("报价分析图表", res)
+                if (res.code != '1') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                })
+
+            })
+        },
+        initChart(data) {
+            const dividend = wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000,
+                colors = ['#6CD2A1', '#5F9DFC', '#ECB937'],
+                getMapText = getApp().globalData.Language.getMapText;
+            const option = {
+                color: colors,
+                tooltip: {
+                    trigger: 'axis',
+                },
+                legend: {
+                    data: [`${getMapText('去年同期金额')}(${getMapText('万元')})`, `${getMapText('本期金额')}(${getMapText('万元')})`, `${getMapText('同比增长率')}`],
+                },
+                xAxis: [{
+                    type: 'category',
+                    axisTick: {
+                        alignWithLabel: true
+                    },
+                    data: data.tbzzl.map(v => v.date),
+                    axisLabel: {
+                        interval: 0,
+                        rotate: 45
+                    }
+                }],
+                yAxis: [{
+                        type: 'value',
+                        name: '',
+                        position: 'right',
+                        offset: 80,
+                        alignTicks: true,
+                        axisLine: {
+                            show: true,
+                        },
+                        axisLabel: {
+                            formatter: '{value}'
+                        }
+                    },
+                    {
+                        type: 'value',
+                        name: '',
+                        position: 'left',
+                        alignTicks: true,
+                        axisLine: {
+                            show: false,
+                        },
+                        axisLabel: {
+                            formatter: '{value}',
+                            rotate: 45
+                        }
+                    },
+                    {
+                        type: 'value',
+                        name: '',
+                        position: 'right',
+                        alignTicks: true,
+                        offset: 80,
+                        axisLine: {
+                            show: false,
+                            lineStyle: {
+                                color: colors[1]
+                            }
+                        },
+                        axisLabel: {
+                            formatter: '{value}'
+                        }
+                    },
+
+                ],
+                dataZoom: [{
+                    type: 'slider',
+                    show: true,
+                    xAxisIndex: 0,
+                    start: 0,
+                    end: 100
+                }],
+                series: [{
+                        name: `${getMapText('去年同期金额')}(${getMapText('万元')})`,
+                        type: 'bar',
+                        data: data.balance.filter(v => v.name == '去年同期金额').map(v => (v.value / dividend).toFixed(2)),
+                        smooth: true
+                    },
+                    {
+                        name: `${getMapText('本期金额')}(${getMapText('万元')})`,
+                        type: 'bar',
+                        yAxisIndex: 1,
+                        data: data.balance.filter(v => v.name == '本年金额').map(v => (v.value / dividend).toFixed(2)),
+                        smooth: true
+                    },
+                    {
+                        name: getMapText('同比增长率'),
+                        type: 'line',
+                        yAxisIndex: 2,
+                        data: data.tbzzl.map(v => (v.value * 100).toFixed(2)),
+                        smooth: true
+                    }
+                ]
+            };
+            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/biddingAnalysis/index.json

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

+ 1 - 0
salesPanel/biddingAnalysis/index.scss

@@ -0,0 +1 @@
+@import "../customerBlance/index.scss";

+ 16 - 0
salesPanel/biddingAnalysis/index.wxml

@@ -0,0 +1,16 @@
+<viewDate title='分析日期' bind:onChange='changeDate' />
+<view class="global-card">
+	<view class="accounts">
+		<view class="item" wx:for="{{list}}" wx:key="name">
+			<view class="title">{{item.name}}</view>
+			<view class="value">
+				{{item.value}}<text wx:if='{{item.suffix}}'>{{item.suffix}}</text>
+			</view>
+			<view class="iconfont icon-wenhao" data-name="{{item.text || item.name}}" catch:tap="showExplain" />
+		</view>
+	</view>
+	<view class="chart"></view>
+</view>
+<view class="chart2">
+	<ec-canvas id="mychart" canvas-id="chart" ec="{{ ec }}"></ec-canvas>
+</view>

+ 6 - 15
salesPanel/index/index.js

@@ -20,9 +20,10 @@ Page({
         }, {
             label: "销售TOP10"
         }, {
-            label: "报价分析"
+            label: "报价分析",
+            model: "#BiddingAnalysis"
         }],
-        tabsActive: 1,
+        tabsActive: 3,
         showFiltrate: false,
         dataid: wx.getStorageSync('userMsg').userid,
         username: wx.getStorageSync('userMsg').name,
@@ -54,21 +55,11 @@ Page({
         this.partialRenewal();
     },
     //局部数据更新 tabs
-    partialRenewal(init = false) {
+    partialRenewal() {
         const model = this.data.tabsList[this.data.tabsActive].model;
         if (model) {
-            const Component = this.selectComponent(model),
-                {
-                    total,
-                    pageNumber,
-                    pageTotal
-                } = Component.data.content,
-                id = this.data.sa_projectid;
-            if (total == null || init) {
-                Component.getList(id, init);
-            } else if (pageNumber <= pageTotal) {
-                Component.getList(id, false);
-            }
+            const Component = this.selectComponent(model);
+            Component.getList(true);
         }
     },
     openFiltrate() {

+ 2 - 1
salesPanel/index/index.json

@@ -1,7 +1,8 @@
 {
     "usingComponents": {
         "Panel": "../panel/index",
-        "CustomerBlance": "../customerBlance/index"
+        "CustomerBlance": "../customerBlance/index",
+        "biddingAnalysis": "../biddingAnalysis/index"
     },
     "navigationBarTitleText": "销售数据"
 }

+ 1 - 0
salesPanel/index/index.wxml

@@ -17,6 +17,7 @@
 <Yl_FunTabs id='Yl_FunTabs' safety='{{false}}' list='{{tabsList}}' mode='buts' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <Panel slot='销售面板' id='Panel' />
     <CustomerBlance slot='客户账户余额分析' id='CustomerBlance' />
+    <biddingAnalysis slot='报价分析' id='BiddingAnalysis' />
 </Yl_FunTabs>
 <Yl_Filtrate1 id="Yl_Filtrate1" show='{{showFiltrate}}' list="{{[]}}" bindhandle="handleFilter" bindinterrupt='interrupt'>
     <organization slot='head' defaultIsleave='1' dimissionF id='organization' />