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