WIP vin lookup.
This commit is contained in:
parent
ebeb40a0fb
commit
1d1384dbcc
2 changed files with 24 additions and 12 deletions
|
|
@ -93,7 +93,7 @@ async function getLatestPageForRedirection() {
|
|||
return fmgPageValues.VEHICLE_DAMAGE;
|
||||
} else {
|
||||
if (store.getters.vehicle.vin) {
|
||||
return fmgPageValues.LICENSE_PLATE_LOOKUP;
|
||||
return fmgPageValues.VIN_LOOKUP;
|
||||
} else {
|
||||
return fmgPageValues.VIN_LOOKUP;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,12 +149,13 @@ export default {
|
|||
foundWindshieldAlert: false,
|
||||
vinNotFound: false,
|
||||
perfectMatchNewVinAlert: false,
|
||||
vin: '',
|
||||
zip: '',
|
||||
email: '',
|
||||
vin: this.getVinFromStore(),
|
||||
zip: this.getZipFromStore(),
|
||||
email: this.getEmailFromStore(),
|
||||
customAlertData: {},
|
||||
isCarIdDifferent: false,
|
||||
previouslyEnteredCarId: '',
|
||||
invalidZip: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -172,7 +173,7 @@ export default {
|
|||
return text;
|
||||
},
|
||||
NoServiceZipHeader(){
|
||||
let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.zip);
|
||||
let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.invalidZip);
|
||||
|
||||
return text;
|
||||
},
|
||||
|
|
@ -201,6 +202,15 @@ export default {
|
|||
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null);
|
||||
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||
},
|
||||
getEmailFromStore(){
|
||||
return store.getters.order.customer.emailAddress
|
||||
},
|
||||
getVinFromStore(){
|
||||
return store.getters.vehicle.vin
|
||||
},
|
||||
getZipFromStore(){
|
||||
return store.getters.vehicle.registration.zipCode
|
||||
},
|
||||
backButtonAction() {
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
|
|
@ -210,17 +220,20 @@ export default {
|
|||
this.customAlertData.zip = this.zip;
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
this.noServiceZip = true;
|
||||
this.invalidZip = this.zip;
|
||||
return;
|
||||
}
|
||||
const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => {
|
||||
this.vinNotFound = true;
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
this.noServiceZip = false;
|
||||
return;
|
||||
});
|
||||
this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId;
|
||||
|
||||
if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) {
|
||||
this.previouslyEnteredCarId = vehicleLookup.data.carId;
|
||||
this.noServiceZip = false;
|
||||
this.customAlertData.vehicleInfo = vehicleLookup.data;
|
||||
this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`);
|
||||
this.isVinValid = true;
|
||||
|
|
@ -228,19 +241,18 @@ export default {
|
|||
this.$refs.funnelFooter.removeLoader();
|
||||
this.matchedDifferentVehicle = true;
|
||||
return;
|
||||
};
|
||||
this.updateStore(vehicleLookup)
|
||||
}
|
||||
this.updateStore(vehicleLookup.data)
|
||||
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||
{
|
||||
carId: vehicleLookup.data.carId,
|
||||
glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace,
|
||||
zipCode: this.zip,
|
||||
vin: vehicleLookup.vin
|
||||
vin: this.vin
|
||||
},
|
||||
false
|
||||
);
|
||||
console.log(vehicleLookup.data);
|
||||
this.navigateForward(partsData);
|
||||
},
|
||||
navigateForward(partsData){
|
||||
|
|
@ -265,9 +277,9 @@ export default {
|
|||
);
|
||||
},
|
||||
updateStore(carInfo) {
|
||||
// if(vehicleDamage){
|
||||
// store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||
// }
|
||||
if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){
|
||||
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||
}
|
||||
store.commit(storeMutations.UPDATE_VEHICLE_VIN, this.vin);
|
||||
store.commit(storeMutations.UPDATE_YEAR, carInfo.year);
|
||||
store.commit(storeMutations.UPDATE_MAKE, carInfo.make);
|
||||
|
|
|
|||
Loading…
Reference in a new issue