app/Resources/views/course/widgets/price.html.twig line 1

Open in your IDE?
  1. {#
  2.   mode的取值有:
  3.     full:该模式下显示折扣价、原价、打折
  4.     price: 该模式下如有打折活动则显示折扣价,没有打折活动就显示为原价
  5.     originPrice:该模式下只显示原价
  6.     discount:该模式下只显示折扣
  7. #}
  8. {% set shows = shows|default(['full']) %}
  9. {% set priceType = (setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin') ? 'coin' : 'default'  %}
  10. <span class="course-price-widget">
  11.   {% if courseSet.discountId and courseSet.locked == 0 %}
  12.     {% if 'full' in shows or 'price' in shows %}
  13.       {% if priceType == 'coin' %}
  14.         <span >{{ course.price * setting('coin.cash_rate')}} {{setting('coin.coin_name', 'finance.coin'|trans)}}</span>
  15.       {% else %}
  16.         <span >{{'course.price.RMB'|trans({'%price%': course.price})}}</span>
  17.       {% endif %}
  18.     {% endif %}
  19.     {% if 'full' in shows or 'originPrice' in shows %}
  20.       {% if priceType == 'coin' %}
  21.         <span class="origin-price"><del>{{course.originPrice * setting('coin.cash_rate')}} {{setting('coin.coin_name', 'finance.coin'|trans)}}</del></span>
  22.       {% else %}
  23.         <span class="origin-price"><del>{{'course.origin_price.RMB'|trans({'%originPrice%': course.originPrice})}}</del></span>
  24.       {% endif %}
  25.     {% endif %}
  26.     {% if 'full' in shows or 'discount' in shows %}
  27.       <span class="discount">
  28.         {% if (courseSet.discount == 0) or (priceType == 'coin' and course.originPrice == 0) or (priceType == 'default' and course.originPrice == 0) %}
  29.           {{'course.price.limited_time_free'|trans}}
  30.         {% else  %}
  31.           {{'course.price.discount'|trans({'%discount%': courseSet.discount|round(2, 'common') })}}
  32.         {% endif %}
  33.       </span>
  34.     {% endif %}
  35.   {% else %}
  36.     {% if 'full' in shows or 'price' in shows %}
  37.       <span class="price">
  38.         {% if setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin' %}
  39.           {% if course.price > 0 %} 
  40.             {{ course.price * setting('coin.cash_rate')}}
  41.             {{setting('coin.coin_name', 'finance.coin'|trans)}} 
  42.           {% else %} 
  43.             <span class="color-success">{{'course.price.free'|trans}}</span> 
  44.           {% endif  %}
  45.         {% else %}
  46.           {% if course.price > 0 %}
  47.             {{'course.price.RMB'|trans({'%price%': course.price})}}
  48.           {% else %} 
  49.             <span class="color-success">{{'course.price.free'|trans}}</span> 
  50.           {% endif %} 
  51.         {% endif %}
  52.       </span>
  53.     {% endif %}
  54.     {% if 'originPrice' in shows %}
  55.       {% if priceType == 'coin' %}
  56.         <span class="origin-price">{{course.originPrice * setting('coin.cash_rate')}}{{setting('coin.coin_name', 'finance.coin'|trans)}}</span>
  57.       {% else %}
  58.         ¥<span class="origin-price">{{course.originPrice}}</span>
  59.       {% endif %}
  60.     {% endif %}
  61.   {% endif %}
  62. </span>