index.vue
6.6 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<template>
<div class="product-list" :class="'terminal'+terminal">
<div class="picListWarp" v-if="componentContent.arrangeType == '横向滑动'">
<div class="picList" v-if="productData.products && productData.products.length>0">
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<swiper class="products-swiper" :options="swiperOption">
<swiper-slide class="products-swiper-slide item" v-for="(item,index) in productData.products" :key="index">
<div class="a-link" @click="jumpProductDetail(item)">
<div class="itemImgBox">
<div class="imgBox">
<el-image
:src="item.image"
fit="contain"></el-image>
</div>
</div>
<div class="text">
<h4 class="h4">{{item.productName}}</h4>
<div class="priceBox">
<span class="discount" v-if="item.originalPrice">¥{{item.originalPrice}}</span>
<dl>
<dt><img src="../../../static/images/group/flag-group.png" alt="拼团价"></dt>
<dd>
¥{{item.price}}
</dd>
</dl>
</div>
</div>
</div>
</swiper-slide>
</swiper>
</div>
</div>
<div v-else class="picList" >
<ul class="clearfix" :class="'imgTextNum' + componentContent.productNum" v-if="productData.products && productData.products.length>0">
<li class="item" v-for="(item,index) in productData.products.slice(0, componentContent.productRowNum * componentContent.productNum)" :key="index">
<div class="a-link" @click="jumpProductDetail(item)">
<div class="itemImgBox">
<div class="imgBox">
<el-image
:src="item.image"
fit="contain"></el-image>
</div>
</div>
<div class="text">
<h4 class="h4">{{item.productName}}</h4>
<div class="priceBox">
<span class="discount" v-if="item.originalPrice">¥{{item.originalPrice}}</span>
<dl>
<dt><img src="../../../static/images/group/flag-group.png" alt="拼团价"></dt>
<dd>
¥{{item.price}}
</dd>
</dl>
</div>
</div>
</div>
</li>
</ul>
</div>
<button v-show="componentContent.showMore" class="btn-more" @click="jumpGroupWorks(productData)">查看全部 <span class="icon iconfont icon-arrow-right"></span></button>
</div>
</template>
<script>
import {commonMixin} from '../mixin'
export default {
mixins: [commonMixin],
data () {
return {
swiperOption: {
slidesPerView: 4, // 显示数量
spaceBetween: 13, // 间隔
autoplay: false, // 可选选项,自动滑动
loop: true,
pagination: {
el: '.group-pagination'
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
}
}
}
}
}
</script>
<style lang="scss" scoped>
.product-list{
padding: 20px 0;
background-color: #fff;
.picListWarp{
width: 1380px;
max-width: 100%;
margin: 0 auto;
position: relative;
}
.picList{
width: 1200px;
max-width: 100%;
margin: 0 auto;
.swiper-button-prev,.swiper-button-next{
width: 50px;
height: 50px;
position: absolute;
cursor:pointer;
top: 140px;
background-repeat: no-repeat;
&:after{
content: '';
}
}
.swiper-button-prev{
left: 0;
background: url('../../../static/images/btn-prev.png');
}
.swiper-button-next{
right: 0;
background: url('../../../static/images/btn-next.png');
}
.a-link{
cursor: pointer;
&:hover{
box-shadow: 3px 4px 20px 0px rgba(186, 186, 186, 0.5);
}
.itemImgBox {
height: auto;
display: flex;
flex-direction: column;
justify-content: center;
.imgBox {
padding-bottom: 100%;
background-color: #cacaca;
position: relative;
.el-image {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
}
}
.text{
padding:25px 20px 17px;
text-align: center;
//height: 180px;
.h4{
font-size: 18px;
line-height: 24px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
color: #333333;
//max-height: 48px;
}
.p{
color: #999;
font-size: 16px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
padding-top: 18px;
position: relative;
margin-top: 8px;
&:after{
position: absolute;
top: 0;
left: 50%;
margin-left: -80px;
width: 160px;
height: 2px;
background: #F0F0F0;
content: '';
}
}
.priceBox {
dl {
display: inline-block;
min-width: 130px;
dt{
float: left;
img{
display: block;
}
}
dd{
border: 1px solid #F3F4F5;
font-size: 25px;
line-height: 34px;
color: #C83732;
margin-left: 57px;
padding: 0 10px;
}
}
span.discount {
display: block;
font-size: 18px;
line-height: 24px;
padding: 15px 0 11px;
color: #ccc;
text-decoration: line-through;
}
}
}
}
ul{
margin: -15px 0 0 -15px;
display: flex;
flex-wrap: wrap;
li{
flex: 0 0 50%;
padding: 15px 0 0 15px;
width: 0;
}
}
.imgTextNum2 {
li {
flex: 0 0 50%;
}
}
.imgTextNum3 {
li {
flex: 0 0 33.33%;
}
}
.imgTextNum4 {
li {
flex: 0 0 25%;
}
}
.imgTextNum5 {
li {
flex: 0 0 20%;
}
}
}
}
.btn-more {
width: 130px;
height: 41px;
border: 2px solid #C5AA7B;
color: #C5AA7B;
font-size: 18px;
background-color: transparent;
margin: 20px auto 0;
display: block;
}
</style>