Showing
12 changed files
with
337 additions
and
155 deletions
@@ -250,6 +250,23 @@ const recommend = (req, res, next) => { | @@ -250,6 +250,23 @@ const recommend = (req, res, next) => { | ||
250 | .catch(next); | 250 | .catch(next); |
251 | }; | 251 | }; |
252 | 252 | ||
253 | +/** | ||
254 | + * 获取套餐 | ||
255 | + */ | ||
256 | +const getPackage = (req, res, next) => { | ||
257 | + let skn = req.query.skn || ''; | ||
258 | + | ||
259 | + if (!skn) { | ||
260 | + return res.json({ | ||
261 | + code: 400, | ||
262 | + message: '服务器错误' | ||
263 | + }); | ||
264 | + } | ||
265 | + service.getPackage(skn) | ||
266 | + .then(result => res.json(result)) | ||
267 | + .catch(next); | ||
268 | +}; | ||
269 | + | ||
253 | module.exports = { | 270 | module.exports = { |
254 | showMain, | 271 | showMain, |
255 | indexHotArea, | 272 | indexHotArea, |
@@ -258,7 +275,8 @@ module.exports = { | @@ -258,7 +275,8 @@ module.exports = { | ||
258 | createConsult, | 275 | createConsult, |
259 | productHeader: detailHeader, | 276 | productHeader: detailHeader, |
260 | detailReturn, | 277 | detailReturn, |
261 | - recommend | 278 | + recommend, |
279 | + getPackage | ||
262 | }; | 280 | }; |
263 | 281 | ||
264 | 282 |
@@ -142,7 +142,7 @@ const getShopRecommendAsync = (skn, page, limit) => { | @@ -142,7 +142,7 @@ const getShopRecommendAsync = (skn, page, limit) => { | ||
142 | */ | 142 | */ |
143 | const getBundleAsync = (skn) => { | 143 | const getBundleAsync = (skn) => { |
144 | return api.get('', { | 144 | return api.get('', { |
145 | - method: 'query.product.bundleSkn', | 145 | + method: 'web.query.bundleSkn', |
146 | product_skn: skn | 146 | product_skn: skn |
147 | }); | 147 | }); |
148 | }; | 148 | }; |
@@ -1542,6 +1542,49 @@ const recommendAsync = (skn, page, limit) => { | @@ -1542,6 +1542,49 @@ const recommendAsync = (skn, page, limit) => { | ||
1542 | })(); | 1542 | })(); |
1543 | }; | 1543 | }; |
1544 | 1544 | ||
1545 | + | ||
1546 | +/** | ||
1547 | + * 获取套餐 | ||
1548 | + */ | ||
1549 | +const getPackage = (skn) => { | ||
1550 | + return co(function * () { | ||
1551 | + let data = yield productAPI.getBundleAsync(skn); | ||
1552 | + let resData = {code: data.code}, | ||
1553 | + packageList = []; | ||
1554 | + | ||
1555 | + if (data.code === 200) { | ||
1556 | + let bundleInfo = data.data.bundleInfo || {}; | ||
1557 | + let productList = data.data.productList || {}; | ||
1558 | + | ||
1559 | + resData.data = { | ||
1560 | + bundleId: bundleInfo.bundleId, | ||
1561 | + salesPrice: bundleInfo.salesPrice, | ||
1562 | + pkgPrice: bundleInfo.discountPrice, | ||
1563 | + savePrice: (bundleInfo.salesPrice - bundleInfo.discountPrice).toFixed(2) | ||
1564 | + }; | ||
1565 | + _.forEach(productList, function(value) { | ||
1566 | + // sku商品信息 | ||
1567 | + let skuData = _getSkuDataByProductBaseInfo(value); | ||
1568 | + | ||
1569 | + let pkgData = { | ||
1570 | + skn: value.product_skn, | ||
1571 | + url: helpers.urlFormat(url.parse(value.product_url).pathname, null, 'item'), | ||
1572 | + src: value.default_images, | ||
1573 | + productName: value.product_name, | ||
1574 | + productPrice: value.sales_price, | ||
1575 | + colors: skuData.skuGoods | ||
1576 | + }; | ||
1577 | + | ||
1578 | + packageList.push(pkgData); | ||
1579 | + }); | ||
1580 | + | ||
1581 | + resData.data.packageData = packageList; | ||
1582 | + } | ||
1583 | + | ||
1584 | + return resData; | ||
1585 | + })(); | ||
1586 | +}; | ||
1587 | + | ||
1545 | module.exports = { | 1588 | module.exports = { |
1546 | getShareOrderListAsync: commentService.getShareOrderListAsync, // 获取评论列表 | 1589 | getShareOrderListAsync: commentService.getShareOrderListAsync, // 获取评论列表 |
1547 | indexConsultAsync: consultService.indexAsync, // 获取咨询列表 | 1590 | indexConsultAsync: consultService.indexAsync, // 获取咨询列表 |
@@ -1551,5 +1594,6 @@ module.exports = { | @@ -1551,5 +1594,6 @@ module.exports = { | ||
1551 | saveRecentGoodInCookies, // 保存最近的商品 | 1594 | saveRecentGoodInCookies, // 保存最近的商品 |
1552 | getDetailHeader, | 1595 | getDetailHeader, |
1553 | saleReturn, | 1596 | saleReturn, |
1554 | - recommendAsync | 1597 | + recommendAsync, |
1598 | + getPackage | ||
1555 | }; | 1599 | }; |
@@ -67,6 +67,7 @@ router.get('/detail/return', detail.detailReturn);// 特殊商品退换货 | @@ -67,6 +67,7 @@ router.get('/detail/return', detail.detailReturn);// 特殊商品退换货 | ||
67 | router.get('/detail/recommend', detail.recommend);// 推荐商品 | 67 | router.get('/detail/recommend', detail.recommend);// 推荐商品 |
68 | router.get('/index/isfav', favorite.isFavoriteBrand);// 品牌收藏状态 | 68 | router.get('/index/isfav', favorite.isFavoriteBrand);// 品牌收藏状态 |
69 | router.get('/detail/coupon', auth, coupon.acquire); // 获得优惠券 | 69 | router.get('/detail/coupon', auth, coupon.acquire); // 获得优惠券 |
70 | +router.get('/detail/getPacakge', detail.getPackage);// 获取套餐 | ||
70 | 71 | ||
71 | // 搜索 | 72 | // 搜索 |
72 | router.get('/search/index', search.index); | 73 | router.get('/search/index', search.index); |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | 35 | ||
36 | <div id="size-title-json" style="display:none;">{{sizeTitleJson}}</div> | 36 | <div id="size-title-json" style="display:none;">{{sizeTitleJson}}</div> |
37 | <div class="total-content"> | 37 | <div class="total-content"> |
38 | - {{> product/package}} | 38 | + <div id="package" class="package-box clearfix"></div> |
39 | <div class="other-infos"> | 39 | <div class="other-infos"> |
40 | 40 | ||
41 | <div class="description-material info-block getnav" id="goodsMessage" data-id="0"> | 41 | <div class="description-material info-block getnav" id="goodsMessage" data-id="0"> |
@@ -373,8 +373,9 @@ | @@ -373,8 +373,9 @@ | ||
373 | 373 | ||
374 | </div> | 374 | </div> |
375 | <div class="common-question buy-consults"> | 375 | <div class="common-question buy-consults"> |
376 | - <p>购买咨询 (4)</p> | 376 | + <p>购买咨询 (<em class="consult-num">0</em>)</p> |
377 | </div> | 377 | </div> |
378 | + <div id="consults-ul"> | ||
378 | <div class="common-question"> | 379 | <div class="common-question"> |
379 | <p> | 380 | <p> |
380 | <span class="top-question"> | 381 | <span class="top-question"> |
@@ -417,9 +418,9 @@ | @@ -417,9 +418,9 @@ | ||
417 | </div> | 418 | </div> |
418 | </div> | 419 | </div> |
419 | </div> | 420 | </div> |
421 | + </div> | ||
420 | <div class="common-question"> | 422 | <div class="common-question"> |
421 | <p> | 423 | <p> |
422 | - | ||
423 | <span> | 424 | <span> |
424 | <i class="iconfont"></i><small class="leave-message"> | 425 | <i class="iconfont"></i><small class="leave-message"> |
425 | 客服留言: 感谢你的咨询,YOHO潮流网站双十一期间服装五折抢购 | 426 | 客服留言: 感谢你的咨询,YOHO潮流网站双十一期间服装五折抢购 |
@@ -430,7 +431,9 @@ | @@ -430,7 +431,9 @@ | ||
430 | 431 | ||
431 | </div> | 432 | </div> |
432 | </div> | 433 | </div> |
434 | + <div class="consults-devide"> | ||
433 | 435 | ||
436 | + </div> | ||
434 | <div class="common-question"> | 437 | <div class="common-question"> |
435 | <textarea id="textbox"></textarea> | 438 | <textarea id="textbox"></textarea> |
436 | <span id="submit-consult" class="btn">提交咨询</span> | 439 | <span id="submit-consult" class="btn">提交咨询</span> |
@@ -553,47 +556,3 @@ | @@ -553,47 +556,3 @@ | ||
553 | })(); | 556 | })(); |
554 | </script> | 557 | </script> |
555 | {{/statGoodsInfo}} | 558 | {{/statGoodsInfo}} |
556 | - <script type="text/html" id="packageDialog"> | ||
557 | - <div class="pkgDg-header"> | ||
558 | - <p class="left">潮流搭配</p> | ||
559 | - <span class="pkg-close close right"><i class="iconfont"></i></span> | ||
560 | - </div> | ||
561 | - <div class="pkgDg-prodetal"> | ||
562 | - <div class="pkg-product clearfix"> | ||
563 | - <a href="#" class="pkg-proImg"><img src="//img12.static.yhbimg.com/goodsimg/2016/11/02/14/0293f6afc458261c612853b2fb371c9a7a.jpg?imageMogr2/thumbnail/75x100/extent/75x100/background/d2hpdGU=/position/center/quality/90" class="pro-img"/></a> | ||
564 | - <div class="type-chose"> | ||
565 | - <div class="chose-color row clearfix"> | ||
566 | - <span class="title pull-left">颜 色:</span> | ||
567 | - <ul class="colors pull-left clearfix"> | ||
568 | - <li class="focus pull-left" title="Reshake 男款logo刺绣织带装饰棉服外套 黑色" data-color="黑色" data-total="10"> | ||
569 | - <img src="//img12.static.yhbimg.com/goodsimg/2016/11/02/14/0293f6afc458261c612853b2fb371c9a7a.jpg?imageMogr2/thumbnail/40x40/extent/40x40/background/d2hpdGU=/position/center/quality/90"><span class="color-name">黑色</span> | ||
570 | - </li> | ||
571 | - </ul> | ||
572 | - </div> | ||
573 | - <div class="chose-size row clearfix"> | ||
574 | - <span class="title pull-left"> 尺 码: </span> | ||
575 | - | ||
576 | - <div id="sizes" class="size-wrapper pull-left"> | ||
577 | - <ul class="size"> | ||
578 | - <li data-sku="1848512" data-num="1" data-name="46" data-title="">46</li> | ||
579 | - <li data-sku="1848514" data-num="4" data-name="48" data-title="">48</li> | ||
580 | - <li data-sku="1848516" data-num="4" data-name="50" data-title="">50</li> | ||
581 | - <li data-sku="1848518" data-num="1" data-name="52" data-title="">52</li> | ||
582 | - | ||
583 | - <span class="size-warn warn-tip hide"> <i class="iconfont"></i> 请选择尺码 </span> | ||
584 | - </ul> | ||
585 | - | ||
586 | - <p class="color-size-tip hide"></p> | ||
587 | - </div> | ||
588 | - </div> | ||
589 | - <div class="chose-done">您已选择:<span>“黑色”</span><span>“M码”</span></div> | ||
590 | - </div> | ||
591 | - </div> | ||
592 | - </div> | ||
593 | - <div class="pkgDg-footer clearfix"> | ||
594 | - <p class="totalMoney left">合计:<em>¥138.00</em></p> | ||
595 | - <span class="buy-product red-color right"> | ||
596 | - <em>立即购买</em> | ||
597 | - </span> | ||
598 | - </div> | ||
599 | - </script> |
1 | -<div class="package-box clearfix"> | ||
2 | - <div class="title-header">优惠套装</div> | ||
3 | - <div class="package-pro clearfix"> | ||
4 | - <div class="good-info" data-skn="" data-from=""> | ||
5 | - <div class="good-detail-img"> | ||
6 | - <a class="good-thumb" href="" target="_blank"> | ||
7 | - <img class="lazy" src="//img11.static.yhbimg.com/goodsimg/2016/11/24/14/012a2e26bd48f26654cbbe724280cd29d9.jpg?imageMogr2/thumbnail/280x382/extent/280x382/background/d2hpdGU=/position/center/quality/90" style="display: block;"> | ||
8 | - </a> | ||
9 | - </div> | ||
10 | - <div class="good-detail-text stu-good-detail "> | ||
11 | - <a href="" target="_blank">PALLADIUM Pampa Cuff WP Lux 男 高帮牛皮防水休闲鞋</a> | ||
12 | - <p class="price "> | ||
13 | - <span class="sale-price red-color"> | ||
14 | - ¥1078.20 | ||
15 | - </span> | ||
16 | - </p> | ||
17 | - </div> | ||
18 | - </div> | ||
19 | - <div class="spliter">+</div> | ||
20 | - <div class="good-info" data-skn="" data-from=""> | ||
21 | - <div class="good-detail-img"> | ||
22 | - <a class="good-thumb" href="" target="_blank"> | ||
23 | - <img class="lazy" src="//img11.static.yhbimg.com/goodsimg/2016/11/24/14/012a2e26bd48f26654cbbe724280cd29d9.jpg?imageMogr2/thumbnail/280x382/extent/280x382/background/d2hpdGU=/position/center/quality/90" style="display: block;"> | ||
24 | - </a> | ||
25 | - </div> | ||
26 | - <div class="good-detail-text stu-good-detail "> | ||
27 | - <a href="" target="_blank">PALLADIUM Pampa Cuff WP Lux 男 高帮牛皮防水休闲鞋</a> | ||
28 | - <p class="price "> | ||
29 | - <span class="sale-price red-color"> | ||
30 | - ¥1078.20 | ||
31 | - </span> | ||
32 | - </p> | ||
33 | - </div> | ||
34 | - </div> | ||
35 | - <div class="spliter">+</div> | ||
36 | - <div class="good-info" data-skn="" data-from=""> | ||
37 | - <div class="good-detail-img"> | ||
38 | - <a class="good-thumb" href="" target="_blank"> | ||
39 | - <img class="lazy" src="//img11.static.yhbimg.com/goodsimg/2016/11/24/14/012a2e26bd48f26654cbbe724280cd29d9.jpg?imageMogr2/thumbnail/280x382/extent/280x382/background/d2hpdGU=/position/center/quality/90" style="display: block;"> | ||
40 | - </a> | ||
41 | - </div> | ||
42 | - <div class="good-detail-text stu-good-detail "> | ||
43 | - <a href="" target="_blank">PALLADIUM Pampa Cuff WP Lux 男 高帮牛皮防水休闲鞋</a> | ||
44 | - <p class="price "> | ||
45 | - <span class="sale-price red-color"> | ||
46 | - ¥1078.20 | ||
47 | - </span> | ||
48 | - </p> | ||
49 | - </div> | ||
50 | - </div> | ||
51 | - <div class="spliter">+</div> | ||
52 | - <div class="good-info" data-skn="" data-from=""> | ||
53 | - <div class="good-detail-img"> | ||
54 | - <a class="good-thumb" href="" target="_blank"> | ||
55 | - <img class="lazy" src="//img11.static.yhbimg.com/goodsimg/2016/11/24/14/012a2e26bd48f26654cbbe724280cd29d9.jpg?imageMogr2/thumbnail/280x382/extent/280x382/background/d2hpdGU=/position/center/quality/90" style="display: block;"> | ||
56 | - </a> | ||
57 | - </div> | ||
58 | - <div class="good-detail-text stu-good-detail "> | ||
59 | - <a href="" target="_blank">PALLADIUM Cuff WP Lux 男 高帮牛皮防水休闲鞋</a> | ||
60 | - <p class="price "> | ||
61 | - <span class="sale-price red-color"> | ||
62 | - ¥1078.20 | ||
63 | - </span> | ||
64 | - </p> | ||
65 | - </div> | ||
66 | - </div> | ||
67 | - <div class="spliter">=</div> | ||
68 | - <div class="package-priceList"> | ||
69 | - <p>销售价:<em class="sale-price">¥633.00</em></p> | ||
70 | - <p>套餐价:<em class="package-price red-color">¥520.00</em></p> | ||
71 | - <p class="save-text red-color">立省<em class="save-price">¥113.00</em>元</p> | ||
72 | - <span id="buy-detail" class="buy-product red-color"> | ||
73 | - <em>立即购买</em> | ||
74 | - </span> | ||
75 | - </div> | ||
76 | - </div> | ||
77 | -</div> |
1 | -{{# consults}} | 1 | +<!-- {{# consults}} |
2 | <li> | 2 | <li> |
3 | <div class="user-info clearfix"> | 3 | <div class="user-info clearfix"> |
4 | <img class="user-avatar" src="{{avatar}}"> | 4 | <img class="user-avatar" src="{{avatar}}"> |
@@ -10,4 +10,25 @@ | @@ -10,4 +10,25 @@ | ||
10 | </div> | 10 | </div> |
11 | <p class="consult">{{answer}}</p> | 11 | <p class="consult">{{answer}}</p> |
12 | </li> | 12 | </li> |
13 | +{{/ consults}} --> | ||
14 | +{{# consults}} | ||
15 | + <div class="common-question"> | ||
16 | + <p> | ||
17 | + <span class="top-question"> | ||
18 | + <i class="iconfont"></i> | ||
19 | + <small>183****3432 {{question}}</small> | ||
20 | + <small class="right-time">{{date}}</small> | ||
21 | + </span> | ||
22 | + <span> | ||
23 | + <i class="iconfont"></i> | ||
24 | + {{answer}} | ||
25 | + </span> | ||
26 | + </p> | ||
27 | + <div class="common-zan"> | ||
28 | + <div class="zan-content"> | ||
29 | + <span class="icon-border"><i class="iconfont getzan"></i>赞(5)</span> | ||
30 | + <span><i class="iconfont"></i>有用(5)</span> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + </div> | ||
13 | {{/ consults}} | 34 | {{/ consults}} |
public/hbs/product/package-dialog.hbs
0 → 100644
1 | +<div class="pkgDg-header"> | ||
2 | + <p class="left">潮流搭配</p> | ||
3 | + <span class="pkg-close close right"><i class="iconfont"></i></span> | ||
4 | +</div> | ||
5 | +<div class="pkgDg-prodetal"> | ||
6 | + {{#packageData}} | ||
7 | + <div class="pkg-product clearfix"> | ||
8 | + <a href="{{url}}" class="pkg-proImg"><img src="{{image src 85 109}}" class="pro-img"/></a> | ||
9 | + <div class="type-chose"> | ||
10 | + <div class="chose-color row clearfix"> | ||
11 | + <span class="title pull-left">颜 色:</span> | ||
12 | + <ul class="pkg-colors colors pull-left clearfix"> | ||
13 | + {{#each colors}} | ||
14 | + <li class="{{#if focus}}focus{{/if}} {{#if disable}}disable{{/if}} pull-left" | ||
15 | + title="{{title}}" data-color="{{name}}" data-total="{{total}}"> | ||
16 | + <img src="{{src}}"><span class="color-name">{{name}}</span> | ||
17 | + </li> | ||
18 | + {{/each}} | ||
19 | + </ul> | ||
20 | + </div> | ||
21 | + <div class="chose-size row clearfix"> | ||
22 | + <span class="title pull-left"> 尺 码: </span> | ||
23 | + | ||
24 | + <div class="pkg-sizes size-wrapper pull-left"> | ||
25 | + {{> pkg-size}} | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + <div class="chose-done">您已选择: | ||
29 | + <span class="pkg-color">“黑色”</span> | ||
30 | + <span class="pkg-size"></span> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | + {{/packageData}} | ||
35 | +</div> | ||
36 | +<div class="pkgDg-footer clearfix"> | ||
37 | + <p class="totalMoney left">合计:<em>¥{{pkgPrice}}</em></p> | ||
38 | + <span id="pay-pkg" class="buy-product red-color right"> | ||
39 | + <em>立即购买</em> | ||
40 | + </span> | ||
41 | +</div> |
public/hbs/product/package.hbs
0 → 100644
1 | +<div class="title-header">优惠套装</div> | ||
2 | +<div id="package-pro" class="package-pro clearfix" data-skn="{{bundleId}}"> | ||
3 | + {{#packageData}} | ||
4 | + <div class="good-info" data-skn="{{skn}}"> | ||
5 | + <div class="good-detail-img"> | ||
6 | + <a class="good-thumb" href="{{url}}" target="_blank"> | ||
7 | + <img class="lazy" src="{{image src 100 135}}" style="display: block;"> | ||
8 | + </a> | ||
9 | + </div> | ||
10 | + <div class="good-detail-text stu-good-detail "> | ||
11 | + <a href="{{url}}" target="_blank">{{productName}}</a> | ||
12 | + <p class="price "> | ||
13 | + <span class="sale-price red-color"> | ||
14 | + ¥{{productPrice}} | ||
15 | + </span> | ||
16 | + </p> | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + <div class="spliter">{{#if @last}}={{/if}}{{#unless @last}}+{{/unless}}</div> | ||
20 | + {{/packageData}} | ||
21 | + <div class="package-priceList"> | ||
22 | + <p>销售价:<em class="sale-price">¥{{salesPrice}}</em></p> | ||
23 | + <p>套餐价:<em class="package-price red-color">¥{{pkgPrice}}</em></p> | ||
24 | + <p class="save-text red-color">立省<em class="save-price">¥{{savePrice}}</em>元</p> | ||
25 | + <span id="buy-detail" class="buy-product red-color"> | ||
26 | + <em>立即购买</em> | ||
27 | + </span> | ||
28 | + </div> | ||
29 | +</div> |
public/hbs/product/pkg-size.hbs
0 → 100644
1 | +{{#each colors}} | ||
2 | + <ul class="size{{#unless focus}} hide{{/unless}}"> | ||
3 | + {{#each size}} | ||
4 | + <li {{#unless num}}class="disable"{{/unless}} data-sku="{{sku}}" | ||
5 | + data-num="{{num}}" data-name="{{name}}" data-title="{{title}}">{{name}}</li> | ||
6 | + {{/each}} | ||
7 | + | ||
8 | + <span class="size-warn warn-tip hide"> <i class="iconfont"></i> 请选择尺码 </span> | ||
9 | + </ul> | ||
10 | +{{/each}} |
@@ -14,12 +14,13 @@ var $ = require('yoho-jquery'); | @@ -14,12 +14,13 @@ var $ = require('yoho-jquery'); | ||
14 | var lazyLoad = require('yoho-jquery-lazyload'); | 14 | var lazyLoad = require('yoho-jquery-lazyload'); |
15 | var yas = require('../common/data-yas'); | 15 | var yas = require('../common/data-yas'); |
16 | var dataLazyLoad = require('../plugins/lazy-load')(document); | 16 | var dataLazyLoad = require('../plugins/lazy-load')(document); |
17 | -var handlebars = require('yoho-handlebars'); | ||
18 | var setPager = require('./detail/pager'); | 17 | var setPager = require('./detail/pager'); |
19 | 18 | ||
20 | var bindEvent = $.Callbacks(); // eslint-disable-line | 19 | var bindEvent = $.Callbacks(); // eslint-disable-line |
21 | var clickAcquireCouponEvent = $.Callbacks('unique'); // eslint-disable-line | 20 | var clickAcquireCouponEvent = $.Callbacks('unique'); // eslint-disable-line |
22 | 21 | ||
22 | +var Dialog = require('../common/dialog').Dialog; | ||
23 | + | ||
23 | var $main = $('.main'), | 24 | var $main = $('.main'), |
24 | id = $main.data('id'), | 25 | id = $main.data('id'), |
25 | md5 = $main.data('md5'), | 26 | md5 = $main.data('md5'), |
@@ -50,6 +51,9 @@ var $saleReturn = $('#saleReturn'); | @@ -50,6 +51,9 @@ var $saleReturn = $('#saleReturn'); | ||
50 | 51 | ||
51 | var dialogTpl = require('hbs/product/coupon-dialog.hbs'); | 52 | var dialogTpl = require('hbs/product/coupon-dialog.hbs'); |
52 | 53 | ||
54 | +var $goodsIdArr = []; | ||
55 | + | ||
56 | +var pkgData;// 套餐数据 | ||
53 | var notifyTpl = require('hbs/product/notify.hbs'); | 57 | var notifyTpl = require('hbs/product/notify.hbs'); |
54 | 58 | ||
55 | var $goodsIdArr = [], | 59 | var $goodsIdArr = [], |
@@ -66,9 +70,6 @@ function isEmpty(el) { | @@ -66,9 +70,6 @@ function isEmpty(el) { | ||
66 | require('../plugins/slider'); | 70 | require('../plugins/slider'); |
67 | require('../common/center-slider'); | 71 | require('../common/center-slider'); |
68 | 72 | ||
69 | -// handlebars模板 | ||
70 | -pkgFn = handlebars.compile($('#packageDialog').html() || ''); | ||
71 | - | ||
72 | bindEvent.add(function() { | 73 | bindEvent.add(function() { |
73 | var $imgShow = $('#img-show'), | 74 | var $imgShow = $('#img-show'), |
74 | $thumbs = $('#thumbs > .thumb-wrap'); | 75 | $thumbs = $('#thumbs > .thumb-wrap'); |
@@ -225,7 +226,7 @@ bindEvent.add(function() { | @@ -225,7 +226,7 @@ bindEvent.add(function() { | ||
225 | move(e); | 226 | move(e); |
226 | }); | 227 | }); |
227 | 228 | ||
228 | - //促销弹出框 | 229 | + // 促销弹出框 |
229 | var icon = { | 230 | var icon = { |
230 | unfold: '', | 231 | unfold: '', |
231 | fold: '' | 232 | fold: '' |
@@ -631,17 +632,6 @@ bindEvent.add(function() { | @@ -631,17 +632,6 @@ bindEvent.add(function() { | ||
631 | } | 632 | } |
632 | }); | 633 | }); |
633 | 634 | ||
634 | - // 套餐 | ||
635 | - $('#buy-detail').click(function() { | ||
636 | - var opt = { | ||
637 | - className: 'pkg-dialog', | ||
638 | - closeIcon: false, | ||
639 | - content: pkgFn({msg: '测试信息!'}) | ||
640 | - }; | ||
641 | - | ||
642 | - new Dialog(opt).show(); | ||
643 | - }); | ||
644 | - | ||
645 | // 继续购物 | 635 | // 继续购物 |
646 | $('#keep-shopping').click(function() { | 636 | $('#keep-shopping').click(function() { |
647 | $('#type-chose').slideDown(SLIDETIME); | 637 | $('#type-chose').slideDown(SLIDETIME); |
@@ -872,10 +862,6 @@ $('#brand-favour').click(function() { | @@ -872,10 +862,6 @@ $('#brand-favour').click(function() { | ||
872 | // $modelContent.slideDown(SLIDETIME); | 862 | // $modelContent.slideDown(SLIDETIME); |
873 | // } | 863 | // } |
874 | // }); | 864 | // }); |
875 | -// 详情页套餐区 | ||
876 | -$('.good-info .good-detail-text > a').dotdotdot({ | ||
877 | - wrap: 'letter' | ||
878 | -}); | ||
879 | 865 | ||
880 | // 售后服务 | 866 | // 售后服务 |
881 | $('.after-service-switch').click(function() { | 867 | $('.after-service-switch').click(function() { |
@@ -1027,7 +1013,7 @@ function fetchComment() { | @@ -1027,7 +1013,7 @@ function fetchComment() { | ||
1027 | }); | 1013 | }); |
1028 | 1014 | ||
1029 | // 顾客咨询 | 1015 | // 顾客咨询 |
1030 | - function loadConsults() { | 1016 | + function loadConsults(nowPage) { |
1031 | if (loadingConsults) { | 1017 | if (loadingConsults) { |
1032 | return; | 1018 | return; |
1033 | } | 1019 | } |
@@ -1039,11 +1025,11 @@ function fetchComment() { | @@ -1039,11 +1025,11 @@ function fetchComment() { | ||
1039 | url: '/product/detail/consult', | 1025 | url: '/product/detail/consult', |
1040 | data: { | 1026 | data: { |
1041 | productId: id, | 1027 | productId: id, |
1042 | - page: consultPage | 1028 | + page: nowPage |
1043 | } | 1029 | } |
1044 | }).then(function(data) { | 1030 | }).then(function(data) { |
1045 | var res; | 1031 | var res; |
1046 | - | 1032 | + var totalnum; |
1047 | if (data.code === 200) { | 1033 | if (data.code === 200) { |
1048 | res = data.data; | 1034 | res = data.data; |
1049 | 1035 | ||
@@ -1055,16 +1041,35 @@ function fetchComment() { | @@ -1055,16 +1041,35 @@ function fetchComment() { | ||
1055 | // 更新总数显示 | 1041 | // 更新总数显示 |
1056 | $consultNum.text(res[0].total); | 1042 | $consultNum.text(res[0].total); |
1057 | 1043 | ||
1058 | - $consultsUl.append(consultsTpl({ | 1044 | + totalnum = Math.ceil(res[0].total / 10) * 20; |
1045 | + | ||
1046 | + $consultsUl.empty().append(consultsTpl({ | ||
1059 | consults: res | 1047 | consults: res |
1060 | })); | 1048 | })); |
1061 | - consultPage++; | 1049 | + |
1050 | + baseUrl = '/product/detail/consult?productId=' + id + '&filterId=7'; | ||
1051 | + | ||
1052 | + $('.consults-devide').empty().append( | ||
1053 | + setPager({baseUrl: baseUrl, totalRecords: totalnum, page: nowPage, type: 'ellipsis', theme: 'msg-pager'}) | ||
1054 | + ); | ||
1062 | } | 1055 | } |
1063 | }).always(function() { | 1056 | }).always(function() { |
1064 | loadingConsults = false; | 1057 | loadingConsults = false; |
1065 | }); | 1058 | }); |
1066 | } | 1059 | } |
1067 | 1060 | ||
1061 | + $('.consults-devide').on('click', 'a', function() { | ||
1062 | + var $this = $(this); | ||
1063 | + var href = $this.data('page'); | ||
1064 | + var data = href.split('?')[1].split('&'); | ||
1065 | + var result = data.map(function(i) { | ||
1066 | + return i.split('=')[1]; | ||
1067 | + }); | ||
1068 | + loadConsults(result[2]); | ||
1069 | + }); | ||
1070 | + | ||
1071 | + | ||
1072 | + | ||
1068 | $('.consult-comment').on('click', '.load-more', function() { | 1073 | $('.consult-comment').on('click', '.load-more', function() { |
1069 | var $this = $(this); | 1074 | var $this = $(this); |
1070 | 1075 | ||
@@ -1305,6 +1310,118 @@ $('.recommend-slider').on('click', '.img-item', function() { | @@ -1305,6 +1310,118 @@ $('.recommend-slider').on('click', '.img-item', function() { | ||
1305 | 1310 | ||
1306 | window.loadRecommend = loadRecommend; | 1311 | window.loadRecommend = loadRecommend; |
1307 | 1312 | ||
1313 | +// 加载套餐默认信息 | ||
1314 | +$(function() { | ||
1315 | + return $.ajax({ | ||
1316 | + type: 'GET', | ||
1317 | + url: '/product/detail/getPacakge', | ||
1318 | + data: { | ||
1319 | + skn: '51127118' | ||
1320 | + } | ||
1321 | + }).then(function(result) { | ||
1322 | + if (result.code === 200) { | ||
1323 | + var packageTpl = require('hbs/product/package.hbs'); | ||
1324 | + | ||
1325 | + pkgData = result.data; | ||
1326 | + $('#package').html(packageTpl(pkgData)); | ||
1327 | + | ||
1328 | + // 详情页套餐区 | ||
1329 | + $('.good-info .good-detail-text > a').dotdotdot({ | ||
1330 | + wrap: 'letter' | ||
1331 | + }); | ||
1332 | + } | ||
1333 | + }); | ||
1334 | + | ||
1335 | +}); | ||
1336 | + | ||
1337 | +// 套餐点击事件 | ||
1338 | +$('.package-box').on('click', '#buy-detail', function() { | ||
1339 | + var pkgDetailTpl = require('hbs/product/package-dialog.hbs'); | ||
1340 | + var opt = { | ||
1341 | + className: 'pkg-dialog', | ||
1342 | + closeIcon: false, | ||
1343 | + content: pkgDetailTpl(pkgData) | ||
1344 | + }; | ||
1345 | + new Dialog(opt).show(); | ||
1346 | + | ||
1347 | + var $pkSizes = $('.pkg-sizes'), | ||
1348 | + $pkColors = $('.pkg-colors'); | ||
1349 | + | ||
1350 | + // 选择颜色 | ||
1351 | + $pkColors.on('click', 'li', function() { | ||
1352 | + var $this = $(this); | ||
1353 | + var index = $this.index(); | ||
1354 | + var $colorName = $this.find('.color-name'); | ||
1355 | + var $pkType = $this.closest('.type-chose'); | ||
1356 | + var $pkSizesUl = $pkType.find('.pkg-sizes ul'); | ||
1357 | + var $pkgColor = $pkType.find('.chose-done .pkg-color'); | ||
1358 | + var $pkgSize = $pkType.find('.chose-done .pkg-size'); | ||
1359 | + | ||
1360 | + if ($this.hasClass('focus') || $this.hasClass('disable')) { | ||
1361 | + return; | ||
1362 | + } | ||
1363 | + | ||
1364 | + $this.addClass('focus').siblings('.focus').removeClass('focus'); | ||
1365 | + | ||
1366 | + // 取消尺码的选择 | ||
1367 | + $pkSizesUl.find('li').removeClass('focus'); | ||
1368 | + $pkgColor.html('"' + $colorName.html() + '"'); | ||
1369 | + $pkgSize.html(''); | ||
1370 | + | ||
1371 | + $pkSizesUl.addClass('hide').eq(index).removeClass('hide'); | ||
1372 | + }); | ||
1373 | + | ||
1374 | + // 选择尺码 | ||
1375 | + $pkSizes.on('click', 'li', function() { | ||
1376 | + var $this = $(this); | ||
1377 | + var $pkType = $this.closest('.type-chose'); | ||
1378 | + var $pkgSize = $pkType.find('.chose-done .pkg-size'); | ||
1379 | + var $pkgSizeWarn = $pkType.find('.pkg-sizes .size-warn'); | ||
1380 | + | ||
1381 | + if ($this.hasClass('focus') || $this.hasClass('disable')) { | ||
1382 | + return; | ||
1383 | + } | ||
1384 | + | ||
1385 | + $this.addClass('focus').siblings('.focus').removeClass('focus'); | ||
1386 | + | ||
1387 | + $pkgSize.html('"' + $this.html() + '码"'); | ||
1388 | + | ||
1389 | + $pkgSizeWarn.addClass('hide'); | ||
1390 | + }); | ||
1391 | + | ||
1392 | + // 立即购买跳转 | ||
1393 | + $('#pay-pkg').on('click', function() { | ||
1394 | + window.location.href = '//www.yohobuy.com/cart/easypay?bundle=1124&sku=809291,789239'; | ||
1395 | + }); | ||
1396 | +}); | ||
1397 | + | ||
1398 | +// 推荐和浏览切换 | ||
1399 | +// $('.individual-comment').on('click', '.title', function() { | ||
1400 | +// var $this = $(this), | ||
1401 | +// index = $this.index(); | ||
1402 | +// | ||
1403 | +// var $latestWalk = $('.latest-walk'), | ||
1404 | +// $recommendComment = $('#recommend-shop'); | ||
1405 | +// | ||
1406 | +// if ($this.hasClass('cur')) { | ||
1407 | +// return; | ||
1408 | +// } | ||
1409 | +// | ||
1410 | +// $this.addClass('cur'); | ||
1411 | +// $this.siblings('.cur').removeClass('cur'); | ||
1412 | +// | ||
1413 | +// if (index === 0) { | ||
1414 | +// // 店铺推荐 | ||
1415 | +// $recommendComment.slideDown(SLIDETIME); | ||
1416 | +// $latestWalk.slideUp(SLIDETIME); | ||
1417 | +// } else { | ||
1418 | +// // 最近游览 | ||
1419 | +// fetchLatestWalk(); // eslint-disable-line | ||
1420 | +// $recommendComment.slideUp(SLIDETIME); | ||
1421 | +// $latestWalk.slideDown(SLIDETIME); | ||
1422 | +// } | ||
1423 | +// }); | ||
1424 | + | ||
1308 | $('.bottom-tab').on('click', '.bottom-title', function() { | 1425 | $('.bottom-tab').on('click', '.bottom-title', function() { |
1309 | var $this = $(this), | 1426 | var $this = $(this), |
1310 | index = $this.index(); | 1427 | index = $this.index(); |
@@ -454,7 +454,7 @@ | @@ -454,7 +454,7 @@ | ||
454 | li { | 454 | li { |
455 | margin-right: 10px; | 455 | margin-right: 10px; |
456 | cursor: pointer; | 456 | cursor: pointer; |
457 | - border: 1px solid #bbbbbb; | 457 | + border: 1px solid #eaeceb; |
458 | height: 34px; | 458 | height: 34px; |
459 | 459 | ||
460 | &.focus { | 460 | &.focus { |
@@ -462,6 +462,10 @@ | @@ -462,6 +462,10 @@ | ||
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | + li.disable { | ||
466 | + opacity: .6; | ||
467 | + } | ||
468 | + | ||
465 | .color-name { | 469 | .color-name { |
466 | float:left; | 470 | float:left; |
467 | height: 34px; | 471 | height: 34px; |
@@ -2136,12 +2140,16 @@ | @@ -2136,12 +2140,16 @@ | ||
2136 | li { | 2140 | li { |
2137 | margin-right: 10px; | 2141 | margin-right: 10px; |
2138 | cursor: pointer; | 2142 | cursor: pointer; |
2139 | - border: 1px solid white; | 2143 | + border: 1px solid #eaeceb; |
2140 | height: 34px; | 2144 | height: 34px; |
2141 | 2145 | ||
2142 | &.focus { | 2146 | &.focus { |
2143 | border-color: black; | 2147 | border-color: black; |
2144 | } | 2148 | } |
2149 | + | ||
2150 | + &.disable { | ||
2151 | + opacity: 0.5; | ||
2152 | + } | ||
2145 | } | 2153 | } |
2146 | 2154 | ||
2147 | .color-name { | 2155 | .color-name { |
@@ -2275,6 +2283,10 @@ | @@ -2275,6 +2283,10 @@ | ||
2275 | .chose-done { | 2283 | .chose-done { |
2276 | font-size: 12px; | 2284 | font-size: 12px; |
2277 | text-align: left; | 2285 | text-align: left; |
2286 | + | ||
2287 | + .pkg-size { | ||
2288 | + margin-left: 15px; | ||
2289 | + } | ||
2278 | } | 2290 | } |
2279 | } | 2291 | } |
2280 | 2292 | ||
@@ -2302,6 +2314,13 @@ | @@ -2302,6 +2314,13 @@ | ||
2302 | } | 2314 | } |
2303 | } | 2315 | } |
2304 | 2316 | ||
2317 | +.consults-devide{ | ||
2318 | + .msg-pager{ | ||
2319 | + text-align: center; | ||
2320 | + margin: 0 auto; | ||
2321 | + } | ||
2322 | +} | ||
2323 | + | ||
2305 | .notify-goods-wrapper { | 2324 | .notify-goods-wrapper { |
2306 | .ring { | 2325 | .ring { |
2307 | color: #d42838; | 2326 | color: #d42838; |
-
Please register or login to post a comment