📄 mod_pro.jsp
字号:
<%@ page contentType="text/html;charset=utf-8"%>
<%@ include file="../../include.jsp"%>
<html>
<head>
<title>发布商品</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" src="SimpleETSOOEditor.js"></script>
<script language="javascript">
function save()
{
var theForm = document.news;
if ( theForm.name.value=="")
{
alert("请填写商品名称");
}
else if ( theForm.cid.value==0)
{
alert("请选择商品货架");
}
else if ( theForm.short_desc.value!=""&&theForm.short_desc.value.length>255 )
{
alert("商品简介请勿超过255个字符");
}
else if ( theForm.img_b.value=="" )
{
alert("请上传清晰图");
showBMsg();
}
else if ( theForm.img_s.value=="" )
{
alert("请上传缩略图");
showSMsg();
}
else if ( theForm.keywords.value=="" )
{
alert("请填写关键词");
}
else if ( theForm.market_price.value=="" )
{
alert("请填写市场价格");
}
else if ( theForm.shop_price.value=="" )
{
alert("请填写商城价格");
}
else if ( !checkAttribute(theForm.attribute.value) )
{
}
else if ( ETSOOEditor.ActiveField.TextArea.value=="" )
{
alert("请编辑详细介绍");
}
else
{
theForm.detail_desc.value = ETSOOEditor.ActiveField.TextArea.value;
theForm.submit();
}
}
function showBMsg()
{
var result = window.showModalDialog('upload_b_if.jsp',window,"dialogWidth:20;dialogHeight:10;status:no;help:no");
if ( !(typeof result == 'undefined') )
{
document.news.img_b.value = result;
document.getElementById('b_yl').src = "<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")%>"+result;
}
}
function showSMsg()
{
var result = window.showModalDialog('upload_b_if.jsp',window,"dialogWidth:20;dialogHeight:10;status:no;help:no");
if ( !(typeof result == 'undefined') )
{
document.news.img_s.value = result;
document.getElementById('s_yl').src = "<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")%>"+result;
}
}
function leftChar()
{
charMaxLen = 255;
document.getElementById('left_char').innerHTML = charMaxLen-document.news.short_desc.value.length;
}
function checkAttribute(attribute)
{
if ( attribute=="" )
{
return(true);
}
var ct = attribute;
var ctA = ct.split("\r\n");
var flag = true;
for (i=0; i<ctA.length; i++)
{
tmpStr = ctA[i];
tmpStr = trim(tmpStr);
if ( tmpStr.indexOf("@")==-1 )
{
flag = false;
alert("万能属性格式不正确");
}
else if ( tmpStr.split("@")[0]=="" )
{
flag = false;
alert("万能属性格式不正确: "+tmpStr);
}
else if ( tmpStr.split("@")[1].indexOf(",")==-1 )
{
flag = false;
alert("万能属性格式不正确: "+tmpStr);
}
else if ( 1==1 )
{
optA = tmpStr.split("@")[1].split("|");
for (j=0; j<optA.length; j++)
{
if ( trim(optA[j]).indexOf(",")==-1 )
{
flag = false;
alert("万能属性格式不正确: "+tmpStr);
}
else if ( trim(optA[j])=="" )
{
flag = false;
alert("万能属性格式不正确: "+tmpStr);
}
}
}
}
return(flag);
}
function trim(str)
{
return(str.replace(/(^\s*)|(\s*$)/g, ""));
}
</script>
<link href="../../style.css" rel="stylesheet" type="text/css">
</head>
<%
long pid = StringUtil.getLong(request,"pid");
DBRow pro = productMgr.getDetailProductByPid(pid);
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="leftChar()">
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="0">
<form name="news" action="<%=ConfigBean.getStringValue("systenFolder")%>appController/modProduct" method="post">
<input type="hidden" name="pid" value="<%=pid%>">
<textarea id="ContentSaved" name="detail_desc" style="display:none"><%=pro.getString("detail_desc")%></textarea>
<input type="hidden" name="img_s" value="<%=pro.getString("img_s")%>">
<input type="hidden" name="img_b" value="<%=pro.getString("img_b")%>">
<input type="hidden" name="backurl" value="<%=StringUtil.getString(request,"backurl")%>">
<tr>
<td width="1263" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td align="right" valign="middle"><font color="#FF0000">商品名称</font></td>
<td height="19" valign="middle"> </td>
<td colspan="2"><input name="name" type="text" id="name" size="50" value="<%=pro.getString("name")%>"></td>
<td width="34%" valign="middle" class="bold-text"> </td>
</tr>
<tr>
<td align="right" valign="middle"><font color="#FF0000">商品货架</font></td>
<td height="28" valign="middle"> </td>
<td colspan="2"><select name="cid" id="select" onChange="document.news.short_desc.focus();">
<option value="0" selected>选择商品货架</option>
<%
DBRow treeRows[] = catalogMgr.getCatalogTree();
String qx;
for ( int i=0; i<treeRows.length; i++ )
{
if ( treeRows[i].get("parentid",0) != 0 )
{
qx = "├ ";
}
else
{
qx = "";
}
%>
<option value="<%=treeRows[i].getString("id")%>" <%=treeRows[i].get("id",0l)==pro.get("cid",0l)?"selected":""%>>
<%=Tree.makeSpace(" ",treeRows[i].get("level",0))%>
<%=qx%>
<%=treeRows[i].getString("title")%>
</option>
<%
}
%>
</select></td>
<td valign="top" class="alert-text"> </td>
</tr>
<tr>
<td align="right" valign="middle">商品简介</td>
<td height="28" valign="middle"> </td>
<td colspan="2">剩余可输入字符:<font color="#FF0000"><strong><span id="left_char">255</span></strong></font><br>
<textarea name="short_desc" cols="60" rows="10" id="short_desc" onKeyDown="leftChar()" onKeyUp="leftChar()" onChange="leftChar()"><%=pro.getString("short_desc")%></textarea></td>
<td valign="top" class="alert-text">255个字符内</td>
</tr>
<tr>
<td align="right" valign="middle"><font color="#FF0000">关键词</font></td>
<td height="28" valign="middle"> </td>
<td width="37%"><input name="keywords" type="text" id="keywords" value="<%=pro.getString("keywords")%>"></td>
<td width="15%" rowspan="5"> </td>
<td valign="top" class="alert-text">与其他商品关联显示,格式:衣服,时尚</td>
</tr>
<tr>
<td align="right" valign="middle">商品状态</td>
<td height="28" valign="middle"> </td>
<td> <input name="alive" type="radio" value="1" <%=pro.get("alive",0)==1?"checked":""%>>
上架
<input name="alive" type="radio" value="0" <%=pro.get("alive",0)==0?"checked":""%>>
下架 </td>
<td valign="top" class="alert-text">只有处于上架状态的商品才会在 商城显示</td>
</tr>
<tr>
<td align="right" valign="middle">商品群组</td>
<td height="28" valign="middle"> </td>
<td>
<%
DBRow proGroup[] = productMgr.getAllPGroup(null);
for (int i=0; i<proGroup.length; i++)
{
%>
<input name="pgid" type="checkbox" id="pgid<%=proGroup[i].getString("pgid")%>" value="<%=proGroup[i].getString("pgid")%>" <%=productMgr.getDetailPGroupMapByPidPgid(pro.get("pid",0l),proGroup[i].get("pgid",0l))!=null?"checked":""%>>
<label for="pgid<%=proGroup[i].getString("pgid")%>">
<%=proGroup[i].getString("title")%>
</label>
<%
}
%>
</td>
<td valign="top" class="alert-text"> </td>
</tr>
<tr>
<td align="right" valign="middle"><font color="#FF0000">市场价格</font></td>
<td height="28" valign="middle"> </td>
<td><input name="market_price" type="text" id="market_price" value="<%=pro.getString("market_price")%>"></td>
<td valign="top" class="alert-text"> </td>
</tr>
<tr>
<td align="right" valign="middle"><font color="#FF0000">商城价格</font></td>
<td height="28" valign="middle"> </td>
<td><input name="shop_price" type="text" id="shop_price" value="<%=pro.getString("shop_price")%>"></td>
<td valign="top" class="alert-text"> </td>
</tr>
<%
DBRow levels[] = memberMgr.getAllMemberLevel();
for (int i=0; i<levels.length; i++)
{
DBRow detailPromemberMap = memberMgr.getDetailProMemberLevelMapByPidMlid(pro.get("pid",0l),levels[i].get("mlid",0l));
%>
<input type="hidden" name="mlid" value="<%=levels[i].getString("mlid")%>">
<tr>
<td align="right" valign="middle"><%=levels[i].getString("level_name")%></td>
<td height="28" valign="middle"> </td>
<td><input name="ml_price" type="text" id="ml_price" value="<%=detailPromemberMap!=null?detailPromemberMap.getString("price"):"0"%>"></td>
<td> </td>
<td class="alert-text"> </td>
</tr>
<%
}
%>
<tr>
<td align="right" valign="middle">万能属性</td>
<td height="28" valign="middle"> </td>
<td><textarea name="attribute" id="attribute" style="width:400px;height:200px"><%=pro.getString("attribute")%></textarea></td>
<td> </td>
<td class="alert-text">格式:属性名称@属性项目,附加价格(-表示减少)<br>
例如:颜色@黄色,5|红色,0|兰色,-5 <br>
每个属性占一行
<table width="330" height="177" border="0" cellpadding="0" cellspacing="1">
<tr align="center" valign="middle">
<td width="163" height="155"><img src="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")%><%=pro.getString("img_b")%>" width="120" height="120" id="b_yl" onClick="showBMsg()"></td>
<td width="164"><img src="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")%><%=pro.getString("img_s")%>" width="120" height="120" id="s_yl" onClick="showSMsg()"></td>
</tr>
<tr align="center" valign="middle">
<td height="19">清晰图预览</td>
<td height="19">缩略图预览</td>
</tr>
</table></td>
</tr>
<tr>
<td align="right" valign="middle"> </td>
<td height="28" valign="middle"> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td width="11%" align="right" valign="middle"><font color="#FF0000">详细介绍</font></td>
<td width="3%" height="28" valign="middle"> </td>
<td colspan="3"> <table width="100%" border="0" cellpadding="0" cellspacing="0" id="table1" style="border-collapse: collapse">
<tr>
<td> <script language="javascript">
var objEditor=new ETSOOEditor();
objEditor.ContentType=1;
objEditor.Init(null,0);
objEditor.ShowMargin=1;
objEditor.ShowMode=1;
objEditor.Create("","100%","500px",document.getElementById("ContentSaved").value);
</script> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</form>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="14%"> </td>
<td width="86%">
<input name="submit" type="button" class="ofc-but" id="submit5" onclick="save()" value=" 保存修改 ">
<input name="submit2" type="button" class="ofc-but" id="submit" onclick="location='ct_product.jsp'" value=" 返 回 ">
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -