Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

liying 7 лет назад
Родитель
Сommit
5382d1d5e3

+ 2 - 1
src/main/resources/static/css/adminStatistic.css

@@ -1,4 +1,5 @@
 .table-container {
     width: 100%;
-    height:400px;
+    height:380px;
+    margin: 20px 0;
 }

+ 78 - 0
src/main/resources/static/js/adminCinemaStatistic.js

@@ -2,6 +2,10 @@ $(document).ready(function() {
 
 
     getScheduleRate();
+    
+    getBoxOffice();
+
+    getAudiencePrice();
 
     function getScheduleRate() {
 
@@ -67,4 +71,78 @@ $(document).ready(function() {
         );
     }
 
+    function getBoxOffice() {
+
+        getRequest(
+            '/statistics/boxOffice/total',
+            function (res) {
+                var data = res.content || [];
+                var tableData = data.map(function (item) {
+                    return item.boxOffice;
+                });
+                var nameList = data.map(function (item) {
+                    return item.name;
+                });
+                var option = {
+                    title : {
+                        text: '所有电影票房',
+                        subtext: '截止至'+new Date().toLocaleDateString(),
+                        x:'center'
+                    },
+                    xAxis: {
+                        type: 'category',
+                        data: nameList
+                    },
+                    yAxis: {
+                        type: 'value'
+                    },
+                    series: [{
+                        data: tableData,
+                        type: 'bar'
+                    }]
+                };
+                var scheduleRateChart = echarts.init($("#box-office-container")[0]);
+                scheduleRateChart.setOption(option);
+            },
+            function (error) {
+                alert(JSON.stringify(error));
+            });
+    }
+
+    function getAudiencePrice() {
+        getRequest(
+            '/statistics/audience/price',
+            function (res) {
+                var data = res.content || [];
+                var tableData = data.map(function (item) {
+                    return item.price;
+                });
+                var nameList = data.map(function (item) {
+                    return formatDate(new Date(item.date));
+                });
+                var option = {
+                    title : {
+                        text: '每日客单价',
+                        x:'center'
+                    },
+                    xAxis: {
+                        type: 'category',
+                        data: nameList
+                    },
+                    yAxis: {
+                        type: 'value'
+                    },
+                    series: [{
+                        data: tableData,
+                        type: 'line'
+                    }]
+                };
+                var scheduleRateChart = echarts.init($("#audience-price-container")[0]);
+                scheduleRateChart.setOption(option);
+            },
+            function (error) {
+                alert(JSON.stringify(error));
+            });
+    }
+
 });

+ 4 - 1
src/main/resources/templates/adminCinemaStatistic.html

@@ -36,7 +36,10 @@
             <span class="title gray-text">影院统计</span>
         </div>
         <div class="card table-container" id="schedule-rate-container">
-
+        </div>
+        <div class="card table-container" id="box-office-container">
+        </div>
+        <div class="card table-container" id="audience-price-container">
         </div>
     </div>
 </div>