generated from liutk/owl-admin-base
Merge branch 'main' of https://gitea.hmily.club/pdkj/store-manage into main
commit
c03698fc0b
|
|
@ -120,7 +120,6 @@ class PlanController extends AdminController
|
|||
->source(admin_url('api/keywords/tree-list?parent_key=store_category'))
|
||||
->labelField('name')
|
||||
->valueField('key')
|
||||
->onlyLeaf(true)
|
||||
->value('${planable.store_category_id}')
|
||||
->required()
|
||||
->visibleOn('${planable_type == "'.$planableTypePerformance.'"}'),
|
||||
|
|
|
|||
|
|
@ -213,11 +213,17 @@ class PlanService extends BaseService
|
|||
// 任务结束时间
|
||||
$endAt = $startAt->copy()->endOfMonth();
|
||||
|
||||
$input = [
|
||||
'category_id' => $plan->planable->store_category_id,
|
||||
'level_id' => $plan->planable->store_level_id,
|
||||
];
|
||||
// 门店分类IDs
|
||||
$categoryIds = value(function ($id) {
|
||||
$ids = collect();
|
||||
if ($parent = Keyword::where('key', $id)->first()) {
|
||||
/** @var \Illuminate\Support\Collection */
|
||||
$ids = Keyword::where('path', 'like', "%-{$parent->id}-%")->pluck('key');
|
||||
}
|
||||
return $ids->push($id);
|
||||
}, $plan->planable->store_category_id);
|
||||
|
||||
// 门店业绩统计
|
||||
$aggregates = Ledger::select(['store_id', DB::raw('SUM(`sales`) as sales')])
|
||||
->whereBetween('date', [$startAt->format('Y-m-d'), $endAt->format('Y-m-d')])
|
||||
->groupBy('store_id')
|
||||
|
|
@ -225,7 +231,9 @@ class PlanService extends BaseService
|
|||
->toArray();
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Collection */
|
||||
$stores = Store::filter($input, StoreFilter::class)->get(['id', 'master_id']);
|
||||
$stores = Store::filter(['level_id' => $plan->planable->store_level_id], StoreFilter::class)
|
||||
->whereIn('category_id', $categoryIds)
|
||||
->get(['id', 'master_id']);
|
||||
|
||||
foreach ($stores as $store) {
|
||||
$taskable = TaskPerformance::create([
|
||||
|
|
|
|||
Loading…
Reference in New Issue