WIP
This commit is contained in:
parent
5b6474fa48
commit
ffd829cee9
2 changed files with 83 additions and 13 deletions
|
|
@ -22,7 +22,7 @@
|
|||
<textLink
|
||||
ref="removeLink"
|
||||
linkType="text"
|
||||
text="showMoreShopsLinkText"
|
||||
:text="removeLinkText"
|
||||
href="#!"
|
||||
@click-event="removeItem(lineItem)" />
|
||||
</div>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
<textLink
|
||||
ref="removeLink"
|
||||
linkType="text"
|
||||
text="showMoreShopsLinkText"
|
||||
text="removeLinkText"
|
||||
href="#!"
|
||||
@click-event="removeItem(lineItem)" />
|
||||
<span>{{ lineItem.price }}</span>
|
||||
|
|
@ -45,7 +45,10 @@
|
|||
><span>{{ recycleFee }}</span>
|
||||
</div>
|
||||
<!-- Sub total, sales tax, total columns -->
|
||||
<div class="sub-total"><span>Subtotal</span><span>$320</span></div>
|
||||
<div class="sub-total">
|
||||
<span>Subtotal</span>
|
||||
<span>{{ subTotal }}</span>
|
||||
</div>
|
||||
<div class="sales-tax"><span>Sales tax</span><span>$1</span></div>
|
||||
<div class="amount-due"><span>Amount due</span><span>$321</span></div>
|
||||
</div>
|
||||
|
|
@ -63,10 +66,12 @@ import {
|
|||
} from "@/helpers/service-package-helper";
|
||||
import textLink from "@/ux-components/text-link/text-link";
|
||||
import textBlock from "@/digital-components/text-block/text-block";
|
||||
import { deepClone } from "@/helpers/object-helper";
|
||||
|
||||
export default {
|
||||
name: "modal",
|
||||
props: {
|
||||
modelValue: Object,
|
||||
damage: Object,
|
||||
servicePackageOptionsCmsName: String,
|
||||
availableLineItems: Object,
|
||||
|
|
@ -76,7 +81,6 @@ export default {
|
|||
return {
|
||||
isActive: false,
|
||||
packageWithVAPS: false,
|
||||
amountDue: this.getAmountDue(),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -130,6 +134,7 @@ export default {
|
|||
...findLineItemsWithPartType(vapType, this.availableLineItems)
|
||||
);
|
||||
});
|
||||
|
||||
return vapsLineItemsForSelectedPackage;
|
||||
},
|
||||
},
|
||||
|
|
@ -167,9 +172,18 @@ export default {
|
|||
return packagePriceString;
|
||||
// return (packagePriceString.length > 0) ? packagePriceString : "Test String";
|
||||
},
|
||||
// cartItems: {
|
||||
// get: function () {
|
||||
// return this.answersToDisplay;
|
||||
// },
|
||||
// set: function (newValue) {
|
||||
|
||||
// },
|
||||
// },
|
||||
displayedPackageLineItems() {
|
||||
const displayedPackageLineItems = [];
|
||||
const packageLineItems = this.getVapsLineItemsForSelectedPackage(this.packageLevel);
|
||||
|
||||
// TODO Determine if we could get the same list from this.lineItems?
|
||||
packageLineItems?.forEach((item) => {
|
||||
let price = item.sellingPrice + item.kitPrice + item.laborAmount;
|
||||
|
|
@ -181,6 +195,7 @@ export default {
|
|||
};
|
||||
displayedPackageLineItems.push(packageLineItem);
|
||||
});
|
||||
|
||||
return displayedPackageLineItems;
|
||||
},
|
||||
displayedNonPackageLineItems() {
|
||||
|
|
@ -244,12 +259,63 @@ export default {
|
|||
// }
|
||||
return true;
|
||||
},
|
||||
removeLinkText() {
|
||||
// TODO: retrieve from CMS
|
||||
return "Remove";
|
||||
},
|
||||
cartLineItems() {
|
||||
const cartLineItems = [];
|
||||
|
||||
|
||||
|
||||
const glassParts = this.lineItems.glassParts?.flat();
|
||||
if (glassParts) {
|
||||
glassParts.forEach((glassPart) => {
|
||||
cartLineItems.push(glassPart);
|
||||
});
|
||||
}
|
||||
|
||||
const supportingItems = this.lineItems.supportingItems;
|
||||
if (supportingItems) {
|
||||
supportingItems.forEach((supportingItem) => {
|
||||
cartLineItems.push(supportingItem);
|
||||
});
|
||||
}
|
||||
|
||||
const vaps = this.lineItems.vaps;
|
||||
if (vaps) {
|
||||
vaps.forEach((vap) => {
|
||||
cartLineItems.push(vap);
|
||||
});
|
||||
}
|
||||
|
||||
return cartLineItems;
|
||||
},
|
||||
subTotal() {
|
||||
let subTotal = 0;
|
||||
const pricedLineItems = this.cartLineItems.filter(i => Object.hasOwn(i, "sellingPrice"));
|
||||
|
||||
pricedLineItems.forEach((lineItem) => {
|
||||
|
||||
subTotal += (lineItem.sellingPrice ?? 0) +
|
||||
(lineItem.kitPrice ?? 0) +
|
||||
(lineItem.laborAmount ?? 0);
|
||||
});
|
||||
return subTotal + this.getVapsPrice(this.packageLevel);
|
||||
},
|
||||
salesTax() {
|
||||
return "$2.50";
|
||||
},
|
||||
amountDue() {
|
||||
return this.getAmountDue();
|
||||
},
|
||||
},
|
||||
components: {
|
||||
textBlock,
|
||||
textLink,
|
||||
},
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
|||
|
|
@ -124,6 +124,13 @@ export default {
|
|||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||
|
||||
const supportingItemsPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_SUPPORTING_ITEMS,
|
||||
null,
|
||||
"payment-method"
|
||||
);
|
||||
|
||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_WIPERS,
|
||||
null,
|
||||
|
|
@ -135,13 +142,6 @@ export default {
|
|||
null,
|
||||
"payment-method"
|
||||
);
|
||||
console.log("rainDefensePromise: ", rainDefensePromise);
|
||||
|
||||
const supportingItemsPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_SUPPORTING_ITEMS,
|
||||
null,
|
||||
"payment-method"
|
||||
);
|
||||
|
||||
const promiseResultMap = [
|
||||
{
|
||||
|
|
@ -181,7 +181,9 @@ export default {
|
|||
"payment-method",
|
||||
false
|
||||
);
|
||||
const lineItems = store.getters.lineItems;
|
||||
|
||||
|
||||
const lineItems = store.getters.order.lineItems;
|
||||
|
||||
const cartItems = [...glassParts, ...lineItems.supportingItems, ...lineItems.vaps]; // TOBEREMOVED BY AJC IN CSR-1384
|
||||
|
||||
|
|
@ -197,7 +199,6 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
cartItems: [], // TOBEREMOVED BY AJC IN CSR-1384
|
||||
|
||||
lineItems: [],
|
||||
availableLineItems: [],
|
||||
displayPaypalAlert: this.getPaypalAlert(),
|
||||
|
|
@ -205,6 +206,9 @@ export default {
|
|||
};
|
||||
},
|
||||
methods: {
|
||||
getLineItemsFromStore() {
|
||||
return store.getters.order.lineItems;
|
||||
},
|
||||
arePagePrerequisitesValid() {
|
||||
// Line Items
|
||||
const packageReqs = !!store.getters.order.lineItems.supportingItems;
|
||||
|
|
|
|||
Loading…
Reference in a new issue