You've already forked qlg.tsgz.moe
							
							
		
			
				
	
	
		
			495 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			495 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
| var mmg;
 | |
| //获取商品总分类首页
 | |
| function initGrid(){  
 | |
|   var h = WST.pageHeight();
 | |
|     var cols = [
 | |
|         {title:'商品名称', name:'goodsclassifyName', width: 160,sortable:true,renderer: function(val,item,rowIndex){
 | |
|             return "<span ><p class='wst-nowrap'>"+item['goodsclassifyName']+"</p></span>";
 | |
|         }},
 | |
|         {title:'排序',name:'orderby',width:100,sortale:true},
 | |
|         {title:'时间',name:'create_time',width:100,sortale:true},
 | |
|         {title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
 | |
|             var h = "";
 | |
|           h += "<a class='btn btn-blue' target='_blank' href='javascript:catdetail(" + item['goodsclassifyId'] + ")'><i class='fa fa-search'></i>绑定分类</a> ";
 | |
|           if(WST.GRANT.DSHSP_04)h += "<a class='btn btn-blue' href='javascript:toEdit(" + item['goodsclassifyId'] + ",0)'><i class='fa fa-check'></i>修改</a> ";
 | |
|           if(WST.GRANT.DSHSP_04)h += "<a class='btn btn-blue' target='_blank' href='javascript:muji(" + item['goodsclassifyId'] + ")'><i class='fa fa-search'></i>设置活动页</a> ";
 | |
|           if(WST.GRANT.DSHSP_03)h += "<a class='btn btn-red' href='javascript:del(" + item['goodsclassifyId'] + ",0)'><i class='fa fa-trash-o'></i>删除</a>";
 | |
|           return h;
 | |
|         }}
 | |
|         ];
 | |
|     mmg = $('.mmg').mmGrid({height: h-85,indexCol:true, cols: cols,method:'POST',
 | |
|         url: WST.U('admin/goodsclassify/pageQuery'), fullWidthRows: true, autoLoad: true,
 | |
|         plugins: [
 | |
|             $('#pg').mmPaginator({})
 | |
|         ]
 | |
|     });
 | |
| }
 | |
| //-修改商品总分类---------------//
 | |
| function toEdit(goodsclassifyId){
 | |
|     $('#attrForm').get(0).reset();
 | |
|     $.post(WST.U('admin/goodsclassify/get'),{goodsclassifyId:goodsclassifyId},function(data,textStatus){
 | |
|         var json = WST.toAdminJson(data);
 | |
|         WST.setValues(json);
 | |
|         var title =(goodsclassifyId==0)?"新增":"编辑";
 | |
|         var box = WST.open({title:title,type:1,content:$('#attrBox'),area: ['750px', '320px'],btn:['确定','取消'],
 | |
|             end:function(){$('#attrBox').hide();},yes:function(){
 | |
|                 $('#attrForm').submit();
 | |
|             }});
 | |
|         $('#attrForm').validator({
 | |
|             fields: {
 | |
|                 'goodsclassifyName': {rule:"required",msg:{required:'请输入属性名称'}},
 | |
|             },
 | |
|             valid: function(form){
 | |
|                 var params = WST.getParams('.ipt');
 | |
|                 var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|                 $.post(WST.U('admin/goodsclassify/'+((params.goodsclassifyId==0)?"add":"edit")),params,function(data,textStatus){
 | |
|                     layer.close(loading);
 | |
|                     var json = WST.toAdminJson(data);
 | |
|                     if(json.status=='1'){
 | |
|                         WST.msg("操作成功",{icon:1});
 | |
|                         layer.close(box);
 | |
|                         $('#attrBox').hide();
 | |
|                         loadGrid();
 | |
|                         layer.close(box);
 | |
|                     }else{
 | |
|                         WST.msg(json.msg,{icon:2});
 | |
|                     }
 | |
|                 });
 | |
|             }
 | |
|         });
 | |
| 
 | |
|     });
 | |
| }
 | |
| //删除商品总分类
 | |
| function del(goodsclassifyId){
 | |
|     var box = WST.confirm({content:"您确定要删除该属性吗?",yes:function(){
 | |
|         var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|         $.post(WST.U('admin/goodsclassify/del'),{goodsclassifyId:goodsclassifyId},function(data,textStatus){
 | |
|             layer.close(loading);
 | |
|             var json = WST.toAdminJson(data);
 | |
|             if(json.status=='1'){
 | |
|                 WST.msg("操作成功",{icon:1});
 | |
|                 layer.close(box);
 | |
|                 loadGrid();
 | |
|             }else{
 | |
|                 WST.msg(json.msg,{icon:2});
 | |
|             }
 | |
|         });
 | |
|     }});
 | |
| }
 | |
| //查看总分类下的商品分类
 | |
| function catdetail(goodsclassifyId){
 | |
|     location.href=WST.U('admin/goodsclassify/catdetail','goodsclassifyId='+goodsclassifyId);
 | |
| }
 | |
| //获取商品分类的列表
 | |
| function initcatDetailGrid(){
 | |
|     var classifyId=$('#classifyId').val();
 | |
| 
 | |
|     var h = WST.pageHeight();
 | |
|     var cols = [
 | |
|         {title:'商品名称', name:'catName', width: 160,sortable:true,renderer: function(val,item,rowIndex){
 | |
|             return "<span ><p class='wst-nowrap'>"+item['catName']+"</p></span>";
 | |
|         }},
 | |
|         {title:'时间',name:'createTime',width:100,sortale:true},
 | |
|         {title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
 | |
|             var h = "";
 | |
|             h += "<a class='btn btn-blue' target='_blank' href='javascript:detail(" + item['catId'] + ")'><i class='fa fa-search'></i>查看</a> ";
 | |
|             if(WST.GRANT.DSHSP_03)h += "<a class='btn btn-red' href='javascript:catDel(" + item['catId'] + ","+classifyId+")'><i class='fa fa-trash-o'></i>删除</a>";
 | |
|             return h;
 | |
|         }}
 | |
|     ];
 | |
|     mmg = $('.mmg').mmGrid({height: h-85,indexCol:true, cols: cols,method:'POST',
 | |
|         url: WST.U('admin/goodsclassify/catdetailPage','classifyId='+classifyId), fullWidthRows: true, autoLoad: true,
 | |
|         plugins: [
 | |
|             $('#pg').mmPaginator({})
 | |
|         ]
 | |
|     });
 | |
| }
 | |
| //查看总分类下的商品
 | |
| function detail(catId){
 | |
|     location.href=WST.U('admin/goodsclassify/detail','catId='+catId);
 | |
| }
 | |
| //
 | |
| function initDetailGrid(){
 | |
|     var catId=$('#catId').val();
 | |
|     var h = WST.pageHeight();
 | |
|     var cols = [
 | |
|         {title:' ', name:'goodsImg', width: 30, renderer: function(val,item,rowIndex){
 | |
|             var thumb = item['goodsImg'];
 | |
|             //thumb = thumb.replace('.','_thumb.');
 | |
|             return "<span class='weixin'><img id='img' onmouseout='toolTip()' onmouseover='toolTip()' style='height:60px;width:60px;' src='"+WST.conf.IMGURL+"/"+thumb+"/thumb80"
 | |
|                 +"'><span class='imged' ><img  style='height:180px;width:180px;' src='"+WST.conf.IMGURL+"/"+item['goodsImg']+"'></span></span>";
 | |
|         }},
 | |
|         {title:'商品名称', name:'goodsName', width: 160,sortable:true,renderer: function(val,item,rowIndex){
 | |
|             return "<span  ><p class='wst-nowrap'>"+item['goodsName']+"</p></span>";
 | |
|         }},
 | |
|         {title:'商品编号', name:'goodsSn' ,width:60,sortable:true},
 | |
|         {title:'价格', name:'shopPrice' ,width:20,sortable:true, renderer: function(val,item,rowIndex){
 | |
|             return '¥'+item['shopPrice'];
 | |
|         }},
 | |
|         {title:'所属店铺', name:'shopName' ,width:60,sortable:true},
 | |
|         {title:'所属分类', name:'goodsCatName' ,width:60,renderer: function(val,item,rowIndex){
 | |
|             return "<span  ><p class='wst-nowrap'>"+item['goodsCatName']+"</p></span>";
 | |
|         }},
 | |
|         {title:'销量', name:'saleNum' ,width:20,sortable:true,align:'center'},
 | |
|         {title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
 | |
|             var h = "";
 | |
|             h += "<a class='btn btn-blue' target='_blank' href='"+WST.U("home/goods/detail","id="+item['goodsId'])+"'><i class='fa fa-search'></i>查看</a> ";
 | |
| 
 | |
|             return h;
 | |
|         }}
 | |
|     ];
 | |
| 
 | |
|     mmg = $('.mmg').mmGrid({height: (h-85),indexCol: true, indexColWidth:50, cols: cols,method:'POST',
 | |
|         url: WST.U('admin/goodsclassify/detailByPage','catId='+catId), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'goodsSn',sortStatus:'desc',
 | |
|         plugins: [
 | |
|             $('#pg').mmPaginator({})
 | |
|         ]
 | |
|     });
 | |
| }
 | |
| //给商品总分类新增商品分类
 | |
| function toEdits(catId,classifyId){
 | |
|     $('#attrForm').get(0).reset();
 | |
|     $.post(WST.U('admin/goodsclassify/gets'),{catId:catId,classifyId:classifyId},function(data,textStatus){
 | |
|         var json = WST.toAdminJson(data);
 | |
|         WST.setValues(json);
 | |
|         var title =(catId==0)?"新增":"编辑";
 | |
|         var box = WST.open({title:title,type:1,content:$('#attrBox'),area: ['750px', '320px'],btn:['确定','取消'],
 | |
|             end:function(){$('#attrBox').hide();},yes:function(){
 | |
|                 $('#attrForm').submit();
 | |
|             }});
 | |
|         $('#attrForm').validator({
 | |
|             fields: {
 | |
|                 'goodsclassifyName': {rule:"required",msg:{required:'请输入属性名称'}},
 | |
|             },
 | |
|             valid: function(form){
 | |
|                 var params = WST.getParams('.ipt');
 | |
|                 var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|                 $.post(WST.U('admin/goodsclassify/add_cat'),params,function(data,textStatus){
 | |
|                     layer.close(loading);
 | |
|                     var json = WST.toAdminJson(data);
 | |
|                     if(json.status=='1'){
 | |
|                         WST.msg("操作成功",{icon:1});
 | |
|                         layer.close(box);
 | |
|                         $('#attrBox').hide();
 | |
|                         loadGrid();
 | |
|                         layer.close(box);
 | |
|                     }else{
 | |
|                         WST.msg(json.msg,{icon:2});
 | |
|                     }
 | |
|                 });
 | |
|             }
 | |
|         });
 | |
| 
 | |
|     });
 | |
| }
 | |
| //删除商品总分类下的商品分类
 | |
| function catDel(catId,classifyId){
 | |
|     var box = WST.confirm({content:"您确定要删除该属性吗?",yes:function(){
 | |
|         var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|         $.post(WST.U('admin/goodsclassify/catdel'),{catId:catId,classifyId:classifyId},function(data,textStatus){
 | |
|             layer.close(loading);
 | |
|             var json = WST.toAdminJson(data);
 | |
|             if(json.status=='1'){
 | |
|                 WST.msg("操作成功",{icon:1});
 | |
|                 layer.close(box);
 | |
|                 loadGrid();
 | |
|             }else{
 | |
|                 WST.msg(json.msg,{icon:2});
 | |
|             }
 | |
|         });
 | |
|     }});
 | |
| }
 | |
