Browse Source

所有地域roi汇总

sunhao 5 years ago
parent
commit
faeabf4584

+ 17 - 0
app/DistrictRoi60.php

@@ -0,0 +1,17 @@
1
+<?php
2
+/**
3
+ * Created by PhpStorm.
4
+ * User: Administrator
5
+ * Date: 2017/12/5
6
+ * Time: 15:07
7
+ */
8
+
9
+namespace App;
10
+use Illuminate\Database\Eloquent\Model;
11
+
12
+class DistrictRoi60 extends Model
13
+{
14
+    public $timestamps = false;
15
+    protected $table = "district_roi_60";
16
+   
17
+}

+ 198 - 0
app/Http/Controllers/Admin/StatisticsController.php

@@ -17,6 +17,7 @@ use App\DistrictRoi7;
17 17
 use App\DistrictRoi30;
18 18
 use App\DistrictRoi15;
19 19
 use App\DistrictRoi45;
20
+use App\DistrictRoi60;
20 21
 use App\SalerTargets;
21 22
 use Illuminate\Http\Request;
22 23
 use Illuminate\Support\Facades\DB;
@@ -3952,8 +3953,205 @@ class StatisticsController extends Controller
3952 3953
         $filename = 'cangkufahuo_'.date('Y-m-d_H').'.xlsx';
3953 3954
         return Order::export_excel($result, $filename, $indexKey, $title);
3954 3955
     } 
