csr 1994
This commit is contained in:
parent
e0a1d28c5b
commit
d7bc92ec0a
3 changed files with 51 additions and 51 deletions
|
|
@ -28,7 +28,7 @@
|
|||
groupName="ServicePackageQuestion"
|
||||
:availableLineItems="availableLineItems"
|
||||
:isInsuranceSelected="isInsuranceSelected"
|
||||
:isDiscount="getServicePackageDiscount"
|
||||
:isServicePackageDiscount="getServicePackageDiscount"
|
||||
@vapsItemsSelected="vapsItemsSelectedAction"
|
||||
:activePromos="lineItems.promos"
|
||||
:lineItems="lineItems"
|
||||
|
|
@ -88,6 +88,7 @@ import contentGroupModal from "@/fmg-components/content-group-modal/content-grou
|
|||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||
import afterpayModalBanner from "@/layouts/quote/afterpay-modal-banner/afterpay-modal-banner";
|
||||
import baseMixin from "@/mixins/base-mixin.js";
|
||||
import experimentMixin from "@/mixins/experiment-mixin.js";
|
||||
import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
|
|
@ -158,13 +159,28 @@ export default {
|
|||
const lineItems = deepClone(store.getters.order.lineItems);
|
||||
lineItems.vaps = lineItems.vaps ?? [];
|
||||
const nullSafeGlassParts = lineItems.glassParts ?? [];
|
||||
const servicePackageDiscountSettingValue = experimentMixin.methods.getSettingValue(
|
||||
experimentSettings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
const isServicePackageDiscount = servicePackageDiscountSettingValue === "True";
|
||||
if (isServicePackageDiscount) {
|
||||
const servicePackageDiscount = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.CASH_SERVICE_PACKAGE_DISCOUNT,
|
||||
null,
|
||||
"quote"
|
||||
);
|
||||
lineItems.supportingItems = [...resultMap.supportingItems,servicePackageDiscount.data];
|
||||
}
|
||||
else{
|
||||
lineItems.supportingItems = resultMap.supportingItems;
|
||||
}
|
||||
const availableLineItems = [
|
||||
resultMap.rainDefense,
|
||||
...resultMap.supportingItems,
|
||||
...lineItems.supportingItems,
|
||||
...resultMap.wipers,
|
||||
...nullSafeGlassParts,
|
||||
];
|
||||
lineItems.supportingItems = resultMap.supportingItems;
|
||||
|
||||
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||
{
|
||||
|
|
@ -233,6 +249,7 @@ export default {
|
|||
availableLineItems: null,
|
||||
lineItems: [],
|
||||
addableVaps: [],
|
||||
servicePackageDiscountLineItems:[]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -240,14 +257,11 @@ export default {
|
|||
return Object.assign({}, this.lineItems);
|
||||
},
|
||||
getServicePackageDiscount() {
|
||||
const servicePackageDiscountSettingValue= this.getSettingValue(
|
||||
const servicePackageDiscountSettingValue = this.getSettingValue(
|
||||
experimentSettings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
const isServicePackageDiscount = servicePackageDiscountSettingValue === "True";
|
||||
|
||||
if (isServicePackageDiscount) {
|
||||
this.getServicePackageDiscountPrice();
|
||||
}
|
||||
return isServicePackageDiscount;
|
||||
},
|
||||
},
|
||||
|
|
@ -255,30 +269,6 @@ export default {
|
|||
openModalAction(modalName) {
|
||||
this.$refs[modalName].openModal();
|
||||
},
|
||||
async getServicePackageDiscountPrice() {
|
||||
const servicePackageDiscount = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.CASH_SERVICE_PACKAGE_DISCOUNT,
|
||||
null,
|
||||
"quote"
|
||||
);
|
||||
const availableLineItems = [servicePackageDiscount.data];
|
||||
|
||||
await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||
{
|
||||
availableLineItems: availableLineItems,
|
||||
},
|
||||
"quote",
|
||||
false
|
||||
);
|
||||
|
||||
this.lineItems.supportingItems.push(...availableLineItems);
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
this.lineItems.supportingItems,
|
||||
false
|
||||
);
|
||||
},
|
||||
arePagePrerequisitesValid() {
|
||||
return (
|
||||
store.getters.order.serviceLocation.zipCode &&
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default {
|
|||
isInsuranceSelected: Boolean,
|
||||
availableLineItems: null,
|
||||
lineItems: null,
|
||||
isDiscount: Boolean,
|
||||
isServicePackageDiscount: Boolean,
|
||||
activePromos: null,
|
||||
},
|
||||
data() {
|
||||
|
|
@ -101,15 +101,12 @@ export default {
|
|||
buttonLabel: this.getHeaderTextFromCms(answer.SubWidgetName),
|
||||
buttonLabelSubCopy: this.getSubheaderTextFromCms(answer.SubWidgetName),
|
||||
buttonBodyCopy: this.getBodyTextFromCms(answer.SubWidgetName),
|
||||
buttonAuxillaryCopy: this.getDiscountedPackagePriceString(
|
||||
answer.Name,
|
||||
this.isDiscount && answer.Text != ""
|
||||
),
|
||||
buttonAuxillaryCopy: this.getDiscountedPackagePriceString(answer.Name,this.isServicePackageDiscount && answer.Text != ""),
|
||||
buttonFooterCopy: this.getFooterTextFromCms(answer.SubWidgetName),
|
||||
additionalButtonData: {
|
||||
strikeThroughPrice: this.getPackagePriceString(answer.Name),
|
||||
servicePackageDiscount: this.isDiscount && answer.Text != "",
|
||||
Text: answer.Text,
|
||||
servicePackageDiscount: this.isServicePackageDiscount && answer.Text != "",
|
||||
Text: answer.Text+this.getServicePackageDiscountPrice(),
|
||||
},
|
||||
}));
|
||||
return modifiedAnswers;
|
||||
|
|
@ -185,32 +182,36 @@ export default {
|
|||
},
|
||||
getPackagePriceString(packageName) {
|
||||
const formattedPriceFloat = parseFloat(
|
||||
this.getPackagePrice(packageName, { discountedPrice: false })
|
||||
this.getPackagePrice(packageName, { discountedPrice: false,servicePackageDiscount:false })
|
||||
).toFixed(2);
|
||||
return "$" + formattedPriceFloat;
|
||||
},
|
||||
getDiscountedPackagePriceString(packageName) {
|
||||
getDiscountedPackagePriceString(packageName,servicePackageDiscount) {
|
||||
const formattedPriceFloat = parseFloat(
|
||||
this.getPackagePrice(packageName, { discountedPrice: true })
|
||||
this.getPackagePrice(packageName, { discountedPrice: true, servicePackageDiscount })
|
||||
).toFixed(2);
|
||||
return (this.isInsuranceSelected ? "As little as $" : "$") + formattedPriceFloat;
|
||||
},
|
||||
getPackagePrice(packageName, { discountedPrice = false }) {
|
||||
var lineItemsToPrice = [...this.nullSafeAvailableLineItems];
|
||||
getPackagePrice(packageName, { discountedPrice = false , servicePackageDiscount = false}) {
|
||||
|
||||
if (discountedPrice) {
|
||||
lineItemsToPrice.push(...removeVapsPromosFromPromoArray(this.activePromos));
|
||||
} else {
|
||||
//remove service package discount part
|
||||
const servicePackageDiscountParts = findLineItemsWithPartType(
|
||||
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
|
||||
this.nullSafeAvailableLineItems
|
||||
);
|
||||
if (servicePackageDiscountParts) {
|
||||
lineItemsToPrice = lineItemsToPrice.filter((item) => {
|
||||
return item != servicePackageDiscountParts;
|
||||
const parts = this.nullSafeAvailableLineItems.filter((item) => {
|
||||
return item.partType != servicePackageDiscountParts?.[0].partType;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var lineItemsToPrice = [...parts];
|
||||
|
||||
if (discountedPrice) {
|
||||
lineItemsToPrice.push(...removeVapsPromosFromPromoArray(this.activePromos));
|
||||
}
|
||||
if(servicePackageDiscount)
|
||||
{
|
||||
lineItemsToPrice.push(...servicePackageDiscountParts);
|
||||
}
|
||||
let priceFloat = this.isInsuranceSelected
|
||||
? 0
|
||||
|
|
@ -222,6 +223,15 @@ export default {
|
|||
|
||||
return priceFloat;
|
||||
},
|
||||
getServicePackageDiscountPrice(){
|
||||
const servicePackageDiscountParts = findLineItemsWithPartType(
|
||||
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
|
||||
this.nullSafeAvailableLineItems
|
||||
);
|
||||
let price = 0;
|
||||
price += baseMixin.methods.getTotalLineItemPrice(servicePackageDiscountParts?.[0]);
|
||||
return Math.abs(price);
|
||||
},
|
||||
getVapsPrice(packageName, applyPromoDiscounts = false) {
|
||||
const vapsItems = this.getVapsLineItemsForSelectedPackage(packageName);
|
||||
let price = 0;
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ export default {
|
|||
display: none;
|
||||
}
|
||||
.discount-text {
|
||||
width: 143px;
|
||||
width: 170px;
|
||||
height: 40px;
|
||||
padding: 8px 16px 8px 16px;
|
||||
background-color: #e6f2ec;
|
||||
|
|
|
|||
Loading…
Reference in a new issue