Browse Source

第4,5个统计

lizhen_gitee 1 year ago
parent
commit
953dbacf84

+ 179 - 0
application/admin/controller/Dashboard.php

@@ -191,4 +191,183 @@ class Dashboard extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 销售金额数据统计
+     */
+    public function datacenter_three(){
+        $type = input('type',1);
+
+        $servicetype = Db::name('servicetype')->field('id,title as name')->select();
+        //七日
+        if($type == 1){
+            $starttime = strtotime(date('Y-m-d')) - 518400;
+            $endtime   = strtotime(date('Y-m-d')) + 86399;
+
+            $ec_date = [];
+
+            $map = [
+                'company_id'  => $this->auth->company_id,
+                'status'      => 3,
+            ];
+            if($this->auth->type == 2){
+                $map['staff_id'] = $this->auth->id;
+            }
+
+
+            for($i=$starttime;$i<$endtime;$i+=86400){
+                $starttime_i = $i;
+                $endtime_i = $i + 86399;
+                //日历
+                $ec_date[] = date('d',$starttime_i).'日';
+            }
+
+            foreach($servicetype as $key => &$val){
+                $map['servicetype_id'] = $val['id'];
+                $val['data'] = [];
+                $val['textColor'] = '#FFFFFF';
+                for($i=$starttime;$i<$endtime;$i+=86400){
+                    $starttime_i = $i;
+                    $endtime_i = $i + 86399;
+                    //销售金额
+                    $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
+                    $val['data'][] = Db::name('order')->where($map)->sum('total_fee');
+                }
+                unset($val['id']);
+            }
+
+            $result = [
+                'ec_data'     => $ec_date,
+                'ec_totalfee' => $servicetype,
+            ];
+            $this->success(1,$result);
+        }else{
+            $thismonth = strtotime(date('Y-m-01'));
+
+            $ec_date = [];
+
+            $map = [
+                'company_id'  => $this->auth->company_id,
+                'status'      => 3,
+            ];
+            if($this->auth->type == 2){
+                $map['staff_id'] = $this->auth->id;
+            }
+
+
+            for($i=5;$i>=0;$i--){
+                $starttime_i = strtotime("-".$i." month",$thismonth);
+                $endtime_i = strtotime("-".($i+1) ." month",$thismonth) - 1;
+                //日历
+                $ec_date[] = date('m',$starttime_i).'月';
+                //dump(date('Y-m-d H:i:s',$starttime_i));
+                //dump(date('Y-m-d H:i:s',$endtime_i));
+            }
+
+
+            foreach($servicetype as $key => &$val){
+                $map['servicetype_id'] = $val['id'];
+                $val['data'] = [];
+                $val['textColor'] = '#FFFFFF';
+                for($i=5;$i>=0;$i-=1){
+                    $starttime_i = strtotime("-".$i." month",$thismonth);
+                    $endtime_i = strtotime("-".($i+1) ." month",$thismonth) - 1;
+                    //销售金额
+                    $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
+                    $val['data'][] = Db::name('order')->where($map)->sum('total_fee');
+                }
+                unset($val['id']);
+            }
+
+            $result = [
+                'ec_data'     => $ec_date,
+                'ec_totalfee' => $servicetype,
+            ];
+            $this->success(1,$result);
+        }
+
+    }
+
+    /**
+     * 业绩统计笔数
+     */
+    public function datacenterfour(){
+        $starttime = strtotime(date('Y-m-d',strtotime("-30 day")));  //默认30天前
+        $endtime   = strtotime(date('Y-m-d')) - 1;
+
+        //接收
+        $choicedatetime = input('choicedatetime','');
+        if(!empty($choicedatetime)){
+            $choicedatetime = explode(' - ',$choicedatetime);
+            $starttime = strtotime($choicedatetime[0]);
+            $endtime   = strtotime($choicedatetime[1]) + 86399;
+        }
+        $this->view->assign('defaultdatetime',date('Y-m-d',$starttime).' - '.date('Y-m-d',$endtime));
+
+        $staff = Db::name('company_staff')->field('id,truename')->where('type',2)->where('company_id',$this->auth->company_id)->select();
+        //柱状图
+        $ec_date = [];
+        $ec_ordernum = [];
+
+        $map = [
+            'company_id'  => $this->auth->company_id,
+            'status'      => 3,
+            'finish_time' => ['between',[$starttime,$endtime]],
+        ];
+
+        foreach($staff as $key => $val){
+            //日历
+            $ec_date[] = $val['truename'];
+            //下单人数
+            $map['staff_id']    = $val['id'];
+            $ec_ordernum[] = Db::name('order')->where($map)->count('id');
+        }
+
+        $this->assignconfig('ec_date', $ec_date);
+        $this->assignconfig('ec_ordernum', $ec_ordernum);
+
+        return $this->view->fetch();
+    }
+
+    /**
+     * 业绩统计金额
+     */
+    public function datacenterfive(){
+        $starttime = strtotime(date('Y-m-d',strtotime("-30 day")));  //默认30天前
+        $endtime   = strtotime(date('Y-m-d')) - 1;
+
+        //接收
+        $choicedatetime = input('choicedatetime','');
+        if(!empty($choicedatetime)){
+            $choicedatetime = explode(' - ',$choicedatetime);
+            $starttime = strtotime($choicedatetime[0]);
+            $endtime   = strtotime($choicedatetime[1]) + 86399;
+        }
+        $this->view->assign('defaultdatetime',date('Y-m-d',$starttime).' - '.date('Y-m-d',$endtime));
+
+        $staff = Db::name('company_staff')->field('id,truename')->where('type',2)->where('company_id',$this->auth->company_id)->select();
+        //柱状图
+        $ec_date = [];
+        $ec_ordernum = [];
+
+        $map = [
+            'company_id'  => $this->auth->company_id,
+            'status'      => 3,
+            'finish_time' => ['between',[$starttime,$endtime]],
+        ];
+
+        foreach($staff as $key => $val){
+            //日历
+            $ec_date[] = $val['truename'];
+            //下单人数
+            $map['staff_id']    = $val['id'];
+            $ec_ordernum[] = Db::name('order')->where($map)->sum('total_fee');
+        }
+
+        $this->assignconfig('ec_date', $ec_date);
+        $this->assignconfig('ec_ordernum', $ec_ordernum);
+
+        return $this->view->fetch();
+    }
+
+
 }