3956
+
3957
+    /**
3958
+     * 地域roi7 15,30,45,60日汇总
3959
+     */
3960
+    public function districtRoiAllTotal(Request $request){
3961
+        $page = (int)$request->input('page');
3962
+        $pageSize = 20;
3963
+        if($page<=0){
3964
+            $page = 1;
3965
+        }
3966
+
3967
+        $offset = ($page-1) * $pageSize;
3968
+        $city = $request->input('city');
3969
+
3970
+        if($city !== null){
3971
+            $city = str_replace('市', '', $city);
3972
+        }
3973
+
3974
+        $count = DistrictRoi7::where(function($query) use($city){    
3975
+            if($city) $query->where('city', 'like', '%'.$city.'%');
3976
+        })->groupBy('city')->get();
3977
+
3978
+        $count = count($count);
3979
+        if ($count > 1) {
3980
+            // 总页数
3981
+            $pages = ceil($count/$pageSize);
3982
+        }else{
3983
+            // 总页数
3984
+            $pages = 1;
3985
+        }
3986
+
3987
+        $result = DistrictRoi7::select(DB::raw('city,sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where(function($query) use($city){    
3988
+            if($city) $query->where('city', 'like', '%'.$city.'%');
3989
+        })->groupBy('city')->orderBy('roi', 'desc')->offset($offset)->limit($pageSize)->get();
3990
+
3991
+        $result = json_decode(json_encode($result), true);
3992
+        foreach($result as $k=>&$v){
3993
+             //新粉roi
3994
+            $v['new_roi'] = $v['cost']>0 ? round($v['new_fan_order_amount'] / $v['cost'], 4) * 100 .'%' : '';
3995
+            //累计roi
3996
+            $v['total_roi'] = $v['cost']>0 ? round($v['sum_order_amount'] / $v['cost'], 4) * 100 .'%' : '';
3997
+            //数据格式化
3998
+            $v['order_amount'] = round($v['sum_order_amount'],2);
3999
+
4000
+            //15日
4001
+            $data15 = DistrictRoi15::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4002
+            if(isset($data15->cost)){
4003
+                $v['cost15'] = $data15->cost;
4004
+                $v['order_count15'] = $data15->order_count;
4005
+                $v['order_amount15'] = round($data15->sum_order_amount,2);
4006
+                $v['total_roi15'] = $v['cost15']>0 ? round($data15->sum_order_amount / $v['cost15'], 4) * 100 .'%' : '';
4007
+            }else{
4008
+                $v['cost15'] = '';
4009
+                $v['order_count15'] = '';
4010
+                $v['order_amount15'] = '';
4011
+                $v['total_roi15'] = '';
4012
+            }
4013
+
4014
+            //30日
4015
+            $data30 = DistrictRoi30::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4016
+            if(isset($data30->cost)){
4017
+                $v['cost30'] = $data30->cost;
4018
+                $v['order_count30'] = $data30->order_count;
4019
+                $v['order_amount30'] = round($data30->sum_order_amount,2);
4020
+                $v['total_roi30'] = $v['cost30']>0 ? round($data30->sum_order_amount / $v['cost30'], 4) * 100 .'%' : '';
4021
+            }else{
4022
+                $v['cost30'] = '';
4023
+                $v['order_count30'] = '';
4024
+                $v['order_amount30'] = '';
4025
+                $v['total_roi30'] = '';
4026
+            }
4027
+
4028
+            //45日
4029
+            $data45 = DistrictRoi45::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4030
+            if(isset($data45->cost)){
4031
+                $v['cost45'] = $data45->cost;
4032
+                $v['order_count45'] = $data45->order_count;
4033
+                $v['order_amount45'] = round($data45->sum_order_amount,2);
4034
+                $v['total_roi45'] = $v['cost45']>0 ? round($data45->sum_order_amount / $v['cost45'], 4) * 100 .'%' : '';
4035
+            }else{
4036
+                $v['cost45'] = '';
4037
+                $v['order_count45'] = '';
4038
+                $v['order_amount45'] = '';
4039
+                $v['total_roi45'] = '';
4040
+            }
4041
+
4042
+            //60日
4043
+            $data60 = DistrictRoi60::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4044
+            if(isset($data60->cost)){
4045
+                $v['cost60'] = $data60->cost;
4046
+                $v['order_count60'] = $data60->order_count;
4047
+                $v['order_amount60'] = round($data60->sum_order_amount,2);
4048
+                $v['total_roi60'] = $v['cost60']>0 ? round($data60->sum_order_amount / $v['cost60'], 4) * 100 .'%' : '';
4049
+            }else{
4050
+                $v['cost60'] = '';
4051
+                $v['order_count60'] = '';
4052
+                $v['order_amount60'] = '';
4053
+                $v['total_roi60'] = '';
4054
+            }
4055
+
4056
+        }
4057
+
4058
+        return view('statistics/districtRoiAllTotal', ['result' =>$result,
4059
+            'page'              =>$page,
4060
+            'count'             =>$count,
4061
+            'pages'             =>$pages,                                    
4062
+            'city'             =>$city,                                        
4063
+            ]);
4064
+
4065
+    }
4066
+
4067
+    /**
4068
+     * 地域roi7日
4069
+     */
4070
+    public function districtRoiAllTotal_export(Request $request){
4071
+
4072
+        $city = $request->input('city');
4073
+        if($city !== null){
4074
+            $city = str_replace('市', '', $city);
4075
+        }
4076
+
4077
+        $result = DistrictRoi7::select(DB::raw('city,sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount,sum(order_amount)/sum(cost) as roi'))->where(function($query) use($city){    
4078
+            if($city) $query->where('city', 'like', '%'.$city.'%');
4079
+        })->groupBy('city')->orderBy('roi', 'desc')->get();
4080
+
4081
+        $result = json_decode(json_encode($result), true);
4082
+        foreach($result as $k=>&$v){
4083
+             //新粉roi
4084
+            $v['new_roi'] = $v['cost']>0 ? round($v['new_fan_order_amount'] / $v['cost'], 4) * 100 .'%' : '';
4085
+            //累计roi
4086
+            $v['total_roi'] = $v['cost']>0 ? round($v['sum_order_amount'] / $v['cost'], 4) * 100 .'%' : '';
4087
+            //数据格式化
4088
+            $v['order_amount'] = round($v['sum_order_amount'],2);
4089
+
4090
+            //15日
4091
+            $data15 = DistrictRoi15::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4092
+            if(isset($data15->cost)){
4093
+                $v['cost15'] = $data15->cost;
4094
+                $v['order_count15'] = $data15->order_count;
4095
+                $v['order_amount15'] = round($data15->sum_order_amount,2);
4096
+                $v['total_roi15'] = $v['cost15']>0 ? round($data15->sum_order_amount / $v['cost15'], 4) * 100 .'%' : '';
4097
+            }else{
4098
+                $v['cost15'] = '';
4099
+                $v['order_count15'] = '';
4100
+                $v['order_amount15'] = '';
4101
+                $v['total_roi15'] = '';
4102
+            }
4103
+
4104
+            //30日
4105
+            $data30 = DistrictRoi30::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4106
+            if(isset($data30->cost)){
4107
+                $v['cost30'] = $data30->cost;
4108
+                $v['order_count30'] = $data30->order_count;
4109
+                $v['order_amount30'] = round($data30->sum_order_amount,2);
4110
+                $v['total_roi30'] = $v['cost30']>0 ? round($data30->sum_order_amount / $v['cost30'], 4) * 100 .'%' : '';
4111
+            }else{
4112
+                $v['cost30'] = '';
4113
+                $v['order_count30'] = '';
4114
+                $v['order_amount30'] = '';
4115
+                $v['total_roi30'] = '';
4116
+            }
4117
+
4118
+            //45日
4119
+            $data45 = DistrictRoi45::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4120
+            if(isset($data45->cost)){
4121
+                $v['cost45'] = $data45->cost;
4122
+                $v['order_count45'] = $data45->order_count;
4123
+                $v['order_amount45'] = round($data45->sum_order_amount,2);
4124
+                $v['total_roi45'] = $v['cost45']>0 ? round($data45->sum_order_amount / $v['cost45'], 4) * 100 .'%' : '';
4125
+            }else{
4126
+                $v['cost45'] = '';
4127
+                $v['order_count45'] = '';
4128
+                $v['order_amount45'] = '';
4129
+                $v['total_roi45'] = '';
4130
+            }
4131
+
4132
+            //60日
4133
+            $data60 = DistrictRoi60::select(DB::raw('sum(cost) as cost,sum(gzh_count) as gzh_count,sum(fan_count) as fan_count,sum(new_fan_order_count) as new_fan_order_count,sum(new_fan_order_amount) as new_fan_order_amount,sum(order_count) as order_count,sum(order_amount) as sum_order_amount, sum(order_amount)/sum(cost) as roi'))->where('city', $v['city'])->first();
4134
+            if(isset($data60->cost)){
4135
+                $v['cost60'] = $data60->cost;
4136
+                $v['order_count60'] = $data60->order_count;
4137
+                $v['order_amount60'] = round($data60->sum_order_amount,2);
4138
+                $v['total_roi60'] = $v['cost60']>0 ? round($data60->sum_order_amount / $v['cost60'], 4) * 100 .'%' : '';
4139
+            }else{
4140
+                $v['cost60'] = '';
4141
+                $v['order_count60'] = '';
4142
+                $v['order_amount60'] = '';
4143
+                $v['total_roi60'] = '';
4144
+            }
4145
+        }
4146
+
4147
+        $indexKey = ['city','cost','order_count','order_amount','total_roi','cost15','order_count15','order_amount15','total_roi15','cost30','order_count30','order_amount30','total_roi30','cost45','order_count45','order_amount45','total_roi45','cost60','order_count60','order_amount60','total_roi60'];
4148
+        $title = ['城市', '7日累计投放成本', '7日累计成单数', '7日累计收入', '7日累计ROI', '15日累计投放成本', '15日累计成单数', '15日累计收入', '15日累计ROI', '30日累计投放成本', '30日累计成单数', '30日累计收入', '30日累计ROI', '45日累计投放成本', '45日累计成单数', '45日累计收入', '45日累计ROI', '60日累计投放成本', '60日累计成单数', '60日累计收入', '60日累计ROI'];
4149
+        $filename = 'districtRoiAll_'.date('Y-m-d_H').'.xlsx';
4150
+        return Order::export_excel($result, $filename, $indexKey, $title);
4151
+    }
3955 4152
                                                                                 
