commit
7398eeb81a
1 changed files with 37 additions and 22 deletions
|
|
@ -27,6 +27,7 @@
|
|||
maxLength="17"
|
||||
:mask="vinMask"
|
||||
@focus="setVinTouched"
|
||||
@maska="rawVinValue = $event.target.dataset.maskRawValue"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -188,6 +189,7 @@ export default {
|
|||
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
|
||||
initialVin: this.getVinFromStore(),
|
||||
vinTouched: false,
|
||||
rawVinValue: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -209,7 +211,8 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
perfectMatchNewVinAlert() {
|
||||
const isVinPerfectMatch = this.vinPopulatedOnPageLoad && this.initialVin === this.getVinFromStore();
|
||||
const vinToCheck = this.vinTouched ? this.rawVinValue : this.initialVin;
|
||||
const isVinPerfectMatch = this.vinPopulatedOnPageLoad && vinToCheck === this.getVinFromStore();
|
||||
this.updateIsCarIdDifferent(isVinPerfectMatch);
|
||||
return isVinPerfectMatch;
|
||||
},
|
||||
|
|
@ -308,23 +311,18 @@ export default {
|
|||
}
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
let zipValidationResponse;
|
||||
let vehicleLookupResponse;
|
||||
|
||||
const zipValidation = this.validateZip(this.zip);
|
||||
const zipValidationResponse = await zipValidation;
|
||||
|
||||
// Check if Service Zip entered is servicable, if not display an alert
|
||||
if (!zipValidationResponse.data.isServiceable) {
|
||||
this.customAlertData.zip = this.zip;
|
||||
this.noServiceZip = true;
|
||||
this.invalidZip = this.zip;
|
||||
}
|
||||
|
||||
let vehicleLookupResponse;
|
||||
if (this.vinTouched && this.vin != this.initialVin) {
|
||||
if (this.vinTouched && this.vin != this.initialVin) {
|
||||
// If the user has clicked on the VIN field, either they are doing a new VIN lookup or changing the VIN previously matched.
|
||||
// Therefore we need to do a VIN Lookup
|
||||
// Therefore we need to do a Vehicle Lookup
|
||||
const vinToLookup = this.vinTouched ? this.vin : this.initialVin;
|
||||
const vehicleLookup = this.lookupVehicle(vinToLookup);
|
||||
|
||||
zipValidationResponse = await zipValidation;
|
||||
vehicleLookupResponse = await vehicleLookup.catch((response) => {
|
||||
if (response.status == StatusCodes.NOT_FOUND) {
|
||||
this.vinNotFound = true;
|
||||
|
|
@ -333,19 +331,36 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
// if the ZIP is not serviceable or the Vin Lookup didn't return anything then don't complete the process and navigate forward.
|
||||
if (!zipValidationResponse.data.isServiceable || !vehicleLookupResponse) {
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// if the ZIP is not serviceable then don't navigate forward.
|
||||
// Check if Service Zip entered is servicable, if not display an alert
|
||||
if (!zipValidationResponse.data.isServiceable) {
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
return;
|
||||
this.customAlertData.zip = this.zip;
|
||||
this.noServiceZip = true;
|
||||
this.invalidZip = this.zip;
|
||||
}
|
||||
|
||||
if (!vehicleLookupResponse || !zipValidationResponse.data.isServiceable) {
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const zipValidationResponse = await zipValidation;
|
||||
|
||||
// Check if Service Zip entered is serviceable, if not display an alert
|
||||
if (!zipValidationResponse.data.isServiceable) {
|
||||
this.customAlertData.zip = this.zip;
|
||||
this.noServiceZip = true;
|
||||
this.invalidZip = this.zip;
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
|
||||
this.navigateForward();
|
||||
return;
|
||||
|
||||
} else {
|
||||
this.navigateForward();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vehicleLookupResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue