Authored by 张丽霞

详情页相关目录整理

1 -{{# result}}  
2 -<div class="good-detail-page yoho-page">  
3 - <div class="banner-container">  
4 - <div class="tag-container">  
5 - {{# tags}}  
6 - {{# is_new}}  
7 - <p class="good-tag new-tag">NEW</p>  
8 - {{/ is_new}}  
9 - {{# is_advance}}  
10 - <p class="good-tag renew-tag">再到着</p>  
11 - {{/ is_advance}}  
12 - {{# is_discount}}  
13 - <p class="good-tag sale-tag">SALE</p>  
14 - {{/ is_discount}}  
15 - {{# is_yohood}}  
16 - <div class="good-tag running-man-tag">跑男同款</div>  
17 - {{/ is_yohood}}  
18 - {{# is_limited}}  
19 - <p class="good-tag limit-tag">限量商品</p>  
20 - {{/ is_limited}}  
21 - {{# is_soon_sold_out}}  
22 - <p class="good-tag soon-sold-out-tag">即将售罄</p>  
23 - {{/ is_soon_sold_out}}  
24 - {{/ tags}}  
25 - </div>  
26 - {{# bannerTop}}  
27 - {{> product/banner-swiper-arrow}}  
28 - {{/ bannerTop}}  
29 - </div>  
30 - {{# goodsName}}  
31 - <h2 class="goods-name"><span>{{.}}</span></h2>  
32 - {{/ goodsName}}  
33 -  
34 - {{# goodsSubtitle}}  
35 - <h1 class="goods-subtitle"><span>{{.}}</span></h1>  
36 - {{/ goodsSubtitle}}  
37 -  
38 - <div class="price-date">  
39 - {{# goodsPrice}}  
40 - <div class="goods-price">  
41 - <h1 class="current-price">{{currentPrice}}</h1>  
42 - <h1 class="previous-price">{{previousPrice}}</h1>  
43 - </div>  
44 - {{/ goodsPrice}}  
45 -  
46 - {{^ noLimitGoodsBtn}}  
47 - {{#if canGetLimitCode}}  
48 - <button class="limit-sale" id='limit-sale'>获取限购码</button>  
49 - {{/if}}  
50 -  
51 - {{#if codeEmpty}}  
52 - <button class="got-limit-sale">限购码已被抢光</button>  
53 - {{/if}}  
54 -  
55 - {{#if gotCode}}  
56 - <button class="got-limit-sale">已获取限购码</button>  
57 - {{/if}}  
58 - {{/noLimitGoodsBtn}}  
59 -  
60 - {{#if periodOfMarket}}  
61 - <div class="period-of-market">  
62 - <h1>上市期:</h1>  
63 - <h1 >{{periodOfMarket}}</h1>  
64 - </div>  
65 - {{/if}}  
66 - </div>  
67 -  
68 - {{# vipLevel}}  
69 - <ul class="vip-level clearfix">  
70 - {{# list}}  
71 - <li class="icons-item {{#if currentLevel}}current-level{{/if}}">  
72 - <span class="vip-img " style="background-size:contain;">  
73 - </span>  
74 - <span class="vip-price ">{{text}}</span>  
75 - </li>  
76 - {{/ list}}  
77 - </ul>  
78 - {{/vipLevel}}  
79 -  
80 - {{# goodsDiscount}}  
81 - <div class="goods-discount" id="goodsDiscount">  
82 - {{# list}}  
83 - {{#if @first}}  
84 - {{#if text}}  
85 - <h1 class="first-item short-text tap-hightlight">{{text}}<span class="icon-down iconfont dropdown">&#xe609;</span></h1>  
86 - {{/if}}  
87 - {{/if}}  
88 - {{/ list}}  
89 - <div class="discount-folder">  
90 - {{# list}}  
91 - {{#if @first}}  
92 - {{else}}  
93 - {{#if text}}  
94 - <h1 class="folder-item tap-hightlight">{{text}}</h1>  
95 - {{/if}}  
96 - {{/if}}  
97 - {{/list}}  
98 - </div>  
99 - </div>  
100 - {{/ goodsDiscount}}  
101 -  
102 - {{# feedbacks}}  
103 - <div class="feedback-list ">  
104 - {{#if commentsNum}}  
105 - {{> product/feedback-tab}}  
106 - {{else}}  
107 - {{#if consultsNum}}  
108 - {{> product/feedback-tab}}  
109 - {{else}}  
110 - <div class="nodata tap-hightlight" id="goto-consult">  
111 - <span>暂无商品评价和咨询</span>  
112 - <a href="{{consultsUrl}}" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>  
113 - </div>  
114 - {{/if}}  
115 - {{/if}}  
116 - </div>  
117 - {{/ feedbacks}}  
118 -  
119 - {{# enterStore}}  
120 - <div id="enter-store" class="enter-store page-block tap-hightlight">  
121 - <a class="store-logo" href="{{url}}" style="">  
122 - <img class="lazy" data-original="{{img}}" alt="{{storeName}}">  
123 - </a>  
124 - <a class="store-name" href="{{url}}">{{storeName}}</a>  
125 - <a class="store-link" href="{{url}}">进入店铺<span class="iconfont">&#xe604;</span></a>  
126 - </div>  
127 - {{/ enterStore}}  
128 -  
129 - <div id="productDesc"> </div>  
130 - {{> product/recommend-for-you}}  
131 - {{> cart/chose-panel}}  
132 -  
133 - {{#cartInfo}}  
134 - <div class="cart-bar">  
135 - <a href="{{cartUrl}}" class="num-incart iconfont"><span class="num-tag hide"></span>&#xe62c;</a>  
136 -  
137 - {{#if addToCartUrl}}  
138 - <!-- <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> -->  
139 - <a id="addtoCart" href="javascript:;" class="addto-cart">加入购物车</a>  
140 - {{/if}}  
141 -  
142 - {{#if soldOut}}  
143 - <a href="javascript:;" class="sold-out">已售罄</a>  
144 - {{/if}}  
145 -  
146 - {{#if notForSale}}  
147 - <a href="javascript:;" class="sold-out">非卖品</a>  
148 - {{/if}}  
149 -  
150 - {{#if limitNotForSale}}  
151 - <a href="javascript:;" class="sold-out limit">即将发售</a>  
152 - {{/if}}  
153 -  
154 - {{#if canBuyLimit}}  
155 - <a href="javascript:;" id="addtoCart" class="addto-cart">立即购买</a>  
156 - {{/if}}  
157 -  
158 - {{#if noLimitCode}}  
159 - <a href="javascript:;" class="sold-out limit">立即购买</a>  
160 - {{/if}}  
161 - <input type="hidden" id="limitCodeUrl" name="limitCodeUrl" value="{{limitCodeUrl}}">  
162 - <input type="hidden" id="limitProductPay" name="limitProductPay" value="{{limitProductPay}}">  
163 - {{#limitProductCode}}  
164 - <input type="hidden" id="limitProductCode" name="limitProductCode" value="{{.}}">  
165 - {{/limitProductCode}}  
166 -  
167 - <a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}">&#xe605;</a>  
168 - </div>  
169 - {{/cartInfo}}  
170 - {{#if introUrl}}  
171 - <input id="introUrl" type="hidden" value="{{introUrl}}">  
172 - {{/if}}  
173 - {{#if id}}  
174 - <input id="productId" type="hidden" value="{{id}}">  
175 - {{/if}}  
176 - {{#if preferenceUrl}}  
177 - <input id="preferenceUrl" type="hidden" value="{{preferenceUrl}}">  
178 - {{/if}}  
179 -  
180 - <input id="productSkn" type="hidden" value="{{productSkn}}">  
181 -  
182 - {{#loginUrl}}  
183 - <input type="hidden" name="loginUrl" id="loginUrl" value="{{.}}">  
184 - {{/loginUrl}}  
185 -  
186 -</div>  
187 -{{/ result}}  
1 -{{# result}}  
2 - {{> product/product-description}}  
3 -{{/ result}}  
1 -<ul id="nav-tab" class="nav-tab clearfix">  
2 - <li class="comment-nav tap-hightlight">商品评价(<span class="comments-num">{{commentsNum}}</span>)</li>  
3 - <li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li>  
4 -</ul>  
5 -<div id="feedback-content" >  
6 - <div class="comment-content content ">  
7 - {{#if commentsNum}}  
8 - <div class="comment-content-main content-main">  
9 - {{# comments}}  
10 - <span class="user-name">  
11 - {{userName}}  
12 - </span>  
13 - <span class="goods-spec">  
14 - 购买了{{desc}}  
15 - </span>  
16 - <p class="detail-content">  
17 - {{content}}  
18 - </p>  
19 - <span class="comment-time">  
20 - {{time}}  
21 - </span>  
22 - {{/ comments}}  
23 - </div>  
24 - <a class="comment-content-footer tap-hightlight" href="{{commentsUrl}}">  
25 - 查看更多  
26 - <span class="iconfont">&#xe604;</span>  
27 - </a>  
28 - {{^}}  
29 - <div class="comment-content-main content-main no-item">  
30 - <span class="iconfont">&#xe63d;</span>暂无评论  
31 - </div>  
32 - {{/if}}  
33 - </div>  
34 -  
35 - <div class="consult-content content hide ">  
36 - {{#if consultsNum}}  
37 - <div class="consult-content-main content-main">  
38 - {{# consults}}  
39 - <div class="question">  
40 - <span class="iconfont">&#xe644;</span>  
41 - <p>  
42 - {{question}}<br>  
43 - <span class="time">{{time}}</span>  
44 - </p>  
45 - </div>  
46 -  
47 - <div class="answer">  
48 - <span class="iconfont">&#xe642;</span>  
49 - <p>{{answer}}</p>  
50 - </div>  
51 - {{/ consults}}  
52 - </div>  
53 - <a class="consult-content-footer tap-hightlight" href="{{consultsUrl}}">  
54 - 查看更多  
55 - <span class="iconfont">&#xe604;</span>  
56 - </a>  
57 - {{else}}  
58 - <div class="consult-content-main content-main no-item">  
59 - <span class="iconfont">&#xe63f;</span>暂无咨询  
60 - </div>  
61 -  
62 - <div class="consult-content-footer tap-hightlight">  
63 - <a href="{{consultsUrl}}">  
64 - 我要咨询  
65 - <span class="iconfont">&#xe604;</span></a>  
66 - </div>  
67 - {{/if}}  
68 - </div>  
69 -</div>  
1 -{{#goodsDescription}}  
2 -<div class="goods-desc page-block">  
3 - <div class="service"></div>  
4 - <h1 class="title">  
5 - {{title}}  
6 - <span class="en-title">{{enTitle}}</span>  
7 - </h1>  
8 - {{#detail}}  
9 - <div class="detail table">  
10 - {{#list}}  
11 - <div class="column">{{param}}</div>  
12 - {{/list}}  
13 - </div>  
14 - {{/detail}}  
15 - {{#if desc}}  
16 - <div class="desc-text">{{desc}}</div>  
17 - {{/if}}  
18 -</div>  
19 -  
20 -{{/goodsDescription}}  
21 -  
22 -{{#sizeInfo}}  
23 -<div class="size-info page-block">  
24 -<h1 class="title">  
25 - {{title}}  
26 - <span class="en-title">{{enTitle}}</span>  
27 -</h1>  
28 -{{#detail}}  
29 -<div class="detail">  
30 - <div class="swiper-container detail-swiper" id="size-swiper-container">  
31 - <div class="swiper-wrapper">  
32 - {{#list}}  
33 - <div class="swiper-slide " >  
34 - {{#params}}  
35 - <div class="cell">{{param}}</div>  
36 - {{/params}}  
37 - </div>  
38 - {{/list}}  
39 - </div>  
40 - </div>  
41 - <p class="tips">提示:左滑查看完整表格信息</p>  
42 -</div>  
43 -{{/detail}}  
44 -</div>  
45 -{{/sizeInfo}}  
46 -  
47 -{{#measurementMethod}}  
48 -<div class="measurement-method page-block">  
49 -<h1 class="title">  
50 - {{title}}  
51 - <span class="en-title">{{enTitle}}</span>  
52 -</h1>  
53 -<div class="detail" style="width:100%">  
54 - <img class="lazy" data-original="{{img}}" alt="">  
55 -</div>  
56 -</div>  
57 -{{/measurementMethod}}  
58 -  
59 -{{#reference}}  
60 -<div class="size-info page-block">  
61 - <h1 class="title">  
62 - {{title}}  
63 - <span class="en-title">{{enTitle}}</span>  
64 - </h1>  
65 - {{#detail}}  
66 - <div class="detail">  
67 - <div class="swiper-container detail-swiper" id="reference-swiper-container">  
68 - <div class="swiper-wrapper">  
69 - {{#list}}  
70 - {{#if @first}}  
71 - <div class="swiper-slide first-group" >  
72 - {{#params}}  
73 - {{#if @first}}  
74 - {{else}}  
75 - <div>  
76 - <img class="avatar lazy" data-original="{{param}}" alt="">  
77 - </div>  
78 - {{/if}}  
79 - {{/params}}  
80 - </div>  
81 - {{else}}  
82 - <div class="swiper-slide" >  
83 - {{#params}}  
84 - <div class=" cell">{{param}}</div>  
85 - {{/params}}  
86 - </div>  
87 - {{/if}}  
88 - {{/list}}  
89 - </div>  
90 - </div>  
91 - <p class="tips">提示:左滑查看完整表格信息</p>  
92 - </div>  
93 - {{/detail}}  
94 -</div>  
95 -{{/reference}}  
96 -  
97 -{{#materials}}  
98 -<div class="materials page-block">  
99 - <h1 class="title">  
100 - {{title}}  
101 - <span class="en-title">{{enTitle}}</span>  
102 - </h1>  
103 - <div class="detail">  
104 - {{#list}}  
105 - <div class="material-item">  
106 - <!-- <img class="lazy" data-original="{{img}}" alt="">  
107 - <p class="material-desc">  
108 - {{desc}}  
109 - </p>-->  
110 - <div class="material-image">  
111 - <img src="{{img}}" alt="材质图">  
112 - </div>  
113 - <div class="material-desc">  
114 - {{desc}}  
115 - </div>  
116 - </div>  
117 - {{/list}}  
118 - </div>  
119 -</div>  
120 -{{/materials}}  
121 -  
122 -{{#washTips}}  
123 -<div class="wash-tips page-block">  
124 - <div class="detail table clearfix">  
125 - {{#list}}  
126 - <div class="tip">  
127 - <img src="{{img}}" alt="">  
128 - <span class="caption">{{caption}}</span>  
129 - </div>  
130 - {{/list}}  
131 - </div>  
132 -</div>  
133 -{{/washTips}}  
134 -  
135 -{{#productDetail}}  
136 -<div class="product-detail page-block">  
137 - <h1 class="title">  
138 - {{{title}}}  
139 - <span class="en-title">{{{enTitle}}}</span>  
140 - </h1>  
141 - <div class="pro-detail">  
142 - <p>{{{desc}}}</p>  
143 - {{#list}}  
144 - <img class="lazy" data-original="{{img}}" alt="">  
145 - {{/list}}  
146 - </div>  
147 -</div>  
148 -{{/productDetail}}  
1 -<div class="recommend-for-you hide">  
2 -</div>  
1 -/**  
2 - * 商品详情 --评论和咨询tab  
3 - * @author: Lynnic  
4 - * @date: 2015/11/18  
5 - */  
6 -var $ = require('yoho-jquery'),  
7 - tip = require('../plugin/tip'),  
8 - Hammer = require('yoho-hammer');  
9 -  
10 -var commentsNum, consultsNum;  
11 -  
12 -var navtabEle = document.getElementById('nav-tab'),  
13 - navtabHammer = navtabEle && new Hammer(navtabEle),  
14 -  
15 - gotoConsultEle = document.getElementById('goto-consult'),  
16 - gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),  
17 -  
18 - readmore = document.getElementById('readmore'),  
19 - readmoreHammer = readmore && new Hammer(readmore);  
20 -  
21 -  
22 -  
23 -(function() {  
24 - consultsNum = $('#nav-tab .consults-num').html() - 0;  
25 -  
26 - commentsNum = $('#nav-tab .comments-num').html() - 0;  
27 -  
28 - $('#nav-tab li').each(function() {  
29 - $(this).removeClass('focus');  
30 - });  
31 -  
32 - $('#feedback-content .content').each(function() {  
33 - $(this).addClass('hide');  
34 - });  
35 - if (0 !== commentsNum) {  
36 - $('#nav-tab .comment-nav').addClass('focus');  
37 - $('#feedback-content .comment-content').removeClass('hide');  
38 -  
39 - } else if (0 !== consultsNum) {  
40 - $('#nav-tab .consult-nav').addClass('focus');  
41 - $('#feedback-content .consult-content').removeClass('hide');  
42 - }  
43 -  
44 -})();  
45 -  
46 -if (navtabHammer) {  
47 - navtabHammer.on('tap', function(e) {  
48 - var $this = $(e.target).closest('li');  
49 - var index = $this.index();  
50 -  
51 - if ($this.hasClass('comment-nav') && 0 === commentsNum) {  
52 - tip.show('暂无商品评价');  
53 - } else {  
54 - if (!$this.hasClass('focus')) {  
55 -  
56 - $('#nav-tab li').each(function() {  
57 - $(this).removeClass('focus');  
58 - });  
59 - $('#feedback-content .content').each(function() {  
60 - $(this).addClass('hide');  
61 - });  
62 -  
63 - $this.addClass('focus');  
64 - $('#feedback-content .content:eq(' + index + ')').removeClass('hide');  
65 - }  
66 - }  
67 - });  
68 -}  
69 -  
70 -// if (consultFooterHammer) {  
71 -// consultFooterHammer.on('tap', function() {  
72 -// location.href = $(consultFooterEle).data('href');  
73 -// });  
74 -// }  
75 -  
76 -if (gotoConsultHammer) {  
77 - gotoConsultHammer.on('tap', function() {  
78 - location.href = $(gotoConsultEle).find('a').attr('href');  
79 - });  
80 -}  
81 -  
82 -// 咨询页面固定header  
83 -if ($('.goods-consults-page').length > 0) {  
84 - $('#yoho-header').css('position', 'fixed').css('top', '0');  
85 -}  
86 -  
87 -if ($('.goods-consults-page').length > 0) {  
88 - $('#yoho-footer').css('border-top', '1px solid #e0e0e0');  
89 -}  
90 -  
91 -if (readmoreHammer) {  
92 - readmoreHammer.on('tap', function() {  
93 - $('.readmore').hide();  
94 - $('.goods-consults.customer-consults').removeClass('customer-consults');  
95 -  
96 - return false;  
97 - });  
98 -}  
99 -  
100 -require('./fav');  
1 -/**  
2 - * 我要咨询提交页面  
3 - * @author: liangzhifeng<zhifeng.liang@yoho.cn>  
4 - * @date: 2015/12/01  
5 - */  
6 -var $ = require('yoho-jquery'),  
7 - tip = require('../../plugin/tip'),  
8 - loading = require('../../plugin/loading');  
9 -  
10 -var $consultForm = $('.consult-form'),  
11 - $submit = $('#submit'),  
12 - $content = $('#content'),  
13 - productId = $('#product_id').val(),  
14 - isSubmiting;  
15 -  
16 -$submit.on('touchend', function() {  
17 - $content.blur();  
18 - $consultForm.submit();  
19 - return false;  
20 -}).on('touchstart', function() {  
21 - $(this).addClass('highlight');  
22 -}).on('touchend touchcancel', function() {  
23 - $(this).removeClass('highlight');  
24 -});  
25 -  
26 -$content.on('focus', function() {  
27 - if ($content.val() === '请输入咨询内容') {  
28 - $content.val('');  
29 - }  
30 -}).on('blur', function() {  
31 - if ($content.val() === '') {  
32 - $content.val('请输入咨询内容');  
33 - }  
34 -});  
35 -  
36 -// 提交表单请求  
37 -$consultForm.on('submit', function() {  
38 - var content;  
39 -  
40 - if (isSubmiting) {  
41 - return false;  
42 - }  
43 -  
44 - // 简单的表单校验  
45 - content = $content.val();  
46 - if (!content || content === '请输入咨询内容') {  
47 - tip.show('咨询内容不能为空');  
48 - return false;  
49 - }  
50 -  
51 - isSubmiting = true;  
52 - loading.showLoadingMask();  
53 - $.ajax({  
54 - method: 'POST',  
55 - url: '/product/detail/consultsubmit',  
56 - data: {  
57 - product_id: productId,  
58 - content: content  
59 - }  
60 - }).then(function(res) {  
61 - if ($.type(res) !== 'object') {  
62 - res = {};  
63 - }  
64 - if (res.code !== 200) {  
65 - tip.show(res.message || '网络出了点问题~');  
66 - isSubmiting = false;  
67 - loading.hideLoadingMask();  
68 - } else {  
69 - tip.show('提交成功~');  
70 - setTimeout(function() {  
71 - window.history.go(-1);  
72 - }, 3000);  
73 - }  
74 - }).fail(function() {  
75 - tip.show('网络出了点问题~');  
76 - isSubmiting = false;  
77 - });  
78 - return false;  
79 -});  
1 -/**  
2 - * 商品详情 --异步加载页面下半部分  
3 - * @author: liangzhifeng<zhifeng.liang@yoho.cn>  
4 - * @date: 2015/11/18  
5 - */  
6 -var $ = require('yoho-jquery'),  
7 - lazyLoad = require('yoho-jquery-lazyload'),  
8 - Swiper = require('yoho-swiper'),  
9 - loading = require('../plugin/loading'),  
10 - tip = require('../plugin/tip');  
11 -  
12 -var introUrl = $('#introUrl').val(),  
13 - winH = $(window).height(),  
14 - $productDesc,  
15 - searching = false,  
16 - end = false;  
17 -  
18 -var sizeSwiper,  
19 - refSwiper;  
20 -  
21 -  
22 -// 判断是否要显示向左滑动提示  
23 -function hiddenTips($ele) {  
24 - var offsetContainer,  
25 - offsetLastColumn;  
26 -  
27 - if ($ele.length > 0) {  
28 - offsetContainer = $ele[0].getBoundingClientRect().right;  
29 - offsetLastColumn = $ele.find('.swiper-slide:last-child')[0].getBoundingClientRect().right;  
30 -  
31 -  
32 - if (offsetLastColumn - offsetContainer < 0) {  
33 - $ele.next('.tips').css('display', 'none');  
34 - } else {  
35 - $ele.next('.tips').css('display', 'block');  
36 - }  
37 - }  
38 -}  
39 -  
40 -// function isFlexSupport() {  
41 -// var flex = document.createElement('p').style.flex,  
42 -// webkitFlex = document.createElement('p').style.webkitFlex,  
43 -// flexWrap = document.createElement('p').style.flexWrap;  
44 -//  
45 -// if ((flex === '' || webkitFlex === '') && flexWrap === '') {  
46 -// return true;  
47 -// } else {  
48 -// return false;  
49 -// }  
50 -// }  
51 -  
52 -function wrapElements(selector, count) {  
53 - var elArr = null;  
54 -  
55 - $(selector).each(function(idx, el) {  
56 - elArr = $(selector).slice(idx, idx + count);  
57 -  
58 - if (elArr.length === count && idx % count === 0) {  
59 - $(elArr).wrapAll($('<div class="js-wraper"></div>'));  
60 - }  
61 - });  
62 -}  
63 -  
64 -  
65 -  
66 -function search() {  
67 - if (searching || end) {  
68 - return;  
69 - }  
70 - searching = true;  
71 -  
72 - // alert($('#reference-swiper-container .swiper-wrapper').width());  
73 -  
74 - loading.showLoadingMask();  
75 -  
76 - $.ajax({  
77 - type: 'GET',  
78 - url: introUrl,  
79 - success: function(data) {  
80 - $productDesc = $('#productDesc');  
81 - $productDesc.append(data);  
82 -  
83 - window.rePosFooter();  
84 -  
85 - lazyLoad($productDesc.find('img.lazy'));  
86 -  
87 - // 尺码信息左右滑动  
88 - sizeSwiper = new Swiper('#size-swiper-container', {  
89 - slidesPerView: 'auto'  
90 - });  
91 -  
92 - // 模特试穿左右滑动  
93 - refSwiper = new Swiper('#reference-swiper-container', {  
94 - slidesPerView: 'auto'  
95 - });  
96 -  
97 - hiddenTips($('#size-swiper-container'));  
98 - hiddenTips($('#reference-swiper-container'));  
99 -  
100 - // if (!isFlexSupport()) {  
101 - // $('.detail .column').removeClass('column').addClass('oldbox');  
102 - // }  
103 - wrapElements('.detail .column', 2);  
104 - searching = false;  
105 - end = true;  
106 - loading.hideLoadingMask();  
107 - },  
108 - error: function() {  
109 - tip.show('网络断开连接了~');  
110 - searching = false;  
111 - loading.hideLoadingMask();  
112 - }  
113 - });  
114 -}  
115 -  
116 -function scrollHandler() {  
117 - if (!end || $(window).scrollTop() + winH >= $(document).height() - 200) {  
118 - search();  
119 - }  
120 -}  
121 -  
122 -// srcoll to load more  
123 -$(window).scroll(function() {  
124 - window.requestAnimationFrame(scrollHandler);  
125 -});  
126 -  
@@ -6,11 +6,10 @@ @@ -6,11 +6,10 @@
6 var $ = require('yoho-jquery'), 6 var $ = require('yoho-jquery'),
7 Swiper = require('yoho-swiper'), 7 Swiper = require('yoho-swiper'),
8 Hammer = require('yoho-hammer'), 8 Hammer = require('yoho-hammer'),
9 - lazyLoad = require('yoho-jquery-lazyload'),  
10 - commonJS = require('../common'); 9 + lazyLoad = require('yoho-jquery-lazyload');
  10 + // commonJS = require('../common');
11 11
12 -var goodsSwiper,  
13 - $discountFolder = $('.goodsDiscount .discount-folder'), 12 +var $discountFolder = $('.goodsDiscount .discount-folder'),
14 $discountArrow = $('.goodsDiscount .first-item span'); 13 $discountArrow = $('.goodsDiscount .first-item span');
15 14
16 var goodsDiscountEl = document.getElementById('goodsDiscount'), 15 var goodsDiscountEl = document.getElementById('goodsDiscount'),
@@ -40,7 +39,7 @@ function showFooter() { @@ -40,7 +39,7 @@ function showFooter() {
40 39
41 showFooter(); 40 showFooter();
42 41
43 -require('./like'); 42 +require('./detail/like');
44 43
45 lazyLoad($('img.lazy')); 44 lazyLoad($('img.lazy'));
46 45
@@ -49,7 +48,7 @@ if ($('#goodsDiscount h1').length < 1) { @@ -49,7 +48,7 @@ if ($('#goodsDiscount h1').length < 1) {
49 } 48 }
50 49
51 // 顶部swiper 50 // 顶部swiper
52 -goodsSwiper = new Swiper('.banner-swiper', { 51 +new Swiper('.banner-swiper', {
53 lazyLoading: true, 52 lazyLoading: true,
54 lazyLoadingInPrevNext: true, 53 lazyLoadingInPrevNext: true,
55 paginationClickable: true, 54 paginationClickable: true,
@@ -59,7 +58,6 @@ goodsSwiper = new Swiper('.banner-swiper', { @@ -59,7 +58,6 @@ goodsSwiper = new Swiper('.banner-swiper', {
59 spaceBetween: 3 58 spaceBetween: 3
60 }); 59 });
61 60
62 -  
63 // 初始化goods-discount 61 // 初始化goods-discount
64 if ($discountFolder.children().length === 0) { 62 if ($discountFolder.children().length === 0) {
65 $discountFolder.css('display', 'none'); 63 $discountFolder.css('display', 'none');
@@ -113,18 +111,18 @@ $('#limit-sale').on('touchend', function(e) { @@ -113,18 +111,18 @@ $('#limit-sale').on('touchend', function(e) {
113 111
114 }, undefined, true); 112 }, undefined, true);
115 113
116 - $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {  
117 - e.stopPropagation();  
118 - if ($(e.target).hasClass('dialog-wrapper')) { 114 + $('.dialog-wrapper').off('touchstart').on('touchstart', function(para) {
  115 + para.stopPropagation();
  116 + if ($(para.target).hasClass('dialog-wrapper')) {
119 dialog.hideDialog(); 117 dialog.hideDialog();
120 } 118 }
121 }); 119 });
122 } 120 }
123 }); 121 });
124 122
125 -require('./desc');  
126 -require('./comments-consults');  
127 -require('../recommend-for-you-product-desc'); 123 +require('./detail/desc');
  124 +require('./detail/comments-consults');
  125 +require('./detail/recommend-for-you-product-desc');
128 126
129 // 购物车商品数量 127 // 购物车商品数量
130 $.ajax({ 128 $.ajax({
1 -/**  
2 - * 商品详情咨询页 --点赞和帮助功能  
3 - * @author: Lynnic  
4 - * @date: 2015/12/09  
5 - */  
6 -  
7 - var $ = require('yoho-jquery'),  
8 - Hammer = require('yoho-hammer'),  
9 - tip = require('../plugin/tip');  
10 -  
11 - var goodsConsultsEle = $('#goods-consults')[0],  
12 - goodsConsultsHammer = goodsConsultsEle && new Hammer(goodsConsultsEle);  
13 -  
14 - var productId,  
15 - total;  
16 -  
17 - function showCountPlus($el) {  
18 - var $count = $el.find('.animate-count');  
19 -  
20 - $count.css('display', 'inline');  
21 - $count.animate({  
22 - opacity: 0.25,  
23 - fontSize: '0.7rem',  
24 - right: '-=5'  
25 - }, 300, function() {  
26 - $count.css('display', 'none');  
27 - });  
28 - }  
29 -  
30 - (function() {  
31 - var queryStr = window.location.search.substring(1);  
32 -  
33 - productId = queryStr.split('&')[0].split('=')[1];  
34 - total = queryStr.split('&')[1] ? queryStr.split('&')[1].split('=')[1] : undefined;  
35 - })();  
36 -  
37 - if (goodsConsultsHammer) {  
38 -  
39 - goodsConsultsHammer.on('tap', function(e) {  
40 -  
41 - var $this = $(e.target).closest('li'),  
42 - id = $this.closest('.consult-item').data('id'),  
43 - count = $this.find('.count').html() - 0,  
44 - url;  
45 -  
46 - if (!$this.hasClass('highlight')) {  
47 -  
48 - if ($this.hasClass('fav')) {  
49 - url = '/product/detail/consultupvote';  
50 - } else if ($this.hasClass('useful')) {  
51 - url = '/product/detail/consultuseful';  
52 - }  
53 -  
54 - $.ajax({  
55 - method: 'post',  
56 - url: url,  
57 - data: {  
58 - id: id,  
59 - productId: productId,  
60 - total: total  
61 - }  
62 - }).done(function(data) {  
63 - if (data.code === 200) {  
64 - showCountPlus($this);  
65 - $this.addClass('highlight');  
66 - $this.find('.count').html(count + 1);  
67 - } else if (data.code === 401) {  
68 - location.href = data.data;// 未登录跳转登录页  
69 - }  
70 - }).fail(function(data) {  
71 - tip.show('网络断开连接了~');  
72 - });  
73 -  
74 - }  
75 - });  
76 - }  
1 -/**  
2 - * 商品详情 --添加收藏  
3 - * @author: Lynnic  
4 - * @date: 2015/11/24  
5 - */  
6 -  
7 -  
8 -var $ = require('yoho-jquery'),  
9 - tip = require('../plugin/tip'),  
10 - chosePanel = require('../cart/chose-panel');  
11 -  
12 -var productId = $('#productId').val();  
13 -  
14 -var skn = $('#productSkn').val(),  
15 - productCode = $('#limitProductCode').val();  
16 -  
17 -$('#likeBtn').on('touchstart', function() {  
18 - var opt,  
19 - favorite;  
20 -  
21 - var $this = $(this);  
22 -  
23 - if ($this.hasClass('liked')) {  
24 - opt = 'cancel';  
25 - favorite = 0;  
26 - } else {  
27 - opt = 'ok';  
28 - favorite = 1;  
29 - }  
30 -  
31 - $.ajax({  
32 - type: 'POST',  
33 - url: '/product/opt/favoriteProduct',  
34 - data: {  
35 - id: productId,  
36 - opt: opt  
37 - },  
38 - success: function(data) {  
39 - if (data.code === 200) {  
40 - $this.toggleClass('liked');  
41 -  
42 - if ('cancel' === opt) {  
43 - tip.show('取消收藏成功');  
44 - } else if ('ok' === opt) {  
45 - tip.show('收藏成功');  
46 - }  
47 - } else if (data.code === 400) {  
48 - location.href = data.data;// 未登录跳转登录页  
49 - } else {  
50 - tip.show(data.message);  
51 - }  
52 - },  
53 - error: function() {  
54 - tip.show('网络断开连接了~');  
55 - }  
56 - });  
57 -  
58 - // 统计代码:用于统计用户加入或取消商品收藏的动作  
59 - if (window._yas) {  
60 - window._yas.sendCustomInfo({  
61 - pd: productId,  
62 - fa: favorite  
63 - }, true);  
64 - }  
65 -  
66 - return false;  
67 -});  
68 -  
69 -$('#addtoCart').on('touchstart', function() {  
70 - $('.cart-bar').hide();  
71 - productCode && chosePanel.setLimitGoodModeWithSknId(productCode, skn);  
72 - chosePanel.show();  
73 -  
74 - // 统计代码:用于统计用户加入购物车的动作  
75 - if (window._yas) {  
76 - window._yas.sendCustomInfo({  
77 - pd: productId,  
78 - by: 1  
79 - }, true);  
80 - }  
81 -  
82 - return false;  
83 -});  
1 -/**  
2 - * 为您优选  
3 - * @author: liangzhifeng<zhifeng.liang@yoho.cn>  
4 - * @date: 2015/11/16  
5 - */  
6 -  
7 -  
8 -var Swiper = require('yoho-swiper'),  
9 - $ = require('yoho-jquery');  
10 -  
11 -var recommendSwiper,  
12 - $recommendForYou = $('.recommend-for-you'),  
13 - preferenceUrl = $('#preferenceUrl').val(),  
14 - winH = $(window).height(),  
15 - end = false,  
16 - requesting = false;  
17 -  
18 -  
19 -function request() {  
20 - if (requesting || end) {  
21 - return;  
22 - }  
23 -  
24 - requesting = true;  
25 -  
26 - if (preferenceUrl) {  
27 - $.get(preferenceUrl).then(function(html) {  
28 - if (html.length < 5) {  
29 - $recommendForYou.css('display', 'none');  
30 - } else {  
31 - $recommendForYou.html(html).show();  
32 - if ($('#swiper-recommend').length) {  
33 - recommendSwiper = new Swiper('#swiper-recommend', {  
34 - slidesPerView: 'auto',  
35 - grabCursor: true,  
36 - slideElement: 'a',  
37 - lazyLoading: true,  
38 - watchSlidesVisibility: true  
39 - });  
40 - }  
41 - }  
42 -  
43 - requesting = false;  
44 - end = true;  
45 -  
46 - window.rePosFooter();  
47 -  
48 - }).fail(function() {  
49 - $recommendForYou.hide();  
50 - });  
51 - }  
52 -}  
53 -  
54 -function scrollHandler() {  
55 - if (!end || $(window).scrollTop() + winH >= $(document).height() - 200) {  
56 - request();  
57 - }  
58 -}  
59 -  
60 -$(window).scroll(function() {  
61 - window.requestAnimationFrame(scrollHandler);  
62 -});