CSR-1994
This commit is contained in:
parent
e90d4c4246
commit
07201731ac
3 changed files with 62 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ const cartItemTypes = {
|
|||
PROMOS: "PROMOS",
|
||||
EARLY_BIRD: "EARLY BIRD",
|
||||
SUPPLIES_REPAIR: "SUPPLIES-REPAIR",
|
||||
SERVICE_PACKAGE_DISCOUNT: "SERVICE PACKAGE DISCOUNT",
|
||||
};
|
||||
|
||||
export { cartItemTypes };
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
!showCoverageAsVerified ||
|
||||
(showCoverageAsVerified && !cartItem.isCoveredByInsurance)
|
||||
"
|
||||
>{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }}</span
|
||||
>{{ getFormattedAmount(cartItem.category, Math.abs(cartItem.subTotal)) }}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
|
|
@ -232,6 +232,13 @@ export default {
|
|||
|
||||
return subTotal;
|
||||
},
|
||||
getServicePackageDiscount() {
|
||||
const servicePackageDiscountLineItems = this.servicePackageDiscountCartItem;
|
||||
let subTotal = 0;
|
||||
|
||||
subTotal += servicePackageDiscountLineItems?.subTotal;
|
||||
return subTotal;
|
||||
},
|
||||
getVapsCartItemsForSelectedPackage(packageName) {
|
||||
const packageContentTypes = getPackageContents(
|
||||
this.glassToReplace,
|
||||
|
|
@ -376,6 +383,9 @@ export default {
|
|||
if (this.mobileFeeCartItem) {
|
||||
cartItems.push(this.mobileFeeCartItem);
|
||||
}
|
||||
if (this.servicePackageDiscountCartItem) {
|
||||
cartItems.push(this.servicePackageDiscountCartItem);
|
||||
}
|
||||
|
||||
if (this.premiumAppointmentDiscountCartItem) {
|
||||
cartItems.push(this.premiumAppointmentDiscountCartItem);
|
||||
|
|
@ -426,6 +436,9 @@ export default {
|
|||
}
|
||||
|
||||
packagePrice += this.getVapsPrice(this.packageLevel);
|
||||
if (this.servicePackageDiscountCartItem) {
|
||||
packagePrice -= this.getServicePackageDiscount();
|
||||
}
|
||||
|
||||
return packagePrice;
|
||||
},
|
||||
|
|
@ -760,13 +773,56 @@ export default {
|
|||
|
||||
return cartItem;
|
||||
},
|
||||
servicePackageDiscountCartItemName() {
|
||||
return this.getCmsContent("ServicePackageDiscountTextWidget", "Text");
|
||||
},
|
||||
servicePackageDiscountCartItem() {
|
||||
let cartItem = null;
|
||||
|
||||
const servicePackageDiscountLineItem = this.supportingItems.find(
|
||||
(lineItem) => lineItem.partType == partTypeStrings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
|
||||
if (servicePackageDiscountLineItem) {
|
||||
cartItem = {
|
||||
name:
|
||||
this.servicePackageDiscountCartItemName +
|
||||
Math.abs(this.getTotalLineItemPrice(servicePackageDiscountLineItem)),
|
||||
category: cartItemCategories.SUPPORTING_ITEMS,
|
||||
cartItemType: cartItemTypes.SERVICE_PACKAGE_DISCOUNT,
|
||||
isDisplayed: true,
|
||||
isRemovable: false,
|
||||
subTotal: 0,
|
||||
salesTax: 0,
|
||||
lineItems: [],
|
||||
isCoveredByInsurance: false,
|
||||
};
|
||||
|
||||
servicePackageDiscountLineItem.cartItemType = cartItem.cartItemType;
|
||||
cartItem.lineItems.push(servicePackageDiscountLineItem);
|
||||
|
||||
cartItem.subTotal +=
|
||||
(servicePackageDiscountLineItem.kitPrice ?? 0) +
|
||||
(servicePackageDiscountLineItem.laborAmount ?? 0) +
|
||||
(servicePackageDiscountLineItem.sellingPrice ?? 0);
|
||||
|
||||
cartItem.salesTax += servicePackageDiscountLineItem.salesTax ?? 0;
|
||||
}
|
||||
|
||||
return cartItem;
|
||||
},
|
||||
otherSupportingItemsCartItem() {
|
||||
let cartItem = null;
|
||||
|
||||
// Don't include fees they are part of the package total
|
||||
let otherSupportingItemsLineItems = baseMixin.methods.filterOutFees(
|
||||
this.supportingItems
|
||||
const servicePackageDiscountLineItem = this.supportingItems.find(
|
||||
(lineItem) => lineItem.partType == partTypeStrings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
const otherSupportingItems = this.supportingItems.filter((item) => {
|
||||
return item != servicePackageDiscountLineItem;
|
||||
});
|
||||
// Don't include fees they are part of the package total
|
||||
let otherSupportingItemsLineItems =
|
||||
baseMixin.methods.filterOutFees(otherSupportingItems);
|
||||
|
||||
if (otherSupportingItemsLineItems.length > 0) {
|
||||
cartItem = {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ export default {
|
|||
let price = 0;
|
||||
price += baseMixin.methods.getTotalLineItemPrice(servicePackageDiscountParts[0]);
|
||||
return Math.abs(price);
|
||||
} else return 0;
|
||||
}
|
||||
},
|
||||
getVapsPrice(packageName, applyPromoDiscounts = false) {
|
||||
const vapsItems = this.getVapsLineItemsForSelectedPackage(packageName);
|
||||
|
|
|
|||
Loading…
Reference in a new issue