3956 4153
 }
4154
+                                                                          
3957 4155
   
3958 4156
   
3959 4157
 

+ 4 - 0
app/Http/routes.php

@@ -150,6 +150,10 @@ Route::group(['prefix' => 'admin'], function(){
150 150
         Route::get('/statistics/districtRoi45day_export', 'Admin\StatisticsController@districtRoi45day_export');
151 151
         Route::get('/statistics/districtRoi45dayTotal', 'Admin\StatisticsController@districtRoi45dayTotal');
152 152
         Route::get('/statistics/districtRoi45dayTotal_export', 'Admin\StatisticsController@districtRoi45dayTotal_export');
153
+        //地域roi所有汇总
154
+        Route::get('/statistics/districtRoiAllTotal', 'Admin\StatisticsController@districtRoiAllTotal');
155
+        Route::get('/statistics/districtRoiAllTotal_export', 'Admin\StatisticsController@districtRoiAllTotal_export');
156
+
153 157
         //团队财务报表
154 158
         Route::get('/statistics/teamFinanceList', 'Admin\StatisticsController@teamFinanceList');
155 159
         Route::get('/statistics/teamFinanceList_export', 'Admin\StatisticsController@teamFinanceList_export');

+ 5 - 1
resources/views/statistics/districtRoi.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3">30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                    
17
+                    <option value="8">45日roi汇总</option>  
18
+                    <option value="9">所有roi汇总</option>                                  
18 19
                   
19 20
                 </select>
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -170,6 +171,9 @@
170 171
             else if(date_type == 8){
171 172
                 location.href='districtRoi45dayTotal';
172 173
             }
174
+            else if(date_type == 9){
175
+                location.href='districtRoiAllTotal';
176
+            }
173 177
         })
