CASH-845: fixing apptType/providerNumber/zipCode conflicts
This commit is contained in:
parent
2839081866
commit
bea71eb171
1 changed files with 63 additions and 60 deletions
|
|
@ -156,7 +156,7 @@
|
||||||
<navbar
|
<navbar
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="navbar"
|
ref="navbar"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid || isForwardActionDisabled"
|
||||||
@back-clicked="backButtonAction"
|
@back-clicked="backButtonAction"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -416,9 +416,9 @@ export default {
|
||||||
isRecalibrationServiceableDropoff: null,
|
isRecalibrationServiceableDropoff: null,
|
||||||
isGlassServiceableMobile: null,
|
isGlassServiceableMobile: null,
|
||||||
isRecalibrationServiceableMobile: null,
|
isRecalibrationServiceableMobile: null,
|
||||||
appointmentType: this.getAppointmentType(),
|
appointmentType: this.getAppointmentTypeFromStore(),
|
||||||
appointmentTypeFromAppointmentTypeQuestion: this.getAppointmentType(),
|
appointmentTypeFromAppointmentTypeQuestion: this.getAppointmentTypeFromStore(),
|
||||||
selectedProvider: this.getSelectedProvider(),
|
selectedProvider: this.getSelectedProviderFromStore(),
|
||||||
mobileFeePart: null,
|
mobileFeePart: null,
|
||||||
recycleFeePart: null,
|
recycleFeePart: null,
|
||||||
zipContainsMilitaryBase: false,
|
zipContainsMilitaryBase: false,
|
||||||
|
|
@ -583,6 +583,7 @@ export default {
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
|
// add pricing by day data
|
||||||
const pricingByDayUpcharge =
|
const pricingByDayUpcharge =
|
||||||
showPricingByDay && resultMap.pricingByDayUpchargePart
|
showPricingByDay && resultMap.pricingByDayUpchargePart
|
||||||
? await baseMixin.methods.getTotalLineItemPrice(
|
? await baseMixin.methods.getTotalLineItemPrice(
|
||||||
|
|
@ -668,17 +669,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
if (newValue.zipCode !== this.zipCode) {
|
this.handleZipCodeChange(newValue);
|
||||||
this.resetMobileLocation();
|
|
||||||
this.appointmentType = null;
|
|
||||||
this.selectedProvider = new Provider();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = newValue.state;
|
|
||||||
this.zipCode = newValue.zipCode;
|
|
||||||
this.zipCodeCtu = newValue.zipCodeCtu;
|
|
||||||
|
|
||||||
this.$nextTick();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isMobileSelected() {
|
isMobileSelected() {
|
||||||
|
|
@ -835,7 +826,11 @@ export default {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.selectedProvider && this.selectedProvider.address) {
|
if (
|
||||||
|
this.selectedProvider &&
|
||||||
|
this.selectedProvider.address &&
|
||||||
|
this.selectedProvider?.providerNumber
|
||||||
|
) {
|
||||||
const provider = this.shopProviderData?.shopProviders?.find(
|
const provider = this.shopProviderData?.shopProviders?.find(
|
||||||
(p) => p.providerNumber === this.selectedProvider?.providerNumber
|
(p) => p.providerNumber === this.selectedProvider?.providerNumber
|
||||||
);
|
);
|
||||||
|
|
@ -987,13 +982,13 @@ export default {
|
||||||
|
|
||||||
if (shopProviderData) {
|
if (shopProviderData) {
|
||||||
this.shopProviderData = shopProviderData;
|
this.shopProviderData = shopProviderData;
|
||||||
|
this.updateSelectedProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
var gaLabel = this.GaLabels.NO;
|
var gaLabel = this.GaLabels.NO;
|
||||||
if (this.isServiceableMobile) {
|
if (this.isServiceableMobile) {
|
||||||
gaLabel = this.GaLabels.YES;
|
gaLabel = this.GaLabels.YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pushEventToGA(
|
this.pushEventToGA(
|
||||||
this.GaCategories.APPOINTMENT,
|
this.GaCategories.APPOINTMENT,
|
||||||
this.GaActions.MOBILE_AVAILABLE,
|
this.GaActions.MOBILE_AVAILABLE,
|
||||||
|
|
@ -1042,10 +1037,10 @@ export default {
|
||||||
getIsVehicleProtectedFromStore() {
|
getIsVehicleProtectedFromStore() {
|
||||||
return store.getters.order.serviceLocation.isVehicleProtected;
|
return store.getters.order.serviceLocation.isVehicleProtected;
|
||||||
},
|
},
|
||||||
getAppointmentType() {
|
getAppointmentTypeFromStore() {
|
||||||
return store.getters.order.serviceLocation.appointmentType;
|
return store.getters.order.serviceLocation.appointmentType;
|
||||||
},
|
},
|
||||||
getSelectedProvider() {
|
getSelectedProviderFromStore() {
|
||||||
return store.getters.order.serviceLocation.provider;
|
return store.getters.order.serviceLocation.provider;
|
||||||
},
|
},
|
||||||
resetMobileLocation() {
|
resetMobileLocation() {
|
||||||
|
|
@ -1584,53 +1579,61 @@ export default {
|
||||||
? AppointmentTypeStrings.DROP_OFF
|
? AppointmentTypeStrings.DROP_OFF
|
||||||
: AppointmentTypeStrings.IN_SHOP;
|
: AppointmentTypeStrings.IN_SHOP;
|
||||||
},
|
},
|
||||||
|
updateSelectedProvider(oldProvider, newProvider) {
|
||||||
|
if (newProvider) {
|
||||||
|
this.selectedProvider = newProvider;
|
||||||
|
} else if (
|
||||||
|
// use closest shopProvider if none exists
|
||||||
|
!this.selectedProvider?.address?.streetAddress &&
|
||||||
|
this.shopProviderData?.shopProviders
|
||||||
|
) {
|
||||||
|
this.selectedProvider = this.shopProviderData.shopProviders[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
handleZipCodeChange(newZipCode) {
|
||||||
|
this.resetMobileLocation();
|
||||||
|
this.selectedProvider = new Provider();
|
||||||
|
getShopProviderData(newZipCode.zipCode).then(async (result) => {
|
||||||
|
this.shopProviderData = result.data;
|
||||||
|
if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
|
||||||
|
this.updateSelectedProvider(
|
||||||
|
this.selectedProvider,
|
||||||
|
new Provider(this.shopProviderData.mobileProviderNumber)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.isMobileAddressValid = true;
|
||||||
|
this.updateSelectedProvider();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.state = newZipCode.state;
|
||||||
|
this.zipCode = newZipCode.zipCode;
|
||||||
|
this.zipCodeCtu = newZipCode.zipCodeCtu;
|
||||||
|
},
|
||||||
|
handleAppointmentTypeChange(newAppointmentType) {
|
||||||
|
if (newAppointmentType === AppointmentTypeStrings.MOBILE) {
|
||||||
|
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
||||||
|
} else {
|
||||||
|
if (this.selectedTimeSlotInfo?.timeSlot?.routeCode) {
|
||||||
|
// update appointmentType based on routeCode to determine if it should be dropoff or inshop
|
||||||
|
this.appointmentType = this.getInShopOrDropOffApptType(
|
||||||
|
this.selectedTimeSlotInfo.timeSlot.routeCode
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure a selectedProvider exists
|
||||||
|
this.updateSelectedProvider();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
zipCode: {
|
|
||||||
handler(newValue) {
|
|
||||||
if (!this.navigatingForward) {
|
|
||||||
getShopProviderData(this.zipCode).then(async (result) => {
|
|
||||||
this.shopProviderData = result.data;
|
|
||||||
if (this.appointmentType === "Mobile") {
|
|
||||||
this.selectedProvider = new Provider(
|
|
||||||
this.shopProviderData.mobileProviderNumber
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.isMobileAddressValid = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
appointmentType: {
|
|
||||||
handler(newValue, oldValue) {
|
|
||||||
if (newValue === AppointmentTypeStrings.MOBILE) {
|
|
||||||
this.selectedProvider = new Provider(
|
|
||||||
this.shopProviderData.mobileProviderNumber
|
|
||||||
);
|
|
||||||
this.isMobileSelected = true;
|
|
||||||
} else {
|
|
||||||
this.selectedProvider = this.shopProviderData.shopProviders[0];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
appointmentTypeFromAppointmentTypeQuestion: {
|
appointmentTypeFromAppointmentTypeQuestion: {
|
||||||
handler(newValue, oldValue) {
|
handler(newValue, oldValue) {
|
||||||
if (newValue === AppointmentTypeStrings.MOBILE) {
|
this.handleAppointmentTypeChange(newValue);
|
||||||
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
|
||||||
} else {
|
|
||||||
if (this.selectedTimeSlotInfo?.timeSlot?.routeCode) {
|
|
||||||
// update appointmentType based on routeCode to determine if it should be dropoff or inshop
|
|
||||||
this.appointmentType = this.getInShopOrDropOffApptType(
|
|
||||||
this.selectedTimeSlotInfo.timeSlot.routeCode
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
selectedDate(newValue, oldValue) {
|
selectedDate(newValue, oldValue) {
|
||||||
// Clear time slot selection if date selected changes
|
// Clear time slot selection if date selected changes
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue