|
@@ -178,7 +178,7 @@
|
|
</div>
|
|
</div>
|
|
@if ($discountpercent && $discountvalue)
|
|
@if ($discountpercent && $discountvalue)
|
|
<div class="d-flex justify-content-between">
|
|
<div class="d-flex justify-content-between">
|
|
- <span class="text-muted d-inline-block">{{ __('Discount') }}
|
|
|
|
|
|
+ <span class="text-muted d-inline-block">{{ __('Partner Discount') }}
|
|
({{ $discountpercent }}%)</span>
|
|
({{ $discountpercent }}%)</span>
|
|
<span
|
|
<span
|
|
class="text-muted d-inline-block">-{{ $product->formatToCurrency($discountvalue) }}</span>
|
|
class="text-muted d-inline-block">-{{ $product->formatToCurrency($discountvalue) }}</span>
|
|
@@ -296,24 +296,26 @@
|
|
calcPriceWithCouponDiscount(couponValue, couponType) {
|
|
calcPriceWithCouponDiscount(couponValue, couponType) {
|
|
let newTotalPrice = this.totalPrice
|
|
let newTotalPrice = this.totalPrice
|
|
|
|
|
|
|
|
+
|
|
|
|
+ console.log(couponType)
|
|
if (couponType === 'percentage') {
|
|
if (couponType === 'percentage') {
|
|
newTotalPrice = newTotalPrice - (newTotalPrice * couponValue / 100)
|
|
newTotalPrice = newTotalPrice - (newTotalPrice * couponValue / 100)
|
|
this.couponDiscountedValue = "- " + couponValue + "%"
|
|
this.couponDiscountedValue = "- " + couponValue + "%"
|
|
} else if (couponType === 'amount') {
|
|
} else if (couponType === 'amount') {
|
|
- newTotalPrice = totanewTotalPricelPrice - couponValue
|
|
|
|
- this.couponDiscountedValue = "- " + couponValue + " {{ $product->currency_code }}"
|
|
|
|
|
|
+
|
|
|
|
+ newTotalPrice = newTotalPrice - couponValue
|
|
|
|
+ this.couponDiscountedValue = "- " + this.formatToCurrency(couponValue)
|
|
}
|
|
}
|
|
|
|
|
|
- // get language for formatting currency
|
|
|
|
- const lang = "{{ app()->getLocale() }}"
|
|
|
|
// format totalPrice to currency
|
|
// format totalPrice to currency
|
|
this.totalPrice = this.formatToCurrency(newTotalPrice)
|
|
this.totalPrice = this.formatToCurrency(newTotalPrice)
|
|
},
|
|
},
|
|
|
|
|
|
formatToCurrency(amount) {
|
|
formatToCurrency(amount) {
|
|
- // get language for formatting currency
|
|
|
|
- const lang = "{{ app()->getLocale() }}"
|
|
|
|
- console.log(lang)
|
|
|
|
|
|
+ // get language for formatting currency - use en_US as product->formatToCurrency() uses it
|
|
|
|
+ //const lang = "{{ app()->getLocale() }}"
|
|
|
|
+ const lang = 'en-US'
|
|
|
|
+
|
|
// format totalPrice to currency
|
|
// format totalPrice to currency
|
|
return amount.toLocaleString(lang, {
|
|
return amount.toLocaleString(lang, {
|
|
style: 'currency',
|
|
style: 'currency',
|