+ 213 - 0
application/admin/view/dashboard/datacenterfive.html

@@ -0,0 +1,213 @@
+<style type="text/css">
+    .sm-st {
+        background: #fff;
+        padding: 20px;
+        -webkit-border-radius: 3px;
+        -moz-border-radius: 3px;
+        border-radius: 3px;
+        margin-bottom: 20px;
+    }
+
+    .sm-st-icon {
+        width: 60px;
+        height: 60px;
+        display: inline-block;
+        line-height: 60px;
+        text-align: center;
+        font-size: 30px;
+        background: #eee;
+        -webkit-border-radius: 5px;
+        -moz-border-radius: 5px;
+        border-radius: 5px;
+        float: left;
+        margin-right: 10px;
+        color: #fff;
+    }
+
+    .sm-st-info {
+        padding-top: 2px;
+    }
+
+    .sm-st-info span {
+        display: block;
+        font-size: 24px;
+        font-weight: 600;
+    }
+
+    .orange {
+        background: #fa8564 !important;
+    }
+
+    .tar {
+        background: #45cf95 !important;
+    }
+
+    .sm-st .green {
+        background: #86ba41 !important;
+    }
+
+    .pink {
+        background: #AC75F0 !important;
+    }
+
+    .yellow-b {
+        background: #fdd752 !important;
+    }
+
+    .stat-elem {
+
+        background-color: #fff;
+        padding: 18px;
+        border-radius: 40px;
+
+    }
+
+    .stat-info {
+        text-align: center;
+        background-color: #fff;
+        border-radius: 5px;
+        margin-top: -5px;
+        padding: 8px;
+        -webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
+        box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
+        font-style: italic;
+    }
+
+    .stat-icon {
+        text-align: center;
+        margin-bottom: 5px;
+    }
+
+    .st-red {
+        background-color: #F05050;
+    }
+
+    .st-green {
+        background-color: #27C24C;
+    }
+
+    .st-violet {
+        background-color: #7266ba;
+    }
+
+    .st-blue {
+        background-color: #23b7e5;
+    }
+
+    .stats .stat-icon {
+        color: #28bb9c;
+        display: inline-block;
+        font-size: 26px;
+        text-align: center;
+        vertical-align: middle;
+        width: 50px;
+        float: left;
+    }
+
+    .stat {
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        display: inline-block;
+    }
+
+    .stat .value {
+        font-size: 20px;
+        line-height: 24px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        font-weight: 500;
+    }
+
+    .stat .name {
+        overflow: hidden;
+        text-overflow: ellipsis;
+        margin: 5px 0;
+    }
+
+    .stat.lg .value {
+        font-size: 26px;
+        line-height: 28px;
+    }
+
+    .stat-col {
+        margin:0 0 10px 0;
+    }
+    .stat.lg .name {
+        font-size: 16px;
+    }
+
+    .stat-col .progress {
+        height: 2px;
+    }
+
+    .stat-col .progress-bar {
+        line-height: 2px;
+        height: 2px;
+    }
+
+    .item {
+        padding: 30px 0;
+    }
+
+
+    #statistics .panel {
+        min-height: 150px;
+    }
+
+    #statistics .panel h5 {
+        font-size: 14px;
+    }
+</style>
+<div class="panel panel-default panel-intro">
+    <form  method="POST"  class="form-horizontal" action="">
+        <div class="form-group">
+            <div class="col-xs-12 col-sm-2">
+                <input type="text" class="form-control" name="choicedatetime" value="{$defaultdatetime}" placeholder="选择时间" id="choicedatetime" data-index="4" autocomplete="off">
+            </div>
+        </div>
+        <div class="form-group layer-footer">
+            <label class="control-label col-xs-12 col-sm-2"></label>
+            <div class="col-xs-12 col-sm-8">
+                <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
+            </div>
+        </div>
+    </form>
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+
+                <div class="row">
+
+
+
+                </div>
+
+                <div class="row">
+                    <div class="col-lg-12">
+                        <div id="echart" class="btn-refresh" style="height:650px;width:100%;"></div>
+                    </div>
+
+                </div>
+
+
+            </div>
+            <div class="tab-pane fade" id="two">
+                <div class="row">
+                    <div class="col-xs-12">
+                        {:__('Custom zone')}
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="/assets/laydate/laydate.js"></script>
+<script>
+    laydate.render({
+        elem: '#choicedatetime'
+        //设置开始日期、日期日期的 input 选择器
+        //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
+        ,range: ['#test-startDate-1', '#test-endDate-1']
+    });
+</script>

