diff --git a/customer-vue/src/api/store.js b/customer-vue/src/api/store.js index ef85401..9fae59a 100644 --- a/customer-vue/src/api/store.js +++ b/customer-vue/src/api/store.js @@ -1,13 +1,14 @@ import axios from "axios"; export default { - requestSearchStore(latitude, longitude, storeName, page) { + requestNearbyStore(latitude, longitude, storeName, page, size) { const options = { params: { latitude: latitude, longitude: longitude, storeName: storeName, - page: page + page: page, + size: size } } return axios.get(process.env.VUE_APP_STORE_API_URL + '/store/search', options); diff --git a/customer-vue/src/assets/store.jpeg b/customer-vue/src/assets/store.jpeg new file mode 100644 index 0000000..10213e9 Binary files /dev/null and b/customer-vue/src/assets/store.jpeg differ diff --git a/customer-vue/src/components/OrderHistoryCard.vue b/customer-vue/src/components/OrderHistoryCard.vue index 7c6052f..194b792 100644 --- a/customer-vue/src/components/OrderHistoryCard.vue +++ b/customer-vue/src/components/OrderHistoryCard.vue @@ -27,7 +27,7 @@ tile size="100" > - + diff --git a/customer-vue/src/components/SlideStore.vue b/customer-vue/src/components/SlideStore.vue index e8cd091..d2152c9 100644 --- a/customer-vue/src/components/SlideStore.vue +++ b/customer-vue/src/components/SlideStore.vue @@ -31,11 +31,22 @@ - {{item.name}} + + {{item.name}} + - 거리 : {{item.distance}} + + + mdi-heart + {{ item.favoriteCounts }} + + + mdi-map-marker + {{item.distance}} + + @@ -47,9 +58,7 @@ diff --git a/customer-vue/src/views/HomeView.vue b/customer-vue/src/views/HomeView.vue index 926b185..0caa5ab 100644 --- a/customer-vue/src/views/HomeView.vue +++ b/customer-vue/src/views/HomeView.vue @@ -1,19 +1,27 @@ - - - - - - Hello - Nice to meet you - - - + - 즐겨찾는 매장입니다. + + 회원님과 + 가까이 있는 매장이에요! + + + + + + + + + + + 회원님이 + 즐겨찾는 매장이에요! + @@ -38,23 +46,25 @@ export default { favoriteStoreList:{ data:[], isActive:'', - }, + nearbyStores: { + data: [], + isActive: '' + } } }, async mounted() { const location = await this.getLocation(); this.latitude = location.latitude; this.longitude = location.longitude; - storeApi.getFavoriteStore(this.latitude,this.longitude) - .then(response =>{ - this.favoriteStoreList.isActive = 'd-none' - this.favoriteStoreList.data = response.data.data; - }); + + await this.requestFavoriteStore() + + await this.requestNearbyStore(); + }, methods:{ getLocation: async function() { - console.log("initGeoLocation"); return new Promise(function (resolve, reject) { if ('geolocation' in navigator) { navigator.geolocation.getCurrentPosition((position) => { @@ -70,6 +80,32 @@ export default { } }); }, + requestFavoriteStore: async function() { + try { + const response = await storeApi.getFavoriteStore(this.latitude,this.longitude) + this.favoriteStoreList.isActive = 'd-none' + this.favoriteStoreList.data = response.data.data; + } catch (error) { + console.log(error); + } + }, + requestNearbyStore: async function() { + try { + const response = await storeApi.requestNearbyStore(this.latitude, this.longitude, "", 0, 10); + const stores = response.data.data.stores; + stores.forEach(store => { + this.nearbyStores.data.push({ + id: store.id, + name: store.name, + distance: store.distance, + favoriteCounts: store.favoriteCounts + }); + this.nearbyStores.isActive = 'd-none'; + }) + } catch (error) { + console.log(error); + } + }, } } diff --git a/customer-vue/src/views/SearchStore.vue b/customer-vue/src/views/SearchStore.vue index 17c8d5a..15171aa 100644 --- a/customer-vue/src/views/SearchStore.vue +++ b/customer-vue/src/views/SearchStore.vue @@ -29,7 +29,7 @@ {{ card.name }} @@ -116,7 +116,7 @@ export default { this.isLoading = true; try { this.page = 0; - const response = await storeApi.requestSearchStore(this.latitude, this.longitude, this.storeName, this.page); + const response = await storeApi.requestNearbyStore(this.latitude, this.longitude, this.storeName, this.page); this.cards = []; this.renderCard(response.data); } catch (error) { @@ -128,7 +128,7 @@ export default { this.isLoading = true; try { this.page += 1; - const response = await storeApi.requestSearchStore(this.latitude, this.longitude, this.storeName, this.page); + const response = await storeApi.requestNearbyStore(this.latitude, this.longitude, this.storeName, this.page); this.renderCard(response.data); } catch (error) { console.log(error);