feat(customer-vue): Just Pick-up 홈 - 가까이 있는 매장 추가

- 가까이 있는 매장 추가
- 스토어 기본 이미지 변경
This commit is contained in:
bum12ark
2022-03-07 19:50:37 +09:00
parent 10202602d5
commit d2b51d0abe
6 changed files with 78 additions and 32 deletions

View File

@@ -1,13 +1,14 @@
import axios from "axios"; import axios from "axios";
export default { export default {
requestSearchStore(latitude, longitude, storeName, page) { requestNearbyStore(latitude, longitude, storeName, page, size) {
const options = { const options = {
params: { params: {
latitude: latitude, latitude: latitude,
longitude: longitude, longitude: longitude,
storeName: storeName, storeName: storeName,
page: page page: page,
size: size
} }
} }
return axios.get(process.env.VUE_APP_STORE_API_URL + '/store/search', options); return axios.get(process.env.VUE_APP_STORE_API_URL + '/store/search', options);

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 KiB

View File

@@ -27,7 +27,7 @@
tile tile
size="100" size="100"
> >
<v-img src="https://cdn.vuetifyjs.com/images/cards/halcyon.png"></v-img> <v-img :src="require('@/assets/store.jpeg')"></v-img>
</v-list-item-avatar> </v-list-item-avatar>
</v-list-item> </v-list-item>

View File

@@ -31,11 +31,22 @@
<v-img <v-img
height="165" height="165"
width="165" width="165"
src="https://cdn.vuetifyjs.com/images/cards/cooking.png" :src="require('@/assets/store.jpeg')"
></v-img> ></v-img>
<v-card-subtitle style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">{{item.name}}</v-card-subtitle> <v-card-subtitle style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
<b>{{item.name}}</b>
</v-card-subtitle>
<v-card-text> <v-card-text>
거리 : {{item.distance}} <v-row>
<div class="orange--text ms-4">
<v-icon color="orange" small>mdi-heart</v-icon>
{{ item.favoriteCounts }}
</div>
<div class="grey--text ms-4">
<v-icon small>mdi-map-marker</v-icon>
{{item.distance}}
</div>
</v-row>
</v-card-text> </v-card-text>
</v-skeleton-loader> </v-skeleton-loader>
</v-card> </v-card>
@@ -47,9 +58,7 @@
<script> <script>
export default { export default {
name: "SlideStore", name: "SlideStore",
props:{ props:["storeList"],
storeList:Array,
},
} }
</script> </script>

View File

@@ -1,19 +1,27 @@
<template> <template>
<v-container <v-container>
fill-height
>
<v-row>
<v-col>
<v-card>
<v-card-title>Hello</v-card-title>
<v-card-text>Nice to meet you</v-card-text>
</v-card>
</v-col>
</v-row>
<v-row justify="center"> <v-row justify="center">
<v-col> <v-col>
<div class="text-h5" >즐겨찾는 매장입니다.</div> <div class="text-h5">
회원님과<br>
<b><span class="deep-orange--text lighten-3">가까이 있는 매장</span></b>이에요!
</div>
<slide-store
:store-list="nearbyStores"
></slide-store>
</v-col>
</v-row>
<v-divider
class="my-5"
></v-divider>
<v-row justify="center">
<v-col>
<div class="text-h5" >
회원님이<br>
<b><span class="deep-orange--text lighten-3">즐겨찾는 매장</span></b>이에요!
</div>
<slide-store <slide-store
:store-list="favoriteStoreList" :store-list="favoriteStoreList"
></slide-store> ></slide-store>
@@ -38,23 +46,25 @@ export default {
favoriteStoreList:{ favoriteStoreList:{
data:[], data:[],
isActive:'', isActive:'',
}, },
nearbyStores: {
data: [],
isActive: ''
}
} }
}, },
async mounted() { async mounted() {
const location = await this.getLocation(); const location = await this.getLocation();
this.latitude = location.latitude; this.latitude = location.latitude;
this.longitude = location.longitude; this.longitude = location.longitude;
storeApi.getFavoriteStore(this.latitude,this.longitude)
.then(response =>{ await this.requestFavoriteStore()
this.favoriteStoreList.isActive = 'd-none'
this.favoriteStoreList.data = response.data.data; await this.requestNearbyStore();
});
}, },
methods:{ methods:{
getLocation: async function() { getLocation: async function() {
console.log("initGeoLocation");
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
if ('geolocation' in navigator) { if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition((position) => { 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);
}
},
} }
} }
</script> </script>

View File

@@ -29,7 +29,7 @@
<v-card v-bind:data-id="card.storeId"> <v-card v-bind:data-id="card.storeId">
<v-img <v-img
height="180" height="180"
src="https://cdn.vuetifyjs.com/images/cards/cooking.png" :src="require('@/assets/store.jpeg')"
></v-img> ></v-img>
<v-card-title>{{ card.name }}</v-card-title> <v-card-title>{{ card.name }}</v-card-title>
<v-card-text> <v-card-text>
@@ -116,7 +116,7 @@ export default {
this.isLoading = true; this.isLoading = true;
try { try {
this.page = 0; 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.cards = [];
this.renderCard(response.data); this.renderCard(response.data);
} catch (error) { } catch (error) {
@@ -128,7 +128,7 @@ export default {
this.isLoading = true; this.isLoading = true;
try { try {
this.page += 1; 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); this.renderCard(response.data);
} catch (error) { } catch (error) {
console.log(error); console.log(error);