{# 
  mode的取值有：
    full：该模式下显示折扣价、原价、打折
    price: 该模式下如有打折活动则显示折扣价，没有打折活动就显示为原价
    originPrice：该模式下只显示原价
    discount：该模式下只显示折扣
#}

{% set shows = shows|default(['full']) %}
{% set priceType = (setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin') ? 'coin' : 'default'  %}

<span class="course-price-widget">
  {% if course.discountId %}

    {% if 'full' in shows or 'price' in shows %}
      {% if priceType == 'coin' %}
        <span class="price">{{ course.coinPrice }} {{setting('coin.coin_name', '虚拟币')}}</span>
      {% else %}
        <span class="price">{{ course.price }} 元</span>
      {% endif %}
    {% endif %}

    {% if 'full' in shows or 'originPrice' in shows %}
      {% if priceType == 'coin' %}
        <span class="origin-price"><del>{{course.originCoinPrice}}</del></span>
      {% else %}
        <span class="origin-price"><del>{{course.originPrice}}</del></span>
      {% endif %}
    {% endif %}

    {% if 'full' in shows or 'discount' in shows %}

      <span class="discount">
        {% if (course.discount == 0) or (priceType == 'coin' and course.originCoinPrice == 0) or (priceType == 'default' and course.originPrice == 0) %}
          限免
        {% else  %}
          {{ course.discount|round(2, 'common') }} 折
        {% endif %}
      </span>

    {% endif %}

  {% else %}

    {% if 'full' in shows or 'price' in shows %}
      <span class="price">
        {% if setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin' %}
          {% if course.coinPrice > 0 %} {{ course.coinPrice }} {{setting('coin.coin_name', '虚拟币')}} {% else %} 免费 {% endif %}
        {% else %}
          {% if course.price > 0 %}{{ course.price }} 元{% else %} 免费 {% endif %}
        {% endif %}
      </span>
    {% endif %}

  {% endif %}
</span>