chore: init saasshop repo + sql migrations runner + gitee go
This commit is contained in:
144
resources/views/admin/site_subscriptions/index.blade.php
Normal file
144
resources/views/admin/site_subscriptions/index.blade.php
Normal file
@@ -0,0 +1,144 @@
|
||||
@extends('admin.layouts.app')
|
||||
|
||||
@section('title', '订阅管理')
|
||||
@section('page_title', '订阅管理')
|
||||
|
||||
@section('content')
|
||||
<div class="card mb-20">
|
||||
<p class="muted muted-tight">这里是总台视角的订阅目录页,承接“套餐 -> 订阅 -> 平台订单”的收费主链中间层。</p>
|
||||
<p class="muted">当前阶段先做到:可访问列表、可筛选、统计摘要;后续再接:订阅激活服务 / 续费 / 取消 / 对账。</p>
|
||||
</div>
|
||||
|
||||
<div class="card mb-20">
|
||||
<h3>筛选条件</h3>
|
||||
<form method="get" action="/admin/site-subscriptions" class="grid-4">
|
||||
<select name="status">
|
||||
<option value="">全部状态</option>
|
||||
@foreach(($filterOptions['statuses'] ?? []) as $value => $label)
|
||||
<option value="{{ $value }}" @selected(($filters['status'] ?? '') === $value)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<select name="expiry">
|
||||
<option value="">全部到期状态</option>
|
||||
<option value="expiring_7d" @selected(($filters['expiry'] ?? '') === 'expiring_7d')>7天内到期</option>
|
||||
<option value="expired" @selected(($filters['expiry'] ?? '') === 'expired')>已过期</option>
|
||||
</select>
|
||||
<select name="merchant_id">
|
||||
<option value="">全部站点</option>
|
||||
@foreach(($merchants ?? []) as $merchant)
|
||||
<option value="{{ $merchant->id }}" @selected(($filters['merchant_id'] ?? '') == $merchant->id)>{{ $merchant->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<select name="plan_id">
|
||||
<option value="">全部套餐</option>
|
||||
@foreach(($plans ?? []) as $plan)
|
||||
<option value="{{ $plan->id }}" @selected(($filters['plan_id'] ?? '') == $plan->id)>{{ $plan->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input name="keyword" placeholder="搜索订阅号 / 套餐快照 / 计费周期" value="{{ $filters['keyword'] ?? '' }}">
|
||||
<div>
|
||||
<button type="submit">应用筛选</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="grid-4 mb-20">
|
||||
<div class="card">
|
||||
<h3>订阅总数</h3>
|
||||
<div class="num-md">{{ $summaryStats['total_subscriptions'] ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>已生效</h3>
|
||||
<div class="num-md">{{ $summaryStats['activated_subscriptions'] ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>待生效</h3>
|
||||
<div class="num-md">{{ $summaryStats['pending_subscriptions'] ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>已取消</h3>
|
||||
<div class="num-md">{{ $summaryStats['cancelled_subscriptions'] ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>已过期(按到期时间)</h3>
|
||||
<div class="num-md">{{ $summaryStats['expired_subscriptions'] ?? 0 }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>7天内到期</h3>
|
||||
<div class="num-md">{{ $summaryStats['expiring_7d_subscriptions'] ?? 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-20">
|
||||
<h3>工具</h3>
|
||||
<form method="get" action="/admin/site-subscriptions/export">
|
||||
<input type="hidden" name="status" value="{{ $filters['status'] ?? '' }}">
|
||||
<input type="hidden" name="merchant_id" value="{{ $filters['merchant_id'] ?? '' }}">
|
||||
<input type="hidden" name="plan_id" value="{{ $filters['plan_id'] ?? '' }}">
|
||||
<input type="hidden" name="expiry" value="{{ $filters['expiry'] ?? '' }}">
|
||||
<input type="hidden" name="keyword" value="{{ $filters['keyword'] ?? '' }}">
|
||||
<button type="submit">导出当前筛选结果(CSV)</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h3>订阅列表</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>订阅号</th>
|
||||
<th>站点</th>
|
||||
<th>套餐</th>
|
||||
<th>状态</th>
|
||||
<th>计费周期</th>
|
||||
<th>周期(月)</th>
|
||||
<th>金额</th>
|
||||
<th>开始时间</th>
|
||||
<th>到期时间</th>
|
||||
<th>到期状态</th>
|
||||
<th>生效时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($subscriptions as $subscription)
|
||||
<tr>
|
||||
<td>{{ $subscription->id }}</td>
|
||||
<td>{{ $subscription->subscription_no }}</td>
|
||||
<td>{{ $subscription->merchant?->name ?? '未关联站点' }}</td>
|
||||
<td>{{ $subscription->plan_name ?: ($subscription->plan?->name ?? '未设置') }}</td>
|
||||
<td>{{ ($statusLabels[$subscription->status] ?? $subscription->status) }} <span class="muted">({{ $subscription->status }})</span></td>
|
||||
<td>{{ $subscription->billing_cycle ?: '-' }}</td>
|
||||
<td>{{ $subscription->period_months }}</td>
|
||||
<td>¥{{ number_format((float) $subscription->amount, 2) }}</td>
|
||||
<td>{{ optional($subscription->starts_at)->format('Y-m-d H:i:s') ?: '-' }}</td>
|
||||
<td>{{ optional($subscription->ends_at)->format('Y-m-d H:i:s') ?: '-' }}</td>
|
||||
<td>
|
||||
@php
|
||||
$endsAt = $subscription->ends_at;
|
||||
$expiryLabel = '无到期';
|
||||
if ($endsAt) {
|
||||
if ($endsAt->lt(now())) {
|
||||
$expiryLabel = '已过期';
|
||||
} elseif ($endsAt->lt(now()->addDays(7))) {
|
||||
$expiryLabel = '7天内到期';
|
||||
} else {
|
||||
$expiryLabel = '未到期';
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
{{ $expiryLabel }}
|
||||
</td>
|
||||
<td>{{ optional($subscription->activated_at)->format('Y-m-d H:i:s') ?: '-' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="12" class="muted">暂无订阅数据,当前阶段先把订阅主表与总台目录立起来,后续再接订阅创建/激活/续费链路。</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-wrap">{{ $subscriptions->links() }}</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user