| //去往设置活动页
 | |
| function muji(goodsclassifyId){
 | |
|     location.href=WST.U('admin/goodsclassify/setdetail','goodsclassifyId='+goodsclassifyId);
 | |
| }
 | |
| //获取活动页列表
 | |
| function initsetDetailGrid(){
 | |
|     var classifyId=$('#classifyId').val();
 | |
|     var h = WST.pageHeight();
 | |
|     var cols = [
 | |
|         {title:'商品ID',name:'goodsId',width:30,sortale:true},
 | |
|         {title:'商品名称', name:'goodsName', width: 180,sortable:true},
 | |
|         {title:'商品分类',name:'recomName',width:60,sortale:true},
 | |
|         {title:'排序',name:'goodsOrder',width:40,sortale:true,align:'center',renderer:function(val, item, rowIndex){
 | |
|             return '<span style="cursor:pointer;" ondblclick="changeSort(this,'+item["recomGoodsId"]+');">'+val+'</span>';
 | |
|         }},
 | |
|         {title:'价格',name:'shopPrice',width:50,sortale:true,align:'center'},
 | |
|         {title:'时间',name:'createTime',width:100,sortale:true,align:'center'},
 | |
|         {title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
 | |
|             var h = "";
 | |
|             h += "<a class='btn btn-blue' target='_blank' href='"+WST.U("home/goods/detail","id="+item['goodsId'])+"'><i class='fa fa-search'></i>查看</a> ";
 | |
|             if(WST.GRANT.DSHSP_03)h += "<a class='btn btn-red' href='javascript:goodsDel(" + item['recomGoodsId'] + ")'><i class='fa fa-trash-o'></i>删除</a>";
 | |
|             return h;
 | |
|         }}
 | |
|     ];
 | |
|     mmg = $('.mmg').mmGrid({height: h-85,indexCol:true, cols: cols,method:'POST',
 | |
|         url: WST.U('admin/goodsclassify/setdetailPage','classifyId='+classifyId), fullWidthRows: true, autoLoad: true,
 | |
|         plugins: [
 | |
|             $('#pg').mmPaginator({})
 | |
|         ]
 | |
|     });
 | |
| }
 | |
| function loadGrid(){
 | |
|     var params = WST.getParams('.j-ipt');
 | |
|     params.page = 1;
 | |
|     mmg.load(params);
 | |
| }
 | |
| //删除活动分类的商品
 | |
| function goodsDel(recomGoodsId){
 | |
|     var box = WST.confirm({content:"您确定要删除该属性吗?",yes:function(){
 | |
|         var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|         $.post(WST.U('admin/goodsclassify/goodsDel'),{recomGoodsId:recomGoodsId},function(data,textStatus){
 | |
|             layer.close(loading);
 | |
|             var json = WST.toAdminJson(data);
 | |
|             if(json.status=='1'){
 | |
|                 WST.msg("操作成功",{icon:1});
 | |
|                 layer.close(box);
 | |
|                 loadGrid();
 | |
|             }else{
 | |
|                 WST.msg(json.msg,{icon:2});
 | |
|             }
 | |
|         });
 | |
|     }});
 | |
| }
 | |
| //查看活动页的活动分类
 | |
| function cats(classifyId){
 | |
|     location.href=WST.U('admin/goodsclassify/cats','classifyId='+classifyId);
 | |
| }
 | |
| //  查看、新增活动页的活动分类列表
 | |