+ 213 - 0
application/admin/view/dashboard/datacenterfour.html

@@ -0,0 +1,213 @@
+<style type="text/css">
+    .sm-st {
+        background: #fff;
+        padding: 20px;
+        -webkit-border-radius: 3px;
+        -moz-border-radius: 3px;
+        border-radius: 3px;
+        margin-bottom: 20px;
+    }
+
+    .sm-st-icon {
+        width: 60px;
+        height: 60px;
+        display: inline-block;
+        line-height: 60px;
+        text-align: center;
+        font-size: 30px;
+        background: #eee;
+        -webkit-border-radius: 5px;
+        -moz-border-radius: 5px;
+        border-radius: 5px;
+        float: left;
+        margin-right: 10px;
+        color: #fff;
+    }
+
+    .sm-st-info {
+        padding-top: 2px;
+    }
+
+    .sm-st-info span {
+        display: block;
+        font-size: 24px;
+        font-weight: 600;
+    }
+
+    .orange {
+        background: #fa8564 !important;
+    }
+
+    .tar {
+        background: #45cf95 !important;
+    }
+
+    .sm-st .green {
+        background: #86ba41 !important;
+    }
+
+    .pink {
+        background: #AC75F0 !important;
+    }
+
+    .yellow-b {
+        background: #fdd752 !important;
+    }
+
+    .stat-elem {
+
+        background-color: #fff;
+        padding: 18px;
+        border-radius: 40px;
+
+    }
+
+    .stat-info {
+        text-align: center;
+        background-color: #fff;
+        border-radius: 5px;
+        margin-top: -5px;
+        padding: 8px;
+        -webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
+        box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
+        font-style: italic;
+    }
+
+    .stat-icon {
+        text-align: center;
+        margin-bottom: 5px;
+    }
+
+    .st-red {
+        background-color: #F05050;
+    }
+
+    .st-green {
+        background-color: #27C24C;
+    }
+
+    .st-violet {
+        background-color: #7266ba;
+    }
+
+    .st-blue {
+        background-color: #23b7e5;
+    }
+
+    .stats .stat-icon {
+        color: #28bb9c;
+        display: inline-block;
+        font-size: 26px;
+        text-align: center;
+        vertical-align: middle;
+        width: 50px;
+        float: left;
+    }
+
+    .stat {
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        display: inline-block;
+    }
+
+    .stat .value {
+        font-size: 20px;
+        line-height: 24px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        font-weight: 500;
+    }
+
+    .stat .name {
+        overflow: hidden;
+        text-overflow: ellipsis;
+        margin: 5px 0;
+    }
+
+    .stat.lg .value {
+        font-size: 26px;
+        line-height: 28px;
+    }
+
+    .stat-col {
+        margin:0 0 10px 0;
+    }
+    .stat.lg .name {
+        font-size: 16px;
+    }
+
+    .stat-col .progress {
+        height: 2px;
+    }
+
+    .stat-col .progress-bar {
+        line-height: 2px;
+        height: 2px;
+    }
+
+    .item {
+        padding: 30px 0;
+    }
+
+
+    #statistics .panel {
+        min-height: 150px;
+    }
+
+    #statistics .panel h5 {
+        font-size: 14px;
+    }
+</style>
+<div class="panel panel-default panel-intro">
+    <form  method="POST"  class="form-horizontal" action="">
+        <div class="form-group">
+            <div class="col-xs-12 col-sm-2">
+                <input type="text" class="form-control" name="choicedatetime" value="{$defaultdatetime}" placeholder="选择时间" id="choicedatetime" data-index="4" autocomplete="off">
+            </div>
+        </div>
+        <div class="form-group layer-footer">
+            <label class="control-label col-xs-12 col-sm-2"></label>
+            <div class="col-xs-12 col-sm-8">
+                <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
+            </div>
+        </div>
+    </form>
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+
+                <div class="row">
+
+
+
+                </div>
+
+                <div class="row">
+                    <div class="col-lg-12">
+                        <div id="echart" class="btn-refresh" style="height:650px;width:100%;"></div>
+                    </div>
+
+                </div>
+
+
+            </div>
+            <div class="tab-pane fade" id="two">
+                <div class="row">
+                    <div class="col-xs-12">
+                        {:__('Custom zone')}
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="/assets/laydate/laydate.js"></script>
+<script>
+    laydate.render({
+        elem: '#choicedatetime'
+        //设置开始日期、日期日期的 input 选择器
+        //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
+        ,range: ['#test-startDate-1', '#test-endDate-1']
+    });
+</script>