174 178
        
175 179
         /*分页*/

+ 5 - 1
resources/views/statistics/districtRoi15day.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3">30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                    
17
+                    <option value="8">45日roi汇总</option>   
18
+                    <option value="9">所有roi汇总</option>                                 
18 19
                   
19 20
                 </select> 
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -127,6 +128,9 @@
127 128
             else if(date_type == 8){
128 129
                 location.href='districtRoi45dayTotal';
129 130
             }
131
+            else if(date_type == 9){
132
+                location.href='districtRoiAllTotal';
133
+            }
130 134
         })
131 135
        
132 136
         /*分页*/

+ 5 - 1
resources/views/statistics/districtRoi15dayTotal.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3">30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                     
17
+                    <option value="8">45日roi汇总</option>   
18
+                    <option value="9">所有roi汇总</option>                                  
18 19
                   
19 20
                 </select>  
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -117,6 +118,9 @@
117 118
             else if(date_type == 8){
118 119
                 location.href='districtRoi45dayTotal';
119 120
             }
121
+            else if(date_type == 9){
122
+                location.href='districtRoiAllTotal';
123
+            }
120 124
         })
121 125
         /*分页*/
122 126
             

+ 5 - 1
resources/views/statistics/districtRoi30day.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3" selected>30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                     
17
+                    <option value="8">45日roi汇总</option>  
18
+                    <option value="9">所有roi汇总</option>                                   
18 19
                   
19 20
                 </select> 
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -127,6 +128,9 @@
127 128
             else if(date_type == 8){
128 129
                 location.href='districtRoi45dayTotal';
129 130
             }
131
+            else if(date_type == 9){
132
+                location.href='districtRoiAllTotal';
133
+            }
130 134
         })
131 135
        
132 136
         /*分页*/

+ 5 - 1
resources/views/statistics/districtRoi30dayTotal.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3" >30日roi明细</option>                                     
15 15
                     <option value="4" selected>30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                     
17
+                    <option value="8">45日roi汇总</option>  
18
+                    <option value="9">所有roi汇总</option>                                   
18 19
                   
19 20
                 </select>  
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -117,6 +118,9 @@
117 118
             else if(date_type == 8){
118 119
                 location.href='districtRoi45dayTotal';
119 120
             }
121
+            else if(date_type == 9){
122
+                location.href='districtRoiAllTotal';
123
+            }
120 124
         })
121 125
         /*分页*/
122 126
             

+ 5 - 1
resources/views/statistics/districtRoi45day.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3">30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7"  selected>45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                      
17
+                    <option value="8">45日roi汇总</option>    
18
+                    <option value="9">所有roi汇总</option>                                  
18 19
                   
19 20
                 </select> 
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -127,6 +128,9 @@
127 128
             else if(date_type == 8){
128 129
                 location.href='districtRoi45dayTotal';
129 130
             }
131
+            else if(date_type == 9){
132
+                location.href='districtRoiAllTotal';
133
+            }
130 134
         })
131 135
        
132 136
         /*分页*/

+ 5 - 1
resources/views/statistics/districtRoi45dayTotal.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3" >30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8" selected>45日roi汇总</option>                                     
17
+                    <option value="8" selected>45日roi汇总</option>        
18
+                    <option value="9">所有roi汇总</option>                             
18 19
                   
19 20
                 </select>  
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -117,6 +118,9 @@
117 118
             else if(date_type == 8){
118 119
                 location.href='districtRoi45dayTotal';
119 120
             }
121
+            else if(date_type == 9){
122
+                location.href='districtRoiAllTotal';
123
+            }
120 124
         })
121 125
         /*分页*/
122 126
             

+ 5 - 1
resources/views/statistics/districtRoi7day.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3" >30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                      
17
+                    <option value="8">45日roi汇总</option>    
18
+                    <option value="9">所有roi汇总</option>                                  
18 19
                   
