-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProductItem.vue
117 lines (116 loc) · 3.12 KB
/
ProductItem.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
<li
v-for="product in productList"
:id="product.id"
:key="product.id"
class="product-item"
>
<a
:id="product.id"
href="javascript:;"
class="likeit"
:class="{ active: product.isLikeActive }"
@click="handleLikeClick"
>{{ product.likeCount }}</a>
<a
href="javascript:"
@click="handleItemClick(product.id, product.type, product.thumbnail, product.name)"
class="product"
>
<span class="thumb crop-out">
<img
:src="product.thumbnail"
alt=""
>
<span :class="[ $isMobile() || isRecommend ? 'badge20' : 'badge26']">
<span :class="['badge', product.type === 'BUY' ? 't-buy' : 't-sell']">{{ product.type === 'BUY' ? '사줘요' : '팔아요' }}</span>
<span
v-if="product.isMatching"
class="badge t-matching flag-usa"
>{{ $t('ML00007') }}</span>
</span>
</span>
<span class="name">{{ product.name }}</span>
<span v-if="!isRecommend">
<span v-if="product.type === 'BUY'">
<span :class="[ $isMobile() ? 'badge20' : 'badge26']">
<span class="badge t-txt">D-{{ product.dueDate }}</span>
<span class="badge t-txt">{{ $t('ML00008', {n: product.matchCount }) }}</span>
</span>
</span>
<span v-else>
<span
class="won"
>{{ product.price }}<span>{{ product.currency }}</span></span>
</span>
</span>
</a>
<a
v-if="!isRecommend"
href="javascript:;"
>
<span :class="[ $isMobile() ? 'badge13' : 'badge16']">
<span class="badge flag-kor">{{ product.towner.townerId }}</span>
</span>
<span class="badge24">
<span v-if="product.towner.badges.length">
<span
v-for="(badge, index) in product.towner.badges"
:key="index"
:class="['badge', `t-${badge.type}`]"
> {{ badge.label }}</span>
</span>
<span v-else>
<!-- 다국어 : 코드 정의 없음 -->
<span class="badge t-nobadge">뱃지를 등록해 보세요</span>
</span>
</span>
</a>
</li>
</template>
<script>
export default {
components: {},
props: {
productList: {
type: Object,
default: () => {
return {
thumbnail: ''
}
}
},
isRecommend: {
type: Boolean,
default: false
},
recentItems: []
},
mounted() {
const recentItems = window.localStorage.getItem('recentItems')
if (this.$isNull(recentItems)) {
window.localStorage.setItem('recentItems', [])
}
},
data() {
return {
isLikeActive: false
}
},
methods: {
handleLikeClick(e) {
e.preventDefault()
e.target.classList.toggle('active')
},
handleItemClick(id, type, thumbnail, name) {
const list = {
id,
type,
src: thumbnail,
name
}
this.$store.commit('SET_ITEMS', list)
}
}
}
</script>