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;
|
return fmgPageValues.VEHICLE_DAMAGE;
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.vehicle.vin) {
|
if (store.getters.vehicle.vin) {
|
||||||
return fmgPageValues.LICENSE_PLATE_LOOKUP;
|
return fmgPageValues.VIN_LOOKUP;
|
||||||
} else {
|
} else {
|
||||||
return fmgPageValues.VIN_LOOKUP;
|
return fmgPageValues.VIN_LOOKUP;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,12 +149,13 @@ export default {
|
||||||
foundWindshieldAlert: false,
|
foundWindshieldAlert: false,
|
||||||
vinNotFound: false,
|
vinNotFound: false,
|
||||||
perfectMatchNewVinAlert: false,
|
perfectMatchNewVinAlert: false,
|
||||||
vin: '',
|
vin: this.getVinFromStore(),
|
||||||
zip: '',
|
zip: this.getZipFromStore(),
|
||||||
email: '',
|
email: this.getEmailFromStore(),
|
||||||
customAlertData: {},
|
customAlertData: {},
|
||||||
isCarIdDifferent: false,
|
isCarIdDifferent: false,
|
||||||
previouslyEnteredCarId: '',
|
previouslyEnteredCarId: '',
|
||||||
|
invalidZip: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -172,7 +173,7 @@ export default {
|
||||||
return text;
|
return text;
|
||||||
},
|
},
|
||||||
NoServiceZipHeader(){
|
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;
|
return text;
|
||||||
},
|
},
|
||||||
|
|
@ -201,6 +202,15 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null);
|
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null);
|
||||||
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
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() {
|
backButtonAction() {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
|
|
@ -210,17 +220,20 @@ export default {
|
||||||
this.customAlertData.zip = this.zip;
|
this.customAlertData.zip = this.zip;
|
||||||
this.$refs.funnelFooter.removeLoader();
|
this.$refs.funnelFooter.removeLoader();
|
||||||
this.noServiceZip = true;
|
this.noServiceZip = true;
|
||||||
|
this.invalidZip = this.zip;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => {
|
const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => {
|
||||||
this.vinNotFound = true;
|
this.vinNotFound = true;
|
||||||
this.$refs.funnelFooter.removeLoader();
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
this.noServiceZip = false;
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId;
|
this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId;
|
||||||
|
|
||||||
if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) {
|
if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) {
|
||||||
this.previouslyEnteredCarId = vehicleLookup.data.carId;
|
this.previouslyEnteredCarId = vehicleLookup.data.carId;
|
||||||
|
this.noServiceZip = false;
|
||||||
this.customAlertData.vehicleInfo = vehicleLookup.data;
|
this.customAlertData.vehicleInfo = vehicleLookup.data;
|
||||||
this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`);
|
this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`);
|
||||||
this.isVinValid = true;
|
this.isVinValid = true;
|
||||||
|
|
@ -228,19 +241,18 @@ export default {
|
||||||
this.$refs.funnelFooter.removeLoader();
|
this.$refs.funnelFooter.removeLoader();
|
||||||
this.matchedDifferentVehicle = true;
|
this.matchedDifferentVehicle = true;
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
this.updateStore(vehicleLookup)
|
this.updateStore(vehicleLookup.data)
|
||||||
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||||
{
|
{
|
||||||
carId: vehicleLookup.data.carId,
|
carId: vehicleLookup.data.carId,
|
||||||
glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace,
|
glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace,
|
||||||
zipCode: this.zip,
|
zipCode: this.zip,
|
||||||
vin: vehicleLookup.vin
|
vin: this.vin
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
console.log(vehicleLookup.data);
|
|
||||||
this.navigateForward(partsData);
|
this.navigateForward(partsData);
|
||||||
},
|
},
|
||||||
navigateForward(partsData){
|
navigateForward(partsData){
|
||||||
|
|
@ -265,9 +277,9 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
updateStore(carInfo) {
|
updateStore(carInfo) {
|
||||||
// if(vehicleDamage){
|
if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){
|
||||||
// store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
// }
|
}
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_VIN, this.vin);
|
store.commit(storeMutations.UPDATE_VEHICLE_VIN, this.vin);
|
||||||
store.commit(storeMutations.UPDATE_YEAR, carInfo.year);
|
store.commit(storeMutations.UPDATE_YEAR, carInfo.year);
|
||||||
store.commit(storeMutations.UPDATE_MAKE, carInfo.make);
|
store.commit(storeMutations.UPDATE_MAKE, carInfo.make);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue