PlatformOrder create: lock merchant/plan when subscription context present
This commit is contained in:
@@ -79,27 +79,45 @@
|
||||
<input type="hidden" name="back" value="{{ $backValSafe }}">
|
||||
@endif
|
||||
|
||||
@php
|
||||
$hasLockedSubscription = (bool) (($siteSubscription ?? null) && ($siteSubscription->id ?? 0));
|
||||
$merchantIdVal = (string) old('merchant_id', $defaults['merchant_id'] ?? '');
|
||||
$planIdVal = (string) old('plan_id', $defaults['plan_id'] ?? '');
|
||||
@endphp
|
||||
|
||||
<label>
|
||||
<span>站点</span>
|
||||
<select name="merchant_id" required>
|
||||
@if($hasLockedSubscription)
|
||||
<input type="hidden" name="merchant_id" value="{{ $merchantIdVal }}">
|
||||
@endif
|
||||
<select name="merchant_id" required @disabled($hasLockedSubscription)>
|
||||
<option value="">请选择站点</option>
|
||||
@foreach(($merchants ?? []) as $m)
|
||||
<option value="{{ $m->id }}" @selected((string)old('merchant_id', $defaults['merchant_id'] ?? '') === (string)$m->id)>{{ $m->name }}</option>
|
||||
<option value="{{ $m->id }}" @selected($merchantIdVal === (string)$m->id)>{{ $m->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@if($hasLockedSubscription)
|
||||
<small class="muted">已从订阅上下文锁定站点(避免误选导致续费串单)。</small>
|
||||
@endif
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<span>套餐</span>
|
||||
<select name="plan_id" required>
|
||||
@if($hasLockedSubscription)
|
||||
<input type="hidden" name="plan_id" value="{{ $planIdVal }}">
|
||||
@endif
|
||||
<select name="plan_id" required @disabled($hasLockedSubscription)>
|
||||
<option value="">请选择套餐</option>
|
||||
@foreach(($plans ?? []) as $p)
|
||||
<option value="{{ $p->id }}" @selected((string)old('plan_id', $defaults['plan_id'] ?? '') === (string)$p->id)>
|
||||
<option value="{{ $p->id }}" @selected($planIdVal === (string)$p->id)>
|
||||
{{ $p->name }}({{ $billingCycleLabels[$p->billing_cycle] ?? $p->billing_cycle }} / ¥{{ number_format((float)$p->price, 2) }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="muted">订单会写入套餐快照(plan_name / billing_cycle / plan_snapshot),便于后续套餐变更时追溯。</small>
|
||||
@if($hasLockedSubscription)
|
||||
<small class="muted">已从订阅上下文锁定套餐(当前阶段不支持跨套餐续费;升级/降级后续再建)。</small>
|
||||
@endif
|
||||
</label>
|
||||
|
||||
<label>
|
||||
|
||||
Reference in New Issue
Block a user