admin offline-order export
parent
2471bec5e1
commit
b185b74f6b
|
|
@ -118,7 +118,7 @@ class OfflineOrderItemStatisticController extends AdminController
|
|||
public function staff(Content $content)
|
||||
{
|
||||
$table = (new OfflineOrder())->getTable();
|
||||
$stores = Store::pluck('title', 'id');
|
||||
$stores = Store::query()->effective()->sort()->pluck('title', 'id');
|
||||
|
||||
$builder = OfflineOrder::query()->with(['staff', 'store'])->select([
|
||||
"{$table}.staff_id",
|
||||
|
|
@ -151,6 +151,30 @@ class OfflineOrderItemStatisticController extends AdminController
|
|||
$grid->disableFilterButton();
|
||||
$grid->disableActions();
|
||||
|
||||
$grid->export()
|
||||
->titles([
|
||||
'staff_id' => '员工',
|
||||
'store_id' => '门店',
|
||||
'count' => '订单数',
|
||||
'products_total_amount' => '订单总额',
|
||||
'discount_reduction_amount' => '折扣优惠',
|
||||
'points_deduction_amount' => '积分抵扣',
|
||||
'coupon_discount_amount' => '优惠券抵扣',
|
||||
'payment_amount' => '实付金额',
|
||||
])->rows(function ($rows) {
|
||||
foreach ($rows as $index => &$row) {
|
||||
$row['staff_id'] = data_get($row, 'staff.phone');
|
||||
$row['store_id'] = data_get($row, 'store.title');
|
||||
$row['count'] = data_get($row, 'count');
|
||||
$row['products_total_amount'] = bcdiv(data_get($row, 'products_total_amount', 0), 100, 2);
|
||||
$row['discount_reduction_amount'] = bcdiv(data_get($row, 'discount_reduction_amount', 0), 100, 2);
|
||||
$row['points_deduction_amount'] = bcdiv(data_get($row, 'points_deduction_amount', 0), 100, 2);
|
||||
$row['coupon_discount_amount'] = bcdiv(data_get($row, 'coupon_discount_amount', 0), 100, 2);
|
||||
$row['payment_amount'] = bcdiv(data_get($row, 'payment_amount', 0), 100, 2);
|
||||
}
|
||||
return $rows;
|
||||
})->filename("员工业绩统计");
|
||||
|
||||
return $content
|
||||
->translation($this->translation())
|
||||
->title("员工业绩统计")
|
||||
|
|
|
|||
Loading…
Reference in New Issue