This commit is contained in:
Jonathan Chevalier
2022-11-09 17:40:21 +01:00
parent 8dcd07fce0
commit 7e418a07ee
4 changed files with 21 additions and 13 deletions

View File

@@ -72,9 +72,9 @@ const timestampConverter = (digit13) => digit13 / 1000
export const useMMCMStore = defineStore('counter', { export const useMMCMStore = defineStore('counter', {
state: () => ({ state: () => ({
idSession: '', idSession: '',
street: '', street: null,
zipCode: '', zipCode: null,
city: '', city: null,
productList: [], productList: [],
withPrescription: null, withPrescription: null,
idProduct: null, idProduct: null,
@@ -82,7 +82,7 @@ export const useMMCMStore = defineStore('counter', {
dateCollect: null dateCollect: null
}), }),
getters: { getters: {
fullAddress: (state) => state.street + ' ' + state.zipCode + ' ' + state.city, fullAddress: (state) => (state.street !== null) ? state.street + ' ' + state.zipCode + ' ' + state.city : null,
deliveryMethod: (state) => state.productList.filter(p => p.id === state.idProduct)[0].name, deliveryMethod: (state) => state.productList.filter(p => p.id === state.idProduct)[0].name,
deliveryMethodCode: (state) => state.productList.filter(p => p.id === state.idProduct)[0].ref, deliveryMethodCode: (state) => state.productList.filter(p => p.id === state.idProduct)[0].ref,
dateDeliveryString: (state) => new Date(state.dateDelivery).toLocaleDateString("fr-FR"), dateDeliveryString: (state) => new Date(state.dateDelivery).toLocaleDateString("fr-FR"),

View File

@@ -43,7 +43,7 @@ export default {
const store = useMMCMStore() const store = useMMCMStore()
const noOfferFound = ref(false) const noOfferFound = ref(false)
const query = ref(import.meta.env.DEV ? "9 Impasse des Peupliers 13008 Marseill" : '') const query = ref(store.fullAddress !== null ? store.fullAddress : import.meta.env.DEV ? "9 Impasse des Peupliers 13008 Marseill" : '')
return { return {
query, query,
@@ -61,6 +61,11 @@ export default {
}, },
methods: { methods: {
updateSearchResult: async function () { updateSearchResult: async function () {
this.store.setStreet(null)
this.store.setZipCode(null)
this.store.setCity(null)
this.isSearching = true this.isSearching = true
this.noOfferFound = false this.noOfferFound = false
this.searchResults = await fetch('https://api-adresse.data.gouv.fr/search/?q=' + this.query) this.searchResults = await fetch('https://api-adresse.data.gouv.fr/search/?q=' + this.query)

View File

@@ -22,14 +22,14 @@
<div class="mb-4"><i class="fa-solid fa-truck fa-fw text-primary me-2"></i><strong>Mode de livraison <div class="mb-4"><i class="fa-solid fa-truck fa-fw text-primary me-2"></i><strong>Mode de livraison
: </strong>{{ store.deliveryMethod }} : </strong>{{ store.deliveryMethod }}
</div> </div>
<div class="mb-4"><i class="fa-solid fa-file-medical fa-fw text-primary me-2"></i><strong>Collecte de l'ordonnnace <div class="mb-4"><i class="fa-solid fa-file-medical fa-fw text-primary me-2"></i><strong>Collecte de l'ordonnance
: </strong> : </strong>
<span v-if="store.withPrescription">Oui</span> <span v-if="store.withPrescription">Oui</span>
<span v-else>Non</span> <span v-else>Non</span>
</div> </div>
<div class="mb-4" v-if="store.withPrescription"> <div class="mb-4" v-if="store.withPrescription">
<i class="fa-solid fa-calendar-days fa-fw text-primary me-2"></i><strong>Date de collecte <i class="fa-solid fa-calendar-days fa-fw text-primary me-2"></i><strong>Date de collecte
de l'ordonnnce de l'ordonnance
: </strong>{{ (store.dateCollect) ? store.dateCollectString : store.dateDeliveryString }} : </strong>{{ (store.dateCollect) ? store.dateCollectString : store.dateDeliveryString }}
</div> </div>
<div class="mb-4"><i class="fa-solid fa-calendar-days fa-fw text-primary me-2"></i><strong>Date de livraison des <div class="mb-4"><i class="fa-solid fa-calendar-days fa-fw text-primary me-2"></i><strong>Date de livraison des
@@ -76,7 +76,7 @@ export default {
} }
if (import.meta.env.DEV) { if (import.meta.env.DEV) {
urlApi += '&ID_SESSION=wUyQ6Pea'; urlApi += '&ID_SESSION=rRN4VnKI';
console.log(urlApi) console.log(urlApi)
} }

View File

@@ -20,8 +20,11 @@ export default {
name: "final-step", name: "final-step",
methods: { methods: {
exitVueApp(url) { exitVueApp(url) {
const domain = 'para-php7-dev'
window.location = 'https://' + domain + '.parapharmacie-et-medicament.com' + url + '?ids=' + this.store.idSession if (import.meta.env.DEV) {
url = 'https://para-php7-devparapharmacie-et-medicament.com' + url
}
window.location = url + '?ids=' + this.store.idSession
} }
} }
} }