shop.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:20k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="cn.js.fan.db.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <%@ page import="cn.js.fan.module.nav.*"%>
  7. <%@ page import="com.redmoon.forum.plugin.auction.*"%>
  8. <%@ page import="com.redmoon.forum.plugin.info.*"%>
  9. <%@ page import="com.redmoon.forum.MsgDb"%>
  10. <%@ page import="com.redmoon.forum.person.UserDb"%>
  11. <%@ page import="cn.js.fan.module.guestbook.*"%>
  12. <%
  13. int id = -1;
  14. try {
  15. id = ParamUtil.getInt(request, "id");
  16. }
  17. catch (Exception e) {
  18. }
  19. AuctionShopDb as = new AuctionShopDb();
  20. String userName = "";
  21. if (id!=-1)
  22. userName = StrUtil.getNullString(as.getShopUserNameById(id));
  23. if (userName.equals(""))
  24. userName = ParamUtil.get(request, "userName");
  25. if (userName.equals("")) {
  26. out.print(SkinUtil.makeErrMsg(request, "对不起,缺少参数!"));
  27. return;
  28. }
  29. as = as.getAuctionShopDb(userName);
  30. if (as==null || !as.isLoaded()) {
  31. out.print(cn.js.fan.web.SkinUtil.makeInfo(request, AuctionSkin.LoadString(request, "info_not_exist")));
  32. return;
  33. }
  34. if (!as.isValid()) {
  35. out.print(cn.js.fan.web.SkinUtil.makeInfo(request, AuctionSkin.LoadString(request, "info_invalid")));
  36. return;
  37. }
  38. MsgDb md = new MsgDb();
  39. UserDb user = new UserDb();
  40. user = user.getUser(userName);
  41. %>
  42. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  43. <HTML>
  44. <HEAD>
  45. <TITLE><%=as.getShopName()%>-<%=Global.AppName%>社区专卖店</TITLE>
  46. <META http-equiv=Content-Type content="text/html; charset=utf-8">
  47. <script language="JavaScript">
  48. function openWin(url,width,height)
  49. {
  50.   var newwin = window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,top=50,left=120,width="+width+",height="+height);
  51. }
  52. </script>
  53. <META content="MSHTML 6.00.2600.0" name=GENERATOR>
  54. </HEAD>
  55. <LINK href="shopskin/<%=as.getSkinCode()%>/skin.css" type=text/css rel=stylesheet>
  56. <BODY>
  57. <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0" class="banner">
  58.   <tr>
  59.     <td height="23" colspan="2" valign="top"><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="topnav_table">
  60.         <tr>
  61.           <td width="7%" height="23">&nbsp;</td>
  62.           <td width="21%" align="center" class="topnav_td"><%=as.getShopName()%></td>
  63.           <td width="17%" align="center"><a href="shopdesc.jsp?userName=<%=StrUtil.UrlEncode(userName)%>" class="link_topnav">【店铺介绍】</a></td>
  64.           <td width="55%">&nbsp;</td>
  65.         </tr>
  66.       </table></td>
  67.   </tr>
  68.   <tr>
  69.     <td width="50%"><div class="shopInfo">
  70.         <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  71.           <tr>
  72.             <td width="45%" rowspan="6" align="center"><%
  73. String logo = StrUtil.getNullStr(as.getLogo());
  74. if (!logo.equals("")) {
  75. String w = "";
  76. if (as.getLogoWidth()>as.LOGO_NO_WIDTH)
  77. w = "width=" + as.getLogoWidth();
  78.       %>
  79.               <img src="<%=request.getContextPath() + "/" + logo%>" <%=w%>>
  80.               <%}
  81. %>            </td>
  82.             <td width="20%"><span>店&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;长:</span></td>
  83.             <td width="35%"><%=userName%></td>
  84.           </tr>
  85.           <tr>
  86.             <td><span>信&nbsp;&nbsp;用&nbsp;&nbsp;值:</span></td>
  87.             <td><%=user.getCredit()%></td>
  88.           </tr>
  89.           <tr>
  90.             <td><span>开店时间:</span></td>
  91.             <td><%=DateUtil.format(as.getOpenDate(), "yy-MM-dd")%></td>
  92.           </tr>
  93.           <tr>
  94.             <td><span>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址:</span></td>
  95.             <td><%=as.getAddress()%></td>
  96.           </tr>
  97.           <tr>
  98.             <td><span>域&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:</span></td>
  99.             <td><a href="http://<%=as.getId()%>.zjrj.cn">http://<%=as.getId()%>.zjrj.cn</a></td>
  100.           </tr>
  101.           <tr>
  102.             <td>&nbsp;</td>
  103.             <td><a href="javascript:openWin('<%=request.getContextPath()%>/message/send.jsp?receiver=<%=userName%>',320,260)">站内消息</a>&nbsp;&nbsp;<a href="manager/index.jsp?userName=<%=StrUtil.UrlEncode(userName)%>">管理店铺</a> </td>
  104.           </tr>
  105.         </table>
  106.       </div></td>
  107.     <td width="50%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="announce_bg">
  108.         <tr>
  109.           <td width="100%" colspan="2" class="">&nbsp;</td>
  110.         </tr>
  111.       </table>
  112.       <table width="100%" border="0" cellpadding="0" cellspacing="1">
  113.         <tr>
  114.           <td height="21" colspan="2" valign="middle" class="notice_title_td"><span class="text_14_bold">本店消息</span></td>
  115.         </tr>
  116.         <tr>
  117.           <td height="13" colspan="2"><hr size="1" class="notice_hr"></td>
  118.         </tr>
  119.         <%
  120. InfoDb idb = new InfoDb();
  121. Iterator idbir = idb.list(0, 4, userName).iterator();
  122. while (idbir.hasNext()) {
  123. idb = (InfoDb)idbir.next();
  124. md = md.getMsgDb(idb.getId());
  125. %>
  126.         <tr>
  127.           <td width="83%" height="22">【<%=idb.getTypeName()%>】<span class="dirItem"><a href="../../showtopic.jsp?rootid=<%=md.getId()%>" target=_blank><%=md.getTitle()%></a></span></td>
  128.           <td width="17%" height="22"><%=DateUtil.format(idb.getAddDate(), "yy-MM-dd")%></td>
  129.         </tr>
  130.         <%}%>
  131.       </table></td>
  132.   </tr>
  133. </table>
  134. <table width="98%"  border="0" align="center" class="recommand">
  135.   <tr>
  136.     <td><%
  137. AuctionDb ad = new AuctionDb();
  138. Iterator rcir = ad.listRecommand(userName).iterator();
  139. while (rcir.hasNext()) {
  140. %>
  141.       <table border="0" align="left">
  142.         <tr>
  143.           <td width="139" height="106" align="center" valign="bottom"><%
  144. ad = (AuctionDb) rcir.next();
  145. String fileName = StrUtil.getNullString(ad.getImage());
  146. if (fileName.equals("")) {
  147. md = md.getMsgDb(ad.getMsgRootId());
  148. fileName = StrUtil.getNullString(md.getFileName());
  149. }
  150. if (!fileName.equals("")) {
  151. %>
  152.             <img src="../../<%=fileName%>" width=80>
  153.         <%}else{%>
  154.             <img src="shopskin/default/images/noimg.jpg" width="80" height="105">
  155.         <%}%>
  156. </td>
  157.         </tr>
  158.         <tr>
  159.           <td height="22" align="center"><a href="../../showtopic.jsp?rootid=<%=ad.getMsgRootId()%>" class="link_commodity"><%=ad.getName()%></a></td>
  160.         </tr>
  161.         <tr>
  162.           <td align="center"><%=ad.getSellTypeDesc(request)%>&nbsp;
  163.             <%
  164. AuctionWorthDb aw = new AuctionWorthDb();
  165. long[] ary = aw.getWorthOfAuction(ad.getMsgRootId());
  166. if (ad.getSellType()==ad.SELL_TYPE_AUCTION) {
  167. aw = aw.getAuctionWorthDb((int)ary[0]);
  168. %>
  169.             <span class="text_price"><%=aw.getMoneyName()%><%=aw.getPrice()%>&nbsp;<%=aw.getMoneyDanWei()%></span>
  170.             <%} else {
  171. int len = ary.length;
  172. for (int i=0; i<len; i++) {
  173. aw = aw.getAuctionWorthDb((int)ary[i]);
  174. %>
  175.             &nbsp;<span class="text_price"><%=aw.getMoneyName()%><%=aw.getPrice()%>&nbsp;<%=aw.getMoneyDanWei()%></span><br>
  176.             <%}
  177. }%>
  178.           </td>
  179.         </tr>
  180.       </table>
  181.       <%}%>
  182.     </td>
  183.   </tr>
  184. </table>
  185. <TABLE width=98% border=0 align="center" cellPadding=0 cellSpacing=0 class="main_table_bg">
  186.   <TBODY>
  187.     <TR>
  188.       <TD width="19%" align=middle vAlign=top><TABLE cellSpacing=0 cellPadding=0 width=100% border=0 class="dir_frame">
  189.           <TBODY>
  190.             <TR>
  191.               <TD height=33 valign="top" class=p3><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="dir_title">
  192.                   <tr>
  193.                     <td><span id=dir_title class="text_white_bold">商品目录</span></td>
  194.                   </tr>
  195.                 </table>
  196.                 <table width="99%" height="29"  border="0" cellpadding="0" cellspacing="0">
  197.                   <tr>
  198.                     <td width="11%" class="text_dir_all">&nbsp;</td>
  199.                     <td align="left" class="text_dir_all"><img src="images/default/arrow.gif" width="13" height="12" border="0" align="absmiddle">&nbsp;<span class="dirItem"><a href="shop.jsp?userName=<%=StrUtil.UrlEncode(userName)%>">全部商品</a></span></td>
  200.                   </tr>
  201.                 </table>
  202.                 <%
  203. AuctionShopDirDb asd = new AuctionShopDirDb();
  204. Iterator irdir = asd.list(userName).iterator();
  205. while (irdir.hasNext())
  206. {
  207. asd = (AuctionShopDirDb) irdir.next();
  208. %>
  209.                 <table width=100% border=0 cellspacing=0 cellpadding=0 class="p9">
  210.                   <tr>
  211.                     <td width=11% height=20>&nbsp;</td>
  212.                     <td width=89%><img src="images/default/arrow.gif" width="13" height="12" border="0" align="absmiddle">&nbsp;<span class="dirItem"><a href="?userName=<%=StrUtil.UrlEncode(userName)%>&dirCode=<%=StrUtil.UrlEncode(asd.getCode())%>"><%=asd.getDirName()%></a></span></td>
  213.                   </tr>
  214.                 </table>
  215.                 <% }%>
  216.                 <table width="99%" height="29"  border="0" cellpadding="0" cellspacing="0">
  217.                   <tr>
  218.                     <td width="11%" class="text_dir_all">&nbsp;</td>
  219.                     <td align="left" class="text_dir_all"><img src="images/default/arrow.gif" width="13" height="12" border="0" align="absmiddle">&nbsp;<span class="dirItem"><a href="shop_alipay.jsp?userName=<%=StrUtil.UrlEncode(userName)%>">支付宝交易</a></span></td>
  220.                   </tr>
  221.                 </table></TD>
  222.             </TR>
  223.           </TBODY>
  224.         </TABLE>
  225.         <br>
  226.         <TABLE cellSpacing=0 cellPadding=0 width=100% border=0 class="link_frame">
  227.           <TBODY>
  228.             <TR>
  229.               <TD height=161 valign="top" class=p3><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="dir_title">
  230.                   <tr>
  231.                     <td><span id=dir_title class="text_white_bold">友情链接</span></td>
  232.                   </tr>
  233.                 </table>
  234.                 <%
  235. LinkDb ld = new LinkDb();
  236. String listsql = "select id from " + ld.getTableName() + " where userName=" + StrUtil.sqlstr(userName) + " and kind=" + StrUtil.sqlstr(ld.KIND_SHOP) + " order by sort";
  237. Iterator irlink = ld.list(listsql).iterator();
  238. while (irlink.hasNext())
  239. {
  240. ld = (LinkDb) irlink.next();
  241. %>
  242.                 <table width=100% border=0 cellspacing=0 cellpadding=0 class="p9">
  243.                   <tr>
  244.                     <td width=11% height=20>&nbsp;</td>
  245.                     <td width=89%>&nbsp;<span class="dirItem"><a target="_blank" href="<%=ld.getUrl()%>" title="<%=ld.getTitle()%>"><%=ld.getTitle()%></a></span></td>
  246.                   </tr>
  247.                 </table>
  248.                 <%}%>
  249.               </TD>
  250.             </TR>
  251.           </TBODY>
  252.         </TABLE></TD>
  253.       <TD vAlign=top width=1%>&nbsp;</TD>
  254.       <TD width="80%" vAlign=top><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 class="p9">
  255.           <TBODY>
  256.             <TR>
  257.               <TD width="431">
  258.             <TR vAlign=top>
  259.               <TD height="251" colspan="2"><table width="100%"  border="0" cellpadding="0" cellspacing="0">
  260.                   <tr>
  261.                     <td width="97" height="22" class="commodity_bar">&nbsp;&nbsp;
  262. <%
  263. String dirCode = ParamUtil.get(request, "dirCode");
  264. String dirName = "全部商品";
  265. if (!dirCode.equals("")) {
  266. asd = asd.getAuctionShopDirDb(userName, dirCode);
  267. if (asd!=null && asd.isLoaded()) {
  268. dirName = asd.getDirName();
  269. }
  270. }
  271. %>
  272. <span class="commodity_title_text"><%=dirName%></span>
  273. </td>
  274.                     <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="p9">
  275.                         <form name="form_search" method="post" action="search.jsp" onSubmit="">
  276.                           <tr>
  277.                             <td width="57%" align="center">&nbsp;</td>
  278.                             <td width="43%" height="22" align="center"><input value="" name="what" onFocus="" onBlur="" type="text" class="singleboarder" size=16 style="height: 18">
  279.                               <input type="image" value="images/default/search.gif" src="images/default/search.gif" align="middle" width="57" height="16"></td>
  280.                           </tr>
  281.                         </form>
  282.                       </table></td>
  283.                   </tr>
  284.                   <tr>
  285.                     <td height="4" colspan="2" class="commodity_bar_tr"></td>
  286.                   </tr>
  287.                 </table>
  288.                 <%
  289. String sql = "";
  290. if (dirCode.equals(""))
  291. sql = "select msgRootId from " + ad.getTableName() + " where userName="+StrUtil.sqlstr(userName) + " order by beginDate desc";
  292. else
  293. sql = "select msgRootId from " + ad.getTableName() + " where userName="+StrUtil.sqlstr(userName) + " and shopDir=" + StrUtil.sqlstr(dirCode) + " order by beginDate desc";
  294. int pagesize = 20;
  295. Paginator paginator = new Paginator(request);
  296. int total = ad.getObjectCount(sql);
  297. paginator.init(total, pagesize);
  298. int curpage = paginator.getCurPage();
  299. //设置当前页数和总页数
  300. int totalpages = paginator.getTotalPages();
  301. if (totalpages==0)
  302. {
  303. curpage = 1;
  304. totalpages = 1;
  305. }
  306. %>
  307.                 <% if(paginator.getTotal()>0){ %>
  308.                 <table width="91%" border="0" cellspacing="0" cellpadding="0" align="center" class="p9" height="24">
  309.                   <tr>
  310.                     <td width="100%" height="24" valign="bottom"><div align="right">共 <b><%=paginator.getTotal() %></b> 条 每页<b><%=paginator.getPageSize() %></b> 条 <b><%=curpage %>/<%=totalpages %></b> &nbsp;&nbsp;
  311.                         <%
  312.   String querystr = "userName=" + StrUtil.UrlEncode(userName) + "&dirCode=" + StrUtil.UrlEncode(dirCode);
  313.     out.print(paginator.getCurPageBlock("?"+querystr));
  314.   %>
  315.                       </div></td>
  316.                   </tr>
  317.                 </table>
  318.                 <%}%>
  319.                 <table width="100%"  border="0" cellspacing="8">
  320.                   <%
  321. Iterator ir = ad.list(sql, (curpage-1)*pagesize, curpage*pagesize-1).iterator();
  322. int k = 0;
  323. while (ir.hasNext()) {
  324. ad = (AuctionDb) ir.next();
  325. k++;
  326. if (k==1) {%>
  327.                   <tr>
  328.                     <td bgcolor="#FFFFFF"><%}
  329. %>
  330.                       <table width="120" border=0 align="left" class="p9">
  331.                         <tr>
  332.                           <td height=100 align=center valign=bottom><%
  333.   String fileName = StrUtil.getNullString(ad.getImage());
  334.   if (fileName.equals("")) {
  335. md = md.getMsgDb(ad.getMsgRootId());
  336. fileName = StrUtil.getNullString(md.getFileName());
  337.   }
  338.   if (!fileName.equals("")) {
  339.   %>
  340.                             <img src="../../<%=fileName%>" width="80">
  341.                           <%}else{%>
  342.                             <img src="shopskin/default/images/noimg.jpg" width="80" height="105">
  343.                           <%}%>
  344.                           </td>
  345.                         </tr>
  346.                         <tr>
  347.                           <td width="154" height="20" align="center" valign="top">&nbsp; <a href="../../showtopic.jsp?rootid=<%=ad.getMsgRootId()%>" class="link_commodity"><%=ad.getName()%></a></td>
  348.                         </tr>
  349.                         <tr>
  350.                           <td height="40" align="center" valign="top"><%
  351. AuctionWorthDb aw = new AuctionWorthDb();
  352. long[] ary = aw.getWorthOfAuction(ad.getMsgRootId());
  353. if (ad.getSellType()==ad.SELL_TYPE_AUCTION) {
  354. // System.out.println("msgRootId=" + ad.getMsgRootId());
  355. if (ary.length!=0)
  356. aw = aw.getAuctionWorthDb((int)ary[0]);
  357. %>
  358.                             拍卖&nbsp;<%=aw.getMoneyName()%><%=aw.getPrice()%>&nbsp;<%=aw.getMoneyDanWei()%>
  359.                             <%} else {
  360. int len = ary.length;
  361. for (int m=0; m<len; m++) {
  362. aw = aw.getAuctionWorthDb((int)ary[m]);
  363. %>
  364.                             一口价&nbsp;<%=aw.getMoneyName()%><%=aw.getPrice()%>&nbsp;<%=aw.getMoneyDanWei()%><br>
  365.                             <%}
  366. }%>
  367.                           </td>
  368.                         </tr>
  369.                       </table>
  370.                       <%
  371.    if (k==5) {
  372. out.print("</td></tr>");
  373. k = 0;
  374. }
  375.   }%>
  376.                       <%if (k!=0) {%>
  377.                     </td>
  378.                   </tr>
  379.                   <%}%>
  380.                 </table>
  381.                 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  382.                   <tr>
  383.                     <td>&nbsp;</td>
  384.                   </tr>
  385.                 </table>
  386.                 <jsp:useBean id="msg" scope="page" class="cn.js.fan.module.guestbook.MessageDb"/>
  387.                 
  388.                 <table width="100%"  border="0" cellpadding="8">
  389.                   <tr>
  390.                     <td><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  391.                         <tr>
  392.                           <td height="2" colspan="2" class="guestbook_bar_tr"></td>
  393.                         </tr>
  394.                         <tr>
  395.                           <td width="153" height="24" class="guestbook_bar">&nbsp;&nbsp;<span class="text_white_bold">本店最新留言</span></td>
  396.                           <td align="right"><a href="guestbook.jsp?shopCode=<%=StrUtil.UrlEncode(userName)%>" class="nav_guestbook">更多留言</a>&nbsp;&nbsp;<a href="guestbook.jsp?shopCode=<%=StrUtil.UrlEncode(userName)%>" class="nav_guestbook">我要留言</a>&nbsp;&nbsp;</td>
  397.                         </tr>
  398.                       </table>
  399.                       <%
  400. sql = "select id from guestbook where shopCode=" + StrUtil.sqlstr(userName) + " order by lydate desc";
  401. Iterator ri = msg.list(sql, 0, 2).iterator();
  402. while (ri.hasNext()) {
  403.   msg = (MessageDb)ri.next();
  404. %>
  405.                       <table width="100%" border="0" align="center" cellpadding="6" cellspacing="0" bgcolor="#FFFFFF" class="tableframe">
  406.                         <tr>
  407.                           <td width="27%" height="22" valign="bottom" class="stable style4">用户:<%=StrUtil.toHtml(msg.getUserName())%> </td>
  408.                           <td width="73%" height="22" valign="bottom" class="stable style4">留言日期:<%=DateUtil.format(msg.getLydate(), "yy-MM-dd HH:mm:ss")%></td>
  409.                         </tr>
  410.                         <tr valign="top">
  411.                           <td height="83" colspan="2" class="stable"><%=StrUtil.toHtml(msg.getContent())%><br>
  412.                             <%
  413.   String reply = StrUtil.getNullString(msg.getReply());
  414.   if (!reply.equals(""))
  415.   {
  416.   %>
  417.                             <br>
  418.                             <font color="#F09F6F">回复:</font><%=StrUtil.toHtml(reply)%> <br>
  419.                             日期:<%=DateUtil.format(msg.getLydate(), "yy-MM-dd HH:mm:ss")%>
  420.                             <% } %>
  421.                           </td>
  422.                         </tr>
  423.                         <tr valign="top">
  424.                           <td height="1" colspan="2"  bgcolor="#999999"></td>
  425.                         </tr>
  426.                       </table>
  427.                       <%}%></td>
  428.                   </tr>
  429.                 </table>
  430.                 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  431.                   <tr>
  432.                     <td align="right"></td>
  433.                   </tr>
  434.                 </table></TD>
  435.             </TR>
  436.           </TBODY>
  437.         </TABLE></TD>
  438.     </TR>
  439.   </TBODY>
  440. </TABLE>
  441. <table width="98%"  border="0" align="center">
  442.   <tr>
  443.     <td height="34" align="center"><HR style="height:1px; color:"#999999">
  444.       Copyright 2005 版权所有:<a href="<%=Global.getRootPath()%>" class="link_commodity"><%=Global.AppName%></a><br>
  445.       联系人:<%=as.getContacter()%></td>
  446.   </tr>
  447. </table>
  448. </BODY>
  449. </HTML>