This commit is contained in:
Sneha 2024-08-08 13:00:16 +05:30
parent 194180b983
commit 89cfaa9eae
3 changed files with 20 additions and 6 deletions

View file

@ -53,6 +53,7 @@ export default {
props: { props: {
cmsWidgetName: String, cmsWidgetName: String,
lineItems: Array, lineItems: Array,
activePromos: null,
}, },
data() { data() {
return {}; return {};
@ -76,7 +77,11 @@ export default {
return this.getCmsContent(this.cmsWidgetName, "SubheaderText"); return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
}, },
afterpayPrice() { afterpayPrice() {
const allLineItems = getArrayOfAllLineItems(this.lineItems); let allLineItems = getArrayOfAllLineItems(this.lineItems);
if (this.activePromos) {
allLineItems = allLineItems?.filter((item) => item.partType !== "PROMO_DISCOUNT");
}
let price = baseMixin.methods.getTierOnePackagePrice( let price = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(allLineItems) baseMixin.methods.filterOutFees(allLineItems)
); );
@ -86,11 +91,9 @@ export default {
price += baseMixin.methods.getTotalLineItemPrice(lineItem); price += baseMixin.methods.getTotalLineItemPrice(lineItem);
}); });
if (this.lineItems.promos) { if (this.activePromos) {
const promos = getPromosThatMatchLineItemsOnOrder( let allLineItems = getArrayOfAllLineItems(this.lineItems);
this.lineItems.promos, const promos = getPromosThatMatchLineItemsOnOrder(this.activePromos, allLineItems);
allLineItems
);
promos.forEach((promo) => { promos.forEach((promo) => {
price += baseMixin.methods.getTotalLineItemPrice(promo); price += baseMixin.methods.getTotalLineItemPrice(promo);
}); });

View file

@ -44,6 +44,7 @@
<div class="col-md-6 col-xl-4"> <div class="col-md-6 col-xl-4">
<afterpayModalBanner <afterpayModalBanner
v-if="!isInsuranceSelected && !isRecalibrationOnOrder" v-if="!isInsuranceSelected && !isRecalibrationOnOrder"
:activePromos="lineItems.promos"
cmsWidgetName="AfterpayModalWidget" cmsWidgetName="AfterpayModalWidget"
:lineItems="lineItems" /> :lineItems="lineItems" />

View file

@ -76,6 +76,16 @@ export default {
this.getServicePackageDiscountPartForSelectedPackage(newValue); this.getServicePackageDiscountPartForSelectedPackage(newValue);
let supportingItems = this.supportingLineItems; let supportingItems = this.supportingLineItems;
if (servicePackageDiscountPartInSelectedPackage?.length > 0) { if (servicePackageDiscountPartInSelectedPackage?.length > 0) {
if (
containsLineItemWithPartType(
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
supportingItems
)
) {
supportingItems = supportingItems.filter(
(item) => item.partType !== partTypeStrings.SERVICE_PACKAGE_DISCOUNT
);
}
supportingItems?.push(servicePackageDiscountPartInSelectedPackage[0]); supportingItems?.push(servicePackageDiscountPartInSelectedPackage[0]);
} else { } else {
if ( if (