This commit is contained in:
Jonathan Chevalier
2022-09-29 17:11:17 +02:00
parent efa0296c1d
commit c219e317b1
4 changed files with 51 additions and 13 deletions

View File

@@ -3,7 +3,8 @@
<li v-for="step in stepList" :class="(step.stepNumber<currentStep) ? 'complete' : ''">
<router-link :to="step.path">
<div class="step"><i :class="step.class"></i></div>
<div class="caption d-none d-sm-block">Etape <span>{{step.stepNumber}}</span>: <span>{{ step.name }}</span></div>
<div class="caption d-none d-sm-block">Etape <span>{{ step.stepNumber }}</span>: <span>{{ step.name }}</span>
</div>
</router-link>
</li>
</ol>
@@ -53,7 +54,7 @@ export default {
const router = useRouter()
const route = useRoute()
const currentStep = computed(() => stepList.filter(step=>step.path === route.path)[0].stepNumber)
const currentStep = computed(() => stepList.filter(step => step.path === route.path).length > 0 ? stepList.filter(step => step.path === route.path)[0].stepNumber : 6)
return {
stepList,

View File

@@ -33,6 +33,11 @@ const routes = [
name: 'delivery-option-summary',
component: () => import('/src/views/delivery-option-summary.vue'),
},
{
path: '/final-step',
name: 'final-step',
component: () => import('/src/views/final-step.vue'),
},
]
const router = createRouter({

View File

@@ -8,33 +8,43 @@
<span v-else>Non</span>
</div>
<div class="mb-2"><strong>Date de livraison des medicaments : </strong>{{ store.dateDeliveryString }}</div>
<button class="btn btn-primary" @click="addToCart"><i class="fa-regular fa-circle-check fa-fw"></i> Ajouter au panier</button>
<button class="btn btn-primary" @click="addToCart">
<i v-if="suspens" class="fa-solid fa-circle-notch fa-spin fa-fw"></i>
<i v-else class="fa-regular fa-circle-check fa-fw"></i>
Ajouter au panier
</button>
</div>
</template>
<script>
import {useMMCMStore} from '../stores/mmcm.js'
import {ref} from "vue";
export default {
setup() {
const suspens = ref(false)
const store = useMMCMStore()
return {
suspens,
store
}
},
name: "delivery-option-summary",
methods: {
addToCart: async function (idProduct) {
this.suspens = true
const urlApi = '/php/api/v3/mmcm.php?EXEC=addToCart&ID_PRODUCT=' + this.store.idProduct
+ '&with_prescription=' + this.store.widthPrescription
+ '&date_delivery=' + this.store.dateDelivery
;
const result = await fetch(urlApi)
.then(response => {
if (response.ok) {
this.suspens = false
this.$router.push({path : '/final-step'})
return response.json();
}
})

22
src/views/final-step.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<h2 class="mb-4">Votre ordonnance livré à domicile a été ajoutée au panier</h2>
<button class="btn btn-secondary me-4" @click="exitVueApp('/')">Continuer mes achats</button>
<button class="btn btn-primary" @click="exitVueApp('/cart/p/AFF_COMM/0/0/')">Finaliser ma commande</button>
</template>
<script>
export default {
name: "final-step",
methods: {
exitVueApp(url) {
window.location = 'https://para-php7-dev.parapharmacie-et-medicament.com' + url
}
}
}
</script>
<style scoped>
</style>