CSR-1971 | Reworking quote page
This commit is contained in:
parent
37b876f72c
commit
e67b661279
2 changed files with 18 additions and 14 deletions
|
|
@ -99,7 +99,7 @@ export default {
|
|||
props: {
|
||||
modelValue: Object,
|
||||
modalWidgetName: String,
|
||||
availableVaps: Object,
|
||||
addableVaps: Object,
|
||||
pageName: String,
|
||||
taxPromos: {
|
||||
type: Boolean,
|
||||
|
|
@ -192,14 +192,14 @@ export default {
|
|||
resetModalButtonStyle() {
|
||||
this.modal.resetButtonStyle();
|
||||
},
|
||||
async getPromoCodeData(promoCode, lineItems, availableVaps, pageNameToLog = null) {
|
||||
async getPromoCodeData(promoCode, lineItems, addableVaps, pageNameToLog = null) {
|
||||
const pageName = pageNameToLog ?? this.$options?.name;
|
||||
const promoValidationResponse = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA,
|
||||
{
|
||||
promoCode: promoCode,
|
||||
lineItemsToUse: lineItems,
|
||||
addableVaps: availableVaps,
|
||||
addableVaps: addableVaps,
|
||||
},
|
||||
pageName,
|
||||
false
|
||||
|
|
@ -264,7 +264,7 @@ export default {
|
|||
const promoCodeData = await this.getPromoCodeData(
|
||||
this.promoCode,
|
||||
this.lineItems,
|
||||
this.availableVaps,
|
||||
this.addableVaps,
|
||||
this.pageName
|
||||
);
|
||||
if (promoCodeData.isValid) {
|
||||
|
|
@ -298,7 +298,7 @@ export default {
|
|||
);
|
||||
const taxedVaps = mapTaxedLineItemsToStoreFormat(
|
||||
taxedLineItems,
|
||||
this.availableVaps
|
||||
this.addableVaps
|
||||
);
|
||||
|
||||
const getVaps = getVapsThatNeedToBeAddedToSatisfyPromos(
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<promoModalQuestion
|
||||
class="small mt-4"
|
||||
v-model="lineItems"
|
||||
:availableVaps="availableVaps"
|
||||
:addableVaps="addableVaps"
|
||||
pageName="quote"
|
||||
:taxPromos="false"
|
||||
modalWidgetName="PromoModalWidget" />
|
||||
|
|
@ -149,8 +149,14 @@ export default {
|
|||
},
|
||||
];
|
||||
|
||||
// -Check PRs to make sure you've looked at all newly added code
|
||||
// -Briefly investigate new issue, then ask Sneha to look at it via email
|
||||
// -Undo the package selection fix sneha did and see if my changes fix that
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
const lineItems = deepClone(store.getters.order.lineItems);
|
||||
lineItems.promos = lineItems.promos ?? [];
|
||||
lineItems.vaps = lineItems.vaps ?? [];
|
||||
const nullSafeGlassParts = lineItems.glassParts ?? [];
|
||||
const availableLineItems = [
|
||||
resultMap.rainDefense,
|
||||
|
|
@ -173,10 +179,11 @@ export default {
|
|||
resultMap.supportingItems,
|
||||
false
|
||||
);
|
||||
lineItems.supportingItems = resultMap.supportingItems;
|
||||
|
||||
// Promo logic
|
||||
// Populate the previous state of promos for toast message usage in "next()"
|
||||
const availableVaps = [...resultMap.wipers, resultMap.rainDefense];
|
||||
const addableVaps = [...resultMap.wipers, resultMap.rainDefense];
|
||||
const oldActivePromos = store.getters.lineItems.promos?.slice(0);
|
||||
const oldInactivePromos = store.getters.order.payment.inactivePromos?.slice(0);
|
||||
|
||||
|
|
@ -189,16 +196,13 @@ export default {
|
|||
pricingResults,
|
||||
"quote"
|
||||
);
|
||||
lineItems.glassParts = nullSafeGlassParts;
|
||||
lineItems.promos = lineItems.promos ?? [];
|
||||
lineItems.vaps = lineItems.vaps ?? [];
|
||||
console.log("lineItems.vaps", JSON.parse(JSON.stringify(lineItems.vaps)));
|
||||
// End of promo logic
|
||||
|
||||
// Call the "next" function to complete the transition to this page.
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.availableVaps = availableVaps;
|
||||
vm.addableVaps = addableVaps;
|
||||
vm.lineItems = lineItems;
|
||||
vm.availableLineItems = pricingResults;
|
||||
vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(vm.availableLineItems);
|
||||
|
|
@ -228,7 +232,7 @@ export default {
|
|||
isInsuranceSelected: null,
|
||||
availableLineItems: null,
|
||||
lineItems: [],
|
||||
availableVaps: [],
|
||||
addableVaps: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -307,7 +311,7 @@ export default {
|
|||
this.$store.getters.order.payment.parentAccountNumber !=
|
||||
applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
||||
) {
|
||||
this.supportingItems = this.filterOutFees(this.supportingItems);
|
||||
this.lineItems.supportingItems = this.filterOutFees(this.lineItems.supportingItems);
|
||||
}
|
||||
|
||||
if (this.lineItems.glassParts?.length > 0) {
|
||||
|
|
@ -323,7 +327,7 @@ export default {
|
|||
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
|
||||
{
|
||||
activePromos: this.lineItems.promos,
|
||||
inactivePromos: this.$store.getters.order.payment.inactivePromos,
|
||||
inactivePromos: this.$store.getters.order.payment.inactivePromos, // I don't think we need this here
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue