Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1
Building an E-Commerce Store - Adding a Checkout Chapter 11

We can now proceed with building our Checkout process. The product display in the


basket is more complicated than the Checkout and Order Confirmation screens so,
unusually, we'll work backward. Starting with the Order Confirmation page and moving


to the Checkout page, adding more complexity before we head to the basket, adding the


ability to exit the products.


Order Confirmation screen


The Order Confirmation screen is one that is shown once the order is complete. This
confirms the items purchased and may include the expected delivery date.


Create a template within the OrderConfirmation.js file with a

and some relevant


content relating to the order being complete:


const OrderConfirmation = {
name: 'OrderConfirmation',

template: `<div>
<h1>Order Complete!</h1>
<p>Thanks for shopping with us - you can expect your products within 2


  • 3 working days

`
};


Open up the application in your browser, add a product to your basket and complete an
order to confirm it's working. The next step is to include the ListProducts component.


First, ensure the ListProducts component is correctly initialized and features an initial


template:


const ListPurchases = {
name: 'ListPurchases',

template: `<table></table>`
};

Add the components object to the OrderConfirmation component and include the


ListProducts component. Next, include it in the template:


const OrderConfirmation = {
name: 'OrderConfirmation',

template: `<div>
<h1>Order Complete!</h1>
<p>Thanks for shopping with us - you can expect your products within 2


  • 3 working days


Free download pdf