sunhao 5 years ago
parent
commit
28271886f0

+ 2 - 2
app/Http/Controllers/Admin/StatisticsController.php

4669
         }  
4669
         }  
4670
         $result  = array_merge([$data], $result);
4670
         $result  = array_merge([$data], $result);
4671
 
4671
 
4672
-        $indexKey = ['idate','throw_cost','cust_count','order_count','order_amount','goods_cost', 'freight_cost', 'aftersale_cost', 'refund_fee', 'profit', 'roi'];
4673
-        $title = ['汇总日期', '总投放', '总客户数', '总下单数', '总销售额', '总货品成本', '总运费成本', '总售后', '总退补', '总毛利', '累计ROI'];
4672
+        $indexKey = ['idate','throw_cost','cust_count','order_count','order_amount','goods_cost', 'freight_cost', 'aftersale_cost', 'refund_fee', 'profit', 'roi', 'fan_count', 'new_order_count', 'old_order_count', 'fugou_order_count', 'fugou_rate'];
4673
+        $title = ['汇总日期', '总投放', '总客户数', '总下单数', '总销售额', '总货品成本', '总运费成本', '总售后', '总退补', '总毛利', '累计ROI', '总加粉数', '总新粉单数', '总老粉单数', '总复购单数', '总复购率'];
4674
         $filename = 'huizongshuj_'.date('Y-m-d_H').'.xlsx';
4674
         $filename = 'huizongshuj_'.date('Y-m-d_H').'.xlsx';
4675
         return Order::export_excel($result, $filename, $indexKey, $title); 
4675
         return Order::export_excel($result, $filename, $indexKey, $title); 
4676
     }
4676
     }

+ 1 - 2
app/Http/Controllers/Api/TemplateController.php

140
         $data['order_amount'] = $order->order_amount;
140
         $data['order_amount'] = $order->order_amount;
141
         $data['cust_count'] = $order->cust_count;
141
         $data['cust_count'] = $order->cust_count;
142
         //加粉
142
         //加粉
143
-        //$data['fan_count'] = CustDetail::where('is_del',0)->where('dtime','>=',$_start)->sum('fan_add');    
143
+        $data['fan_count'] = CustDetail::where('is_del',0)->where('dtime','>=',$_start)->sum('fan_add');    
144
         //毛利 = 总销售额-总商品成本-总运费-总售后
144
         //毛利 = 总销售额-总商品成本-总运费-总售后
145
         $data['profit'] = $order->order_amount - $order->goods_cost - $order->freight_cost - $order->aftersale_cost - $data['throw_cost'] + $order->refund_fee;
145
         $data['profit'] = $order->order_amount - $order->goods_cost - $order->freight_cost - $order->aftersale_cost - $data['throw_cost'] + $order->refund_fee;
146
         $data['roi'] = $data['throw_cost']>0?  round($order->order_amount / $data['throw_cost'], 4) : '';
146
         $data['roi'] = $data['throw_cost']>0?  round($order->order_amount / $data['throw_cost'], 4) : '';
157
         $result = DB::table('day_grand_total')->where('idate', '>', $stime)->orderBy('idate', 'desc')->get();
157
         $result = DB::table('day_grand_total')->where('idate', '>', $stime)->orderBy('idate', 'desc')->get();
158
         $result = json_decode(json_encode($result), true); 
158
         $result = json_decode(json_encode($result), true); 
159
         foreach($result as $k=>&$v){
159
         foreach($result as $k=>&$v){
160
-            unset($v['fan_count']);
161
             $v['roi'] = $v['throw_cost']>0 ? round($v['order_amount'] / $v['throw_cost'], 4) : '';
160
             $v['roi'] = $v['throw_cost']>0 ? round($v['order_amount'] / $v['throw_cost'], 4) : '';
162
             $v['fugou_rate'] = $v['cust_count']>0 ? round($v['fugou_order_count'] / $v['cust_count'], 4) : '';
161
             $v['fugou_rate'] = $v['cust_count']>0 ? round($v['fugou_order_count'] / $v['cust_count'], 4) : '';
163
         }       
162
         }       

+ 10 - 0
resources/views/statistics/dayGrandTotal.blade.php

26
                     <th width="5%">总退补</th>  
26
                     <th width="5%">总退补</th>  
27
                     <th width="5%">总毛利</th>                                                                                            
27
                     <th width="5%">总毛利</th>                                                                                            
28
                     <th width="5%">累计roi</th>                                                                                            
28
                     <th width="5%">累计roi</th>                                                                                            
29
+                    <th width="5%">总加粉数</th>                                                                                            
30
+                    <th width="5%">总新粉下单</th>                                                                                            
31
+                    <th width="5%">总老粉下单</th>                                                                                            
32
+                    <th width="5%">总复购单数</th>                                                                                            
33
+                    <th width="5%">总复购率</th>                                                                                            
29
                                              
34
                                              
30
                 </tr>
35
                 </tr>
31
                 </thead>
36
                 </thead>
44
                             <td>{{$a['refund_fee']}}</td>                                                                                 
49
                             <td>{{$a['refund_fee']}}</td>                                                                                 
45
                             <td>{{$a['profit']}}</td>                                                                                   
50
                             <td>{{$a['profit']}}</td>                                                                                   
46
                             <td>{{$a['roi']}}</td>                                                                                   
51
                             <td>{{$a['roi']}}</td>                                                                                   
52
+                            <td>{{$a['fan_count']}}</td>                                                                                   
53
+                            <td>{{$a['new_order_count']}}</td>                                                                                   
54
+                            <td>{{$a['old_order_count']}}</td>                                                                                   
55
+                            <td>{{$a['fugou_order_count']}}</td>                                                                                   
56
+                            <td>{{$a['fugou_rate']}}</td>                                                                                   
47
                            
57
                            
48
                         </tr>
58
                         </tr>
49
                     @endforeach
59
                     @endforeach