app/template/default/refer_friend_lp.twig line 1

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% block javascript %}
  3. <script>
  4.     const INVITE_URL = '{{ referralLink }}';
  5.     // 反映
  6.     const input = document.getElementById('invite-url');
  7.     const copyBtn = document.getElementById('copy-btn');
  8.     const toast = document.getElementById('copy-toast');
  9.     input.value = INVITE_URL;
  10.     // コピー動作
  11.     if({{ availableCount }} > 0) {
  12.         copyBtn.addEventListener('click', async () => {
  13.         console.log('copying...');
  14.         try {
  15.             await navigator.clipboard.writeText(input.value);
  16.             toast.textContent = 'リンクをコピーしました';
  17.             setTimeout(() => toast.textContent = '', 2000);
  18.         } catch (e) {
  19.             input.select();
  20.             document.execCommand('copy');
  21.             toast.textContent = 'コピーしました(互換モード)';
  22.             setTimeout(() => toast.textContent = '', 2000);
  23.         }
  24.         });
  25.         // 共有リンク(必要に応じてエンコード)
  26.         const shareMessage = `【シコメルストア】
  27. お友達から3,000円の割引クーポンが届きました!
  28. さっそく、有名店の仕込み済みメニューを試してみましょう。
  29. 下記URLから登録するだけで、クーポンがもらえます。
  30. ` + INVITE_URL;
  31.         const shareText = encodeURIComponent(shareMessage);
  32.         const shareUrl  = encodeURIComponent(INVITE_URL);
  33.         const lineShareLink = (isMobile()) 
  34.             ?`https://line.me/R/share?text=${shareText}`
  35.                 : `https://social-plugins.line.me/lineit/share?url=${shareUrl}&text=${shareText}`
  36.         // LINE (line.me)
  37.         document.getElementById('share-line').href = lineShareLink;
  38.         
  39.         // Facebook (シェアダイアログ。ドメインが公開到達可能である必要あり)
  40.         document.getElementById('share-fb').href =
  41.         // `https://www.facebook.com/sharer/sharer.php?u=${shareUrl}`;
  42.         `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(getFaceBookShareLink())}`;
  43.         // メール(mailto)
  44.         document.getElementById('share-mail').href =
  45.         `mailto:?subject=${encodeURIComponent('招待リンクの共有')}&body=${shareText}`;
  46.     } else {
  47.         // リンクを無効化
  48.         document.getElementById('share-line').style.pointerEvents = "none";
  49.         document.getElementById('share-fb').style.pointerEvents = "none";
  50.         document.getElementById('share-mail').style.pointerEvents = "none";
  51.     }
  52.     function getFaceBookShareLink() {
  53.         const url = new URL(INVITE_URL);
  54.         const params = url.searchParams;
  55.         const origin = url.origin;
  56.         return url.origin + "/user_data/share-entry-before?rc=" + params.get('rc');    
  57.     }
  58.     function isMobile() {
  59.         return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
  60.     }
  61. </script>
  62. {% endblock javascript %}
  63. {% block stylesheet %}
  64. <style>
  65.     .ec-layoutRole {
  66.         background: #ffffffff;
  67.     }
  68.     .main_content {
  69.         width: 375px;
  70.         margin: auto;
  71.     }
  72.     .main_content h1 {
  73.         font-size: 22px;
  74.         font-weight: bold;
  75.         margin: 0px;
  76.     }
  77.     .section1 {
  78.         --bg: #fff7d6;         /* パネル背景(薄いきいろ) */
  79.         --ink: #2b2b2b;        /* 文字色 */
  80.         --muted: #6b7280;      /* 補助文字色 */
  81.         --pill: #f3f4f6;       /* 入力背景 */
  82.         --copy: #e5e7eb;       /* コピーボタン背景 */
  83.         --danger: #ef4444;     /* 残回数の赤 */
  84.         --border: #e5e7eb;     /* 枠線 */
  85.     }
  86.     /* カード本体 */
  87.     .section1 .invite-card {
  88.         margin: 0 auto;
  89.         background: var(--bg);
  90.         padding: 20px 20px 16px;
  91.         box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 6px 20px rgba(0,0,0,.06);
  92.     }
  93.     /* タイトル */
  94.     .section1 .invite-title {
  95.         text-align: center;
  96.         font-weight: 700;
  97.         font-size: 18px;
  98.         margin: 2px 0 16px;
  99.         letter-spacing: .02em;
  100.         color: var(--ink);
  101.     }
  102.     /* 入力 + コピー */
  103.     .section1 .copy-row {
  104.         display: grid;
  105.         grid-template-columns: 1fr auto;
  106.         align-items: center;
  107.         width: 327px;
  108.     }
  109.     @media screen and (max-width: 767px) {
  110.         .main_content {
  111.             width: 100%
  112.         }
  113.         .section1 .copy-row {
  114.             width: 100%;
  115.         }
  116.     }
  117.     .section1 .copy-input {
  118.         width: 100%;
  119.         background: #ffffff;
  120.         border: 1px solid #d1d5db;
  121.         border-right-color: #ffff;
  122.         height: 48px;
  123.         padding: 0 12px;
  124.         font-size: 14px;
  125.         color: var(--ink);
  126.         outline: none;
  127.     }
  128.     .section1 .copy-btn {
  129.         background: #ffffff;
  130.         border: 1px solid #d1d5db;
  131.         border-left-color: #ffff;
  132.         padding: 0 12px;
  133.         height: 48px;
  134.         font-size: 14px;
  135.         cursor: pointer;
  136.         color: #1F9FCB;
  137.         font-weight: bold;
  138.         white-space: nowrap;
  139.     }
  140.     .section1 span {
  141.         font-weight: bold;
  142.     }
  143.     .section1 .copy-btn:hover { filter: brightness(0.98); }
  144.     .section1 .copy-toast {
  145.         font-size: 12px;
  146.         color: var(--muted);
  147.         min-height: 16px;
  148.         text-align: left;
  149.     }
  150.     /* 共有ボタン群 */
  151.     .section1 .share-row {
  152.         display: flex;
  153.         justify-content: space-between;
  154.         gap: 10px;
  155.         padding: 0 0 16px;
  156.     }
  157.     .section1 .share-row span {
  158.         font-size: 12px;
  159.     }
  160.     .section1 .share-btn {
  161.         flex: 1 1 0;
  162.         display: flex;
  163.         flex-direction: column;
  164.         align-items: center;
  165.         gap: 6px;
  166.         text-decoration: none;
  167.         color: var(--ink);
  168.         font-size: 12px;
  169.         text-align: center;
  170.         transition: background-color .12s ease;
  171.     }
  172.     
  173.     /* アイコンサイズ(SVG) */
  174.     .section1 .icon {
  175.         width: 28px;
  176.         height: 28px;
  177.         display: inline-block;
  178.     }
  179.     /* 残回数テキスト */
  180.     .section1 .note {
  181.         text-align: center;
  182.         font-size: 16px;
  183.         color: var(--muted);
  184.         margin-top: 16px;
  185.         font-weight: bold;
  186.     }
  187.     .section1 .note .count {
  188.         color: var(--danger);
  189.         font-weight: 700;
  190.         font-size: 28px;
  191.         margin: 0 2px;
  192.     }
  193.     /* スマホ最適化(狭い端末での余白最適化) */
  194.     @media (max-width: 380px) {
  195.         .section1 .invite-card { padding: 16px 14px; }
  196.         .section1 .share-row { gap: 8px; }
  197.         .section1 .invite-title { font-size: 17px; }
  198.     }
  199.     /* ===== ダークセクション(section2専用) ===== */
  200.     .section2 {
  201.         --bg: #ffffffff;          /* 背景(黒) */
  202.         --ink: #000000ff;         /* 文字(明) */
  203.         --muted: #cbd5e1;       /* 補助文字 */
  204.         --line: #1f2937;        /* 区切り線 */
  205.         --primary: #22d3ee;     /* アクセント(シアン) */
  206.         --primary-ink: #0b0b0b; /* ボタン文字(濃) */
  207.         background: var(--bg);
  208.         color: var(--ink);
  209.         padding: 48px 20px;
  210.     }
  211.     .section2 ul {
  212.         list-style: disc;
  213.     }
  214.     .section2__inner{
  215.         max-width: 960px;
  216.         margin: 0 auto;
  217.         text-align: left;
  218.     }
  219.     .section2__title h2{
  220.         text-align: center;
  221.     }
  222.     .section2__title h2{
  223.         font-size: 24px;
  224.         line-height: 1.2;
  225.         font-weight: 800;
  226.         letter-spacing: .01em;
  227.         margin: 0 0 10px;
  228.     }
  229.     .section2__subtitle{
  230.         font-size: 15px;
  231.         line-height: 1.9;
  232.         font-weight: bold;
  233.         max-width: 680px;
  234.     }
  235.     .section2__btn{
  236.         display: inline-flex;
  237.         align-items: center;
  238.         justify-content: center;
  239.         padding: 12px 18px;
  240.         border-radius: 999px;
  241.         font-weight: 700;
  242.         text-decoration: none;
  243.         border: 1px solid var(--line);
  244.         transition: transform .08s ease, filter .12s ease, background-color .12s ease;
  245.     }
  246.     .section2__btn:active{ transform: translateY(1px); }
  247.     .section2__btn--primary{
  248.         background: var(--primary);
  249.         color: var(--primary-ink);
  250.         border-color: transparent;
  251.     }
  252.     .section2__btn--primary:hover{ filter: brightness(0.96); }
  253.     .section2__btn--ghost{
  254.         background: transparent;
  255.         color: var(--ink);
  256.     }
  257.     .section2__btn--ghost:hover{ background: rgba(255,255,255,.06); }
  258.     /* アイコン付き特徴 */
  259.     .section2__features{
  260.         grid-template-columns: repeat(3, minmax(0,1fr));
  261.         gap: 12px;
  262.         padding: 0; 
  263.         margin: 0 auto 0;
  264.         max-width: 780px;
  265.     }
  266.     .feature{
  267.         align-items: center; 
  268.         gap: 10px;
  269.         background: rgba(255,255,255,.04);
  270.         padding: 4px 0px 4px 0;
  271.         margin-left: 18px;
  272.     }
  273.     .feature__icon{
  274.         width: 28px; height: 28px; border-radius: 8px;
  275.         background: rgba(255,255,255,.08);
  276.         display: grid; place-items: center;
  277.         font-size: 14px;
  278.     }
  279.     .feature__text{ font-size: 13px; color: var(--muted); }
  280.     
  281.     .share_line,
  282.     .share_facebook,
  283.     .share_mail {
  284.         width: 100px;
  285.         text-align: center;
  286.     }
  287.     .share_line .share-btn,
  288.     .share_facebook .share-btn,
  289.     .share_mail .share-btn
  290.     {
  291.         margin-bottom: 4px;
  292.     }
  293.     /* SP */
  294.     @media (max-width: 640px){
  295.         .section2{ padding: 36px 16px; }
  296.         .section2__title{ font-size: 22px; }
  297.         .section2__lead{ font-size: 14px; }
  298.         .section2__features{ grid-template-columns: 1fr; }
  299.     }
  300. </style>
  301. {% endblock stylesheet %}
  302. {% block main %}
  303.     <div class="main_content">
  304.         <header id="header_content" style="position: relative;">
  305.             <h1><img src="{{ asset('assets/img/refer_friend/top.webp', 'user_data') }}" alt="友達紹介でクーポンがもらえる" style="max-width: 100%;"></h1>
  306.         </header>
  307.         <section class="section1" style="">
  308.             <div class="invite-card" role="region" aria-labelledby="invite-title">
  309.             <h2 id="invite-title" class="invite-title">招待リンク</h2>
  310.             <div class="copy-row" style="{% if availableCount is same as (0) %} opacity: 0.4; {% endif %}">
  311.                 <input id="invite-url" class="copy-input" type="text"
  312.                     value="" aria-label="招待リンクURL" readonly />
  313.                 <button id="copy-btn" class="copy-btn" type="button" aria-label="リンクをコピー">コピー</button>
  314.             </div>
  315.             <div id="copy-toast" class="copy-toast" aria-live="polite"></div>
  316.             <div class="share-row" style="{% if availableCount is same as (0) %} opacity: 0.4; {% endif %}">
  317.                 <!-- LINE -->
  318.                 <div class="share_line">
  319.                     <a class="share-btn" id="share-line" href="#" target="_blank" rel="noopener">
  320.                     <img src="{{ asset('assets/img/refer_friend/line_logo.png', 'user_data') }}" style="max-width: 50px;">
  321.                     </a>
  322.                     <span>LINEで共有</span>
  323.                 </div>
  324.                 <!-- Facebook -->
  325.                 <div class="share_facebook">
  326.                     <a class="share-btn" id="share-fb" href="#" target="_blank" rel="noopener">
  327.                     <img src="{{ asset('assets/img/refer_friend/facebook_logo.png', 'user_data') }}" style="max-width: 50px;">
  328.                     </a>
  329.                     <span>Facebookで共有</span>
  330.                 </div>
  331.                 <!-- Mail -->
  332.                 <div class="share_mail">
  333.                     <a class="share-btn" id="share-mail" href="#" target="_blank" rel="noopener">
  334.                     <img src="{{ asset('assets/img/refer_friend/mail_icon.png', 'user_data') }}" style="max-width: 50px;">
  335.                     </a>
  336.                     <span>メールで共有</span>
  337.                 </div>
  338.             </div>
  339.             {% if app.user %}
  340.             <p class="note">あと <span id="remain-count" class="count">{{ availableCount }} 回</span> 招待できます</p>
  341.             {% else %}
  342.             <p class="note"><a href="{{ path('mypage_login', {'_target_path': app.request.uri }) }}">ログインする</a>と共有できます</p>
  343.             {% endif %}
  344.             </div>
  345.         </section>
  346.         <section class="section2">
  347.             <div class="section2__title">
  348.                 <h2>注意事項</h2>
  349.             </div>
  350.             <div class="section2__inner">
  351.                 <p class="section2__subtitle">1.クーポンの進呈・利用条件について</p>
  352.                 <ul class="section2__features">
  353.                     <li class="feature">本紹介システムを通じて紹介される方(新規会員)は、必ず紹介専用URLから遷移し、新規会員登録を完了してください。専用URL以外からの登録は特典の対象外となります。</li> 
  354.                     <li class="feature">特典の3,000円クーポン(紹介された方)は、新規会員登録完了後にその場で自動で付与されます。</li>
  355.                     <li class="feature">特典の1,000円クーポン(紹介した方)は、紹介された方が初回購入を完了し、その商品が発送された時点で自動で付与されます。クーポン獲得はLINEまたはメールで通知いたします。</li>
  356.                     <li class="feature">特典の1,000円クーポン(紹介した方)は、最大5枚まで獲得が可能です。</li> 
  357.                     <li class="feature">クーポンはシコメルストア内でのみ利用可能です。 </li>
  358.                     <li class="feature">3,000円クーポンは3,000円以上のご購入で、1,000円クーポンは1,000円以上のご購入で利用が可能です。クーポンの併用はできません。</li> 
  359.                     <li class="feature">過去にシコメルストアに会員登録されていた方の再登録は、紹介特典の対象外となります。</li> 
  360.                     <li class="feature">アプリでの会員登録はクーポン付与の対象外です。Webからのご登録をお願いいたします。</li>
  361.   
  362.                 </ul>
  363.                 <p class="section2__subtitle">2. 禁止事項について</p>
  364.                 <ul class="section2__features">
  365.                     <li class="feature">紹介する人・される人が同一と見なされる場合、特典を剥奪させていただく場合がございます。</li> 
  366.                     <li class="feature">不特定多数への営利目的での紹介、またはスパム行為と見なされるような紹介活動は固く禁止いたします。</li>
  367.                     <li class="feature">紹介システムを悪用した不正行為が確認された場合、特典の無効化、クーポンの失効、または強制退会の措置をとる場合があります。</li>
  368.                 </ul>
  369.                 <p class="section2__subtitle">3. その他</p>
  370.                 <ul class="section2__features">
  371.                     <li class="feature">本紹介システムの内容は、予告なく変更または終了する場合があります。その際、取得したクーポンを破棄させていただく場合がございます。</li>
  372.                     <li class="feature">クーポンの換金・返金はできません。</li> 
  373.                     <li class="feature">本システムについてご不明な点がある場合は、シコメルストアのお問い合わせ窓口までご連絡ください。</li>
  374.                 </ul>
  375.             </div>
  376.             </section>
  377.     </div>
  378. {% endblock %}