|
|
@@ -7,7 +7,6 @@ import { LoadingOverlayComponent } from '../../../components/domain/loading-over
|
|
|
import { ProvisionInstructionComponent } from '../../../components/domain/provision-instruction/provision-instruction';
|
|
|
import { PlanService } from '../../../core/plan.service';
|
|
|
import { ProvisionService } from '../../../core/provision.service';
|
|
|
-import { RenewalGuideComponent } from '../../../components/domain/renewal-guide/renewal-guide';
|
|
|
import { LiveService } from '../../../core/live.service';
|
|
|
import { ProvisionConfirmComponent } from '../../../components/domain/provision-confirm/provision-confirm';
|
|
|
import { suggestContainerName } from '../../../components/domain/provision-confirm/container-name';
|
|
|
@@ -28,7 +27,7 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
@Component({
|
|
|
selector: 'app-dk-plans-page',
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
|
- imports: [UserNoticePipe, ProvisionInstructionComponent, LoadingOverlayComponent, RenewalGuideComponent, ProvisionConfirmComponent],
|
|
|
+ imports: [UserNoticePipe, ProvisionInstructionComponent, LoadingOverlayComponent, ProvisionConfirmComponent],
|
|
|
template: `
|
|
|
<div class="plans-page">
|
|
|
<!-- 名额已满提示(2026-12-03):页面顶部,用户点了开通马上能看到 -->
|
|
|
@@ -47,6 +46,10 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
</div>
|
|
|
}
|
|
|
<header class="plans-head">
|
|
|
+ <!-- 返回(2026-12-03):套餐页多为门禁跳转进来的,必须能退回去 -->
|
|
|
+ <button type="button" class="plans-back" [disabled]="!canGoBack()" (click)="goBack()">
|
|
|
+ <i class="fa-solid fa-arrow-left" aria-hidden="true"></i> 返回
|
|
|
+ </button>
|
|
|
<div>
|
|
|
<p class="plans-eyebrow"><i class="fa-solid fa-crown" aria-hidden="true"></i> 套餐与开通</p>
|
|
|
<h1>选择适合你的协作方式。</h1>
|
|
|
@@ -125,12 +128,12 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
<h2>先体验,再决定。<span>两天试用</span></h2>
|
|
|
<p>用你自己的 Hermes 接入 Fmode:<b>本机直接安装</b>或 <b>Docker 容器</b>均可</p>
|
|
|
</div>
|
|
|
- <button type="button" class="plans-banner-btn" [disabled]="provision.startBlocked()" (click)="apply('trial')">
|
|
|
+ <button type="button" class="plans-banner-btn" [disabled]="provision.startBlocked() || trialUsed()" (click)="apply('trial')">
|
|
|
@if (provision.isStarting('trial')) {
|
|
|
<i class="fa-solid fa-circle-notch fa-spin" aria-hidden="true"></i>
|
|
|
生成中…
|
|
|
} @else {
|
|
|
- 开始两天试用
|
|
|
+ {{ trialUsed() ? '已使用过试用' : '开始两天试用' }}
|
|
|
}
|
|
|
</button>
|
|
|
</section>
|
|
|
@@ -162,16 +165,29 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
</div>
|
|
|
<h3>{{ item.name }}</h3>
|
|
|
<p class="plan-tagline">{{ item.tagline }}</p>
|
|
|
- <!-- 名额显示已用/上限(2026-12-03 用户反馈「看不到我的限额」);列表未载出时只显示上限 -->
|
|
|
- <p class="plan-quota">
|
|
|
- @if (live.hasData()) {
|
|
|
- <strong>{{ live.agents().length }}/{{ item.quota }}</strong>
|
|
|
- } @else {
|
|
|
- <strong>{{ item.quota }}</strong>
|
|
|
- }
|
|
|
- <span>{{ item.quotaLabel }}</span>
|
|
|
- </p>
|
|
|
+ <!--
|
|
|
+ 额度(2026-12-03 用户裁决 B):
|
|
|
+ · 只显示**上限**(如「3 个容器」),不显示已用数;
|
|
|
+ · 超额仍会**禁止开通**(判定在 apply(),用 existingNames 与配额比);
|
|
|
+ · 企业版(contactOnly)不显示任何数量。
|
|
|
+ -->
|
|
|
+ @if (!item.contactOnly && item.quota > 0) {
|
|
|
+ <p class="plan-quota"><strong>{{ item.quota }}</strong><span>{{ item.quotaLabel }}</span></p>
|
|
|
+ }
|
|
|
|
|
|
+ <!-- 企业版(contactOnly):不显示时长与价格,改为联系客服定制(2026-12-03 用户裁决) -->
|
|
|
+ @if (item.contactOnly) {
|
|
|
+ <div class="plan-contact">
|
|
|
+ <p class="plan-contact-title">企业定制方案</p>
|
|
|
+ <p>容器数量、专属资源、私有化部署与定制化开发,按企业需求评估。</p>
|
|
|
+ <a class="plan-contact-link" href="tel:400-000-0000" target="_blank" rel="noopener">
|
|
|
+ <i class="fa-solid fa-phone" aria-hidden="true"></i> 客服电话:400-000-0000
|
|
|
+ </a>
|
|
|
+ <a class="plan-contact-link" href="mailto:contact@fmode.cn" target="_blank" rel="noopener">
|
|
|
+ <i class="fa-solid fa-envelope" aria-hidden="true"></i> 联系邮箱:contact@fmode.cn
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ } @else {
|
|
|
<!-- 付费时长三档(2026-12-03 用户裁决:月/季/年,默认月 30 天;价格仍待定不出现金额) -->
|
|
|
<div class="plan-periods" role="radiogroup" [attr.aria-label]="item.name + ' 计费周期'">
|
|
|
@for (opt of billingOptions; track opt.value) {
|
|
|
@@ -186,7 +202,12 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
<span>{{ periodUnit(item.code) }}</span>
|
|
|
</div>
|
|
|
<p class="plan-billing">按{{ periodLabel(item.code) }}开通 · {{ periodDays(item.code) }} 天</p>
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ @if (item.contactOnly) {
|
|
|
+ <a class="plan-cta plan-cta--contact" href="mailto:contact@fmode.cn?subject=企业版定制咨询" target="_blank" rel="noopener">联系客服</a>
|
|
|
+ } @else {
|
|
|
<button
|
|
|
type="button"
|
|
|
class="plan-cta"
|
|
|
@@ -199,9 +220,10 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
<i class="fa-solid fa-circle-notch fa-spin" aria-hidden="true"></i>
|
|
|
提交中…
|
|
|
} @else {
|
|
|
- 立即开通
|
|
|
+ {{ ctaText(item.code) }}
|
|
|
}
|
|
|
</button>
|
|
|
+ }
|
|
|
|
|
|
<ul class="plan-features">
|
|
|
@for (f of item.features; track f) {
|
|
|
@@ -217,8 +239,6 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
<span>具体价格请咨询客服。提交申请后由工作人员联系确认,确认前不会产生费用。</span>
|
|
|
</p>
|
|
|
|
|
|
- <app-renewal-guide />
|
|
|
-
|
|
|
<!--
|
|
|
底部不再放「我的容器」入口卡(2026-12-03 用户反馈):
|
|
|
顶部状态条已有「管理容器」按钮,两个入口同页重复。
|
|
|
@@ -507,6 +527,33 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
|
|
|
color: var(--muted);
|
|
|
font-size: var(--fs-12);
|
|
|
}
|
|
|
+ .plans-back {
|
|
|
+ display: inline-flex; align-items: center; gap: var(--sp-2);
|
|
|
+ min-height: 32px; margin-bottom: var(--sp-3); padding: 0 var(--sp-2);
|
|
|
+ border: 0; border-radius: 8px; background: transparent;
|
|
|
+ color: var(--ink-2); font-size: var(--fs-13); cursor: pointer;
|
|
|
+ }
|
|
|
+ .plans-back:hover { background: var(--surface-2); color: var(--ink); }
|
|
|
+ .plans-back:disabled { opacity: .5; cursor: default; }
|
|
|
+ .plan-contact {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: var(--sp-2);
|
|
|
+ margin: var(--sp-3) 0;
|
|
|
+ padding: var(--sp-3);
|
|
|
+ border: 1px dashed var(--edge);
|
|
|
+ border-radius: var(--r-md, 10px);
|
|
|
+ background: var(--surface-2);
|
|
|
+ font-size: var(--fs-13);
|
|
|
+ }
|
|
|
+ .plan-contact-title { margin: 0; font-weight: 600; color: var(--ink); }
|
|
|
+ .plan-contact p { margin: 0; color: var(--ink-2); line-height: 1.5; }
|
|
|
+ .plan-contact-link {
|
|
|
+ display: inline-flex; align-items: center; gap: var(--sp-2);
|
|
|
+ color: var(--primary); text-decoration: none;
|
|
|
+ }
|
|
|
+ .plan-contact-link:hover { text-decoration: underline; }
|
|
|
+ .plan-cta--contact { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
|
|
|
.plan-periods {
|
|
|
display: flex;
|
|
|
gap: 2px;
|
|
|
@@ -780,6 +827,21 @@ export class DkPlansPage implements OnInit {
|
|
|
void this.live.ensureLoaded();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否已有付费套餐(2026-12-03 用户裁决:按有无套餐自动切「开通 / 续费」)。
|
|
|
+ *
|
|
|
+ * 判据:名下任一容器 planCode 属于付费档(starter/advanced/enterprise)。
|
|
|
+ * 试用不算「已有套餐」——试用是体验,不是订阅。
|
|
|
+ */
|
|
|
+ protected readonly hasPaidPlan = computed(() =>
|
|
|
+ this.live.agents().some((a) => a.planCode === 'starter' || a.planCode === 'advanced' || a.planCode === 'enterprise'),
|
|
|
+ );
|
|
|
+
|
|
|
+ /** 按钮文案:已有套餐 → 续费;否则 → 开通(企业版走联系客服,不经过这里) */
|
|
|
+ protected ctaText(_code: string): string {
|
|
|
+ return this.hasPaidPlan() ? '续费' : '立即开通';
|
|
|
+ }
|
|
|
+
|
|
|
/* 付费时长三档(2026-12-03):每张卡各自记住选择,默认月 */
|
|
|
protected readonly billingOptions = BILLING_OPTIONS;
|
|
|
private readonly billingSel = signal<Record<string, BillingPeriod>>({});
|
|
|
@@ -791,6 +853,15 @@ export class DkPlansPage implements OnInit {
|
|
|
protected periodUnit(code: string): string { return BILLING_OPTIONS.find((o) => o.value === this.billingOf(code))?.unit ?? '/ 月'; }
|
|
|
protected periodDays(code: string): number { return billingDays(this.billingOf(code)); }
|
|
|
|
|
|
+ /**
|
|
|
+ * 该账号是否已用过试用(2026-12-03 用户裁决:试用与容器数量无关,按账号只一次)。
|
|
|
+ * 判据来自云函数派生的 trialUsedAt/trialExpired;用过就禁用试用入口,
|
|
|
+ * 后端 `TRIAL_USED` 仍是最终防线。
|
|
|
+ */
|
|
|
+ protected readonly trialUsed = computed(() =>
|
|
|
+ this.live.agents().some((a) => a.planCode === 'trial' || a.trialExpired === true),
|
|
|
+ );
|
|
|
+
|
|
|
protected readonly plans = computed(() => this.plan.catalog);
|
|
|
|
|
|
/** 运行中的容器数(资产概览用;状态口径与通讯录一致) */
|
|
|
@@ -856,6 +927,10 @@ export class DkPlansPage implements OnInit {
|
|
|
*
|
|
|
* 与移动端同源逻辑:试用/入门留在本页给提示词,进阶/企业跳全屏等待页。
|
|
|
*/
|
|
|
+ /** 是否有上一页(直接打开 /plans 时没有,按钮置灰) */
|
|
|
+ protected canGoBack(): boolean { return history.length > 1; }
|
|
|
+ protected goBack(): void { if (history.length > 1) history.back(); else void this.router.navigateByUrl('/desktop/chat'); }
|
|
|
+
|
|
|
protected async apply(code: PaidPlanCode | 'trial'): Promise<void> {
|
|
|
if (this.provision.isRunning()) return;
|
|
|
/*
|
|
|
@@ -869,8 +944,13 @@ export class DkPlansPage implements OnInit {
|
|
|
* 在弹窗之前拦,而不是等提交后云函数返回 409 ——
|
|
|
* 「认真填完名字才被告知名额已满」是很差的体验。
|
|
|
*/
|
|
|
+ /*
|
|
|
+ * 超额禁止(2026-12-03 用户裁决 B):卡片只显示上限不显示已用数,
|
|
|
+ * 但达到上限后仍然**不允许再开**——这里就是拦截点。
|
|
|
+ * 试用独立计数(与容器数量无关,只按账号判一次)。
|
|
|
+ */
|
|
|
const quota = code === 'trial' ? 1 : (this.plan.planOf(code as never)?.quota ?? 0);
|
|
|
- if (quota > 0 && this.existingNames().length >= quota) {
|
|
|
+ if (code !== 'trial' && quota > 0 && this.existingNames().length >= quota) {
|
|
|
this.quotaFull.set({ plan: this.plan.planOf(code as never)?.name || '该套餐', quota });
|
|
|
return;
|
|
|
}
|