| function initCatsGrid(){
 | |
|     var classifyId=$('#classifyId').val();
 | |
|     var h = WST.pageHeight();
 | |
|     var cols = [
 | |
|         {title:'所属分类', name:'goodsclassifyName' ,width:60,sortable:true},
 | |
|         {title:'活动名称', name:'recomName', width: 60,sortable:true},
 | |
|         {title:'活动排序', name:'recomOrder' ,width:60,sortable:true,align:'center'},
 | |
|         {title:'开始时间', name:'startTime' ,width:80,sortable:true,align:'center'},
 | |
|         {title:'结束时间', name:'endTime' ,width:80,sortable:true,align:'center'},
 | |
|         {title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
 | |
|             var h = "";
 | |
|             h += "<a class='btn btn-blue' target='_blank'href='javascript:toAddCats(" + item['recomId'] + ")'><i class='fa fa-check'></i>修改</a> ";
 | |
|             h += "<a class='btn btn-blue' target='_blank'href='javascript:catsDel(" + item['recomId'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
 | |
|             return h;
 | |
|         }}
 | |
|     ];
 | |
| 
 | |
|     mmg = $('.mmg').mmGrid({height: (h-85),indexCol: true, indexColWidth:50, cols: cols,method:'POST',
 | |
|         url: WST.U('admin/goodsclassify/catsPage','classifyId='+classifyId), fullWidthRows: true, autoLoad: true,remoteSort: true,sortName:'goodsSn',sortStatus:'desc',
 | |
|         plugins: [
 | |
|             $('#pg').mmPaginator({})
 | |
|         ]
 | |
|     });
 | |
| }
 | |
| //添加活动页的活动分类
 | |
| function toAddCats(recomId,classifyId){
 | |
|     var laydate = layui.laydate;
 | |
|     laydate.render({
 | |
|         elem: '#startTime',
 | |
|         type: 'datetime'
 | |
|     });
 | |
|     laydate.render({
 | |
|         elem: '#endTime',
 | |
|         type: 'datetime'
 | |
|     });
 | |
|     $('#attrForm').get(0).reset();
 | |
|     $.post(WST.U('admin/goodsclassify/getCats'),{recomId:recomId},function(data,textStatus){
 | |
|         var json = WST.toAdminJson(data);
 | |
|         WST.setValues(json);
 | |
|         layui.form.render();
 | |
|         var title =(recomId==0)?"新增":"编辑";
 | |
|         var box = WST.open({title:title,type:1,content:$('#attrBox'),area: ['750px', '320px'],btn:['确定','取消'],
 | |
|             end:function(){$('#attrBox').hide();},yes:function(){
 | |
|                 $('#attrForm').submit();
 | |
|             }});
 | |
|         $('#attrForm').validator({
 | |
|             fields: {
 | |
|                 'goodsclassifyName': {rule:"required",msg:{required:'请输入属性名称'}},
 | |
|             },
 | |
|             valid: function(form){
 | |
|                 var params = WST.getParams('.jipt');
 | |
|                 params.classifyId=classifyId;
 | |
|                 params.recomId=recomId;
 | |
|                 var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|                 $.post(WST.U('admin/goodsclassify/'+((params.recomId==0)?"addCats":"editCats")),params,function(data,textStatus){
 | |
|                     layer.close(loading);
 | |
|                     var json = WST.toAdminJson(data);
 | |
|                     if(json.status=='1'){
 | |
|                         WST.msg("操作成功",{icon:1});
 | |
|                         layer.close(box);
 | |
|                         $('#attrBox').hide();
 | |
|                         loadGrid();
 | |
|                         layer.close(box);
 | |
|                     }else{
 | |
|                         WST.msg(json.msg,{icon:2});
 | |
|                     }
 | |
|                 });
 | |
|             }
 | |
|         });
 | |
| 
 | |
|     });
 | |
| }
 | |
| //删除活动设置页的活动分类
 | |
