ソースを参照

Merge branch '红色' into 测试

xiaohaizhao 1 年間 前
コミット
42c92cbc76

+ 67 - 6
packageA/salesHourglass/index.js

@@ -16,8 +16,8 @@ const _Http = getApp().globalData.http,
             }
         } else if (length <= 8) {
             return { //万-千万
-                
-                show: CNY(currency(n).divide(wx.getStorageSync('languagecode')=='ZH' ? 10000 : 1000)).replace(regexp, '$1') + getApp().globalData.Language.getMapText('万元'),
+
+                show: CNY(currency(n).divide(wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000)).replace(regexp, '$1') + getApp().globalData.Language.getMapText('万元'),
                 value: CNY(n)
             }
         } else {
@@ -33,12 +33,14 @@ import {
     createElement
 } from '@antv/f2';
 import Chart from './modules/chart';
+import barChart from './modules/barChart';
 import {
     jsx as _jsx
 } from "@antv/f2/jsx-runtime";
 Page({
     data: {
         onRenderChart: () => {},
+        onRenderBarChart: () => {},
         showFiltrate: false,
         "where": {
             "begindate": "",
@@ -103,7 +105,13 @@ Page({
                 id: 4,
                 queryMonths: 3
             }]
-        }]
+        }],
+        firstTwelveMonths: {
+            dealaccuracyrate: '0%',
+            totaldealamount: 0,
+            totaldeviationamount: 0,
+            totalsignamount_due: 0
+        }
     },
     onLoad(options) {
         _Http.basic({
@@ -138,7 +146,7 @@ Page({
     onReady() {
         this.setChartData();
         this.selectComponent("#organization").setData({
-            isleave:1
+            isleave: 1
         })
         this.selectComponent("#organization").initDepAndUser();
         // this.selectComponent("#Yl_Filtrate1").queryMonths(12)
@@ -160,7 +168,7 @@ Page({
     }) {
         if (detail.name == 'reset') {
             this.selectComponent("#organization").setData({
-                isleave:1
+                isleave: 1
             })
             this.selectComponent("#organization").initDepAndUser()
             this.setData({
@@ -195,7 +203,8 @@ Page({
     },
     setChartData() {
         this.setData({
-            statistics: []
+            statistics: [],
+            comingYear: []
         })
         _Http.basic({
             "id": 20230630151504,
@@ -232,10 +241,62 @@ Page({
                 }
             });
         })
+
+        _Http.basic({
+            "id": 20241028162104,
+            "content": this.data.content
+        }).then(res => {
+            console.log("前12个月总数据", res)
+            if (res.code != '1') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+
+
+            this.setData({
+                firstTwelveMonths: {
+                    dealaccuracyrate: (res.data.dealaccuracyrate * 100).toFixed(2) + '%',
+                    totaldealamount: (res.data.totaldealamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000)).toFixed(2),
+                    totaldeviationamount: (res.data.totaldeviationamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000)).toFixed(2),
+                    totalsignamount_due: (res.data.totalsignamount_due / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000)).toFixed(2),
+                }
+            })
+        })
+
+        //wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000)
+
+        _Http.basic({
+            "id": 20241028162004,
+            "content": this.data.content
+        }).then(res => {
+            console.log("未来12月", res)
+            if (res.code != '1') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            this.setData({
+                comingYear: res.data.map(v => {
+                    v.signamount_due = (v.signamount_due / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000)).toFixed(2) - 0
+                    return v
+                }),
+                onRenderBarChart: res.data.length == 0 ? () => {} : () => {
+                    return this.renderBarChart();
+                }
+            });
+            console.log(this.data.comingYear)
+        })
     },
     renderChart() {
+        console.log("renderChart")
         return createElement(Chart, {
             data: this.data.statistics
         });
+
+    },
+    renderBarChart() {
+        console.log("renderBarChart")
+        return createElement(barChart, {
+            data: this.data.comingYear
+        });
     }
 })

+ 62 - 0
packageA/salesHourglass/index.scss

@@ -25,6 +25,68 @@
     }
 }
 
+.box {
+    background-color: #fff;
+    padding: 20rpx 30rpx;
+    padding-bottom: 0;
+    width: 100vw;
+    box-sizing: border-box;
+    margin-top: 20rpx;
+
+    .project-title {
+        line-height: 42rpx;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 600;
+        font-size: 30rpx;
+        color: #333333;
+    }
+
+    .project-total-data-box {
+        width: 690rpx;
+        background: #F6F6F6;
+        border-radius: 8rpx;
+        padding: 20rpx;
+        box-sizing: border-box;
+        margin-top: 20rpx;
+
+        .title {
+            line-height: 40rpx;
+            font-family: PingFangSC-Semibold, PingFangSC-Semibold;
+            font-weight: 600;
+            font-size: 28rpx;
+            color: #171A1D;
+        }
+
+        .row {
+            display: flex;
+
+            .col {
+                width: 50%;
+                display: flex;
+                line-height: 34rpx;
+                font-family: PingFang SC, PingFang SC;
+                font-size: 24rpx;
+                color: #666666;
+                margin-top: 10rpx;
+                box-sizing: border-box;
+                padding-right: 6rpx;
+
+                .green {
+                    color: #009966;
+                }
+            }
+        }
+    }
+
+}
+
+.bar-chart-box {
+    width: 100%;
+    height: 340rpx;
+    box-sizing: border-box;
+    background-color: #fff;
+}
+
 .item {
     background-color: #fff;
     padding: 20rpx 30rpx;

+ 33 - 0
packageA/salesHourglass/index.wxml

@@ -10,6 +10,39 @@
 <view class="container" style="height: {{cHeight}};" wx:if="{{statistics.length}}">
     <f2 onRender="{{onRenderChart}}" />
 </view>
+
+<view class="box">
+    <view class="project-title">
+        {{language['项目预计成交统计']||'项目预计成交统计'}}
+    </view>
+    <view class="project-total-data-box">
+        <view class="title">{{language['前12个月总数据']||'前12个月总数据'}}</view>
+        <view class="row">
+            <view class="col">
+                {{language['准确率']||'准确率'}}:
+                <text class="green">{{firstTwelveMonths.dealaccuracyrate}}</text>
+            </view>
+            <view class="col">
+                {{language['偏差金额']||'偏差金额'}}:
+                <text class="green">{{firstTwelveMonths.totaldeviationamount + (language['万']||'万')}}</text>
+            </view>
+        </view>
+        <view class="row">
+            <view class="col">
+                {{language['预计签约金额']||'预计签约金额'}}:{{firstTwelveMonths.totalsignamount_due + (language['万']||'万') }}
+            </view>
+            <view class="col">
+                {{language['项目成交金额']||'项目成交金额'}}:{{firstTwelveMonths.totaldealamount + (language['万']||'万') }}
+            </view>
+        </view>
+    </view>
+    <view wx:if="{{comingYear.length}}" class="project-title" style="margin-top: 20rpx;">
+        {{language['未来12月预计签约金额统计']||'未来12月预计签约金额统计'}}({{language['单位']||'单位'}}:{{language['万']||'万'}})
+    </view>
+</view>
+<view wx:if="{{comingYear.length}}" class="bar-chart-box">
+    <f2 onRender="{{onRenderBarChart}}" />
+</view>
 <view class="row-amount">
     <view>
         {{language['项目总计']||'项目总计'}}:{{statistics.length ? statistics[0].sequence1 : 0}}

+ 41 - 0
packageA/salesHourglass/modules/barChart.js

@@ -0,0 +1,41 @@
+import {
+    Chart,
+    Interval,
+    Axis,
+    Tooltip,
+    ScrollBar
+} from '@antv/f2';
+
+import {
+    jsx as _jsx
+} from "@antv/f2/jsx-runtime";
+import {
+    jsxs as _jsxs
+} from "@antv/f2/jsx-runtime";
+
+export default (({
+    data
+}) => {
+    return _jsxs(Chart, {
+        data,
+        children: [
+            _jsx(Axis, {
+                field: "signdate_due"
+            }),
+            _jsx(Axis, {
+                field: "signamount_due"
+            }),
+            _jsx(Interval, {
+                x: "signdate_due",
+                y: "signamount_due",
+            }),
+            _jsx(ScrollBar, {
+                mode: "x",
+                range: [0, 0.6]
+            }),
+            _jsx(Tooltip, {
+                triggerOn: "touchstart"
+            }),
+        ]
+    });
+});

+ 2 - 2
project.private.config.json

@@ -9,8 +9,8 @@
         "miniprogram": {
             "list": [
                 {
-                    "name": "客户报价单",
-                    "pathName": "packageA/offers/addSetclientOffer",
+                    "name": "销售漏斗",
+                    "pathName": "packageA/salesHourglass/index",
                     "query": "",
                     "launchMode": "default",
                     "scene": null