CSR-2008
This commit is contained in:
parent
d4ccc7095d
commit
bd10a8b8a6
3 changed files with 23 additions and 4 deletions
|
|
@ -29,6 +29,8 @@
|
|||
<script>
|
||||
import { splitCopyOnCMSPlaceHolder } from "@/helpers/cms-content-helper";
|
||||
import baseMixin from "@/mixins/base-mixin.js";
|
||||
import { getPromosThatMatchLineItemsOnOrder } from "@/helpers/promotions-helper";
|
||||
import { getArrayOfAllLineItems } from "@/store";
|
||||
|
||||
const INLINE_IMAGE_TOKEN = "custom:inlineImage";
|
||||
const AFTERPAY_PRICE_TOKEN = "custom:afterpayPrice";
|
||||
|
|
@ -50,7 +52,9 @@ export default {
|
|||
name: "afterpay-modal-banner",
|
||||
props: {
|
||||
cmsWidgetName: String,
|
||||
availableLineItems: Array,
|
||||
lineItems: Array,
|
||||
activePromos: null,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
|
|
@ -62,7 +66,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
nullSafeLineItems() {
|
||||
return this.lineItems ?? [];
|
||||
return this.availableLineItems ?? [];
|
||||
},
|
||||
imageUrl() {
|
||||
return this.getCmsContent(this.cmsWidgetName, "Image");
|
||||
|
|
@ -77,10 +81,23 @@ export default {
|
|||
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
||||
},
|
||||
afterpayPrice() {
|
||||
const price = baseMixin.methods.getTierOnePackagePrice(
|
||||
let price = baseMixin.methods.getTierOnePackagePrice(
|
||||
baseMixin.methods.filterOutFees(this.nullSafeLineItems)
|
||||
);
|
||||
|
||||
let vapsLineItemsForSelectedPackage = this.lineItems.vaps;
|
||||
vapsLineItemsForSelectedPackage.forEach((lineItem) => {
|
||||
price += baseMixin.methods.getTotalLineItemPrice(lineItem);
|
||||
});
|
||||
|
||||
if (this.activePromos) {
|
||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
||||
const promos = getPromosThatMatchLineItemsOnOrder(this.activePromos, allLineItems);
|
||||
promos.forEach((promo) => {
|
||||
price += baseMixin.methods.getTotalLineItemPrice(promo);
|
||||
});
|
||||
}
|
||||
|
||||
const adjusted = (price / 4).toFixed(2);
|
||||
|
||||
return `$${adjusted}`;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@
|
|||
<afterpayModalBanner
|
||||
v-if="!isInsuranceSelected"
|
||||
cmsWidgetName="AfterpayModalWidget"
|
||||
:lineItems="availableLineItems" />
|
||||
:activePromos="lineItems.promos"
|
||||
:availableLineItems="availableLineItems"
|
||||
:lineItems="lineItems" />
|
||||
|
||||
<promoModalQuestion
|
||||
class="small mt-4"
|
||||
|
|
|
|||
|
|
@ -2829,7 +2829,7 @@ export function mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItem
|
|||
return lineItems;
|
||||
}
|
||||
|
||||
function getArrayOfAllLineItems(lineItems) {
|
||||
export function getArrayOfAllLineItems(lineItems) {
|
||||
let consolidatedLineItemsArray = [];
|
||||
|
||||
if (lineItems.glassParts != null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue