order-confirmation cart WIP
This commit is contained in:
parent
4fb167db71
commit
5e3fe33414
2 changed files with 140 additions and 7 deletions
|
|
@ -171,6 +171,11 @@ export default {
|
|||
recyclingModalCmsWidgetName: String,
|
||||
availableVaps: Array
|
||||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
const { submittedOrder } = mainStore;
|
||||
return { mainStore, submittedOrder };
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false,
|
||||
|
|
@ -191,16 +196,35 @@ export default {
|
|||
computed: {
|
||||
deductible() {
|
||||
// Note: added as computed so it can be used in the template.
|
||||
if (this.submittedOrder) {
|
||||
return this.submittedOrder.currentDeductible;
|
||||
}
|
||||
return useMainStore().order.currentDeductible;
|
||||
},
|
||||
showDeductibleCartItem() {
|
||||
if (this.submittedOrder) {
|
||||
return this.submittedOrder.policy.noCoverage === false && this.submittedOrder.policy.isITAC === false;
|
||||
}
|
||||
return !useMainStore().isNoComp && !useMainStore().isITAC;
|
||||
},
|
||||
recycleFeeLineItem() {
|
||||
if (this.submittedOrder) {
|
||||
return this.submittedOrder.lineItems.supportingItems
|
||||
?.find((lineItem) => lineItem.partNumber === partNumberStrings.RECYCLE_FEE);
|
||||
}
|
||||
return useMainStore().lineItems.supportingItems
|
||||
?.find((lineItem) => lineItem.partNumber === partNumberStrings.RECYCLE_FEE);
|
||||
},
|
||||
baseServiceLineItems() {
|
||||
if (this.submittedOrder) {
|
||||
const { supportingItems, glassParts, otherParts } = this.submittedOrder.lineItems;
|
||||
const parts = [
|
||||
...(supportingItems ?? []),
|
||||
...(glassParts ?? []),
|
||||
...(otherParts ?? [])
|
||||
];
|
||||
return parts.filter((part) => part !== this.recycleFeeLineItem);
|
||||
}
|
||||
const { supportingItems, glassParts, otherParts } = useMainStore().lineItems;
|
||||
const parts = [
|
||||
...(supportingItems ?? []),
|
||||
|
|
@ -213,10 +237,27 @@ export default {
|
|||
return getPriceOfLineItems(this.baseServiceLineItems) ?? 0;
|
||||
},
|
||||
isUnverified() {
|
||||
return !useMainStore().isNoComp && !useMainStore().isITAC
|
||||
&& (this.deductible == null || !useMainStore().isVerifiedCoverageStatus);
|
||||
if (this.submittedOrder) {
|
||||
return this.submittedOrder.policy.noCoverage === false && this.submittedOrder.policy.isITAC === false
|
||||
&& (this.submittedOrder.currentDeductible == null || this.submittedOrder.payment.isVerified === false);
|
||||
} return !useMainStore().isNoComp && !useMainStore().isITAC
|
||||
&& (this.deductible == null || !useMainStore().isVerifiedCoverageStatus);
|
||||
},
|
||||
subTotal() {
|
||||
if (this.submittedOrder) {
|
||||
const { supportingItems, glassParts, otherParts, vaps, mobileFee } = this.submittedOrder.lineItems;
|
||||
const allLineItems = [
|
||||
...(supportingItems ?? []),
|
||||
...(glassParts ?? []),
|
||||
...(otherParts ?? []),
|
||||
...(vaps ?? []),
|
||||
mobileFee
|
||||
];
|
||||
return this.submittedOrder.policy.noCoverage === false && this.submittedOrder.policy.isITAC === false
|
||||
? this.deductible + getPriceOfLineItems([...this.feeLineItems, ...(vaps ?? [])])
|
||||
: getPriceOfLineItems(allLineItems);
|
||||
}
|
||||
|
||||
const { supportingItems, glassParts, otherParts, vaps, mobileFee } = useMainStore().lineItems;
|
||||
const allLineItems = [
|
||||
...(supportingItems ?? []),
|
||||
|
|
@ -230,6 +271,17 @@ export default {
|
|||
: getPriceOfLineItems(allLineItems);
|
||||
},
|
||||
feeLineItems() {
|
||||
if (this.submittedOrder) {
|
||||
const { mobileFee } = this.submittedOrder.lineItems;
|
||||
const result = [];
|
||||
if (mobileFee) {
|
||||
result.push(mobileFee);
|
||||
}
|
||||
if (this.recycleFeeLineItem) {
|
||||
result.push(this.recycleFeeLineItem);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const { mobileFee } = useMainStore().lineItems;
|
||||
const result = [];
|
||||
if (mobileFee) {
|
||||
|
|
@ -247,6 +299,19 @@ export default {
|
|||
|
||||
let result = 0;
|
||||
|
||||
if (this.submittedOrder) {
|
||||
if (this.submittedOrder.payment.insuranceCoverage.isVerified) {
|
||||
if (this.submittedOrder.policy.isITAC || this.submittedOrder.policy.noCoverage) {
|
||||
result += sumTax(this.baseServiceLineItems);
|
||||
} else {
|
||||
// deductible-case need to show tax for Recycle Fee
|
||||
result += this.recycleFeeLineItem?.salesTax ?? 0;
|
||||
}
|
||||
}
|
||||
result += sumTax(this.submittedOrder.lineItems.vaps ?? []);
|
||||
|
||||
return result;
|
||||
}
|
||||
if (useMainStore().payment.insuranceCoverage.isVerified) {
|
||||
if (useMainStore().isITAC || useMainStore().isNoComp) {
|
||||
result += sumTax(this.baseServiceLineItems);
|
||||
|
|
@ -266,6 +331,19 @@ export default {
|
|||
: this.subTotal + this.salesTax;
|
||||
},
|
||||
availableLineItems() {
|
||||
if (this.submittedOrder) {
|
||||
const { supportingItems, glassParts, otherParts, mobileFee } = this.submittedOrder.lineItems;
|
||||
const result = [
|
||||
...(supportingItems ?? []),
|
||||
...(glassParts ?? []),
|
||||
...(otherParts ?? []),
|
||||
...(this.availableVaps ?? [])
|
||||
];
|
||||
if (mobileFee) {
|
||||
result.push(mobileFee);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const { supportingItems, glassParts, otherParts, mobileFee } = useMainStore().lineItems;
|
||||
const result = [
|
||||
...(supportingItems ?? []),
|
||||
|
|
@ -279,6 +357,16 @@ export default {
|
|||
return result;
|
||||
},
|
||||
servicePackageTier() {
|
||||
if (this.submittedOrder) {
|
||||
const { glassToReplace, isRepair } = this.submittedOrder.damage;
|
||||
const { vaps } = this.submittedOrder.lineItems;
|
||||
return getHighestFullySatisfiedTier(
|
||||
glassToReplace ?? [],
|
||||
this.availableLineItems,
|
||||
isRepair,
|
||||
vaps ?? []
|
||||
);
|
||||
}
|
||||
const { glassToReplace, isRepair } = useMainStore().damage;
|
||||
const { vaps } = useMainStore().lineItems;
|
||||
return getHighestFullySatisfiedTier(
|
||||
|
|
@ -367,10 +455,16 @@ export default {
|
|||
return this.getCmsContent(this.widget.salesTax, widgetFields.TEXT_BLOCK_WIDGET.TEXT);
|
||||
},
|
||||
servicePackageNames() {
|
||||
return this.getCmsContent(
|
||||
const test = this.getCmsContent(
|
||||
this.widget.servicePackage,
|
||||
widgetFields.INPUT_QUESTION_WIDGET.ANSWERS
|
||||
);
|
||||
console.log(test);
|
||||
return test;
|
||||
// return this.getCmsContent(
|
||||
// this.widget.servicePackage,
|
||||
// widgetFields.INPUT_QUESTION_WIDGET.ANSWERS
|
||||
// );
|
||||
},
|
||||
servicePackageLabelWidget() {
|
||||
if (!this.servicePackageNames) {
|
||||
|
|
@ -411,6 +505,13 @@ export default {
|
|||
this.isExpanded = !this.isExpanded;
|
||||
},
|
||||
getDisplayed(amount) {
|
||||
if (this.submittedOrder) {
|
||||
return this.isUnverified
|
||||
&& this.submittedOrder.policy.noCoverage === false
|
||||
&& this.submittedOrder.policy.isITAC === false
|
||||
? VERIFYING_COVERAGE
|
||||
: formatAmountInDollars(amount);
|
||||
}
|
||||
return this.isUnverified
|
||||
&& !useMainStore().isNoComp
|
||||
&& !useMainStore().isITAC
|
||||
|
|
@ -436,6 +537,12 @@ export default {
|
|||
return cartItem;
|
||||
},
|
||||
getCartItemForVapsPart(partType) {
|
||||
if (this.submittedOrder) {
|
||||
const label = this.getCmsContentForVapsType(partType);
|
||||
const lineItems = this.submittedOrder.lineItems.vaps
|
||||
?.filter((vapsLineItem) => vapsLineItem.partType === partType) ?? [];
|
||||
return this.getCartItem(label, lineItems, cartItemType.VAP, partType);
|
||||
}
|
||||
const label = this.getCmsContentForVapsType(partType);
|
||||
const lineItems = useMainStore().lineItems.vaps
|
||||
?.filter((vapsLineItem) => vapsLineItem.partType === partType) ?? [];
|
||||
|
|
|
|||
|
|
@ -47,6 +47,14 @@
|
|||
v-html="appointmentWordingText2">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<cartDropdown
|
||||
:showAsPaid="isPayInAdvance"
|
||||
:readOnly="true"
|
||||
recyclingModalCmsWidgetName="RecycleModal"
|
||||
servicePackageTitleWidgetName="ServicePackageTitle"
|
||||
:availableVaps="selectedVaps" />
|
||||
</div>
|
||||
<div
|
||||
class="email-confirmation-text"
|
||||
v-html="confirmationEmailText" />
|
||||
|
|
@ -69,6 +77,8 @@ import siteHeader from '@/iss-components/site-header/site-header.vue';
|
|||
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
import addToCalendar from '@/layouts/order-confirmation/add-to-calendar/add-to-calendar.vue';
|
||||
import cartDropdown from '@/iss-components/cart-dropdown/cart-dropdown.vue';
|
||||
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage, processIfStatements } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
|
|
@ -91,22 +101,26 @@ export default {
|
|||
siteHeader,
|
||||
vehicleBanner,
|
||||
siteFooter,
|
||||
addToCalendar
|
||||
addToCalendar,
|
||||
cartDropdown
|
||||
},
|
||||
mixins: [BaseFormMixin],
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
console.log('beforeRouteEnter just called');
|
||||
useMainStore().createSubmittedOrder();
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: 'cmsContent',
|
||||
promise: cmsContentPromise
|
||||
}];
|
||||
// use resultMap to populate layout content.
|
||||
}
|
||||
];
|
||||
|
||||
// use resultMap to populate layout content.
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
});
|
||||
|
|
@ -116,6 +130,11 @@ export default {
|
|||
const { submittedOrder } = mainStore;
|
||||
return { mainStore, submittedOrder };
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectedVaps: this.submittedOrder.lineItems.vaps
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
carrierName() {
|
||||
return this.mainStore.issConfig.clientName;
|
||||
|
|
@ -263,12 +282,16 @@ export default {
|
|||
this.submittedOrder.schedule.jobMaxMinutes
|
||||
);
|
||||
return inshopDurationTime;
|
||||
},
|
||||
isPayInAdvance() {
|
||||
return this.submittedOrder.payment.isPayInAdvance;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.carrierUrl) {
|
||||
this.$refs.siteFooter.updateButtonText(`Go back to ${this.carrierName}`);
|
||||
}
|
||||
console.log(this.submittedOrder);
|
||||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
|
|
@ -364,6 +387,9 @@ export default {
|
|||
default:
|
||||
return null;
|
||||
}
|
||||
},
|
||||
setAvailableVaps(vaps) {
|
||||
this.availableVaps = vaps;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue