detail.vue
10.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<!--
* @description: 二手商品详情
* @fileName: detail.vue
* @author: huzhiming
* @date: 2019-11-21 10:28:52
* @后台人员:
* @version: v1.0.0
* @path: 页面访问路径及参数说明 http://m.yohobuy.com:6001/xianyu/second/product/商品id.html
!-->
<template>
<LayoutApp :show-back="true" title="商品详情" class="second-detail-wrap">
<LayoutScroll
ref="pageScroll"
@scroll-end="false"
:loading="{hide: true, noMore: true}">
<cube-slide ref="slide" v-if="info.imageList" :options="slideOptions" :data="info.imageList">
<cube-slide-item v-for="(item, index) in info.imageList" :key="index">
<image-format
:lazy="false"
alt="图片加载失败"
:src="item"
:width="375"
:height="375"
/>
<div class="pole-dot-area"></div>
</cube-slide-item>
<template slot="dots" slot-scope="props">
<div class="dot-wrap">
<span class="cube-dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots" :key="item">•</span>
</div>
</template>
</cube-slide>
<div class="primary">
<div>
<p class="price">¥{{info.price}} <span v-if="info.newProductPrice">全新¥{{info.newProductPrice}}</span><span class="red" v-if="info.savePrice"> 省¥{{info.savePrice}}</span></p>
<p class="size">{{info.sizeName}}</p>
</div>
<p class="name">{{info.productName}} {{info.colorName}} {{info.productCode}}</p>
</div>
<div class="other-info">
<p>{{info.gender}} {{info.brandName}}</p>
<p>状况:{{ info.shoeQualityDesc }}</p>
<p>鞋盒:{{ info.shoeBoxDesc }}</p>
<p v-show="info.soldTime">售出时间:{{ info.soldTime }}</p>
<p>{{ info.describeInfo }}</p>
</div>
<div class="extra-card" @click="$router.push({name: 'ProductDetail', params: { productId: info.productId } })">
<image-format
:alt="info.image"
:src="info.image"
:width="70"
:height="70"
/>
<div class="middle" @click="'productId'">
<p class="name ellipsis">{{ info.productName }}</p>
<p class="number ellipsis">货号 {{ info.productCode }}</p>
</div>
<span class="iconfont iconright"></span>
</div>
</LayoutScroll>
<div class="fixed-footer">
<cube-button v-if="info.status==1" class="active" @click="buy">购买 <span class="price">¥{{info.price}}</span></cube-button>
<cube-button v-else class="disable">商品已售出</cube-button>
</div>
</LayoutApp>
</template>
<script>
import { Button, Slide } from 'cube-ui';
import { mapState, mapActions } from 'vuex'
import ImgSize from '@/components/img-size';
// const info = {
// "brandName": "NIKE",
// "colorName": "黑色",
// "describeInfo": "ggAir Jordan 4 Retro Motorsport Away BG AJ4 赛车白40839787-002g",
// "gender": "男款",
// "image": "",
// "imageList": [
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/01f5f36a2ce3e935b7481a658466c574af.jpg",
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/0150f24aed5fe9f26df7516c9479ee39c8.jpg",
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/01f247d64097dfadd5d510621e9d69abc3.jpg",
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/01e758d028aeb48d40e656a708488844dc.jpg",
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/017d63f422ee227a6fa519d44d7aa27f7f.jpg",
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/01a15766233785ea70f2fda57e1e906ce4.jpg",
// "http://img11.static.yhbimg.com/goodsimg/2019/11/07/17/01701885a5ca6b7cf8cae2fca6c0e36795.jpg"
// ],
// "price": "99.00",
// "productCode": "TB-011-A-BLK-GLD-49",
// "productId": 10014795,
// "productName": "DXF测试商品",
// "sechondHandTypeName": "二手",
// "shoeBoxDesc": "完好",
// "shoeQualityDesc": "该商品没有明显瑕疵",
// "sizeName": "37 2/3码",
// "soldTime": "2019.03.12",
// "status": 1
// }
export default {
name: 'UfoSecondProductDetail',
mixins: [],
props: {
skup: Number,
yasParams: {
TAB_ID: '',
TAB_NAME: '',
PRD_ID: ''
}
},
// 服务端渲染函数
asyncData({store, router}) {
return store.dispatch('second/fetchDetailById', { skup: router.params.skup });
},
data(){
return {
slideOptions: {
eventPassthrough: 'vertical'
},
// info
}
},
created() {},
mounted() {},
activated() {
this.fetchDetailById({ skup: this.skup })
this.refresh();
/*
[二手商品详情页打开时]
1.FP_NAME:来源页面名称;eg:XY_UFO...
2.FP_PARAM:来源页面参数;搜索关键词,系列ID,品牌ID,商品池ID;
3.TAB_ID:tab切id,1-人气,2-价格,3-新品;
4.TAB_NAME:tab切名称,人气,价格,新品;
5.PRD_ID:商品id;
6.PRD_TYPE:1-二手,2-全新瑕疵;
*/
// let { TAB_ID, TAB_NAME, PRD_ID } = this.yasParams;
console.log(this.yasParams);
this.$store.dispatch('reportYas', {
params: {
appop: 'XY_UFO_PRD_DT_INFO',
param:{
FP_NAME: `XY_UFO${this.yasParams?.P_NAME}`,
FP_PARAM: this.skup,
TAB_ID: this.yasParams?.TAB_ID,
TAB_NAME: this.yasParams?.TAB_NAME,
PRD_ID: this.yasParams?.PRD_ID,
PRD_TYPE: this.info.sechondHandTypeName == '全新瑕疵' ? 2 :1
}
}
});
},
deactivated() {},
// beforeRouteEnter (to, from, next) {},
// beforeRouteUpdate(to, from, next) {},
// beforeRouteLeave(to, from, next) {},
destroyed() {},
methods: {
...mapActions('second',['fetchDetailById']),
refresh() {
this.$refs.slide && this.$refs.slide.refresh && this.$refs.slide.refresh();
},
// 购买
buy() {
/*
新增二手商品订单:二手商品详情页-购买按钮点击
1.P_NAME:页面名称;
2.PRD_ID:商品ID;
3.PRD_SKU:商品SKU;
4.PRD_SIZE:尺码;
5.ORD_TYPE:订单类型;1-出售,2-购买,3-求购,4-变现;5-二手;6-全新瑕疵;
*/
const { sizeName, describeInfo } = this.info;
this.$store.dispatch('reportYas', {
params: {
appop: 'XY_UFO_PRD_DT_BUY_SEL_C',
param:{
P_NAME: `XY_UFO${this.$route.name}`,
PRD_ID: this.yasParams?.pid,
PRD_SIZE: this.info.sizeName,
ORD_TYPE: this.info.sechondHandTypeName == '全新瑕疵' ? 2 :1
}
}
});
this.$router.push({
name: 'OrderBuyConfirm',
query: {
type: 'second',
skup: this.skup
}
});
this.$store.dispatch('reportYas', {
params: {
appop: 'XY_UFO_SECOND_PRD_DT_BUY_C',
param: {
PRD_ID: this.info.productId,
PRD_SKU: this.skup,
PRD_SIZE: this.info.size_name,
ORD_TYPE: this.info.sechondHandTypeName == '全新瑕疵' ? 2 :1
},
},
});
}
},
computed: {
...mapState('second', ['info'])
},
watch: {},
components: {
ImgSize,
'cube-button': Button,
'cube-slide': Slide,
'cube-slide-item': Slide.Item,
}
};
</script>
/* 定义局部样式,添加外围容器,scss嵌套尽量不要超过三层,会影响查找器性能 */
<style rel='stylesheet/scss' lang='scss' scoped>
@import '@/pages/product/product-detail.scss';
.second-detail-wrap {
display: flex;
}
/deep/ .layout-context {
margin-bottom: 130px;
}
.ellipsis {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
/* banner */
.cube-slide {
height: 396px;
max-height: 396px;
/deep/ .cube-slide-dots {
padding: 0;
}
.cube-slide-item {
img {
display: flex;
height: 375px;
min-height: 375px;
max-height: 375px;
margin: 0 auto;
max-width: max-content;
}
}
.pole-dot-area {
width: inherit;
height: 21px;
}
.cube-dot {
display: inline-block;
width: 4px;
height: 4px;
margin: 0 5px;
background: rgba(0, 0, 0, 0.15);
border-radius: 50%;
&.active {
transform-origin: 50% 50%;
transform: scale(1.5);
background: rgba(0, 0, 0, 1);
}
}
}
// product information display
.primary {
margin: 0 40px 40px;
padding: 9px 0 0 0;
border-bottom: 1px solid #eee;
& > div:first-child {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
}
.price {
font-size: 48px;
line-height: 56px;
color: #D0021B;
&::first-letter {
font-size: 36px;
letter-spacing: 2px;
}
& > span {
font-size: 24px;
color: #000;
&.red {
color: #D0021B;
}
}
}
.size {
font-size: 32px;
color: #000;
line-height: 38px;
}
.name {
margin-bottom: 16px;
font-size: 28px;
color: #999;
}
}
// other-info
.other-info {
margin: 0 40px 40px;
color: #000;
font-size: 28px;
& > p:not(:last-child) {
margin-bottom: 5px;
}
}
// extra-card
.extra-card {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 40px 0;
border: 1px solid #f2f2f2;
border-radius: 4px;
.image {
min-width: 140px;
min-height: 140px;
max-width: 140px;
max-height: 140px;
margin: 0 20px;
}
.middle {
flex: 1 1 auto;
display: flex;
flex-direction: column;
justify-content: space-between;
max-width: 420px;
height: 82px;
font-size: 28px;
line-height: 32px;
.number {
font-size: 24px;
color: #999;
line-height: 28px;
}
}
.iconfont {
font-size: 48px;
color: #999;
margin-right: 20px;
}
}
// fixed-footer
.fixed-footer {
position: fixed;
bottom: 0;
display: flex;
width: 100%;
height: 112px;
padding: 16px 30px;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
text-align: center;
background: #fff;
z-index: 5;
@include cube-ufo-btn;
.price {
font-size: 28px;
line-height: 32px;
color: #65AB85;
&::first-letter {
font-size: 20px;
letter-spacing: 2px;
}
}
.disable {
background: #ddd;
color: #999;
border-color: #ddd;
font-size: 32px;
}
}
</style>
/* 定义全局样式,添加外围容器,避免覆盖全局样式, 若不需要,请删除 */
<style rel='stylesheet/scss' lang='scss'>
.second-detail-wrap {}
</style>