+ 118 - 0
public/assets/js/backend/dashboard.js

@@ -231,6 +231,124 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
             });
 
         },
+        datacenterfour: function () {
+            // 基于准备好的dom,初始化echarts实例
+            var myChart = Echarts.init(document.getElementById('echart'), 'walden');
+
+            // 指定图表的配置项和数据
+            var option = {
+                title: {
+                    text: '业绩统计'
+                },
+                tooltip: {
+                    trigger: 'axis'
+                },
+                legend: {
+                    data: ['笔数']
+                },
+                grid: {
+                    left: '3%',
+                    right: '4%',
+                    bottom: '3%',
+                    containLabel: true
+                },
+                toolbox: {
+                    feature: {
+                        saveAsImage: {}
+                    }
+                },
+                xAxis: {
+                    type: 'category',
+                    boundaryGap: false,
+                    data: Config.ec_date
+                },
+                yAxis: {
+                    type: 'value'
+                },
+                series: [
+                    {
+                        name: '笔数',
+                        type: 'line',
+//                        stack: 'Total',
+                        data: Config.ec_ordernum
+                    },
+
+                ]
+            };
+
+            // 使用刚指定的配置项和数据显示图表。
+            myChart.setOption(option);
+
+            $(window).resize(function () {
+                myChart.resize();
+            });
+
+            $(document).on("click", ".btn-refresh", function () {
+                setTimeout(function () {
+                    myChart.resize();
+                }, 0);
+            });
+
+        },
+        datacenterfive: function () {
+            // 基于准备好的dom,初始化echarts实例
+            var myChart = Echarts.init(document.getElementById('echart'), 'walden');
+
+            // 指定图表的配置项和数据
+            var option = {
+                title: {
+                    text: '业绩统计'
+                },
+                tooltip: {
+                    trigger: 'axis'
+                },
+                legend: {
+                    data: ['金额']
+                },
+                grid: {
+                    left: '3%',
+                    right: '4%',
+                    bottom: '3%',
+                    containLabel: true
+                },
+                toolbox: {
+                    feature: {
+                        saveAsImage: {}
+                    }
+                },
+                xAxis: {
+                    type: 'category',
+                    boundaryGap: false,
+                    data: Config.ec_date
+                },
+                yAxis: {
+                    type: 'value'
+                },
+                series: [
+                    {
+                        name: '笔数',
+                        type: 'line',
+//                        stack: 'Total',
+                        data: Config.ec_ordernum
+                    },
+
+                ]
+            };
+
+            // 使用刚指定的配置项和数据显示图表。
+            myChart.setOption(option);
+
+            $(window).resize(function () {
+                myChart.resize();
+            });
+
+            $(document).on("click", ".btn-refresh", function () {
+                setTimeout(function () {
+                    myChart.resize();
+                }, 0);
+            });
+
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));

+ 1 - 1
public/assets/js/backend/user_coupons_log.js

@@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'coupon_name', title: __('Coupon_name'), operate: 'LIKE'},
                         {field: 'coupons.info', title: __('Coupons.info'), operate: false},
                         {field: 'coupons.days', title: __('Coupons.days'), operate: false},
-                        {field: 'user_coupon_id', title: __('User_coupon_id')},
+//                        {field: 'user_coupon_id', title: __('User_coupon_id')},
                         {field: 'staff_id', title: __('Staff_id')},
                         {field: 'staff.truename', title: __('Staff.truename'), operate: 'LIKE'},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},