commit
7398eeb81a
1 changed files with 37 additions and 22 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
maxLength="17"
|
maxLength="17"
|
||||||
:mask="vinMask"
|
:mask="vinMask"
|
||||||
@focus="setVinTouched"
|
@focus="setVinTouched"
|
||||||
|
@maska="rawVinValue = $event.target.dataset.maskRawValue"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -188,6 +189,7 @@ export default {
|
||||||
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
|
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
|
||||||
initialVin: this.getVinFromStore(),
|
initialVin: this.getVinFromStore(),
|
||||||
vinTouched: false,
|
vinTouched: false,
|
||||||
|
rawVinValue: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -209,7 +211,8 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
perfectMatchNewVinAlert() {
|
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);
|
this.updateIsCarIdDifferent(isVinPerfectMatch);
|
||||||
return isVinPerfectMatch;
|
return isVinPerfectMatch;
|
||||||
},
|
},
|
||||||
|
|
@ -308,23 +311,18 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
|
let zipValidationResponse;
|
||||||
|
let vehicleLookupResponse;
|
||||||
|
|
||||||
const zipValidation = this.validateZip(this.zip);
|
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.
|
// 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 vinToLookup = this.vinTouched ? this.vin : this.initialVin;
|
||||||
const vehicleLookup = this.lookupVehicle(vinToLookup);
|
const vehicleLookup = this.lookupVehicle(vinToLookup);
|
||||||
|
|
||||||
|
zipValidationResponse = await zipValidation;
|
||||||
vehicleLookupResponse = await vehicleLookup.catch((response) => {
|
vehicleLookupResponse = await vehicleLookup.catch((response) => {
|
||||||
if (response.status == StatusCodes.NOT_FOUND) {
|
if (response.status == StatusCodes.NOT_FOUND) {
|
||||||
this.vinNotFound = true;
|
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.
|
// Check if Service Zip entered is servicable, if not display an alert
|
||||||
if (!zipValidationResponse.data.isServiceable || !vehicleLookupResponse) {
|
|
||||||
this.$refs.funnelFooter.removeLoader();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// if the ZIP is not serviceable then don't navigate forward.
|
|
||||||
if (!zipValidationResponse.data.isServiceable) {
|
if (!zipValidationResponse.data.isServiceable) {
|
||||||
this.$refs.funnelFooter.removeLoader();
|
this.customAlertData.zip = this.zip;
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue