code changes
This commit is contained in:
parent
89cfaa9eae
commit
51071c375a
3 changed files with 22 additions and 29 deletions
|
|
@ -53,7 +53,6 @@ export default {
|
|||
props: {
|
||||
cmsWidgetName: String,
|
||||
lineItems: Array,
|
||||
activePromos: null,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
|
|
@ -78,7 +77,7 @@ export default {
|
|||
},
|
||||
afterpayPrice() {
|
||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
||||
if (this.activePromos) {
|
||||
if (this.lineItems.promos) {
|
||||
allLineItems = allLineItems?.filter((item) => item.partType !== "PROMO_DISCOUNT");
|
||||
}
|
||||
|
||||
|
|
@ -91,9 +90,12 @@ export default {
|
|||
price += baseMixin.methods.getTotalLineItemPrice(lineItem);
|
||||
});
|
||||
|
||||
if (this.activePromos) {
|
||||
if (this.lineItems.promos) {
|
||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
||||
const promos = getPromosThatMatchLineItemsOnOrder(this.activePromos, allLineItems);
|
||||
const promos = getPromosThatMatchLineItemsOnOrder(
|
||||
this.lineItems.promos,
|
||||
allLineItems
|
||||
);
|
||||
promos.forEach((promo) => {
|
||||
price += baseMixin.methods.getTotalLineItemPrice(promo);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@
|
|||
<div class="col-md-6 col-xl-4">
|
||||
<afterpayModalBanner
|
||||
v-if="!isInsuranceSelected && !isRecalibrationOnOrder"
|
||||
:activePromos="lineItems.promos"
|
||||
cmsWidgetName="AfterpayModalWidget"
|
||||
:lineItems="lineItems" />
|
||||
|
||||
|
|
|
|||
|
|
@ -75,31 +75,23 @@ export default {
|
|||
const servicePackageDiscountPartInSelectedPackage =
|
||||
this.getServicePackageDiscountPartForSelectedPackage(newValue);
|
||||
let supportingItems = this.supportingLineItems;
|
||||
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]);
|
||||
} else {
|
||||
if (
|
||||
supportingItems?.length > 0 &&
|
||||
containsLineItemWithPartType(
|
||||
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
|
||||
supportingItems
|
||||
)
|
||||
) {
|
||||
supportingItems = supportingItems.filter(
|
||||
(item) => item.partType !== partTypeStrings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
}
|
||||
if (
|
||||
containsLineItemWithPartType(
|
||||
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
|
||||
supportingItems
|
||||
)
|
||||
) {
|
||||
supportingItems = supportingItems.filter(
|
||||
(item) => item.partType !== partTypeStrings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
}
|
||||
if (
|
||||
servicePackageDiscountPartInSelectedPackage?.length > 0 &&
|
||||
supportingItems != null
|
||||
) {
|
||||
supportingItems.push(servicePackageDiscountPartInSelectedPackage[0]);
|
||||
}
|
||||
|
||||
this.$emit("servicePackageDiscountSelected", supportingItems);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue