xieruidong il y a 2 ans
Parent
commit
dfc16df57e

+ 9 - 0
application/admin/view/seller/my_team/cate_check.html

@@ -2,6 +2,11 @@
     .content{
         background: white;
     }
+    #charts1,#charts2{
+        display: inline-block;
+        width: 48%;
+        height: 500px;
+    }
 </style>
 <form class="form-inline form" role="form">
     <div class="form-group">
@@ -13,6 +18,10 @@
     </div>
     <input type="hidden" name="dialog" value="{:input('dialog')}">
 </form>
+<div style="margin: 20px 0;">
+    <div id="charts1"></div>
+    <div id="charts2"></div>
+</div>
 <div class="col-md-12">
     <div class="panel panel-default panel-intro panel-nav">
         <div class="panel-heading">

+ 37 - 1
public/assets/js/backend/seller/my_team.js

@@ -21,7 +21,43 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
                         {field: 'category_name', title: __('名称'), operate: false,},
                         {field: 'num', title: __('数量'), operate: false,},
                     ]
-                ]
+                ],
+                onLoadSuccess(row){
+                    let a=Echarts.init(document.getElementById('charts1'))
+                    let items=[]
+                    row.rows.forEach(item=>{
+                        items.push({value:item.num,name:item.category_name})
+                    })
+                    console.log(items)
+                    a.setOption({
+                        title: {
+                            text: '订单量排名',
+                            left: 'center'
+                        },
+                        tooltip: {
+                            trigger: 'item'
+                        },
+                        legend: {
+                            orient: 'vertical',
+                            left: 'left'
+                        },
+                        series: [
+                            {
+                                name: '品类',
+                                type: 'pie',
+                                radius: '50%',
+                                data: items,
+                                emphasis: {
+                                    itemStyle: {
+                                        shadowBlur: 10,
+                                        shadowOffsetX: 0,
+                                        shadowColor: 'rgba(0, 0, 0, 0.5)'
+                                    }
+                                }
+                            }
+                        ]
+                    })
+                }
             });
             table1.bootstrapTable({
                 url: location.href+'&type=2',