(function () { 'use strict'; var CHECK_SVG = '' + ''; function esc(s) { if (window.SoonMemberPay && window.SoonMemberPay.esc) return window.SoonMemberPay.esc(s); if (s == null) return ''; return String(s) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"'); } function isPlanFeatureLine(line) { if (!line) return false; return line.indexOf('到期') < 0 && line.indexOf('订阅有效期') < 0 && line.indexOf('订阅周期') < 0 && line.indexOf('权益一致') < 0; } function featureItem(text) { return '
  • ' + CHECK_SVG + '' + esc(text) + '
  • '; } function billingSavePercent(items, plan) { if (window.SoonMemberPay && window.SoonMemberPay.billingSavePercent) { return window.SoonMemberPay.billingSavePercent(items, plan); } return null; } function planCardHtml(plan, ctx) { ctx = ctx || {}; var items = ctx.allPlans || []; var mode = ctx.mode || 'page'; var isMember = !!ctx.isMember; var currentCode = ctx.currentCode || ''; var selectedId = ctx.selectedId; var feat = plan.is_recommended ? ' soon-plan-card--featured' : ''; var cur = plan.code === currentCode ? ' soon-plan-card--current' : ''; var isGate = mode === 'gate'; var isPicker = mode === 'picker' || isGate; var picker = isPicker ? ' soon-plan-card--picker' : ''; if (isGate) picker += ' soon-plan-card--gate'; var selected = isPicker && plan.id === selectedId ? ' soon-plan-card--selected' : ''; var ribbon = plan.is_recommended ? '推荐' : (plan.code === currentCode ? '当前' : ''); var savePct = billingSavePercent(items, plan); if (savePct) ribbon += '省 ' + savePct + '%'; var badgeCls = ribbon ? ' soon-plan-card--badged' : ''; if (savePct) badgeCls += ' soon-plan-card--save'; var period = plan.duration_days > 0 ? '/' + esc(plan.period_label || plan.duration_days + '天') + '' : ''; var features = (plan.features || []).filter(isPlanFeatureLine).map(featureItem).join(''); var desc = plan.description || ''; var price = esc(plan.price_display || (plan.price_cents / 100).toFixed(2)); var inner = ribbon + '
    ' + '
    ' + esc(plan.name) + '
    ' + (desc ? '

    ' + esc(desc) + '

    ' : '') + '
    ' + '¥' + '' + price + '' + period + '
    '; if (!isGate) { inner += '
    ' + '
    '; } if (isPicker) { return ''; } var cta = ''; return '
    ' + inner + '
    ' + cta + '
    '; } function plansGridHtml(plans, ctx) { return (plans || []).map(function (p) { return planCardHtml(p, ctx); }).join(''); } window.SoonMemberPlan = { isPlanFeatureLine: isPlanFeatureLine, planCardHtml: planCardHtml, plansGridHtml: plansGridHtml, }; })();