More changes from tech review

This commit is contained in:
Leah Schumann 2023-03-08 13:23:53 -05:00
parent cff0f89e76
commit 4b6be3fa5c
4 changed files with 27 additions and 18 deletions

View file

@ -7,7 +7,7 @@ export async function getPricedMobileFeePart(serviceZipCode) {
} }
const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode); const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode);
// Get the Mobile Fee Part // Get the Mobile Fee Part
const mobileFeePart = await baseMixin.methods.dispatchStoreAction( const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_FEE_PART, storeActions.GET_MOBILE_FEE_PART,
@ -21,7 +21,7 @@ export async function getPricedMobileFeePart(serviceZipCode) {
{ {
availableLineItems: [mobileFeePart.data], availableLineItems: [mobileFeePart.data],
serviceZipCode: serviceZipCode, serviceZipCode: serviceZipCode,
ctu: zipCodeData.zipCodeCtu, serviceZipCodeCtu: zipCodeData.zipCodeCtu,
}, },
false false
); );

View file

@ -59,6 +59,7 @@ import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location
// Helpers // Helpers
import { deepClone } from "@/helpers/object-cloning-helper"; import { deepClone } from "@/helpers/object-cloning-helper";
import { object } from "yup/lib/locale";
export default { export default {
name: "mobile-location-modal-questions", name: "mobile-location-modal-questions",
@ -81,10 +82,12 @@ export default {
zipCode: "", zipCode: "",
}, },
isVehicleProtected: null, isVehicleProtected: null,
serviceZipCode: "",
mobileFeePart: null,
}), }),
}, },
mobileFeePart: {
type: Object,
default: () => ({}),
},
isZipServiceableMobile: Boolean, isZipServiceableMobile: Boolean,
isZipServiceableInShop: Boolean, isZipServiceableInShop: Boolean,
linkWidgetName: String, linkWidgetName: String,
@ -122,13 +125,14 @@ export default {
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee); return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
}, },
mobileFee() { mobileFee() {
if (!this.modelValue.mobileFeePart) { if (!this.mobileFeePart) {
return 0; return 0;
} }
return ( return (
this.modelValue.mobileFeePart.laborAmount + this.mobileFeePart.laborAmount +
this.modelValue.mobileFeePart.sellingPrice + this.mobileFeePart.sellingPrice +
this.modelValue.mobileFeePart.kitPrice this.mobileFeePart.kitPrice
); );
}, },
modalFooterText() { modalFooterText() {

View file

@ -11,6 +11,7 @@
modalWidgetName="ServiceZipModalWidget" /> modalWidgetName="ServiceZipModalWidget" />
<mobileLocationModalQuestions <mobileLocationModalQuestions
v-model="mobileLocationQuestions" v-model="mobileLocationQuestions"
:mobileFeePart="mobileFeePart"
ref="mobileLocationModalQuestions" ref="mobileLocationModalQuestions"
linkWidgetName="MobileLocationLinkWidget" linkWidgetName="MobileLocationLinkWidget"
modalWidgetName="MobileLocationModalWidget" /> modalWidgetName="MobileLocationModalWidget" />
@ -90,7 +91,7 @@ export default {
}, },
set: function (newValue) { set: function (newValue) {
if (newValue.zipCode !== this.zipCode) { if (newValue.zipCode !== this.zipCode) {
this.resetMobileLocation(this.zipCode); this.resetMobileLocation(newValue.zipCode);
} }
this.state = newValue.state; this.state = newValue.state;
@ -108,7 +109,6 @@ export default {
zipCode: this.zipCode, zipCode: this.zipCode,
}, },
isVehicleProtected: this.isVehicleProtected, isVehicleProtected: this.isVehicleProtected,
mobileFeePart: this.mobileFeePart,
}; };
}, },
set: function (newValue) { set: function (newValue) {
@ -119,17 +119,17 @@ export default {
this.state = newValue.addressQuestions.state; this.state = newValue.addressQuestions.state;
this.zipCode = newValue.addressQuestions.zipCode; this.zipCode = newValue.addressQuestions.zipCode;
this.isVehicleProtected = newValue.isVehicleProtected; this.isVehicleProtected = newValue.isVehicleProtected;
this.mobileFeePart = newValue.mobileFeePart;
}, },
}, },
}, },
methods: { methods: {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return ( return true;
store.getters.lineItems.supportingItems !== null && // return (
store.getters.order.serviceLocation.zipCode !== null && // store.getters.lineItems.supportingItems !== null &&
store.getters.payment.isInsurance !== null // store.getters.order.serviceLocation.zipCode !== null &&
); // store.getters.payment.isInsurance !== null
// );
}, },
setData(mobileFeePart) { setData(mobileFeePart) {
if (mobileFeePart) { if (mobileFeePart) {

View file

@ -1431,11 +1431,16 @@ export const actions = {
context.commit(storeMutations.UPDATE_VAPS, vaps); context.commit(storeMutations.UPDATE_VAPS, vaps);
}, },
// Price order actions // Price order actions
async priceOrderItemsAndSaveServerData(context, { availableLineItems, serviceZipCode, serviceZipCodeCtu }) { async priceOrderItemsAndSaveServerData(
context,
{ availableLineItems, serviceZipCode, serviceZipCodeCtu }
) {
const zipCodeToUse = serviceZipCode const zipCodeToUse = serviceZipCode
? serviceZipCode ? serviceZipCode
: context.getters.order.serviceLocation.zipCode; : context.getters.order.serviceLocation.zipCode;
const ctuToUse = serviceZipCodeCtu ? serviceZipCodeCtu : context.getters.order.serviceLocation.zipCodeCtu; const ctuToUse = serviceZipCodeCtu
? serviceZipCodeCtu
: context.getters.order.serviceLocation.zipCodeCtu;
const availableLineItemsFormattedForRequest = const availableLineItemsFormattedForRequest =
getLineItemQueryStringForPricing(availableLineItems); getLineItemQueryStringForPricing(availableLineItems);