CSR-1994
code optimize
This commit is contained in:
parent
2a790bd5f2
commit
01e2df15a5
2 changed files with 10 additions and 21 deletions
|
|
@ -31,7 +31,6 @@
|
|||
@vapsItemsSelected="vapsItemsSelectedAction"
|
||||
@servicePackageDiscountSelected="servicePackageDiscountSelectedAction"
|
||||
:activePromos="lineItems.promos"
|
||||
:lineItems="lineItems"
|
||||
v-on="{ 'buttonEvent.openModal': openModalAction }"
|
||||
validationRules="option-required"
|
||||
isRequired />
|
||||
|
|
@ -109,7 +108,6 @@ import { queryStrings } from "@/constants/query-strings";
|
|||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||
import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question";
|
||||
import { experimentSettings } from "@/constants/experiments";
|
||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||
|
||||
export default {
|
||||
|
|
@ -163,26 +161,23 @@ export default {
|
|||
experimentSettings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
const isServicePackageDiscount = servicePackageDiscountSettingValue === "True";
|
||||
//Service package cash discount api call when experiment is active
|
||||
var servicePackageDiscountPart = [];
|
||||
if (isServicePackageDiscount) {
|
||||
const servicePackageDiscountPart =
|
||||
const servicePackageDiscountPartResponse =
|
||||
await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.CASH_SERVICE_PACKAGE_DISCOUNT,
|
||||
null,
|
||||
"quote"
|
||||
);
|
||||
//add service package discount part to supporting items to get price together
|
||||
lineItems.supportingItems = [
|
||||
...resultMap.supportingItems,
|
||||
servicePackageDiscountPart.data,
|
||||
];
|
||||
} else {
|
||||
lineItems.supportingItems = resultMap.supportingItems;
|
||||
servicePackageDiscountPart = servicePackageDiscountPartResponse.data;
|
||||
}
|
||||
const availableLineItems = [
|
||||
resultMap.rainDefense,
|
||||
...lineItems.supportingItems,
|
||||
...resultMap.supportingItems,
|
||||
...resultMap.wipers,
|
||||
...nullSafeGlassParts,
|
||||
...servicePackageDiscountPart,
|
||||
];
|
||||
|
||||
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
|
|
@ -193,18 +188,13 @@ export default {
|
|||
"quote",
|
||||
false
|
||||
);
|
||||
if (isServicePackageDiscount) {
|
||||
//remove service package discount part after pricing
|
||||
lineItems.supportingItems = lineItems.supportingItems.filter(
|
||||
(item) => item.partType !== partTypeStrings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
}
|
||||
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
lineItems.supportingItems,
|
||||
resultMap.supportingItems,
|
||||
false
|
||||
);
|
||||
|
||||
lineItems.supportingItems = resultMap.supportingItems;
|
||||
const addableVaps = [...resultMap.wipers, resultMap.rainDefense];
|
||||
|
||||
// Promo logic
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ export default {
|
|||
isRequired: Boolean,
|
||||
isInsuranceSelected: Boolean,
|
||||
availableLineItems: null,
|
||||
lineItems: null,
|
||||
activePromos: null,
|
||||
},
|
||||
data() {
|
||||
|
|
@ -96,7 +95,7 @@ export default {
|
|||
return this.availableLineItems ?? [];
|
||||
},
|
||||
supportingLineItems() {
|
||||
return this.lineItems?.supportingItems;
|
||||
return this.$store.getters.lineItems?.supportingItems;
|
||||
},
|
||||
servicePackageAnswers() {
|
||||
const cmsWidgetName = this.isInsuranceSelected
|
||||
|
|
|
|||
Loading…
Reference in a new issue