You've already forked qlg.tsgz.moe
							
							Init Repo
This commit is contained in:
		
							
								
								
									
										110
									
								
								hyhproject/home2/view/default/shops/stockwarn/list.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										110
									
								
								hyhproject/home2/view/default/shops/stockwarn/list.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
{extend name="default/shops/base" /}
 | 
			
		||||
{block name="title"}库存预警 - 卖家中心{__block__}{/block}
 | 
			
		||||
{block name="css"}
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="content"}
 | 
			
		||||
<div class="wst-shop-head"><span>库存预警</span></div>
 | 
			
		||||
<div class="wst-shop-tbar">
 | 
			
		||||
  <label>
 | 
			
		||||
    商品分类:
 | 
			
		||||
    <select name="cat1" id="cat1" onchange="getCat(this.value)" class="s-query">
 | 
			
		||||
        <option value="">-请选择-</option>
 | 
			
		||||
      {volist name=":WSTShopCats(0)" id="vo"}
 | 
			
		||||
            <option value="{$vo['catId']}" >{$vo['catName']}</option>
 | 
			
		||||
      {/volist}
 | 
			
		||||
    </select>
 | 
			
		||||
    <select name="cat2" id="cat2" class="s-query"><option value="">-请选择-</option></select>
 | 
			
		||||
    <a class="s-btn" onclick="stockByPage()" style='margin-top:5px;'>查询</a>
 | 
			
		||||
  </label>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="wst-shop-content">
 | 
			
		||||
   <table class='wst-list'>
 | 
			
		||||
   <thead>
 | 
			
		||||
   <tr>
 | 
			
		||||
     <th width="220">商品名称</th>
 | 
			
		||||
     <th>货号</th>
 | 
			
		||||
     <th>规格</th>
 | 
			
		||||
     <th width="130">库存<font color='red'>(红色双击编辑)</font></th>
 | 
			
		||||
     <th width="130">预警<font color='red'>(红色双击编辑)</font></th>
 | 
			
		||||
     <th width="120">操作</th>
 | 
			
		||||
   </tr>
 | 
			
		||||
   </thead>
 | 
			
		||||
   <tbody id='list'></tbody>
 | 
			
		||||
   <tfoot>
 | 
			
		||||
     <tr align="center"><td colspan='10' id='pager' align="center" style='padding:5px 0px 5px 0px'></td></tr>
 | 
			
		||||
   </tfoot>
 | 
			
		||||
   <script id="tblist" type="text/html">
 | 
			
		||||
   {{# for(var i = 0; i < d.length; i++){ }}
 | 
			
		||||
   <tr>
 | 
			
		||||
      {{# if(d[i]['isSpec']==1) { }}
 | 
			
		||||
      <td>
 | 
			
		||||
          <div class="goods-img">
 | 
			
		||||
          <a href="{{WST.U("home/goods/detail","id="+d[i]['goodsId']+"&key="+d[i]['verfiycode'])}}">
 | 
			
		||||
            <img class='j-goodsImg'  data-original='__IMGURL__/{{d[i].goodsImg}}'/>
 | 
			
		||||
          </a>
 | 
			
		||||
        </div>
 | 
			
		||||
        <p class="goodsName">
 | 
			
		||||
          {{WST.cutStr(d[i]['goodsName'],43)}}
 | 
			
		||||
        </p>
 | 
			
		||||
      </td>
 | 
			
		||||
        <td>{{d[i]['productNo']}}</td>
 | 
			
		||||
		<td>
 | 
			
		||||
		<span class="spec">
 | 
			
		||||
		{{# for(var s = 0; s < d[i].spec.length; s++){ }}
 | 
			
		||||
			{{d[i].spec[s]['catName']}}:{{d[i].spec[s]['itemName']}};
 | 
			
		||||
		{{# } }}
 | 
			
		||||
		</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td width="40" ondblclick="javascript:toEditGoodsStock({{d[i]['id']}},1)">
 | 
			
		||||
        <input id="ipt_1_{{d[i]['id']}}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberKey(event)" onblur="javascript:editGoodsStock({{d[i]['id']}},1,{{d[i]['goodsId']}})" class="stockin" maxlength="6"/>
 | 
			
		||||
        <span id="span_1_{{d[i]['id']}}" style="display: inline;cursor:pointer;color:#f30505;">{{d[i]['goodsStock']}}</span>
 | 
			
		||||
        </td>
 | 
			
		||||
		<td width="40" ondblclick="javascript:toEditGoodsStock({{d[i]['id']}},2)">
 | 
			
		||||
        <input id="ipt_2_{{d[i]['id']}}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberKey(event)" onblur="javascript:editGoodsStock({{d[i]['id']}},2,{{d[i]['goodsId']}})" class="stockin" maxlength="6"/>
 | 
			
		||||
        <span id="span_2_{{d[i]['id']}}" style="display: inline;cursor:pointer;color:#f30505;">{{d[i]['warnStock']}}</span>
 | 
			
		||||
        </td>
 | 
			
		||||
      <td><a class="g-handle" href='javascript:toEdit({{d[i]['goodsId']}},"sale")'>[进入商品编辑]</a></td>
 | 
			
		||||
      {{# }else{ }}
 | 
			
		||||
      <td>
 | 
			
		||||
          <div class="goods-img">
 | 
			
		||||
          <a href="{{WST.U("home/goods/detail","id="+d[i]['goodsId']+"&key="+d[i]['verfiycode'])}}">
 | 
			
		||||
            <img class='j-goodsImg'  data-original='__IMGURL__/{{d[i].goodsImg}}'/>
 | 
			
		||||
          </a>
 | 
			
		||||
        </div>
 | 
			
		||||
        <p class="goodsName">
 | 
			
		||||
          {{WST.cutStr(d[i]['goodsName'],43)}}
 | 
			
		||||
        </p>
 | 
			
		||||
      </td>
 | 
			
		||||
		<td>{{d[i]['productNo']}}</td>
 | 
			
		||||
		<td>无</td>
 | 
			
		||||
      {{# if(d[i]['goodsType']==0){ }}
 | 
			
		||||
		  <td width="40" ondblclick="javascript:toEditGoodsStock({{d[i]['goodsId']}},3)">
 | 
			
		||||
        <input id="ipt_3_{{d[i]['goodsId']}}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberKey(event)" onblur="javascript:editGoodsStock({{d[i]['goodsId']}},3)" class="stockin" maxlength="6"/>
 | 
			
		||||
        <span id="span_3_{{d[i]['goodsId']}}" style="display: inline;cursor:pointer;color:#f30505;">{{d[i]['goodsStock']}}</span>
 | 
			
		||||
        </td>
 | 
			
		||||
		  <td width="40" ondblclick="javascript:toEditGoodsStock({{d[i]['goodsId']}},4)">
 | 
			
		||||
        <input id="ipt_4_{{d[i]['goodsId']}}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberKey(event)" onblur="javascript:editGoodsStock({{d[i]['goodsId']}},4)" class="stockin" maxlength="6"/>
 | 
			
		||||
        <span id="span_4_{{d[i]['goodsId']}}" style="display: inline;cursor:pointer;color:#f30505;">{{d[i]['warnStock']}}</span>
 | 
			
		||||
        </td>
 | 
			
		||||
        {{# }else{ }}
 | 
			
		||||
        <td width="40">{{d[i]['goodsStock']}}</td>
 | 
			
		||||
        <td width="40">{{d[i]['warnStock']}}</td>
 | 
			
		||||
        {{#}}}
 | 
			
		||||
        <td>
 | 
			
		||||
        {{#if(d[i]['goodsType']==1){}}
 | 
			
		||||
        <a class="g-handle" href='javascript:toStock({{d[i]['goodsId']}},"stockWarnByPage")'>[进入卡券编辑]</a>
 | 
			
		||||
        {{#}else{}}
 | 
			
		||||
        <a class="g-handle" href='javascript:toEdit({{d[i]['goodsId']}},"sale")'>[进入商品编辑]</a>
 | 
			
		||||
        {{#}}}
 | 
			
		||||
        </td>
 | 
			
		||||
      
 | 
			
		||||
      {{# } }}
 | 
			
		||||
   </tr>
 | 
			
		||||
   {{# } }}
 | 
			
		||||
   </script>
 | 
			
		||||
  </table> 
 | 
			
		||||
</div>
 | 
			
		||||
{/block}
 | 
			
		||||
{block name="js"}
 | 
			
		||||
<script type='text/javascript' src='__STYLE__/shops/stockwarn/stockwarn.js?v={$v}'></script>
 | 
			
		||||
{/block}
 | 
			
		||||
							
								
								
									
										95
									
								
								hyhproject/home2/view/default/shops/stockwarn/stockwarn.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										95
									
								
								hyhproject/home2/view/default/shops/stockwarn/stockwarn.js
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,95 @@
 | 
			
		||||
$(function(){
 | 
			
		||||
	stockByPage();
 | 
			
		||||
});
 | 
			
		||||
function toStock(id,src){
 | 
			
		||||
    location.href=WST.U('home/goodsvirtuals/stock','id='+id+"&src="+src);
 | 
			
		||||
}
 | 
			
		||||
function stockByPage(p){
 | 
			
		||||
	$('#list').html('<tr><td colspan="11"><img src="'+WST.conf.ROOT+'/hyhproject/home/view/default/img/loading.gif">正在加载数据...</td></tr>');
 | 
			
		||||
	var params = {};
 | 
			
		||||
	params = WST.getParams('.s-query');
 | 
			
		||||
	params.page = p;
 | 
			
		||||
	$.post(WST.U('home/goods/stockByPage'),params,function(data,textStatus){
 | 
			
		||||
	    var json = WST.toJson(data);
 | 
			
		||||
	    if(json.status==1 && json.Rows){
 | 
			
		||||
	       	var gettpl = document.getElementById('tblist').innerHTML;
 | 
			
		||||
	       	laytpl(gettpl).render(json.Rows, function(html){
 | 
			
		||||
	       		$('#list').html(html);
 | 
			
		||||
	       		$('.j-goodsImg').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});//商品默认图片
 | 
			
		||||
	       	});
 | 
			
		||||
	       	if(json.TotalPage>1){
 | 
			
		||||
	       		laypage({
 | 
			
		||||
		        	 cont: 'pager', 
 | 
			
		||||
		        	 pages:json.TotalPage, 
 | 
			
		||||
		        	 curr: json.CurrentPage,
 | 
			
		||||
		        	 skin: '#e23e3d',
 | 
			
		||||
		        	 groups: 3,
 | 
			
		||||
		        	 jump: function(e, first){
 | 
			
		||||
		        		    if(!first){
 | 
			
		||||
		        		    	stockByPage(e.curr);
 | 
			
		||||
		        		    }
 | 
			
		||||
		        	    } 
 | 
			
		||||
		        });
 | 
			
		||||
	       	}else{
 | 
			
		||||
	       		$('#pager').empty();
 | 
			
		||||
	       	}
 | 
			
		||||
       	}  
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
function toEdit(id,src){
 | 
			
		||||
	location.href = WST.U('home/goods/edit','id='+id+'&src='+src);
 | 
			
		||||
}
 | 
			
		||||
//双击修改
 | 
			
		||||
function toEditGoodsStock(id,type){
 | 
			
		||||
	$("#ipt_"+type+"_"+id).show();
 | 
			
		||||
	$("#span_"+type+"_"+id).hide();
 | 
			
		||||
	$("#ipt_"+type+"_"+id).focus();
 | 
			
		||||
	$("#ipt_"+type+"_"+id).val($("#span_"+type+"_"+id).html());
 | 
			
		||||
}
 | 
			
		||||
function endEditGoodsStock(type,id){
 | 
			
		||||
	$('#span_'+type+'_'+id).html($('#ipt_'+type+'_'+id).val());
 | 
			
		||||
	$('#span_'+type+'_'+id).show();
 | 
			
		||||
    $('#ipt_'+type+'_'+id).hide();
 | 
			
		||||
}
 | 
			
		||||
function editGoodsStock(id,type,goodsId){
 | 
			
		||||
	var number = $('#ipt_'+type+'_'+id).val();
 | 
			
		||||
	if($.trim(number)==''){
 | 
			
		||||
		WST.msg('库存不能为空', {icon: 5});
 | 
			
		||||
        return;
 | 
			
		||||
	}
 | 
			
		||||
	var params = {};
 | 
			
		||||
	params.id = id;
 | 
			
		||||
	params.type = type;
 | 
			
		||||
	params.goodsId = goodsId;
 | 
			
		||||
	params.number = number;
 | 
			
		||||
	$.post(WST.U('Home/Goods/editwarnStock'),params,function(data,textStatus){
 | 
			
		||||
		var json = WST.toJson(data);
 | 
			
		||||
		if(json.status>0){
 | 
			
		||||
			$('#img_'+type+'_'+id).fadeTo("fast",100);
 | 
			
		||||
			endEditGoodsStock(type,id);
 | 
			
		||||
			$('#img_'+type+'_'+id).fadeTo("slow",0);
 | 
			
		||||
		}else{
 | 
			
		||||
			WST.msg(json.msg, {icon: 5}); 
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getCat(val){
 | 
			
		||||
  if(val==''){
 | 
			
		||||
  	$('#cat2').html("<option value='' >-请选择-</option>");
 | 
			
		||||
  	return;
 | 
			
		||||
  }
 | 
			
		||||
  $.post(WST.U('home/shopcats/listQuery'),{parentId:val},function(data,textStatus){
 | 
			
		||||
       var json = WST.toJson(data);
 | 
			
		||||
       var html = [],cat;
 | 
			
		||||
       html.push("<option value='' >-请选择-</option>");
 | 
			
		||||
       if(json.status==1 && json.list){
 | 
			
		||||
         json = json.list;
 | 
			
		||||
       for(var i=0;i<json.length;i++){
 | 
			
		||||
           cat = json[i];
 | 
			
		||||
           html.push("<option value='"+cat.catId+"'>"+cat.catName+"</option>");
 | 
			
		||||
        }
 | 
			
		||||
       }
 | 
			
		||||
       $('#cat2').html(html.join(''));
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user