feat: add vip payment and member center

This commit is contained in:
2026-04-11 12:01:52 +08:00
parent db26820544
commit 746116d325
23 changed files with 1781 additions and 2 deletions
+31 -2
View File
@@ -74,6 +74,9 @@
// VIP 等级
$vipLevels = VipLevel::orderBy('sort_order')->get();
// VIP 在线支付开关
$vipPaymentEnabled = Sysparam::getValue('vip_payment_enabled', '0') === '1';
// 礼物列表
$gifts = Gift::activeList();
@@ -378,7 +381,8 @@
<th class="px-4 py-2 text-center">经验倍率</th>
<th class="px-4 py-2 text-center">金币倍率</th>
<th class="px-4 py-2 text-center">时长</th>
<th class="px-4 py-2 text-center rounded-tr-md">价格</th>
<th class="px-4 py-2 text-center">价格</th>
<th class="px-4 py-2 text-center rounded-tr-md">操作</th>
</tr>
</thead>
<tbody>
@@ -391,14 +395,39 @@
×{{ $vip->exp_multiplier }}</td>
<td class="px-4 py-2.5 text-center text-amber-600 font-bold">
×{{ $vip->jjb_multiplier }}</td>
<td class="px-4 py-2.5 text-center text-gray-600">{{ $vip->duration_days }} </td>
<td class="px-4 py-2.5 text-center text-gray-600">{{ $vip->duration_days > 0 ? $vip->duration_days . ' 天' : '永久' }}</td>
<td class="px-4 py-2.5 text-center text-rose-600 font-bold">
{{ $vip->price > 0 ? $vip->price . ' 元' : '免费' }}</td>
<td class="px-4 py-2.5 text-center">
@php
$isCurrentVipLevel = auth()->user()?->isVip() && (int) auth()->user()?->vip_level_id === (int) $vip->id;
@endphp
@if ($vip->price > 0 && $vipPaymentEnabled)
<form action="{{ route('vip.payment.store') }}" method="POST"
onsubmit="return confirm('确认支付 {{ $vip->price }} 元购买【{{ $vip->name }}】吗?');">
@csrf
<input type="hidden" name="vip_level_id" value="{{ $vip->id }}">
<button type="submit"
class="px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-xs font-bold hover:bg-indigo-700 transition">
{{ $isCurrentVipLevel ? '立即续费' : '立即购买' }}
</button>
</form>
@elseif ($vip->price > 0)
<span class="inline-flex px-3 py-1.5 rounded-lg bg-gray-100 text-gray-500 text-xs font-bold">暂未开启</span>
@else
<span class="inline-flex px-3 py-1.5 rounded-lg bg-emerald-100 text-emerald-700 text-xs font-bold">联系管理员</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="mt-4 rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-xs text-indigo-700">
VIP 会员支付由平台支付中心提供,最终开通结果以异步回调为准。
</div>
</section>
@endif