售后金额上浮

This commit is contained in:
liu
2026-09-07 23:27:56 +08:00
parent 58c733baa2
commit edf5e42c38
6 changed files with 130 additions and 25 deletions
@@ -623,8 +623,9 @@ class PurchaseOrderController extends BaseController
->get(['id', 'store_id', 'total_amount']);
$stores = StoreModel::withTrashed()
->with('level:id,name,percent')
->whereIn('id', $orders->pluck('store_id')->unique())
->get(['id', 'name'])
->get(['id', 'name', 'level_id'])
->keyBy('id');
$bills = BillModel::query()
@@ -642,9 +643,13 @@ class PurchaseOrderController extends BaseController
'0'
);
$bill = $bills->get((int) $storeId);
$store = $stores->get((int) $storeId);
$rows[] = [
'store_id' => (int) $storeId,
'store_name' => $stores->get((int) $storeId)->name ?? ('门店#' . $storeId),
'store_name' => $store->name ?? ('门店#' . $storeId),
// 客户等级(售后金额上浮折算预览用;无等级=不上浮)
'level_name' => $store?->level?->name,
'level_percent' => (string) ($store?->level?->percent ?? '0'),
'order_count' => $storeOrders->count(),
'product_amount' => $productAmount,
'box_price' => $boxPrice,