johnswang
2021-11-09 abc52b4faa5ede1a9f97c078dad3714109f70d65
提交 | 用户 | age
efff2c 1 <%@ page language="java" contentType="text/html; charset=UTF-8"
J 2     pageEncoding="UTF-8"%>
3 <%@page import="com.yc.factory.FactoryBean"%>
4 <%@page import="com.yc.sdk.shopping.service.SettingIfc"%>
5 <%@page import="com.yc.sdk.shopping.entity.SettingEntity"%>
6 <%@page import="com.yc.sdk.shopping.service.MatCodeIfc"%>
7 <%@page import="com.yc.sdk.shopping.entity.MatCodeEntity"%>
8
9 <%@page import="com.yc.sdk.shopping.service.MatCodeImageIfc"%>
10 <%@page import="com.yc.sdk.shopping.entity.MatCodeImageEntity"%>
11
12 <%@page import="com.yc.sdk.shopping.service.MatPriceIfc"%>
13
14 <%@page import="com.yc.sdk.shopping.service.CurrencyIfc"%>
15 <%@page import="com.yc.sdk.shopping.entity.CurrencyEntity"%>
16
17 <%@page import="com.yc.sdk.shopping.service.MatPointsIfc"%>
18
19 <%@page import="com.yc.sdk.shopping.service.MatDiscountIfc"%>
20 <%@page import="com.yc.sdk.shopping.entity.MatDiscountEntity"%>
21
22 <%@page import="com.yc.sdk.shopping.service.MatComponentIfc"%>
23 <%@page import="com.yc.sdk.shopping.entity.MatPriceEntity"%>
24
25 <%@page import="java.util.List"%>
26 <%@page import="com.yc.sdk.shopping.util.SettingKey"%>  
27 <%@page import="com.yc.utils.SessionKey"%>
28 <%@page import="com.yc.sdk.shopping.service.NavigatorIfc"%>
29 <%@page import="com.yc.sdk.shopping.entity.NavigatorEntity"%>
30 <%@page import="com.yc.sdk.shopping.entity.NavigatorBar"%>
31 <%@page import="com.yc.sdk.shopping.entity.NavigatorBars"%>  
32 <%@page import="com.yc.sdk.shopping.entity.ProductListSetting"%> 
33 <%@page import="com.yc.sdk.shopping.service.imagedata.ShoppingImageDataIfc"%> 
34 <%@page import="com.yc.multiData.SpObserver"%>
35 <%@page import="org.springframework.dao.DataAccessException"%> 
36 <%@page import="com.yc.sdk.shopping.service.CartIfc"%>
37 <%@page import="com.yc.sdk.shopping.entity.CartEntity"%>
38 <%@page import="com.yc.sdk.shopping.service.MatCodeIfc"%>
39 <%@page import="com.yc.sdk.shopping.entity.MatCodeEntity"%> 
40 <%@page import="java.io.File"%>
41 <%@page import="com.yc.sdk.shopping.service.ShoppingImageIfc"%>
42 <%@page import="com.yc.sdk.weixinmp.service.jssdk.JssdkIfc" %> 
43 <%@page import="com.yc.sdk.shopping.entity.ShareEntity"%>
44 <%@page import="com.yc.sdk.shopping.service.share.ShareIfc"%>
45 <%@page import="com.yc.sdk.shopping.entity.WxConfig"%> 
46 <%@page import="com.yc.sdk.shopping.service.MatAttrIfc"%>
47 <%@page import="com.yc.sdk.shopping.entity.ShopCcCodeEntity"%>
48 <%@page import="com.yc.sdk.shopping.action.api.ShopCcCode"%>
49 <%
50     String dbId = (String) session.getAttribute(SessionKey.SHOPPING_DBID);
51 String userCode = (session.getAttribute(SessionKey.USERCODE) == null ? "" 
52         : (String)session.getAttribute(SessionKey.USERCODE));
53
54 String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "" 
55         : (String) session.getAttribute(SessionKey.WEIXIN_OPENID) ) ;
56 String sessionId = session.getId();
57
58 String cltCode = (session.getAttribute(SettingKey.CLTCODE) == null ? "" : (String)session.getAttribute(SettingKey.CLTCODE)); 
59 String cltName = (session.getAttribute(SettingKey.CLTNAME) == null ? "" : (String)session.getAttribute(SettingKey.CLTNAME)) ;
60 boolean isMoblieBrowser = SettingKey.isMoblieBrowser(request);
61
62 String corpId = request.getParameter(SessionKey.WEIXIN_CORPID) ;
63 String wx = request.getParameter(SessionKey.WEIXIN_FROM) ;
64 if (corpId == null || "".equals(corpId)) {
65     corpId = request.getParameter(SessionKey.WEIXIN_APPID) ;
66 }
67
68 SettingIfc settingIfc = (SettingIfc)FactoryBean.getBean("SettingImpl");   
69
70
71 SettingEntity settingEntity = null ;
72 String matCode = (request.getParameter(SettingKey.MATCODE) == null ? "" : request.getParameter(SettingKey.MATCODE)) ;
73
74 //购物车
75 List<CartEntity> cartList = null;
76 CartIfc cartIfc = (CartIfc)FactoryBean.getBean("CartImpl"); 
77
78 //附件图片
79 ShoppingImageIfc shoppingImageIfc = (ShoppingImageIfc)FactoryBean.getBean("ShoppingImageImpl"); 
80 //关注的商品
81 List<MatCodeEntity> matCodeList = null;
82 try {
83     SpObserver.setDBtoInstance("_"+dbId);//切换数据源
84     settingEntity = settingIfc.getSettingEntity() ;
85     
86     //取网店 shopcccode
87     ShopCcCodeEntity shopCcCodeEntity = ShopCcCode.getShopCcCode(settingEntity,request);
88     
89     String hostUrl = SettingKey.getHostUrl(request) ;
90     //将微信corpid组装成url
91     String wxQueryString = SettingKey.getQueryStringByWx(request); 
92     String cssFile ="<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no\">";
93     if (settingEntity.getProductDetailStyle() == 0) {
94         cssFile += "<link rel=\"stylesheet\" href=\""+hostUrl+"/shopping/mobile/css/details.css\">" ;
95     }else if (settingEntity.getProductDetailStyle() == 1) {
96         cssFile += "<link rel=\"stylesheet\" href=\""+hostUrl+"/shopping/mobile/css/details2.css\">" ;
97     }
98
99
100
101        if (settingEntity.getProductListStyle() == 0) { 
102            cssFile += "<link rel=\"stylesheet\" href=\""+hostUrl+"/shopping/mobile/css/index_container.css\">" ;
103         } else if (settingEntity.getProductListStyle() == 1) { 
104             cssFile += "<link rel=\"stylesheet\" href=\""+hostUrl+"/shopping/mobile/css/index_container2.css\">" ;
105        } else if (settingEntity.getProductListStyle() == 2) { 
106            cssFile += "<link rel=\"stylesheet\" href=\""+hostUrl+"/shopping/mobile/css/index_container3.css\">" ;
107         } else if (settingEntity.getProductListStyle() == 3) { 
108             cssFile += "<link rel=\"stylesheet\" href=\""+hostUrl+"/shopping/mobile/css/index_list_container.css\">" ;
109         } 
110        request.setAttribute("cssfile", cssFile);
111     request.setAttribute("isJsViewPort", "true") ;
112     
113        Integer cssCaptionHeight = (settingEntity.getCssCaptionHeight() == null
114                   ||settingEntity.getCssCaptionHeight().equals(0) ? 180: settingEntity.getCssCaptionHeight()) ;
115
116     //商品编号信息
117     MatCodeIfc matCodeIfc = (MatCodeIfc)FactoryBean.getBean("MatCodeImpl");  
118     MatCodeEntity matCodeEntity = matCodeIfc.getMatCode(matCode,shopCcCodeEntity.getShopCcCode());
119     if (matCodeEntity==null) {
120         out.println("未找到编号为【"+matCode+"】商品资料");
121         return ;
122     }
123     
124     //商品附加图片信息
125     MatCodeImageIfc matCodeImageIfc = (MatCodeImageIfc)FactoryBean.getBean("MatCodeImageImpl");  
126     List<MatCodeImageEntity> matImageList = matCodeImageIfc.getMatCodeImage(matCode);
127
128     //商品评价条数
129     Integer matReviewCount = 0 ;
130     if (matCodeEntity != null) {
131         matReviewCount = matCodeEntity.getRatingCount(); 
132     }
133
134     //获取相关商品资料集合 
abc52b 135     List<MatCodeEntity> matRelList = matCodeIfc.getMatCodesByRelMat(matCode,shopCcCodeEntity.getShopCcCode(),cltCode,openId) ;
efff2c 136
J 137     //价格
138     MatPriceIfc matPriceIfcProd = (MatPriceIfc)FactoryBean.getBean("MatPriceImpl");
139     MatPriceEntity matPriceEntity = matPriceIfcProd.getMatPrice(matCode, cltCode, null) ; 
140     Double price = matPriceEntity.getPrice() ;
141     //货币
142     CurrencyIfc currencyIfcProd = (CurrencyIfc)FactoryBean.getBean("CurrencyImpl");  
143     String currencyProd = settingEntity.getCurrency();
144     CurrencyEntity currencyEntityProd = currencyIfcProd.getUserCurrency(userCode);
145
146     //消费积份
147     MatPointsIfc matPointsIfc = (MatPointsIfc)FactoryBean.getBean("MatPointsImpl");  
148     Integer points = matPointsIfc.getMatPoints(matCode, null );
149
150     //商品促销活动关联表
151     MatDiscountIfc matDiscountIfc = (MatDiscountIfc)FactoryBean.getBean("MatDiscountImpl");  
152     List<MatDiscountEntity> matDisList = matDiscountIfc.getMatDiscount(matCode, null );
153
154     //选项
155     MatComponentIfc matComponentIfc = (MatComponentIfc)FactoryBean.getBean("MatComponentImpl");  
156     //显示页面图形(data)
157     ShoppingImageDataIfc imgData = (ShoppingImageDataIfc)FactoryBean.getBean("ShoppingImageDataImpl"); 
158     
159     //取处理过的商品描述 
160     request.setAttribute(SettingKey.FROMOPENID, openId);
161     String matDmatDescription = imgData.getDescriptionByNewImgLink(matCodeEntity.getDescription(), request) ;
162     
163     //购物车
164     cartList = cartIfc.getCartList(userCode, sessionId,openId,cltCode,shopCcCodeEntity.getShopCcCode());    
165     
166     //关注商品资料
167     matCodeList = matCodeIfc.getMatCodesByWishList(userCode,sessionId,openId,cltCode,shopCcCodeEntity.getShopCcCode());
168     List<MatCodeEntity> matCodeCompareList = matCodeIfc.getMatCodesByCompare(userCode,sessionId,openId,cltCode,shopCcCodeEntity.getShopCcCode());
169     ShareIfc shareIfc = (ShareIfc)FactoryBean.getBean("ShareImpl");  
170     ShareEntity shareEntity=shareIfc.getShareEntity(shopCcCodeEntity.getShopCcCode());
171     
172     MatAttrIfc matAttrIfc = (MatAttrIfc)FactoryBean.getBean("MatAttrImpl");
173     boolean hasMatAttr =  matAttrIfc.hasMatAttr(matCode);
174     
175     request.setAttribute(SettingKey.TITLE, (matCodeEntity !=null?matCodeEntity.getMatName():"商品详情"));
176 %>    
177 <jsp:include page="/shopping/mobile/home/header.jsp" flush="true"/>
178 <body class="common-home">
179 <style type="text/css">
180     .product-layout .caption {
181         height: <%=cssCaptionHeight*1.0000/40%>rem;
182     }
183 </style>
184 <% JssdkIfc jssdkIfc = (JssdkIfc)FactoryBean.getBean("JssdkImpl");
185 if (!jssdkIfc.isWeiXinBrowse(request))  { %>
186 <script src="<%=hostUrl%>/shopping/mobile/js/pinchzoom/underscore.js"></script>
187 <script src="<%=hostUrl%>/shopping/mobile/js/pinchzoom/pinchzoom.js"></script>
188
189 <style type="text/css">
190         div.pinch-zoom,
191         div.pinch-zoom img {
192             width: 100%;
193             -webkit-user-drag: none;
194             -moz-user-drag: none;
195             -ms-user-drag: none;
196             user-drag: none;
197         }
198     </style>
199     <script type="text/javascript">
200         $(function () {
201             $('div.pinch-zoom').each(function () {
202                 new RTP.PinchZoom($(this), {});
203             });
204         })
205     </script>
206 <% } %>    
207 <% if (settingEntity.getProductDetailStyle() == 0) { %>
208     <% if (!isMoblieBrowser) { %>
209     <header class="header">
210         <nav id="nav_box"   <% if (settingEntity.getHomePageBackgroundColor()!=null&&!"".equals(settingEntity.getHomePageBackgroundColor())){ %>
211             style="background-color:<%=settingEntity.getHomePageBackgroundColor() %>"
212         <% } %>>
213             <div class="nav_top">
214                 <a href="javascript:window.history.go(-1);" class="esc_btn"></a>
215                 <div class="txt">
216                     <span><%=(matCodeEntity !=null?matCodeEntity.getMatName():"商品详情") %></span>
217                 </div>
218             </div>
219         </nav>
220     </header>
221     <% } %>
222     <div class="container">
223         <% if (!isMoblieBrowser) { %><div style="padding-top:2.5rem"></div><% } %>
224         <div class="">
225             <div id="content" class="">
226                 <div class="">
227                     <div class="">
228                         <ul class="thumbnails">
229                                     <div id="slideshow" class="owl-carousel">
230                                         <div class="item pinch-zoom">
231                                              
232                                              <img class="thumbnail" src="<%= imgData.getImageUrl(matCodeEntity.getPhotoPath(),settingEntity.getImageThumbWidth(),settingEntity.getImageThumbHeight(),settingEntity.isShowThumbOrgImage(),settingEntity.isFromCached(),request) %>" title="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" alt="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" /></div>
233
234                                         <%
235                                          for (int k = 0 ;matImageList != null && k < matImageList.size();k++) {
236                                              MatCodeImageEntity matImage = matImageList.get(k) ;
237                                          %>
238                                         <div class="item pinch-zoom">
239                                              
240                                                <img class="thumbnail" src="<%= imgData.getImageUrl(matImage.getImage(),settingEntity.getImageAdditionalWidth(),settingEntity.getImageAdditionalHeight(),true,settingEntity.isFromCached(),request) %>" title="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" alt="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" /></div>
241                                         <% } %>
242                                     </div>
243                         </ul>
244                         
245                         <ul class="nav nav-tabs">
246                             <li class="active"><a href="#tab-description" data-toggle="tab">商品描述</a></li>
247                             <% if (hasMatAttr) { %>
248                             <li><a href="#tab-specification" data-toggle="tab">商品属性</a></li>
249                             <% } %>
250                             <% if (settingEntity.getReviewStatus()) { %>
251                             <li><a href="#tab-review" data-toggle="tab">商品评价 (<%= (matReviewCount == null?0:matReviewCount) %>)</a></li>
252                             <% } %>
253                         </ul>
254                         
255                         <div class="tab-content">
256                             <div class="tab-pane active pinch-zoom" id="tab-description">
257                             
258                             <div class="property">
259                                 <ul class="list-unstyled">
260                                   <% if (settingEntity.isShowBrand()) { %>
261                                    <li>品  牌: <a href="<%=hostUrl%><%= SettingKey.getBrandUrl(matCodeEntity.getBrandId(),isMoblieBrowser) %><%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString)  %>"><%=matCodeEntity.getShopBrand() %></a></li>
262                                   <% } %>
263                                   <% if (settingEntity.isShowMatName()){ %><li>名  称: <%=matCodeEntity.getMatName() %></li><% } %>
264                                   <% if (settingEntity.isShowMatCode()){ %><li>编  号: <%=matCodeEntity.getShopMatCode() %></li><% } %>
265
266                                   <% if (settingEntity.isShowSpecial()){ %><li>规  格: <%=matCodeEntity.getSpecial() %></li><% } %>
267                                   <% if (settingEntity.isStartupMatName2()) { %><li><%=settingEntity.getMatName2Label() %>: <%=matCodeEntity.getMatName2() %></li><% } %>
268                                   <% if (settingEntity.isStartupMatName3()) { %><li><%=settingEntity.getMatName3Label() %>: <%=matCodeEntity.getMatName3() %></li><% } %>
269                                   <% if (settingEntity.isStartupMatName4()) { %><li><%=settingEntity.getMatName4Label() %>: <%=matCodeEntity.getMatName4() %></li><% } %>
270                                   <% if (settingEntity.isShowPoints()){ %><li>奖励积分:<%= matCodeEntity.getPoints() %></li><% } %>
271                                   <% if (matCodeEntity.getStockStatusName() != null && ! "".equals(matCodeEntity.getStockStatusName())) { %>
272                                   <li>库存状态:<%= matCodeEntity.getStockStatusName() %></li>
273                                   <% } %>
274                                 </ul>
275                                 <ul class="list-unstyled">
276                                 <% 
277                                   if (settingEntity.isShowPrice()) {
278                                     //价格
279                                     if (price!=null && matCodeEntity.getSalesPrice() != null&& price != 0.00 && price < matCodeEntity.getSalesPrice() ) { %> 
280                                     <li><span style="text-decoration: line-through;"><%=currencyEntityProd.getCurrencySign()%><%=matCodeEntity.getSalesPrice()%></span></li>
281                                     <%
282                                         }
283                                     %>
284                                     <li><h2><%=currencyEntityProd.getCurrencySign()%><%=price!=null?price:""%></h2></li>
285                                   <%
286                                       }
287                                   %>
288                                   <%
289                                       //消费积分
290                                       if (settingEntity.isShowPoints() && points != null && ! points.equals(0)) {
291                                   %>
292                                   <li>消费积分:<%=points%></li>
293                                   <%
294                                       }
295                                   %>
296                                   <%
297                                       //商品促销活动关联表
298                                                             if (matDisList != null && matDisList.size() > 0 ) {
299                                   %>
300                                   <li><hr></li>
301                                   <%
302                                       for (int i = 0; matDisList != null && i <matDisList.size();i++) {
303                                   %>
304                                   <li>数量<%=matDisList.get(i).getDigit()%>或更多,优惠价<%=currencyEntityProd.getCurrencySign()%><%=(matDisList.get(i).getPrice()!=null?matDisList.get(i).getPrice():"")%></li>                     
305                                   <%
306                                                            } 
307                                                                                  }
308                                                        %>
309                                 </ul>
310         
311                                 <%=matComponentIfc.getMatComponent(matCodeEntity, matCode, currencyEntityProd.getCurrencySign(),isMoblieBrowser,false)%>
312                                 <%
313                                     if (settingEntity.isShowRatingOnHomePage()) {
314                                                           Integer rating = matCodeEntity.getRatingAvg(); 
315                                                           if (rating != null && ! rating.equals(0))  {
316                                 %>
317                                 <div class="rating">
318                                 <p>
319                                 <%
320                                     for (int k = 0 ; rating != null && k < rating ; k ++) {
321                                 %>
322                                    <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i><i class="fa fa-star-o fa-stack-1x"></i></span>
323                                 <%
324                                     }
325                                 %>
326                                 <%
327                                     for (int k = 0 ; k < 5 - (rating==null?0:rating) ; k++) {
328                                 %>
329                                    <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-1x"></i></span>
330                                 <%
331                                     }
332                                                           }
333                                                         }
334                                 %>
335                                 <%
336                                     if (settingEntity.getReviewStatus()) {
337                                 %>
338                                    <a  onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;"><%=(matReviewCount == null?0: matReviewCount)%> 评价</a>
339                                    
340                                     / <a  onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;">如果您对本商品有什么问题或经验,请在此留下您的意见和建议!</a></p>
341                                         <hr>
342                                     <%
343                                         }
344                                     %>
345                                 </div>
346                             </div>
347                             <div><%=matDmatDescription%></div>
348                             </div>
349                             <%
350                                 if (hasMatAttr) {
351                             %>
352                             <div class="tab-pane" id="tab-specification">
353                                 <jsp:include page="/shopping/product/productattr.jsp" flush="true"/>
354                             </div>
355                             <%
356                                 }
357                             %>
358                             <%
359                                 if (settingEntity.getReviewStatus()) {
360                             %>
361                             <div class="tab-pane" id="tab-review">
362                             
363                              <div id="review"></div>
364                           
365                             </div>
366                             <%
367                                 }
368                             %>
369                         </div>
370                     </div>
371                     
372                 </div>
373
374
375             </div>
376         </div>
377     </div>    
378     
379     
380     
381     
382     
383     <%
384                                 } else  if (settingEntity.getProductDetailStyle() == 1) {
385                             %>
386     
387     <header class="header">
388         <nav id="nav_box"   <%if (settingEntity.getHomePageBackgroundColor()!=null&&!"".equals(settingEntity.getHomePageBackgroundColor())){%>
389             style="background-color:<%=settingEntity.getHomePageBackgroundColor()%>"
390         <%}%>>
391             <div class="nav_top">
392                 <a href="javascript:window.history.go(-1);" class="esc_btn"></a>
393                 <div class="txt">
394                     <ul class="nav nav-tabs">
395                         <li class="active"><a href="#tab-description" data-toggle="tab">商品</a></li>
396                         
397                         <li><a href="#tab-specification" data-toggle="tab">详情</a></li>
398                    
399                         <%
400                                                if (settingEntity.getReviewStatus()) {
401                                            %>
402                         <li><a href="#tab-review" data-toggle="tab">评价</a></li>
403                         <%
404                             }
405                         %>
406                     </ul>
407                 </div>
408             </div>
409         </nav>
410     </header>
411     <div class="container">
412         <div style="padding-top:2.5rem"></div>
413
414             <div id="content" class="">
415
416                 <div class="tab-content">
417                     <div class="tab-pane active pinch-zoom" id="tab-description">
418                         <ul class="thumbnails">
419                                     <div id="slideshow" class="owl-carousel">
420                                         <div class="item">
421                                              <a class="thumbnail" href="<%=imgData.getImageUrl(matCodeEntity.getPhotoPath(),settingEntity.getImagePopupWidth(),settingEntity.getImagePopupHeight(),settingEntity.isShowPopupOrgImage(),settingEntity.isFromCached(),request)%>" title="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>">
422                                              <img src="<%=imgData.getImageUrl(matCodeEntity.getPhotoPath(),settingEntity.getImageThumbWidth(),settingEntity.getImageThumbHeight(),settingEntity.isShowThumbOrgImage(),settingEntity.isFromCached(),request)%>" title="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" alt="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" /></a></div>
423
424                                         <%
425                                             for (int k = 0 ;matImageList != null && k < matImageList.size();k++) {
426                                                                              MatCodeImageEntity matImage = matImageList.get(k) ;
427                                         %>
428                                         <div class="item">
429                                              <a class="thumbnail" href="<%=imgData.getImageUrl(matImage.getImage(),settingEntity.getImagePopupWidth(),settingEntity.getImagePopupHeight(),settingEntity.isShowPopupOrgImage(),settingEntity.isFromCached(),request)%>" title="<%=matCodeEntity.getMatName()%>"> 
430                                                <img src="<%=imgData.getImageUrl(matImage.getImage(),settingEntity.getImageAdditionalWidth(),settingEntity.getImageAdditionalHeight(),settingEntity.isShowAdditionalOrgImage(),settingEntity.isFromCached(),request)%>" title="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" alt="<%=settingEntity.isShowMatName()? matCodeEntity.getMatName():""%>" /></a></div>
431                                         <%
432                                             }
433                                         %>
434                                     </div>
435
436                         </ul>
437                          
438                         <div class="property">
439                             <ul class="list-unstyled">
440                               <%
441                                   if (settingEntity.isShowBrand()) {
442                               %>
443                                <li>品  牌: <a href="<%=hostUrl%><%=SettingKey.getBrandUrl(matCodeEntity.getBrandId(),isMoblieBrowser)%><%=(wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString)%>"><%=matCodeEntity.getBrand()%></a></li>
444                               <%
445                                   }
446                               %>
447                               <%
448                                   if (settingEntity.isShowMatName()){
449                               %><li>名  称: <%=matCodeEntity.getMatName()%></li><%
450                                   }
451                               %>
452                               <%
453                                   if (settingEntity.isShowMatCode()){
454                               %><li>编  号: <%=matCodeEntity.getShopMatCode()%></li><%
455                                   }
456                               %>
457                               
458                               <%
459                                                                 if (settingEntity.isShowSpecial()){
460                                                             %><li>规  格: <%=matCodeEntity.getSpecial()%></li><%
461                                                                 }
462                                                             %>
463                               <%
464                                   if (settingEntity.isStartupMatName2()) {
465                               %><li><%=settingEntity.getMatName2Label()%>: <%=matCodeEntity.getMatName2()%></li><%
466                                   }
467                               %>
468                               <%
469                                   if (settingEntity.isStartupMatName3()) {
470                               %><li><%=settingEntity.getMatName3Label()%>: <%=matCodeEntity.getMatName3()%></li><%
471                                   }
472                               %>
473                               <%
474                                   if (settingEntity.isStartupMatName4()) {
475                               %><li><%=settingEntity.getMatName4Label()%>: <%=matCodeEntity.getMatName4()%></li><%
476                                   }
477                               %>
478                               <%
479                                   if (settingEntity.isShowPoints()){
480                               %><li>奖励积分:<%=matCodeEntity.getPoints()%></li><%
481                                   }
482                               %>
483                               <%
484                                   if (matCodeEntity.getStockStatusName() != null && ! "".equals(matCodeEntity.getStockStatusName())) {
485                               %>
486                               <li>库存状态:<%=matCodeEntity.getStockStatusName()%></li>
487                               <%
488                                   }
489                               %>
490                             </ul>
491                             <ul class="list-unstyled">
492                             <%
493                                 if (settingEntity.isShowPrice()) {
494                                     //价格
495                                     if (price!=null&&matCodeEntity.getSalesPrice() !=null&&price != 0.00 && price < matCodeEntity.getSalesPrice() ) {
496                             %> 
497                                 <li><span style="text-decoration: line-through;"><%=currencyEntityProd.getCurrencySign()%><%=matCodeEntity.getSalesPrice()%></span></li>
498                                 <%
499                                     }
500                                 %>
501                                 <li><h2><%=currencyEntityProd.getCurrencySign()%><%= price!=null? price:""%></h2></li>
502                               <%
503                                   }
504                               %>
505                               <%
506                                   //消费积分
507                                                     if (settingEntity.isShowPoints() && points != null && ! points.equals(0)) {
508                               %>
509                               <li>消费积分:<%=points%></li>
510                               <%
511                                   }
512                               %>
513                               <%
514                                   //商品促销活动关联表
515                                                     if (matDisList != null && matDisList.size() > 0 ) {
516                               %>
517                               <li><hr></li>
518                               <%
519                                   for (int i = 0; matDisList != null && i <matDisList.size();i++) {
520                               %>
521                               <li>数量<%=matDisList.get(i).getDigit()%>或更多,优惠价<%=currencyEntityProd.getCurrencySign()%><%=matDisList.get(i).getPrice()!=null?matDisList.get(i).getPrice():""%></li>                     
522                               <%
523                                                        } 
524                                                                          }
525                                                    %>
526                             </ul>
527                             <%=matComponentIfc.getMatComponent(matCodeEntity, matCode, currencyEntityProd.getCurrencySign(),isMoblieBrowser,false)%>
528                             <%
529                             if (settingEntity.isShowRatingOnHomePage()) {
530                               Integer rating = matCodeEntity.getRatingAvg();  
531                               if (rating != null && ! rating.equals(0))  {
532                             %>
533                             <div class="rating">
534                             <p>
535                             <% for (int k = 0 ; rating != null && k < rating ; k ++) { %>
536                                <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i><i class="fa fa-star-o fa-stack-1x"></i></span>
537                             <% } %>
538                             <% for (int k = 0 ; k < 5 - (rating==null?0:rating) ; k++) { %>
539                                <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-1x"></i></span>
540                             <% } 
541                               }
542                             } %>
543                             <% if (settingEntity.getReviewStatus()) { %>
544                                <a href="" onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;"><%= (matReviewCount == null?0: matReviewCount) %> 评价</a> / <a href="" onclick="$('a[href=\'#tab-review\']').trigger('click'); return false;">如果您对本商品有什么问题或经验,请在此留下您的意见和建议!</a></p>
545                             <hr>
546                             <% } %>
547                             </div>
548                         </div>
549                         
550                     </div>
551                     
552                     <div class="tab-pane" id="tab-specification">
553                         <div><%= matDmatDescription  %></div><br/>
554                         <jsp:include page="/shopping/product/productattr.jsp" flush="true"/>
555                     </div>
556                   
557
558
559                     <div class="tab-pane" id="tab-review">
560                     <% if (settingEntity.getReviewStatus()) { %>
561                      <div id="review"></div>
562                      <%} %>
563                         
564                     </div>
565                 </div>
566             </div>
567     <% } %>
568     </div>
569     <div id="productlist" class="clearfix">
570       <% if (matRelList != null && matRelList.size() > 0) {
571             ProductListSetting set = new ProductListSetting() ;
572             set.setDisplay("grid");
573           set.setProductThumbCss("transition") ;
574           set.setFrom("3");
575           
576           set.setShowCompareBlock(true);
577           set.setShowPageBarBlock(false) ;
578           set.setShowSortBlock(false) ;
579           set.setTitle("<h4 class=\"h4\">相关商品</h4>") ;
580           request.setAttribute(SettingKey.PRODLISTSETTING, set);
581           if (settingEntity.getProductListStyle() == 0||settingEntity.getProductListStyle() == 1
582                   ||settingEntity.getProductListStyle() == 2 ) {
583           %>
584           <jsp:include page="/shopping/mobile/product/ProductVertical.jsp" flush="true"/>
585       <%  } else { %>
586           <jsp:include page="/shopping/mobile/product/ProductHorizontal.jsp" flush="true"/>
587       <%  } 
588       }
589       %>
590     </div>
591     <div style="height:3rem"></div>
592     <footer>
593         <div class="footer">
594             <div class="button-group">
595                 <button type="button" title="购物车" style="cursor:pointer;" onclick="location.href='<%= hostUrl%>/shopping/mobile/cart/index.jsp<%= (wxQueryString == null||"".equals(wxQueryString)?"":"?" + wxQueryString)  %>'"><i class="fa fa-shopping-cart"></i><span class="cart-num btn-num"><%= cartList !=null?cartList.size():0 %></span> <span class="">购物车</span></button>
596                 <button type="button" title="收藏" onclick="wishlist.add('<%=matCodeEntity.getMatCode() %>');" style="cursor:pointer;"><i class="fa fa-heart"></i><span class="star-num btn-num"><%= matCodeList!=null?matCodeList.size():0 %></span><span class="">收藏</span></button>
597                 <button type="button" title="对比" onclick="compare.add('<%=matCodeEntity.getMatCode() %>');" style="cursor:pointer;"><i class="fa fa-exchange"></i><span class="compare-num btn-num"><%= matCodeCompareList != null?matCodeCompareList.size():0 %></span><span class="">对比</span></button>
598             </div>
599             <div class="go-order">
600                 <a class="go-cart"  id="button-cart">加入购物车</a>
601                 <a class="go-shop" id="button-shop">立即购买</a>
602             </div>
603         </div>
604     </footer>
605
606     <jsp:include page="/shopping/mobile/home/gotop.jsp" flush="true"/>
607     <script type="text/javascript">
608         $(function(){
609             
610             // 数量减
611             $(".a-red").click(function() {
612                 var t = $(this).parent().find('.car-item-count-inp');
613                 t.val(parseInt(t.val()) - 1);
614                 if (t.val() <= 1) {
615                     t.val(1);
616                 }
617             });
618             // 数量加
619             $(".a-add").click(function() {
620                 var t = $(this).parent().find('.car-item-count-inp');
621                 t.val(parseInt(t.val()) + 1);
622                 if (t.val() <= 1) {
623                     t.val(1);
624                 }
625             });
626             $(".contentImg").addClass("img-responsive center-block");
627         });
628     </script>
629
630
631
632
633 <script type="text/javascript"><!--
634 $('.date').datetimepicker({
635     pickTime: false
636 });
637
638 $('.datetime').datetimepicker({
639     pickDate: true,
640     pickTime: true
641 });
642
643 $('.time').datetimepicker({
644     pickDate: false
645 });
646
647 $('button[id^=\'button-upload\']').on('click', function() {
648     var node = this;
649
650     $('#form-upload').remove();
651
652     $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
653
654     $('#form-upload input[name=\'file\']').trigger('click');
655
656     if (typeof timer != 'undefined') {
657         clearInterval(timer);
658     }
659
660     timer = setInterval(function() {
661         if ($('#form-upload input[name=\'file\']').val() != '') {
662             clearInterval(timer);
663
664             $.ajax({
665                 url: 'index.php?route=tool/upload',
666                 type: 'post',
667                 dataType: 'json',
668                 data: new FormData($('#form-upload')[0]),
669                 cache: false,
670                 contentType: false,
671                 processData: false,
672                 beforeSend: function() {
673                     $(node).button('loading');
674                 },
675                 complete: function() {
676                     $(node).button('reset');
677                 },
678                 success: function(json) {
679                     $('.text-danger').remove();
680
681                     if (json['error']) {
682                         $(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
683                     }
684
685                     if (json['success']) {
686                         alert(json['success']);
687
688                         $(node).parent().find('input').attr('value', json['code']);
689                     }
690                 },
691                 error: function(xhr, ajaxOptions, thrownError) {
692                     alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
693                 }
694             });
695         }
696     }, 500);
697 });
698 //--></script>
699 <script type="text/javascript"><!--
700 $('#review').delegate('.pagination a', 'click', function(e) {
701     e.preventDefault();
702
703     $('#review').fadeOut('slow');
704
705     $('#review').load(this.href);
706
707     $('#review').fadeIn('slow');
708 });
709
710 $('#review').load('/shopping/matreviewlist.do?<%=SettingKey.MATCODE%>=<%=matCode %><%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString)  %>');
711
712 $('#button-review').on('click', function() {
713     $.ajax({
714         url: '/shopping/matreviewwrite.do?<%=SettingKey.MATCODE%>=<%=matCode %><%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString)  %>',
715         type: 'post',
716         dataType: 'json',
717         data: $("#form-review").serialize(),
718         beforeSend: function() {
719             $('#button-review').button('loading');
720         },
721         complete: function() {
722             $('#button-review').button('reset');
723         },
724         success: function(json) {
725             $('.alert-success, .alert-danger').remove();
726
727             if (json['error']) {
728                 $('#review').after('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
729             }
730
731             if (json['success']) {
732                 $('#review').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');
733
734                 $('input[name=\'name\']').val('');
735                 $('textarea[name=\'text\']').val('');
736                 $('input[name=\'rating\']:checked').prop('checked', false);
737             }
738         }
739     });
740 });
741 <% if (!jssdkIfc.isWeiXinBrowse(request)) { %>
742 $(document).ready(function() {
743     $('.thumbnails').magnificPopup({
744         type:'image',
745         delegate: 'a',
746         gallery: {
747             enabled:true
748         }
749     });
750 });
751 <% } %>
752     $(function () {
753         $('#slideshow').owlCarousel({
754             items: 1,
755             autoPlay: false,
756             singleItem: true,
757             pagination:true
758         });
759     })
760 //--></script>
761
762 <% 
763 //设置微信分享
764 //微信js api 列表
765 request.setAttribute(SettingKey.JSAPILIST,new String[]{"onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareQZone","previewImage"});
766 //图片缩放
767 //request.setAttribute(SettingKey.WXPREVIEWIMAGES,new String[]{"#slideshow img",".tab-content img",".tab-pane img"}) ;
768 request.setAttribute(SettingKey.WXPREVIEWIMAGES,new String[]{"img"}) ;
769 %>
770 <jsp:include page="/shopping/mobile/account/sharewidget.jsp" flush="true" /> 
771
772 <script type="text/javascript">
773 //阻止 a 标签生效
774 $("#slideshow a").click(function(e){
775     e.preventDefault();
776 })
777 </script>
778 <script type="text/javascript"><!--
779 $('#button-cart').on('click', function() {
780     $.ajax({
781         url: '/shopping/cart.do?m=add<%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString)  %>',
782         type: 'post',
783         data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
784         dataType: 'json',
785         beforeSend: function() {
786             $('#button-cart').button('loading');
787         },
788         complete: function() {
789             $('#button-cart').button('reset');
790         },
791         success: function(json) {
792             $('.alert, .text-danger').remove();
793             $('.form-group').removeClass('has-error');
794
795             if (json['error']) {
796                 if (json['error']['option']) {
797                     for (i in json['error']['option']) {
798                         var element = $('#input-option' + i.replace('_', '-'));
799
800                         if (element.parent().hasClass('input-group')) {
801                             element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
802                         } else {
803                             element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
804                         }
805                     }
806                 }
807
808                 if (json['error']['recurring']) {
809                     $('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
810                 }
811
812                 if (json['error']['quantity']) {
813                     $('#input-quantity').after('<div class="text-danger">' + json['error']['quantity'] + '</div>');
814                 }
815                 
816                 // Highlight any found errors
817                 $('.text-danger').parent().addClass('has-error');
818             }
819
820             if (json['success']) {
821                 $('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
822
823                 $('#cart > button').html('<i class="fa fa-shopping-cart"></i> ' + json['total']);
824
825                 //$('html, body').animate({ scrollTop: 0 }, 'slow');
826
827                 $('#cart > ul').load('/shopping/cart.do?m=info ul li');
828                 
829                 if (json['cart-num']) {
830                        $('.cart-num').html(json['cart-num']) ;
831                 }
832                 
833                 //https://github.com/akquinet/jquery-toastmessage-plugin/wiki
834                 // user configuration of all toastmessages to come:
835                 $().toastmessage('showToast', {
836                     inEffectDuration:600,
837                     stayTime:  2000,
838                     text     : json['toastmessage'],
839                     sticky   : false,
840                     position : 'middle-center',
841                     type     : 'success'
842                 });
843             }
844         },
845         error: function(xhr, ajaxOptions, thrownError) {
846             alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
847         }
848     });
849 });
850
851 $('#button-shop').on('click', function() {
852     $.ajax({
853         url: '/shopping/cart.do?m=add&action=goshop<%= (wxQueryString == null||"".equals(wxQueryString)?"":"&" + wxQueryString)  %>',
854         type: 'post',
855         data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
856         dataType: 'json',
857         beforeSend: function() {
858             $('#button-cart').button('loading');
859         },
860         complete: function() {
861             $('#button-cart').button('reset');
862         },
863         success: function(json) {
864             $('.alert, .text-danger').remove();
865             $('.form-group').removeClass('has-error');
866
867             if (json['redirect']) {
868                 location = json['redirect'];
869                 return ;
870             }
871             if (json['error']) {
872                 if (json['error']['option']) {
873                     for (i in json['error']['option']) {
874                         var element = $('#input-option' + i.replace('_', '-'));
875
876                         if (element.parent().hasClass('input-group')) {
877                             element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
878                         } else {
879                             element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
880                         }
881                     }
882                 }
883
884                 if (json['error']['recurring']) {
885                     $('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
886                 }
887
888                 if (json['error']['quantity']) {
889                     $('#input-quantity').after('<div class="text-danger">' + json['error']['quantity'] + '</div>');
890                 }
891                 
892                 // Highlight any found errors
893                 $('.text-danger').parent().addClass('has-error');
894             }
895
896             if (json['success']) {
897                 $('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
898
899                 $('#cart > button').html('<i class="fa fa-shopping-cart"></i> ' + json['total']);
900
901                 //$('html, body').animate({ scrollTop: 0 }, 'slow');
902
903                 $('#cart > ul').load('/shopping/cart.do?m=info ul li');
904                 //https://github.com/akquinet/jquery-toastmessage-plugin/wiki
905                 // user configuration of all toastmessages to come:
906                 $().toastmessage('showToast', {
907                     inEffectDuration:600,
908                     stayTime:  2000,
909                     text     : json['toastmessage'],
910                     sticky   : false,
911                     position : 'middle-center',
912                     type     : 'success'
913                 });
914             }
915         },
916         error: function(xhr, ajaxOptions, thrownError) {
917             alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
918         }
919     });
920 });
921 //--></script>
922
923 </body>
924 </html>
925
926 <% 
927  
928  
929  }catch(DataAccessException e ) {
930     e.printStackTrace();
931 }catch(Exception e ) {
932     e.printStackTrace();
933 }finally {
934     SpObserver.setDBtoInstance();
935 }
936
a6a76f 937 %>