| function catsDel(recomId){
 | |
|     var box = WST.confirm({content:"您确定要删除该属性吗?",yes:function(){
 | |
|         var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|         $.post(WST.U('admin/goodsclassify/catsDel'),{recomId:recomId},function(data,textStatus){
 | |
|             layer.close(loading);
 | |
|             var json = WST.toAdminJson(data);
 | |
|             if(json.status=='2'){
 | |
|                 var con = WST.confirm({content:"此活动下有活动商品,确定连活动商品一起删除吗",yes:function(){
 | |
|                     $.post(WST.U('admin/goodsclassify/catsDel'),{recomId:recomId,m:2},function(data,textStatus){
 | |
|                         var js= WST.toAdminJson(data);
 | |
|                         if(js.status=='1'){
 | |
|                             WST.msg("操作成功",{icon:1});
 | |
|                             layer.close(con);
 | |
|                             loadGrid();
 | |
|                         }else{
 | |
|                             WST.msg(js.msg,{icon:2});
 | |
|                         }
 | |
|                     })
 | |
|                 }})
 | |
|             }else if(json.status=='1'){
 | |
|                 WST.msg("操作成功",{icon:1});
 | |
|                 layer.close(box);
 | |
|                 loadGrid();
 | |
|             }else{
 | |
|                 WST.msg(json.msg,{icon:2});
 | |
|             }
 | |
|         });
 | |
|     }});
 | |
| }
 | |
| 
 | |
| //查看设置活动页的推荐商品
 | |
| function recom(goodsclassifyId){
 | |
|     location.href=WST.U('admin/goodsclassify/recom','goodsclassifyId='+goodsclassifyId);
 | |
| }
 | |
| //设置活动页、推荐商品的商品列表
 | |
| function initrecomDetailGrid(){
 | |
|     var classifyId=$('#classifyId').val();
 | |
|     var h = WST.pageHeight();
 | |
|     var cols = [
 | |
|         {title:'商品ID',name:'goodsId',width:30,sortale:true},
 | |
|         {title:'商品名称', name:'goodsName', width: 180,sortable:true},
 | |
|         {title:'排序',name:'goodsOrder',width:100,sortale:true,align:'center',renderer:function(val, item, rowIndex){
 | |
|             return '<span style="cursor:pointer;" ondblclick="changeSort(this,'+item["recomActiveId"]+');">'+val+'</span>';
 | |
|         }},
 | |
|         {title:'价格',name:'shopPrice',width:100,sortale:true,align:'center'},
 | |
|         {title:'时间',name:'createTime',width:100,sortale:true,align:'center'},
 | |
|         {title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
 | |
|             var h = "";
 | |
|             h += "<a class='btn btn-blue' target='_blank' href='"+WST.U("home/goods/detail","id="+item['goodsId'])+"'><i class='fa fa-search'></i>查看</a> ";
 | |
|             if(WST.GRANT.DSHSP_03)h += "<a class='btn btn-red' href='javascript:recomActiveDel(" + item['recomActiveId'] + ")'><i class='fa fa-trash-o'></i>删除</a>";
 | |
|             return h;
 | |
|         }}
 | |
|     ];
 | |
|     mmg = $('.mmg').mmGrid({height: h-85,indexCol:true, cols: cols,method:'POST',
 | |
|         url: WST.U('admin/goodsclassify/recomPage','classifyId='+classifyId), fullWidthRows: true, autoLoad: true,
 | |
|         plugins: [
 | |
|             $('#pg').mmPaginator({})
 | |
|         ]
 | |
|     });
 | |
| }
 | |
| //删除活动分类的商品
 | |
| function recomActiveDel(recomActiveId){
 | |
|     var box = WST.confirm({content:"您确定要删除该属性吗?",yes:function(){
 | |
|         var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|         $.post(WST.U('admin/goodsclassify/recomActiveDel'),{recomActiveId:recomActiveId},function(data,textStatus){
 | |
|             layer.close(loading);
 | |
|             var json = WST.toAdminJson(data);
 | |
|             if(json.status=='1'){
 | |
|                 WST.msg("操作成功",{icon:1});
 | |
|                 layer.close(box);
 | |
|                 loadGrid();
 | |
|             }else{
 | |
|                 WST.msg(json.msg,{icon:2});
 | |
|             }
 | |
|         });
 | |
|     }});
 | |
| }
 | |
| 
 | |
