cody 2 years ago
parent 995aafbca5
commit d25098b0b2

@ -92,12 +92,11 @@ class HomeController extends CommonController
foreach ($allMontn as $month) { foreach ($allMontn as $month) {
$saleList[] = [ $saleList[] = [
'month' => $month, 'month' => $month,
'total' => (new OrderItems())->where("service_date", $month)->whereHas("order", function ($query) use ($project_id) { 'total' => (new OrderItems())->where("service_date", 'like', $month . '%')->whereHas("order", function ($query) use ($project_id) {
$query->ofProject($project_id); $query->ofProject($project_id);
})->sum("total") })->sum("total")
]; ];
} }
dump($saleList);
// 订单量 // 订单量
$orderList = []; $orderList = [];
foreach ($allMontn as $month) { foreach ($allMontn as $month) {
@ -114,7 +113,7 @@ class HomeController extends CommonController
if (is_mobile() || empty($tongji)) { if (is_mobile() || empty($tongji)) {
return view($this->bladePath . ".mobile_home"); return view($this->bladePath . ".mobile_home");
} else { } else {
return view($this->bladePath . ".home", compact('project_id','projects','counts', 'lies', 'saleList', 'orderList')); return view($this->bladePath . ".home", compact('project_id', 'projects', 'counts', 'lies', 'saleList', 'orderList'));
} }
} }
@ -136,7 +135,7 @@ class HomeController extends CommonController
'product_item_id' => $item->id, 'product_item_id' => $item->id,
'factor_item_id' => $factor_item->id, 'factor_item_id' => $factor_item->id,
'total' => $total, 'total' => $total,
'product_item_name'=>$item->name, 'product_item_name' => $item->name,
'rate' => round($total / $order_total, 2) 'rate' => round($total / $order_total, 2)
]; ];
} }

Loading…
Cancel
Save