Просмотр исходного кода

show discount rate on pricing page

Henry Oswald 11 лет назад
Родитель
Сommit
b1c0dfb0e4

+ 3 - 1
services/web/app/views/subscriptions/new.jade

@@ -41,7 +41,9 @@ block content
 							hr.thin
 							.row
 								.col-md-12.text-center
-									div(ng-if="trialLength") !{translate("first_few_days_free", {trialLen:'{{trialLength}}'})}
+									div(ng-if="trialLength") 
+										span !{translate("first_few_days_free", {trialLen:'{{trialLength}}'})}
+										span(ng-if="discountMonths && discountRate")   -  {{discountMonths}} #{translate("month")}s {{discountRate}}% Off
 									div(ng-if="price")
 										strong {{price.currency.symbol}}{{price.next.total}} 
 										span(ng-if="monthlyBilling")  #{translate("every")} #{translate("month")}

+ 4 - 0
services/web/public/coffee/main/new-subscription.coffee

@@ -58,6 +58,10 @@ define [
 			if pricing.items?.coupon?.discount?.type == "percent"
 				basePrice = parseInt(pricing.price.base.plan.unit)
 				$scope.normalPrice = basePrice
+				if pricing.items.coupon.applies_for_months > 0 and pricing.items.coupon?.discount?.rate and pricing.items.coupon?.applies_for_months?
+					$scope.discountMonths =  pricing.items.coupon?.applies_for_months
+					$scope.discountRate =  pricing.items.coupon?.discount?.rate * 100
+
 				if pricing.price?.taxes[0]?.rate?
 					$scope.normalPrice += (basePrice * pricing.price.taxes[0].rate)
 			$scope.$apply()