| //添加设置活动页的推荐商品
 | |
| function mujiGoods(recomActiveId,classifyId){
 | |
|     var laydate = layui.laydate;
 | |
|     $('#goodsForm').get(0).reset();
 | |
|     $.post(WST.U('admin/goodsclassify/getrecomActive'),{recomActiveId:recomActiveId},function(data,textStatus){
 | |
|         var json = WST.toAdminJson(data);
 | |
|         WST.setValues(json);
 | |
|         var title ="新增";
 | |
|         var box = WST.open({title:title,type:1,content:$('#goodsBox'),area: ['750px', '320px'],btn:['确定','取消'],
 | |
|             end:function(){$('#goodsBox').hide();},yes:function(){
 | |
|                 $('#goodsForm').submit();
 | |
|             }});
 | |
|         $('#goodsForm').validator({
 | |
|             fields: {
 | |
|                 'goodsclassifyName': {rule:"required",msg:{required:'请输入属性名称'}},
 | |
|             },
 | |
|             valid: function(form){
 | |
|                 var params = WST.getParams('.ipt');
 | |
|                 params.classifyId=classifyId;
 | |
|                 var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|                 $.post(WST.U('admin/goodsclassify/addrecomActive'),params,function(data,textStatus){
 | |
|                     layer.close(loading);
 | |
|                     var json = WST.toAdminJson(data);
 | |
|                     if(json.status=='1'){
 | |
|                         WST.msg("操作成功",{icon:1});
 | |
|                         layer.close(box);
 | |
|                         $('#goodsBox').hide();
 | |
|                         loadGrid();
 | |
|                         layer.close(box);
 | |
|                     }else{
 | |
|                         WST.msg(json.msg,{icon:2});
 | |
|                     }
 | |
|                 });
 | |
|             }
 | |
|         });
 | |
| 
 | |
|     });
 | |
| }
 | |
| //姓曾活动设置页/活动商品
 | |
| function toAddGoods(recomGoodsId){
 | |
|     var laydate = layui.laydate;
 | |
|     laydate.render({
 | |
|         elem: '#startTime',
 | |
|         type: 'datetime'
 | |
|     });
 | |
|     laydate.render({
 | |
|         elem: '#endTime',
 | |
|         type: 'datetime'
 | |
|     });
 | |
|     $('#goodsForm').get(0).reset();
 | |
|     $.post(WST.U('admin/goodsclassify/getGoods'),{recomGoodsId:recomGoodsId},function(data,textStatus){
 | |
|         var json = WST.toAdminJson(data);
 | |
|         WST.setValues(json);
 | |
|         var title ="新增";
 | |
|         var box = WST.open({title:title,type:1,content:$('#goodsBox'),area: ['750px', '320px'],btn:['确定','取消'],
 | |
|             end:function(){$('#goodsBox').hide();},yes:function(){
 | |
|                 $('#goodsForm').submit();
 | |
|             }});
 | |
|         $('#goodsForm').validator({
 | |
|             fields: {
 | |
|                 'recomId': {rule:"required",msg:{required:'请选择分类名称'}},
 | |
|             },
 | |
|             valid: function(form){
 | |
|                 var params = WST.getParams('.ipt');
 | |
|                 var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
 | |
|                 $.post(WST.U('admin/goodsclassify/addGoods'),params,function(data,textStatus){
 | |
|                     layer.close(loading);
 | |
|                     var json = WST.toAdminJson(data);
 | |
|                     if(json.status=='1'){
 | |
|                         WST.msg("操作成功",{icon:1});
 | |
|                         layer.close(box);
 | |
|                         $('#attrBox').hide();
 | |
|                         loadGrid();
 | |
|                         layer.close(box);
 | |
|                     }else{
 | |
|                         WST.msg(json.msg,{icon:2});
 | |
|                     }
 | |
|                 });
 | |
|             }
 | |
|         });
 | |
| 
 | |
|     });
 | |
| }
 |