19 20
                 </select> 
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -127,6 +128,9 @@
127 128
             else if(date_type == 8){
128 129
                 location.href='districtRoi45dayTotal';
129 130
             }
131
+            else if(date_type == 9){
132
+                location.href='districtRoiAllTotal';
133
+            }
130 134
         })
131 135
        
132 136
         /*分页*/

+ 8 - 1
resources/views/statistics/districtRoi7dayTotal.blade.php

@@ -14,7 +14,8 @@
14 14
                     <option value="3" >30日roi明细</option>                                     
15 15
                     <option value="4">30日roi汇总</option> 
16 16
                     <option value="7">45日roi明细</option>                                     
17
-                    <option value="8">45日roi汇总</option>                                      
17
+                    <option value="8">45日roi汇总</option>  
18
+                    <option value="9">所有roi汇总</option>                                    
18 19
                   
19 20
                 </select>  
20 21
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
@@ -117,6 +118,12 @@
117 118
             else if(date_type == 8){
118 119
                 location.href='districtRoi45dayTotal';
119 120
             }
121
+            else if(date_type == 9){
122
+                location.href='districtRoiAllTotal';
123
+            }
124
+            else if(date_type == 9){
125
+                location.href='districtRoiAllTotal';
126
+            }
120 127
         })
121 128
         /*分页*/
122 129
             

+ 163 - 0
resources/views/statistics/districtRoiAllTotal.blade.php

