|
@@ -17,7 +17,7 @@
|
|
|
<link href="${pageContext.request.contextPath }/common/other/kingedit/themes/default/default.css" rel="stylesheet" type="text/css" />
|
|
|
<title>添加商品</title>
|
|
|
<style>
|
|
|
- .ke-container.ke-container-default{width:350px!important;height:500px!important;}
|
|
|
+ .ke-container.ke-container-default{width:740px!important;height:300px!important;}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
@@ -78,7 +78,7 @@
|
|
|
<div class="row cl">
|
|
|
<label class="form-label col-2"><span class="c-red">*</span>产品图片:</label>
|
|
|
<div class="col-10 ">
|
|
|
- <img alt="产品图片" src="" id="introduceImg" width="90" height="80">
|
|
|
+ <img alt="产品图片" src="${pageContext.request.contextPath }/common/images/noImage.jpg" id="introduceImg" width="90" height="80">
|
|
|
<input type="hidden" id="productIntroduceImg" name="productIntroduceImg" value=""/>
|
|
|
<input id="insertfileIntroduce" class="btn btn-primary radius upload-btn" type="button" value="点击上传(330 px * 280 px)" />
|
|
|
</div>
|
|
@@ -144,7 +144,7 @@
|
|
|
<label class="form-label col-2"><span class="c-red">*</span>产品banner图:</label>
|
|
|
<div class="col-10 " id="bannerInfo">
|
|
|
<div style="float: left;margin-right: 10px; margin-bottom: 10px;" class="bannerImageList">
|
|
|
- <img style="border:2px solid #0A6999;" alt="产品banner图" src="" id="bannerImg" width="90" height="80" onclick="removes(this)">
|
|
|
+ <img alt="请上传banner图" src="" id="bannerImg" width="90" height="80" onclick="removes(this)">
|
|
|
<input type="hidden" id="productBannerImg" name="productBannerImg" value=""/>
|
|
|
</div>
|
|
|
<%--<input type="button" id="insertfileBanner" value="选择文件" />--%>
|
|
@@ -157,7 +157,7 @@
|
|
|
</div>
|
|
|
<div class="row cl" id="iamgeTextDiv">
|
|
|
<label class="form-label col-2">商品图文:</label>
|
|
|
- <div class="formControls col-5">
|
|
|
+ <div class="formControls col-9">
|
|
|
<textarea id="productsInfoProductdesc" name="productImageText.imagetextContext" cols="" rows="" class="textarea" ></textarea>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -170,10 +170,11 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <%--<!-- 已售数量 -->
|
|
|
+ <!-- 已售数量 -->
|
|
|
<input type="hidden" name="productSalesnum" value="0">
|
|
|
<!-- 浏览量 -->
|
|
|
- <input type="hidden" name="productAccessnum" value="0">--%>
|
|
|
+ <input type="hidden" name="productAccessnum" value="0">
|
|
|
+ <input type="hidden" name="colorLists" id="colorLists">
|
|
|
</form>
|
|
|
</div>
|
|
|
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
|
|
@@ -195,8 +196,8 @@ KindEditor.ready(function(K) {
|
|
|
uploadJson : '${pageContext.request.contextPath }/common/other/kingedit/jsp/upload_json.jsp',
|
|
|
allowFileManager : true,
|
|
|
afterBlur: function(){this.sync();},
|
|
|
- width : '350px',
|
|
|
- height : '500px'
|
|
|
+ width : '740px',
|
|
|
+ height : '300px'
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -263,7 +264,7 @@ KindEditor.ready(function(K) {
|
|
|
K(productBannerImgDom).val(url);
|
|
|
}else{
|
|
|
var bannerHtml = '<div style="float: left;margin-right: 10px; margin-bottom: 10px;" class="bannerImageList">' +
|
|
|
- '<img style="border:2px solid #0A6999;" alt="产品banner图" src="' + url + '" id="bannerImg" width="90" height="80" onclick="removes(this)">' +
|
|
|
+ '<img alt="产品banner图" src="' + url + '" id="bannerImg" width="90" height="80" onclick="removes(this)">' +
|
|
|
'<input type="hidden" id="productBannerImg" name="productBannerImg" value="' + url + '"/></div>';
|
|
|
K(bannerInfo).append(bannerHtml);
|
|
|
}
|
|
@@ -395,7 +396,7 @@ function addBtnEvent(goodsimagess){
|
|
|
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+var toothInfoJson = '${toothInfoJson}';
|
|
|
//数据校验
|
|
|
function checkProduct(){
|
|
|
|
|
@@ -424,23 +425,77 @@ function checkProduct(){
|
|
|
});*/
|
|
|
|
|
|
var colorList = new Array();
|
|
|
-
|
|
|
-
|
|
|
+ var tb = document.getElementById("example"); //根据id找到这个表格
|
|
|
+ var rows = tb.rows; //取得这个table下的所有行
|
|
|
+ for(var i=1;i<rows.length;i++)//循环遍历所有的tr行
|
|
|
+ {
|
|
|
+ var color = {};
|
|
|
+ for(var j=0;j<rows[i].cells.length;j++)//取得第几行下面的td个数,再次循环遍历该行下面的td元素
|
|
|
+ {
|
|
|
+ var cell = rows[i].cells[j];//获取某行下面的某个td元素
|
|
|
+ if(j == 0){
|
|
|
+ var img = cell.children;
|
|
|
+ color.colorProductPic = img[0].getAttribute("src");
|
|
|
+ }
|
|
|
+ if(j == 1){
|
|
|
+ color.colorName = cell.innerHTML;
|
|
|
+ }
|
|
|
+ if(j == 2){
|
|
|
+ color.colorPresent = cell.innerHTML;
|
|
|
+ }
|
|
|
+ if(j == 3){
|
|
|
+ if(cell.innerHTML == "在售"){
|
|
|
+ color.colorStatus = 1;
|
|
|
+ }
|
|
|
+ if(cell.innerHTML == "停止销售"){
|
|
|
+ color.colorStatus = 2;
|
|
|
+ }
|
|
|
+ if(cell.innerHTML == "删除"){
|
|
|
+ color.colorStatus = 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(j == 4){
|
|
|
+ color.colorPrice = cell.innerHTML;
|
|
|
+ }
|
|
|
+ if(j == 5){
|
|
|
+ color.colorDiscount = cell.innerHTML;
|
|
|
+ }
|
|
|
+ if(j == 6){
|
|
|
+ color.color69Code = cell.innerHTML;
|
|
|
+ }
|
|
|
+ if(j == 7){
|
|
|
+ $.each(eval(toothInfoJson), function(index,item){
|
|
|
+ if(item.produceName == cell.innerHTML){
|
|
|
+ color.ptsProductId = item.produceId;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ colorList.push(color);
|
|
|
+ }
|
|
|
+ $("#colorLists").val(JSON.stringify(colorList));
|
|
|
$.ajax({
|
|
|
url: '${pageContext.request.contextPath }/admin/product/add',
|
|
|
type: "POST",
|
|
|
dataType: "json",
|
|
|
- data: {productId : $("#productName").val(),
|
|
|
+ /*data: {productId : $("#productName").val(),
|
|
|
typeId : $("#typeId").val(),
|
|
|
productBannerImg : $("#productBannerImg").val(),
|
|
|
productsInfoProductdesc : $("#productsInfoProductdesc").val(),
|
|
|
-
|
|
|
- },
|
|
|
+ colorLists : $("#colorLists").val()
|
|
|
+ },*/
|
|
|
+ data: $("#form-addGoods").serialize(),
|
|
|
error:function(data){
|
|
|
- layer.msg(data.status,{icon: 5,time:2000});
|
|
|
+ layer.msg("添加失败!",{icon: 5,time:2000});
|
|
|
},
|
|
|
success: function(data){
|
|
|
- layer.msg(data.status,{icon: 1,time:2000});
|
|
|
+ if(data.status){
|
|
|
+ layer.msg("添加成功!",{icon: 1,time:2000});
|
|
|
+ window.location.href = '${pageContext.request.contextPath }/admin/product/list';
|
|
|
+ }else{
|
|
|
+ layer.msg("添加失败!",{icon: 2,time:2000});
|
|
|
+ }
|
|
|
+
|
|
|
/* $("#Goodstatus").val(obj.val()); */
|
|
|
/* window.location.href = '${pageContext.request.contextPath }/admin/goods/listGoodsUI'; */
|
|
|
}
|
|
@@ -497,8 +552,6 @@ function addColorTable(){
|
|
|
}
|
|
|
|
|
|
var ptsProductid = null;
|
|
|
- var toothInfoJson = '${toothInfoJson}';
|
|
|
-
|
|
|
$.each(eval(toothInfoJson), function(index,item){
|
|
|
if(item.produceId == $("#ptsProductid").val()){
|
|
|
ptsProductid = item.produceName;
|