Showing
8 changed files
with
262 additions
and
225 deletions
@@ -70,14 +70,13 @@ exports.intro = (req, res) => { | @@ -70,14 +70,13 @@ exports.intro = (req, res) => { | ||
70 | */ | 70 | */ |
71 | exports.preference = (req, res) => { | 71 | exports.preference = (req, res) => { |
72 | preference({ | 72 | preference({ |
73 | - productskn: req.params.productskn, | ||
74 | - yhchannel: req.params.yhchannel, | ||
75 | - brandId: req.params.brandId | 73 | + productskn: req.query.productSkn, |
74 | + yhchannel: 1, | ||
75 | + brandId: req.query.brandId | ||
76 | }).then((result) => { | 76 | }).then((result) => { |
77 | - res.render('detail/preference', { | ||
78 | - result: result, | 77 | + res.render('detail/preference', Object.assign({ |
79 | layout: false | 78 | layout: false |
80 | - }); | 79 | + }, result)); |
81 | }); | 80 | }); |
82 | }; | 81 | }; |
83 | 82 |
@@ -288,11 +288,9 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -288,11 +288,9 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
288 | 288 | ||
289 | // 品牌信息 | 289 | // 品牌信息 |
290 | if (origin.brand) { | 290 | if (origin.brand) { |
291 | + let extra = `?productSkn=${origin.erpProductId}&brandId=${origin.brand.id}`; | ||
291 | 292 | ||
292 | - dest.preferenceUrl = helpers.urlFormat('/product/detail/preference', { | ||
293 | - productSkn: origin.erpProductId, | ||
294 | - brandId: origin.brand.id | ||
295 | - }); | 293 | + dest.preferenceUrl = `/product/detail/preference${extra}`; |
296 | } | 294 | } |
297 | 295 | ||
298 | dest.productSkn = origin.erpProductId; | 296 | dest.productSkn = origin.erpProductId; |
@@ -7,12 +7,41 @@ | @@ -7,12 +7,41 @@ | ||
7 | 7 | ||
8 | 'use strict'; | 8 | 'use strict'; |
9 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | -const productProcess = require(`${global.utils}/product-process`); | ||
11 | 10 | ||
12 | const api = global.yoho.API; | 11 | const api = global.yoho.API; |
12 | +const helpers = global.yoho.helpers; | ||
13 | + | ||
14 | +const _formatProduct = (data) => { | ||
15 | + let list = []; | ||
16 | + | ||
17 | + _.forEach(data, function(value) { | ||
18 | + if (!value.product_skn || !value.goods_list || !value.goods_list.length) { | ||
19 | + return; | ||
20 | + } | ||
21 | + value.goodsId = value.goods_list[0].goods_id; | ||
22 | + | ||
23 | + let goods = { | ||
24 | + salePrice: value.sales_price ? value.sales_price : '', | ||
25 | + price: value.market_price ? value.market_price : '', | ||
26 | + url: helpers.urlFormat(`/product/pro_${value.product_id}_${value.goodsId}/${value.cn_alphabet}.html`), | ||
27 | + thumb: value.default_images, | ||
28 | + name: value.product_name | ||
29 | + | ||
30 | + }; | ||
31 | + | ||
32 | + // 市场价和售价一样,则不显示市场价 | ||
33 | + if (goods.salePrice === goods.price) { | ||
34 | + goods.price = false; | ||
35 | + } | ||
36 | + | ||
37 | + list.push(goods); | ||
38 | + }); | ||
39 | + | ||
40 | + return list; | ||
41 | +}; | ||
13 | 42 | ||
14 | module.exports = (data) => { | 43 | module.exports = (data) => { |
15 | - let finalResult; | 44 | + let finalResult = {}; |
16 | 45 | ||
17 | return api.get('', { | 46 | return api.get('', { |
18 | method: 'h5.preference.Search', | 47 | method: 'h5.preference.Search', |
@@ -20,9 +49,8 @@ module.exports = (data) => { | @@ -20,9 +49,8 @@ module.exports = (data) => { | ||
20 | yhchannel: data.yhchannel, | 49 | yhchannel: data.yhchannel, |
21 | brandId: data.brandId | 50 | brandId: data.brandId |
22 | }).then(result => { | 51 | }).then(result => { |
23 | - if (!_.isEmpty(result) && result.code === 200) { | ||
24 | - // 为你优选数据处理,接口没有数据,待处理,待验证 | ||
25 | - finalResult = productProcess.processProductList(result.data); | 52 | + if (result) { |
53 | + finalResult.recommendList = _formatProduct(result); | ||
26 | } | 54 | } |
27 | 55 | ||
28 | return finalResult; | 56 | return finalResult; |
1 | +<div class="title">为您优选新品</div> | ||
2 | +<div id="swiper-recommend" class="swiper-container"> | ||
3 | + <div class="swiper-wrapper swiper-wrapper-recommend"> | ||
4 | + {{# recommendList}} | ||
5 | + <a class="swiper-slide" href="{{url}}"> | ||
6 | + <img class="swiper-lazy img-box" data-src="{{image thumb 299 388}}"> | ||
7 | + <div class="sale-name"> | ||
8 | + {{name}} | ||
9 | + </div> | ||
10 | + <div class="price"> | ||
11 | + <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span> | ||
12 | + {{#price}}<span class="old-price">¥{{.}}</span>{{/price}} | ||
13 | + </div> | ||
14 | + <div class="swiper-lazy-preloader"></div> | ||
15 | + </a> | ||
16 | + {{/ recommendList}} | ||
17 | + </div> | ||
18 | +</div> |
@@ -256,203 +256,3 @@ | @@ -256,203 +256,3 @@ | ||
256 | margin-top: 20px; | 256 | margin-top: 20px; |
257 | } | 257 | } |
258 | } | 258 | } |
259 | - | ||
260 | -.good-detail-page { | ||
261 | - .feedback-list { | ||
262 | - padding-top: 30px; | ||
263 | - margin-bottom: 30px; | ||
264 | - background-color: #f0f0f0; | ||
265 | - | ||
266 | - .nav-tab { | ||
267 | - width: 100%; | ||
268 | - height: 60px; | ||
269 | - padding: 10px 0; | ||
270 | - background-color: #fff; | ||
271 | - border-top: 1px solid $borderC; | ||
272 | - border-bottom: 1px solid $borderC; | ||
273 | - } | ||
274 | - | ||
275 | - .comment-nav, | ||
276 | - .consult-nav { | ||
277 | - box-sizing: border-box; | ||
278 | - float: left; | ||
279 | - width: 50%; | ||
280 | - height: 60px; | ||
281 | - line-height: 60px; | ||
282 | - font-size: 28px; | ||
283 | - text-align: center; | ||
284 | - color: $subFontC; | ||
285 | - | ||
286 | - &.focus { | ||
287 | - color: #000; | ||
288 | - } | ||
289 | - } | ||
290 | - | ||
291 | - .comment-nav { | ||
292 | - border-right: 1px solid #ccc; | ||
293 | - } | ||
294 | - | ||
295 | - .content-main { | ||
296 | - background-color: #fff; | ||
297 | - border-bottom: 1px solid $borderC; | ||
298 | - } | ||
299 | - | ||
300 | - .content-main.comment-content-main { | ||
301 | - .user-name { | ||
302 | - font-size: 24px; | ||
303 | - line-height: 62px; | ||
304 | - color: $mainFontC; | ||
305 | - padding-left: 28px; | ||
306 | - padding-right: 18px; | ||
307 | - } | ||
308 | - | ||
309 | - .goods-spec, | ||
310 | - .comment-time { | ||
311 | - font-size: 24px; | ||
312 | - line-height: 62px; | ||
313 | - } | ||
314 | - | ||
315 | - .detail-content { | ||
316 | - font-size: 24px; | ||
317 | - line-height: 62px; | ||
318 | - color: $mainFontC; | ||
319 | - padding-left: 28px; | ||
320 | - padding-right: 18px; | ||
321 | - } | ||
322 | - | ||
323 | - .goods-spec, | ||
324 | - .comment-time { | ||
325 | - font-size: 24px; | ||
326 | - line-height: 62px; | ||
327 | - } | ||
328 | - | ||
329 | - .detail-content { | ||
330 | - font-size: 28px; | ||
331 | - line-height: 36px; | ||
332 | - } | ||
333 | - | ||
334 | - .goods-spec, | ||
335 | - .detail-content { | ||
336 | - color: $mainFontC; | ||
337 | - } | ||
338 | - | ||
339 | - .detail-content, | ||
340 | - .comment-time { | ||
341 | - padding-left: 28px; | ||
342 | - } | ||
343 | - | ||
344 | - .detail-content { | ||
345 | - padding-right: 28px; | ||
346 | - padding-left: 28px; | ||
347 | - } | ||
348 | - | ||
349 | - .detail-content { | ||
350 | - padding-right: 28px; | ||
351 | - } | ||
352 | - | ||
353 | - .comment-time { | ||
354 | - color: #c1c1c1; | ||
355 | - } | ||
356 | - } | ||
357 | - | ||
358 | - .content-main.consult-content-main { | ||
359 | - padding-right: 28px; | ||
360 | - padding-left: 28px; | ||
361 | - padding-top: 20px; | ||
362 | - padding-bottom: 20px; | ||
363 | - | ||
364 | - .question { | ||
365 | - font-size: 24px; | ||
366 | - color: $mainFontC; | ||
367 | - | ||
368 | - span { | ||
369 | - display: block; | ||
370 | - float: left; | ||
371 | - font-size: inherit; | ||
372 | - padding-right: 15px; | ||
373 | - } | ||
374 | - | ||
375 | - p { | ||
376 | - overflow: hidden; | ||
377 | - } | ||
378 | - } | ||
379 | - | ||
380 | - .time { | ||
381 | - font-size: 22px; | ||
382 | - color: $subFontC; | ||
383 | - } | ||
384 | - | ||
385 | - .answer { | ||
386 | - font-size: 24px; | ||
387 | - line-height: 36px; | ||
388 | - color: $subFontC; | ||
389 | - margin-top: 14px; | ||
390 | - | ||
391 | - span { | ||
392 | - display: block; | ||
393 | - float: left; | ||
394 | - font-size: inherit; | ||
395 | - color: $mainFontC; | ||
396 | - padding-right: 15px; | ||
397 | - } | ||
398 | - | ||
399 | - p { | ||
400 | - overflow: hidden; | ||
401 | - } | ||
402 | - } | ||
403 | - } | ||
404 | - | ||
405 | - .content-main.no-item { | ||
406 | - height: 200px; | ||
407 | - line-height: 200px; | ||
408 | - color: #e0e0e0; | ||
409 | - font-size: 16PX; | ||
410 | - text-align: center; | ||
411 | - | ||
412 | - span { | ||
413 | - display: inline-block; | ||
414 | - font-size: 16PX; | ||
415 | - padding-right: 5PX; | ||
416 | - } | ||
417 | - } | ||
418 | - | ||
419 | - .comment-content-footer, | ||
420 | - .consult-content-footer { | ||
421 | - display: block; | ||
422 | - min-height: 88px; | ||
423 | - text-align: center; | ||
424 | - background-color: #fff; | ||
425 | - border-bottom: 1px solid $borderC; | ||
426 | - line-height: 88px; | ||
427 | - font-size: 28px; | ||
428 | - color: #b0b0b0; | ||
429 | - | ||
430 | - .iconfont { | ||
431 | - font-size: inherit; | ||
432 | - } | ||
433 | - } | ||
434 | - | ||
435 | - .content.hide { | ||
436 | - display: none; | ||
437 | - } | ||
438 | - | ||
439 | - .nodata { | ||
440 | - height: 88px; | ||
441 | - font-size: 28px; | ||
442 | - line-height: 88px; | ||
443 | - background-color: #fff; | ||
444 | - padding: 0 28px; | ||
445 | - border-top: 1px solid $borderC; | ||
446 | - border-bottom: 1px solid $borderC; | ||
447 | - | ||
448 | - .go-consult { | ||
449 | - float: right; | ||
450 | - color: $subFontC; | ||
451 | - | ||
452 | - span { | ||
453 | - font-size: 28px; | ||
454 | - } | ||
455 | - } | ||
456 | - } | ||
457 | - } | ||
458 | -} |
@@ -490,6 +490,203 @@ $basicBtnC: #eb0313; | @@ -490,6 +490,203 @@ $basicBtnC: #eb0313; | ||
490 | } | 490 | } |
491 | } | 491 | } |
492 | 492 | ||
493 | + .feedback-list { | ||
494 | + padding-top: 30px; | ||
495 | + margin-bottom: 30px; | ||
496 | + background-color: #f0f0f0; | ||
497 | + | ||
498 | + .nav-tab { | ||
499 | + width: 100%; | ||
500 | + padding: 10px 0; | ||
501 | + background-color: #fff; | ||
502 | + border-top: 1px solid $borderC; | ||
503 | + border-bottom: 1px solid $borderC; | ||
504 | + } | ||
505 | + | ||
506 | + .comment-nav, | ||
507 | + .consult-nav { | ||
508 | + box-sizing: border-box; | ||
509 | + float: left; | ||
510 | + width: 50%; | ||
511 | + height: 60px; | ||
512 | + line-height: 60px; | ||
513 | + font-size: 28px; | ||
514 | + text-align: center; | ||
515 | + color: $subFontC; | ||
516 | + | ||
517 | + &.focus { | ||
518 | + color: #000; | ||
519 | + } | ||
520 | + } | ||
521 | + | ||
522 | + .comment-nav { | ||
523 | + border-right: 1px solid #ccc; | ||
524 | + } | ||
525 | + | ||
526 | + .content-main { | ||
527 | + background-color: #fff; | ||
528 | + border-bottom: 1px solid $borderC; | ||
529 | + } | ||
530 | + | ||
531 | + .content-main.comment-content-main { | ||
532 | + .user-name { | ||
533 | + font-size: 24px; | ||
534 | + line-height: 62px; | ||
535 | + color: $mainFontC; | ||
536 | + padding-left: 28px; | ||
537 | + padding-right: 18px; | ||
538 | + } | ||
539 | + | ||
540 | + .goods-spec, | ||
541 | + .comment-time { | ||
542 | + font-size: 24px; | ||
543 | + line-height: 62px; | ||
544 | + } | ||
545 | + | ||
546 | + .detail-content { | ||
547 | + font-size: 24px; | ||
548 | + line-height: 62px; | ||
549 | + color: $mainFontC; | ||
550 | + padding-left: 28px; | ||
551 | + padding-right: 18px; | ||
552 | + } | ||
553 | + | ||
554 | + .goods-spec, | ||
555 | + .comment-time { | ||
556 | + font-size: 24px; | ||
557 | + line-height: 62px; | ||
558 | + } | ||
559 | + | ||
560 | + .detail-content { | ||
561 | + font-size: 28px; | ||
562 | + line-height: 36px; | ||
563 | + } | ||
564 | + | ||
565 | + .goods-spec, | ||
566 | + .detail-content { | ||
567 | + color: $mainFontC; | ||
568 | + } | ||
569 | + | ||
570 | + .detail-content, | ||
571 | + .comment-time { | ||
572 | + padding-left: 28px; | ||
573 | + } | ||
574 | + | ||
575 | + .detail-content { | ||
576 | + padding-right: 28px; | ||
577 | + padding-left: 28px; | ||
578 | + } | ||
579 | + | ||
580 | + .detail-content { | ||
581 | + padding-right: 28px; | ||
582 | + } | ||
583 | + | ||
584 | + .comment-time { | ||
585 | + color: #c1c1c1; | ||
586 | + } | ||
587 | + } | ||
588 | + | ||
589 | + .content-main.consult-content-main { | ||
590 | + padding-right: 28px; | ||
591 | + padding-left: 28px; | ||
592 | + padding-top: 20px; | ||
593 | + padding-bottom: 20px; | ||
594 | + | ||
595 | + .question { | ||
596 | + font-size: 24px; | ||
597 | + color: $mainFontC; | ||
598 | + | ||
599 | + span { | ||
600 | + display: block; | ||
601 | + float: left; | ||
602 | + font-size: inherit; | ||
603 | + padding-right: 15px; | ||
604 | + } | ||
605 | + | ||
606 | + p { | ||
607 | + overflow: hidden; | ||
608 | + } | ||
609 | + } | ||
610 | + | ||
611 | + .time { | ||
612 | + font-size: 22px; | ||
613 | + color: $subFontC; | ||
614 | + } | ||
615 | + | ||
616 | + .answer { | ||
617 | + font-size: 24px; | ||
618 | + line-height: 36px; | ||
619 | + color: $subFontC; | ||
620 | + margin-top: 14px; | ||
621 | + | ||
622 | + span { | ||
623 | + display: block; | ||
624 | + float: left; | ||
625 | + font-size: inherit; | ||
626 | + color: $mainFontC; | ||
627 | + padding-right: 15px; | ||
628 | + } | ||
629 | + | ||
630 | + p { | ||
631 | + overflow: hidden; | ||
632 | + } | ||
633 | + } | ||
634 | + } | ||
635 | + | ||
636 | + .content-main.no-item { | ||
637 | + height: 200px; | ||
638 | + line-height: 200px; | ||
639 | + color: #e0e0e0; | ||
640 | + font-size: 16PX; | ||
641 | + text-align: center; | ||
642 | + | ||
643 | + span { | ||
644 | + display: inline-block; | ||
645 | + font-size: 16PX; | ||
646 | + padding-right: 5PX; | ||
647 | + } | ||
648 | + } | ||
649 | + | ||
650 | + .comment-content-footer, | ||
651 | + .consult-content-footer { | ||
652 | + display: block; | ||
653 | + min-height: 88px; | ||
654 | + text-align: center; | ||
655 | + background-color: #fff; | ||
656 | + border-bottom: 1px solid $borderC; | ||
657 | + line-height: 88px; | ||
658 | + font-size: 28px; | ||
659 | + color: #b0b0b0; | ||
660 | + | ||
661 | + .iconfont { | ||
662 | + font-size: inherit; | ||
663 | + } | ||
664 | + } | ||
665 | + | ||
666 | + .content.hide { | ||
667 | + display: none; | ||
668 | + } | ||
669 | + | ||
670 | + .nodata { | ||
671 | + height: 88px; | ||
672 | + font-size: 28px; | ||
673 | + line-height: 88px; | ||
674 | + background-color: #fff; | ||
675 | + padding: 0 28px; | ||
676 | + border-top: 1px solid $borderC; | ||
677 | + border-bottom: 1px solid $borderC; | ||
678 | + | ||
679 | + .go-consult { | ||
680 | + float: right; | ||
681 | + color: $subFontC; | ||
682 | + | ||
683 | + span { | ||
684 | + font-size: 28px; | ||
685 | + } | ||
686 | + } | ||
687 | + } | ||
688 | + } | ||
689 | + | ||
493 | /* | 690 | /* |
494 | 底部固定栏 | 691 | 底部固定栏 |
495 | */ | 692 | */ |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | border-top: 1px solid #e0e0e0; | 3 | border-top: 1px solid #e0e0e0; |
4 | border-bottom: 1px solid #e0e0e0; | 4 | border-bottom: 1px solid #e0e0e0; |
5 | background: #fff; | 5 | background: #fff; |
6 | + font-size: 12px; | ||
6 | 7 | ||
7 | .title { | 8 | .title { |
8 | color: #444; | 9 | color: #444; |
@@ -15,19 +16,15 @@ | @@ -15,19 +16,15 @@ | ||
15 | padding: 30px 0 20px; | 16 | padding: 30px 0 20px; |
16 | width: 100%; | 17 | width: 100%; |
17 | 18 | ||
19 | + .swiper-wrapper { | ||
20 | + padding: 0 30px; | ||
21 | + } | ||
22 | + | ||
18 | .swiper-slide { | 23 | .swiper-slide { |
19 | float: left; | 24 | float: left; |
20 | - padding: 0 10px; | 25 | + margin: 0 10px; |
21 | width: 156px; | 26 | width: 156px; |
22 | 27 | ||
23 | - &:first-child { | ||
24 | - padding-left: 30px; | ||
25 | - } | ||
26 | - | ||
27 | - &:last-child { | ||
28 | - padding-right: 30px; | ||
29 | - } | ||
30 | - | ||
31 | img { | 28 | img { |
32 | width: 100%; | 29 | width: 100%; |
33 | height: 208px; | 30 | height: 208px; |
-
Please register or login to post a comment