@@ -0,0 +1,163 @@
1
+@extends('admin/master')
2
+@section('content')
3
+    <body>
4
+    <div class="page-container">
5
+        <div>
6
+            <div>  
7
+                <input class="input-text" style="width:6%;text-align:center" type="text" value="数据分类"/> 
8
+                <select style="width:10%;text-align:center" id='data_type' name="data_type">
9
+                    <option value="0"  >7日roi明细</option>                   
10
+                    <option value="1" >7日roi汇总</option>                                     
11
+                    <option value="2" >每日roi明细</option>
12
+                    <option value="5">15日roi明细</option>                                     
13
+                    <option value="6" >15日roi汇总</option>                                   
14
+                    <option value="3" >30日roi明细</option>                                     
15
+                    <option value="4">30日roi汇总</option> 
16
+                    <option value="7">45日roi明细</option>                                     
17
+                    <option value="8">45日roi汇总</option>                                      
18
+                    <option value="9" selected>所有roi汇总</option>                                      
19
+                  
20
+                </select>  
21
+                <input class="input-text" style="width:5%;text-align:center" type="text" value="所属城市"/>
22
+                <input id="city" type="text"  class="input-text" style="width:6%;text-align:center" name="city" value="{{$city?$city:''}}">                         
23
+                
24
+                <a class="btn btn-primary radius"  style="margin-left: 5px" onclick="user_search()" href="javascript:;">搜索</a>
25
+                <a class="btn btn-primary radius" onclick="statistics_export()" href="javascript:;"><i class="Hui-iconfont"></i> 导出数据</a>
26
+                
27
+            </div>
28
+        </div>
29
+        
30
+        <div class="mt-20">
31
+            <table class="table table-border table-bordered table-bg table-hover table-sort">
32
+                <thead>
33
+                <tr class="text-c">
34
+                    <th width="4%">城市</th>
35
+                    <th width="4%">7日累计投放成本</th>
36
+                    <th width="4%">7日累计成单数</th>
37
+                    <th width="4%">7日累计收入</th>
38
+                    <th width="4%">7日累计ROI</th> 
39
+                    <th width="4%">15日累计投放成本</th>
40
+                    <th width="4%">15日累计成单数</th>
41
+                    <th width="4%">15日累计收入</th>
42
+                    <th width="4%">15日累计ROI</th>
43
+                    <th width="4%">30日累计投放成本</th>
44
+                    <th width="4%">30日累计成单数</th>
45
+                    <th width="4%">30日累计收入</th>
46
+                    <th width="4%">30日累计ROI</th>
47
+                    <th width="4%">45日累计投放成本</th>
48
+                    <th width="4%">45日累计成单数</th>
49
+                    <th width="4%">45日累计收入</th>
50
+                    <th width="4%">45日累计ROI</th> 
51
+                    <th width="4%">60日累计投放成本</th>
52
+                    <th width="4%">60日累计成单数</th>
53
+                    <th width="4%">60日累计收入</th>
54
+                    <th width="4%">60日累计ROI</th>                                               
55
+                </tr>
56
+                </thead>
57
+                <tbody>
58
+                @if($result)
59
+                    @foreach($result as $a)
60
+                        <tr class="text-c" style=" text-align:center;">                                                                           
61
+                            <td>{{$a['city']}}</td>                                                                                         
62
+                            <td>{{$a['cost']}}</td>         
63
+                            <td>{{$a['order_count']}}</td>                                                                                         
64
+                            <td>{{$a['order_amount']}}</td>                                                                                         
65
+                            <td>{{$a['total_roi']}}</td>
66
+                            <td>{{$a['cost15']}}</td>         
67
+                            <td>{{$a['order_count15']}}</td>                                                                                         
68
+                            <td>{{$a['order_amount15']}}</td>                                                                                         
69
+                            <td>{{$a['total_roi15']}}</td>
70
+                            <td>{{$a['cost30']}}</td>         
71
+                            <td>{{$a['order_count30']}}</td>                                                                                         
72
+                            <td>{{$a['order_amount30']}}</td>                                                                                         
73
+                            <td>{{$a['total_roi30']}}</td>
74
+                            <td>{{$a['cost45']}}</td>         
75
+                            <td>{{$a['order_count45']}}</td>                                                                                         
76
+                            <td>{{$a['order_amount45']}}</td>                                                                                         
77
+                            <td>{{$a['total_roi45']}}</td>
78
+                            <td>{{$a['cost60']}}</td>         
79
+                            <td>{{$a['order_count60']}}</td>                                                                                         
80
+                            <td>{{$a['order_amount60']}}</td>                                                                                         
81
+                            <td>{{$a['total_roi60']}}</td>                                                                                         
82
+                        </tr>
83
+                    @endforeach
84
+                @endif
85
+                </tbody>
86
+            </table>
87
+        </div>
88
+        <div id="page" class="page_div"></div>
89
+    </div>
90
+    
91
+    <!--_footer 作为公共模版分离出去-->
92
+    <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
93
+    <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
94
+    <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
95
+    <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
96
+    <script type="text/javascript" src="/admin/lib/page/paging.js"></script>
97
+    <script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
98
+    <!--/_footer 作为公共模版分离出去-->
99
+    <!--/_footer 作为公共模版分离出去-->
100
+     <script type="text/javascript">
101
+        
102
+        function user_search(){
103
+
104
+            var city = $('#city').val();
105
+            //var page = {{$page}};
106
+            location.href = 'districtRoiAllTotal?city='+city;
107
+        }
108
+        //导出
109
+        function statistics_export(){
110
+            var city = $('#city').val();
111
+            location.href = '/admin/statistics/districtRoiAllTotal_export?city='+city;
112
+        }
113
+       
114
+        $("#data_type").change(function(){
115
+            var date_type = $(this).val();
116
+            if(date_type == 0){
117
+                location.href='districtRoi7day';
118
+            }
119
+            else if(date_type == 1){
120
+                location.href='districtRoi7dayTotal';
121
+            }
122
+            else if(date_type == 2){
123
+                location.href='districtRoi';
124
+            }
125
+            else if(date_type == 3){
126
+                location.href='districtRoi30day';
127
+            }
128
+            else if(date_type == 4){
129
+                location.href='districtRoi30dayTotal';
130
+            }
131
+            else if(date_type == 5){
132
+                location.href='districtRoi15day';
133
+            }
134
+            else if(date_type == 6){
135
+                location.href='districtRoi15dayTotal';
136
+            }
137
+            else if(date_type == 7){
138
+                location.href='districtRoi45day';
139
+            }
140
+            else if(date_type == 8){
141
+                location.href='districtRoi45dayTotal';
142
+            }
143
+            else if(date_type == 9){
144
+                location.href='districtRoiAllTotal';
145
+            }
146
+        })
147
+        /*分页*/
148
+            
149
+        $("#page").paging({
150
+            pageNo:{{$page}},
151
+            totalPage: {{$pages}},
152
+            totalSize: {{$count}},
153
+            callback: function(num) {
154
+                var city = $('#city').val();
155
+                location.href='districtRoiAllTotal?page='+num+'&city='+city;
156
+            }
157
+        })
158
+        
159
+    </script>
160
+   
161
+    </body>
162
+
163
+@endsection