diff --git a/resources/views/admin/holiday-events/index.blade.php b/resources/views/admin/holiday-events/index.blade.php index 0d0a3ee..74f37ab 100644 --- a/resources/views/admin/holiday-events/index.blade.php +++ b/resources/views/admin/holiday-events/index.blade.php @@ -1,155 +1,285 @@ +{{-- 文件功能:后台节日福利活动列表页,展示节日福利模板并提供启用、立即触发、编辑、删除等操作。 --}} @extends('admin.layouts.app') @section('title', '节日福利管理') @section('content') + @php + $visibleEvents = $events->getCollection(); + $enabledCount = $visibleEvents->where('enabled', true)->count(); + $yearlyCount = $visibleEvents->where('repeat_type', 'yearly')->count(); + $statusMap = [ + 'pending' => ['待触发', 'bg-amber-100 text-amber-700'], + 'active' => ['领取中', 'bg-emerald-100 text-emerald-700'], + 'completed' => ['已结束', 'bg-slate-100 text-slate-600'], + 'cancelled' => ['已取消', 'bg-rose-100 text-rose-700'], + ]; + $repeatLabels = [ + 'once' => '一次', + 'daily' => '每天', + 'weekly' => '每周', + 'monthly' => '每月', + 'yearly' => '每年', + 'cron' => 'CRON', + ]; + @endphp +
配置一次性、周期性与年度节日福利,系统自动触发广播并分配红包。
+统一维护节日福利模板与触发计划。
+列表按关键信息压缩展示,适合批量查看。
+| ID | -活动名称 | -奖池 | -分配方式 | -限额人数 | -触发时间 | -重复 | -状态 | -启用 | -操作 | +|||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 编号 | +活动信息 | +奖池 | +分配 | +限额 / 重复 | +触发计划 | +运行状态 | +操作 | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ $event->id }} | -
- {{ $event->name }}
- @if ($event->description)
- {{ Str::limit($event->description, 40) }}
+ @php
+ [$statusLabel, $statusClass] = $statusMap[$event->status] ?? ['未知', 'bg-slate-100 text-slate-600'];
+ $repeatLabel = $repeatLabels[$event->repeat_type] ?? '-';
+ $isRandomDistribute = $event->distribute_type === 'random';
+ $yearlyScheduleText =
+ data_get($event, 'schedule_month', $event->send_at?->format('n')) .
+ '月' .
+ data_get($event, 'schedule_day', $event->send_at?->format('j')) .
+ '日 · ' .
+ data_get($event, 'duration_days', 1) .
+ '天 · 每天' .
+ data_get($event, 'daily_occurrences', 1) .
+ '次 · 间隔' .
+ data_get($event, 'occurrence_interval_minutes', 60) .
+ '分钟';
+ @endphp
+
+ |
+
+
+ {{ $event->id }}
+
+
+ |
-
+
{{ $event->name }}
+
+ {{ $repeatLabel }}
+ @if ($event->repeat_type === 'yearly')
+ 年度固定节日模板
+ @endif
- @endif
+
+ {{ Str::limit($event->description ?: '未填写节日祝福语,当前活动将广播默认福利提示。', 32) }}
+
+
- 💰 {{ number_format($event->total_amount) }}
+
+ |
+ |
- {{ number_format($event->total_amount) }}
+ 金币奖池
- @if ($event->distribute_type === 'random')
+
+ |
+ |
-
随机
- @else
- 定额
- {{ number_format($event->fixed_amount) }}
- @endif
-
- {{ $event->max_claimants === 0 ? '不限' : $event->max_claimants . ' 人' }}
- |
-
- {{ $event->send_at->format('m-d H:i') }}
- @if ($event->repeat_type === 'yearly')
- |
-
- {{ data_get($event, 'schedule_month', $event->send_at?->format('n')) }}月{{ data_get($event, 'schedule_day', $event->send_at?->format('j')) }}日
- · {{ data_get($event, 'duration_days', 1) }}天
- · 每天{{ data_get($event, 'daily_occurrences', 1) }}次
- · 间隔{{ data_get($event, 'occurrence_interval_minutes', 60) }}分钟
+ class="inline-flex rounded-full px-2.5 py-1 text-xs font-bold {{ $isRandomDistribute ? 'bg-fuchsia-100 text-fuchsia-700' : 'bg-sky-100 text-sky-700' }}">
+ {{ $isRandomDistribute ? '随机分配' : '固定金额' }}
+
+
+ @if ($isRandomDistribute)
+ 按本轮人数拆分
+ @else
+ 每人 {{ number_format($event->fixed_amount) }} 金币
+ @endif
- @endif
+
- @php
- $repeatLabels = [
- 'once' => '一次',
- 'daily' => '每天',
- 'weekly' => '每周',
- 'monthly' => '每月',
- 'yearly' => '每年',
- 'cron' => 'CRON',
- ];
- @endphp
- {{ $repeatLabels[$event->repeat_type] ?? '-' }}
+
+ |
+ |
-
+
+
+ 限额人数
+
+ {{ $event->max_claimants === 0 ? '不限人数' : $event->max_claimants . ' 人' }}
+
+
+
+ 重复策略
+ {{ $repeatLabel }}
+
- @php
- $statusMap = [
- 'pending' => ['待触发', 'bg-yellow-100 text-yellow-700'],
- 'active' => ['领取中', 'bg-green-100 text-green-700'],
- 'completed' => ['已结束', 'bg-gray-100 text-gray-500'],
- 'cancelled' => ['已取消', 'bg-red-100 text-red-600'],
- ];
- [$label, $cls] = $statusMap[$event->status] ?? [
- '未知',
- 'bg-gray-100 text-gray-500',
- ];
- @endphp
- {{ $label }}
+
+ |
+ |
-
+
+
+ @if ($event->repeat_type === 'yearly')
+ 最近计划时间
+ {{ $event->send_at->format('m-d H:i') }}
+ {{ $event->send_at->format('Y-m-d') }}
+
+ {{ Str::limit($yearlyScheduleText, 22) }}
+
+ @endif
+
-
+
+ |
+ |
-
+
+
+ {{ $statusLabel }}
+
+
+ {{ $event->enabled ? '已启用' : '已停用' }}
+
+
+
+
+
+
+ @if ($event->triggered_at)
+ 最近触发:{{ $event->triggered_at->format('m-d H:i') }}
+ @else
+ 尚未产生发放批次
+ @endif
+
+
- {{-- 手动触发 --}}
- @if ($event->status === 'pending')
- |
+ |
暂无节日福利活动,立即创建一个?
+ class="font-bold text-amber-500 hover:text-amber-600">立即创建一个。
|
| ||||||||||||||||