Exemple #1
0
 /**
  * 说明:从产品中心获取产品类别中文名 支持get 传参 或者方法直接传参(优先后者)
  * @param $goodsCategory 从goods表里取得的产品类型
  * @return  $categoryName
  * pc.getCategoryInfoByPath
  */
 public function act_categoryName($goodsCategory)
 {
     // 		return "test";
     if (!empty($goodsCategory)) {
         $path = $goodsCategory;
     } else {
         $path = trim($_GET['goodsCategory']);
     }
     if (empty($path)) {
         self::$errCode = '002';
         self::$errMsg = '传参非法';
         return false;
     }
     $paramArr['method'] = 'pc.getCategoryInfoByPath';
     //API名称
     $paramArr['username'] = C('OPEN_SYS_USER');
     //开放系统用户名
     $paramArr['format'] = 'json';
     //数据格式
     $paramArr['v'] = '1.0';
     //版本号
     $paramArr['path'] = $path;
     $data = callOpenSystem($paramArr, "local");
     $data = json_decode($data, true);
     if (empty($data['data']['name'])) {
         //接口无返回数据
         $name = GoodsAct::act_getCategoryName($path);
         if (empty($name)) {
             return "无类别";
         }
         return $name;
     }
     return $data['data']['name'];
 }
    function content_5284ca07706e10_89868177($_smarty_tpl)
    {
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

			<div  class="fourvar">
            	<div class="pathvar">
                	您的位置:<a href="index.php?mod=goods&act=goods_search_index">货品资料管理</a>&nbsp;>>&nbsp;货品搜索
                </div>
				<div class="pagination">
                	<?php 
        echo $_smarty_tpl->tpl_vars['fpage']->value;
        ?>

            	</div>
            </div>
            <div class="servar wh-servar">
	<span>
		<span>
			<input name="searchContent" id="searchContent" value="<?php 
        echo $_GET['searchContent'];
        ?>
" size="50">
			<input type="button" id="search" value="搜索">
            <label>
				<input name="searchtype" type="radio" value="1" <?php 
        if ($_GET['searchtype'] == 1) {
            ?>
checked="checked"<?php 
        }
        ?>
 <?php 
        if (empty($_smarty_tpl->tpl_vars['type']->value)) {
            ?>
checked="checked"<?php 
        }
        ?>
 />SKU
			</label>
			<label>
				<input name="searchtype" type="radio" value="2" <?php 
        if ($_GET['searchtype'] == 2) {
            ?>
checked="checked"<?php 
        }
        ?>
/>仓位
			</label>
			<label>
				<input name="searchtype" type="radio" value="3" <?php 
        if ($_GET['searchtype'] == 3) {
            ?>
checked="checked"<?php 
        }
        ?>
/>货品名称
			</label>
			<label>
            	<input name="searchtype" type="radio" value="5" <?php 
        if ($_GET['searchtype'] == 5) {
            ?>
checked="checked"<?php 
        }
        ?>
/>供应商
            </label>
			<label>
				<input name="searchtype" type="radio" value="4" <?php 
        if ($_GET['searchtype'] == 4) {
            ?>
checked="checked"<?php 
        }
        ?>
/>采购负责人
			</label>
		</span>
            &nbsp;&nbsp;
    <span style="color: red;"></span>
    </span>
	<div style="margin-top:10px;">
					<span style="width:60px;">产品状态:</span>
					<select  name="online" id="online" style="width:100px">
						<option value="">请选择</option>
						<option value="0" <?php 
        if ($_GET['online'] === "0") {
            ?>
selected<?php 
        }
        ?>
>在线</option>
						<option value="1" <?php 
        if ($_GET['online'] == 1) {
            ?>
selected<?php 
        }
        ?>
>下线</option>
						<option value="2" <?php 
        if ($_GET['online'] == 2) {
            ?>
selected<?php 
        }
        ?>
>零库存</option>
						<option value="3" <?php 
        if ($_GET['online'] == 2) {
            ?>
selected<?php 
        }
        ?>
>停售</option>
						<option value="4" <?php 
        if ($_GET['online'] == 2) {
            ?>
selected<?php 
        }
        ?>
>部分停售</option>
						<option value="5" <?php 
        if ($_GET['online'] == 2) {
            ?>
selected<?php 
        }
        ?>
>部分下线</option>
						<option value="6" <?php 
        if ($_GET['online'] == 2) {
            ?>
selected<?php 
        }
        ?>
>缺货</option>
						<option value="7" <?php 
        if ($_GET['online'] == 2) {
            ?>
selected<?php 
        }
        ?>
>无采购人</option>
					</select>
					<span style="width:60px;">仓库:</span>
					<select  name="warehouse" id="warehouse" style="width:100px">
						<option value="">请选择</option>
						<?php 
        $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['list']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['warehousList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
            $_smarty_tpl->tpl_vars['list']->_loop = true;
            ?>
							<option value="<?php 
            echo $_smarty_tpl->tpl_vars['list']->value['id'];
            ?>
" <?php 
            if ($_GET['warehouse'] == $_smarty_tpl->tpl_vars['list']->value['id']) {
                ?>
selected<?php 
            }
            ?>
><?php 
            echo $_smarty_tpl->tpl_vars['list']->value['whName'];
            ?>
</option>
						<?php 
        }
        ?>
					</select>
					<span style="width:60px;">新/老品:</span>
					<select  name="isnew" id="isnew" style="width:100px">
						<option value="">请选择</option>
						<option value="1" <?php 
        if ($_GET['isnew'] == 1) {
            ?>
selected<?php 
        }
        ?>
>新品</option>
						<option value="0" <?php 
        if ($_GET['isnew'] === "0") {
            ?>
selected<?php 
        }
        ?>
>老品</option>
					</select>
					<span style="width:60px;">类别:</span>
					<select id="pid_one" style="width:100px" onchange="select_one1();">
						<option value="">请选择</option>
						<?php 
        $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['list']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['categoryList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
            $_smarty_tpl->tpl_vars['list']->_loop = true;
            ?>
							<option value="<?php 
            echo $_smarty_tpl->tpl_vars['list']->value['id'];
            ?>
" <?php 
            if ($_GET['pid_one'] == $_smarty_tpl->tpl_vars['list']->value['id']) {
                ?>
selected<?php 
            }
            ?>
><?php 
            echo $_smarty_tpl->tpl_vars['list']->value['name'];
            ?>
</option>
						<?php 
        }
        ?>
					</select>
					<span id="div_two">
						<?php 
        if (!empty($_GET['pid_one2'])) {
            ?>
						<select name='pid_one2' id='pid_one2' style='width:100px' onchange='select_one2();'>
							<option value="">请选择</option>
							<?php 
            $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['list']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['cate_two']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
                $_smarty_tpl->tpl_vars['list']->_loop = true;
                ?>
								<option value="<?php 
                echo $_smarty_tpl->tpl_vars['list']->value['id'];
                ?>
" <?php 
                if ($_GET['pid_one2'] == $_smarty_tpl->tpl_vars['list']->value['id']) {
                    ?>
selected<?php 
                }
                ?>
><?php 
                echo $_smarty_tpl->tpl_vars['list']->value['name'];
                ?>
</option>
							<?php 
            }
            ?>
						</select>
						<?php 
        }
        ?>
					</span>
					<span id="div_three">
						<?php 
        if (!empty($_GET['pid_one3'])) {
            ?>
							<select name='pid_one3' id='pid_one3' style='width:100px' onchange='select_one3();'>
							<option value="">请选择</option>
							<?php 
            $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['list']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['cate_three']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
                $_smarty_tpl->tpl_vars['list']->_loop = true;
                ?>
								<option value="<?php 
                echo $_smarty_tpl->tpl_vars['list']->value['id'];
                ?>
" <?php 
                if ($_GET['pid_one3'] == $_smarty_tpl->tpl_vars['list']->value['id']) {
                    ?>
selected<?php 
                }
                ?>
><?php 
                echo $_smarty_tpl->tpl_vars['list']->value['name'];
                ?>
</option>
							<?php 
            }
            ?>
							</select>
						<?php 
        }
        ?>
					</span>
					<span id="div_four">
						<?php 
        if (!empty($_GET['pid_one4'])) {
            ?>
							<select name='pid_one4' id='pid_one4' style='width:100px'>
							<option value="">请选择</option>
							<?php 
            $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['list']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['cate_four']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
                $_smarty_tpl->tpl_vars['list']->_loop = true;
                ?>
								<option value="<?php 
                echo $_smarty_tpl->tpl_vars['list']->value['id'];
                ?>
" <?php 
                if ($_GET['pid_one4'] == $_smarty_tpl->tpl_vars['list']->value['id']) {
                    ?>
selected<?php 
                }
                ?>
><?php 
                echo $_smarty_tpl->tpl_vars['list']->value['name'];
                ?>
</option>
							<?php 
            }
            ?>
							</select>
						<?php 
        }
        ?>
					</span>
				</div>
</div>
<div class="main underline-main">
	<table cellspacing="0" width="100%">
		<tbody>
        	<tr class="title purchase-title">
				<td width="10%">图片</td>
				<td align="left">sku</td>
				<td>仓位</td>
				<td>重量Kg</td>
				<td>成本RMB</td>
				<td>实际库存</td>
				<td>到货库存</td>
				<td>虚拟库存</td>
				<td>缺货库存</td>
				<td>产品类别</td>
				<td>产品状态</td>
				<td>新/老品</td>
				<td>仓库</td>
			</tr>	
			<?php 
        if (!empty($_smarty_tpl->tpl_vars['goodsList']->value)) {
            ?>
			<?php 
            $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['value']->_loop = false;
            $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable();
            $_from = $_smarty_tpl->tpl_vars['goodsList']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
                $_smarty_tpl->tpl_vars['value']->_loop = true;
                $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['value']->key;
                ?>
			<tr >
                <td  rowspan="3"> 
	               	<a href="javascript:void(0)" id="imga-<?php 
                echo $_smarty_tpl->tpl_vars['value']->value['sku'];
                ?>
" class="fancybox">
						<img src="./public/img/ajax-loader.gif" name="skuimg" id="imgs-<?php 
                echo $_smarty_tpl->tpl_vars['value']->value['sku'];
                ?>
" spu="<?php 
                echo $_smarty_tpl->tpl_vars['value']->value['spu'];
                ?>
">
			   		</a>
                 </td>
                <td align="left"><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['sku'];
                ?>
</td>
                <td name="api_goodsCategory" data-goodscategory="1"></td>
                <td><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['goodsWeight'];
                ?>
</td>
                <td><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['goodsCost'];
                ?>
</td>
                <td><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['stock_qty'];
                ?>
</td>
                <td>到货库存</td>
                <td><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['stock_qty'] - $_smarty_tpl->tpl_vars['value']->value['waiting_send'];
                ?>
</td>
                <td><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['stock_qty'] - $_smarty_tpl->tpl_vars['value']->value['waiting_send'] - $_smarty_tpl->tpl_vars['value']->value['autointerceptnums'];
                ?>
</td>
				<?php 
                $_smarty_tpl->tpl_vars['categoryName'] = new Smarty_variable(CommandAct::act_categoryName($_smarty_tpl->tpl_vars['value']->value['goodsCategory']), null, 0);
                ?>
				<td><?php 
                echo $_smarty_tpl->tpl_vars['categoryName']->value;
                ?>
</td>
				<td><?php 
                if ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] === "0") {
                    ?>
在线<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 1) {
                    ?>
下线<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 2) {
                    ?>
零库存<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 3) {
                    ?>
停售<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 4) {
                    ?>
部分停售<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 5) {
                    ?>
部分下线<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 6) {
                    ?>
缺货<?php 
                } elseif ($_smarty_tpl->tpl_vars['value']->value['goodsStatus'] == 7) {
                    ?>
无采购人<?php 
                }
                ?>
</td>
				<td><?php 
                if ($_smarty_tpl->tpl_vars['value']->value['isNew'] == 0) {
                    ?>
老品<?php 
                } else {
                    ?>
新品<?php 
                }
                ?>
</td>
				<td>
				<?php 
                $_smarty_tpl->tpl_vars['warehous'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['warehous']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['warehousList']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['warehous']->key => $_smarty_tpl->tpl_vars['warehous']->value) {
                    $_smarty_tpl->tpl_vars['warehous']->_loop = true;
                    ?>
					<?php 
                    if ($_smarty_tpl->tpl_vars['value']->value['warehouseid'] == $_smarty_tpl->tpl_vars['warehous']->value['id']) {
                        ?>
						<?php 
                        echo $_smarty_tpl->tpl_vars['warehous']->value['whName'];
                        ?>
	
					<?php 
                    }
                    ?>
				<?php 
                }
                ?>
				</td>
            </tr>
            <tr >                    	     	              	
                <td colspan="13" align="left"><?php 
                echo $_smarty_tpl->tpl_vars['value']->value['goodsName'];
                ?>
</td>
            </tr>
            <tr >   	              	
                <td colspan="4" align="left">采购员:<?php 
                echo GoodsAct::purchaseNameById($_smarty_tpl->tpl_vars['value']->value['purchaseId']);
                ?>
</td>
  				<td colspan="10" align="left">供应商:<?php 
                echo GoodsAct::partnerNameBySku($_smarty_tpl->tpl_vars['value']->value['sku']);
                ?>
</td>
  			</tr>
		<?php 
            }
            ?>
			
		<?php 
        } else {
            ?>
			<tr >
					<td colspan="14">没有搜索值!</td>
			</tr>
		<?php 
        }
        ?>
  		</tbody>
    </table>
</div>
            <div class="bottomvar">
            	<div class="pagination">
                	<?php 
        echo $_smarty_tpl->tpl_vars['fpage']->value;
        ?>

            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript">
var web_api = "<?php 
        echo @WEB_API;
        ?>
";
var purchaser = "<?php 
        echo $_smarty_tpl->tpl_vars['purchasers']->value;
        ?>
";

//审核料号
$('#audit-btn').click(function(){
    var skuArr = $('input[name="checkbox"]:checked'),idArr=[];
	if(skuArr.length == 0){
		alertify.alert( '亲,您没有选择要审核的料号呢!', function (){
		return false;
	});
	}else {
		$.each(skuArr,function(i,item){
			idArr.push($(item).val());
		});
        var url  = web_api + "json.php?mod=goods&act=auditSku";
        var data = {"idArr":idArr};
		alertify.confirm("亲,真的要批量审核料号吗?", function (e) {
        if (e) {
			$.post(url,data,function(rtn){
				if(rtn.errCode == 0){              
					alertify.success("亲,批量审核料号成功!");
					window.location.reload();
				}else {
					 alertify.error(rtn.errMsg);
			   }
			},"jsonp");
		}});
	}
});

//为ID move-sku 附加一个事件处理函数
$("#move-sku").live("click", function(){
	$("select[class*=flexselect]").flexselect();
});
//移交料号
$('#move-sku').click(function(){
    var skuArr = $('input[name="checkbox"]:checked'),idArr=[];
	if(skuArr.length == 0){
		alertify.alert( '亲,您没有选择要移交的料号呢!', function (){
		return false;
	});
	}else {
		$.each(skuArr,function(i,item){
			idArr.push($(item).val());
		});
        var url  = web_api + "json.php?mod=goods&act=moveSku";
        var data = {"idArr":idArr};
		alertify.confirm("亲,真的要批量移交料号给以下采购吗?<p><br/>采购员:" + purchaser + "</p>", function (e) {
			if (e) {
				var purchase	= $('#purchasers').val();
				var data = {"idArr":idArr,"purchase":purchase};
				if(purchase == '0'){
					alertify.error('亲,您没有选择要移交给那个采购呢?');
					return false;
				}else {
					$.post(url,data,function(rtn){
						if(rtn.errCode == 0){              
							alertify.success("亲,批量移交料号成功!");
							window.location.reload();
						}else {
							 alertify.error(rtn.errMsg);
					   }
					},"jsonp");
				}
			}
		});
	}
});

function getCategoryPid()
{
    var pid1,pid2,pid3,pid4;
	pid1 = $("#pid_one").val();     
    if(pid1 == '0') {       
        return '0';
    } else {
        pid2 = $("#pid_one2").val();       
        if(pid2 == '0') {
            return pid1;
        } else {
            pid3 = $("#pid_one3").val();           
            if(pid3 == '0') {
                return pid2;
            } else {
                pid4 = $("#pid_one4").val();               
                if(pid4 == '0') {
                    return pid3;
                } else {
                    return pid4;
                }
            }
        }
    } 	
}



//搜索货品资料入口 mod by wxb 2013/11/7
$("#search").click(function(){
	var searchContent,searchtype,online,warehouse,isnew,pid_one;
	searchContent = $.trim($("#searchContent").val());
	searchtype = $.trim($("input[name='searchtype']:checked").val());
	
	online = $.trim($("#online").val());
	warehouse = $.trim($("#warehouse").val());
	isnew = $.trim($("#isnew").val());
	pid_one =  $.trim($("#pid_one").val());
	pid_one2 =  $.trim($("#pid_one2").val());
	pid_one3 =  $.trim($("#pid_one3").val());
	pid_one4 =  $.trim($("#pid_one4").val());
	
	var selFlag = true;
	if(online=='' && warehouse ==''  && isnew==''  && pid_one =='' ){
		selFlag = false;
	}
	var textFlag = true;
	if(searchContent==''){
		textFlag = false;
	}
	if(textFlag==false && selFlag==false){
		alertify.error('请选择搜索内容');
		return;
	}
	var url = "index.php?mod=goods&act=index";
	var param = "&pid_one2="+pid_one2+"&pid_one3="+pid_one3+"&pid_one4="+pid_one4;
	window.location.href = url+param+"&searchContent="+searchContent+"&searchtype="+searchtype+"&online="+online+"&warehouse="+warehouse+"&isnew="+isnew+"&pid_one="+pid_one;
});

//全选反选入口
$('#inverse-check').click(function(){
  select_all('inverse-check','input[name="checkbox"]',0);
});



function select_one1(){     //拉取二级目录  
	   
	var pid         = document.getElementById('pid_one').value;
	var div_two     = document.getElementById('div_two');
	var div_three   = document.getElementById('div_three');
	var div_four    = document.getElementById('div_four');
	if(pid=="")
	{
		div_two.style.display = "none";
		div_three.style.display = "none";
		div_four.style.display  = "none";
		$('#pid_one2').remove();
		$('#pid_one3').remove();
		$('#pid_one4').remove();    
		return false;
	}
    var url  = web_api + "json.php?mod=command&act=getCategoryInfo";
    var data = { "pid":pid  };	
//     console.log(data);
	$.post(url,data,function(rtn){
	   //console.log(rtn);
		if(rtn.errCode == 200){              
			show_second_cate(rtn.data);
		}else {
			 console.log(rtn.errMsg);
	    }
	},"jsonp");
}
                        
function show_second_cate(data) //展示二级目录  
{   
	var datas = data;
	var showdetail = document.getElementById("div_two");
	showdetail.innerHTML = "";
	if(datas.length!=0)
	{
		showdetail.style.display = "";
	}
	else
	{
		showdetail.style.display = "none";
	}
	var newtab = '';  
	newtab +="<select name='pid_one2' id='pid_one2' onchange='select_one2()'>";
	newtab +="<option value=''>请选择子类别</option>";   
	for(var i=0; i<datas.length; i++)
	{
		newtab +="<option value='"+datas[i].id+"'>"+datas[i].name+"</option>";
	}
	newtab +="</select>";
	showdetail.innerHTML = newtab;
}

function select_one2(){     //拉取三级目录  

	var path        = document.getElementById('pid_one2').value;    
    var pathArr;
    pathArr = path.split('-');
    pid =  pathArr[pathArr.length - 1];         
	var div_three  = document.getElementById('div_three');
	var div_four   = document.getElementById('div_four');
	if(pid=="")
	{
		div_three.style.display = 'none';
		$('#pid_one3').remove();
		$('#pid_one4').remove();
		return false;
	}
    var url  = web_api + "json.php?mod=command&act=getCategoryInfo";
    var data = {"pid":pid};	
//     console.log(data);
	$.post(url,data,function(rtn){
		if(rtn.errCode == 200){              
			show_third_cate(rtn.data);
		}else {
			 console.log(rtn.errMsg);
	    }
	},"jsonp");  
}

function show_third_cate(data) //展示二级目录  
{
	var datas = data;
	var showdetail = document.getElementById("div_three");
	showdetail.innerHTML = "";
	if(datas.length!=0)
	{
		showdetail.style.display = "";
	}
	else
	{
		showdetail.style.display = "none";
	}
	var newtab = '';
	newtab +="<select name='pid_one3' id='pid_one3' onchange='select_one3()'>";
	newtab +="<option value=''>请选择子类别</option>";
	for(var i=0; i<datas.length; i++)
	{
		newtab +="<option value='"+datas[i].id+"'>"+datas[i].name+"</option>";	
	}
	newtab +="</select>";
	showdetail.innerHTML = newtab;
}


function select_one3(){  //拉取四级目录  
	var path = document.getElementById('pid_one3').value;    
    var pathArr;
    pathArr = path.split('-');   
    pid =  pathArr[pathArr.length - 1];
	var div_four   = document.getElementById('div_four');
	if(pid=="")
	{
		div_four.style.display = 'none';
		$('#pid_one4').remove();
		return false;
	}
    var url  = web_api + "json.php?mod=command&act=getCategoryInfo";
    //var url  = web_api + "json.php?mod=goods&act=getCategoryPidMap";
    var data = {"pid":pid};	
	$.post(url,data,function(rtn){
	   //console.log(rtn);
		if(rtn.errCode == 200){              
			show_fourth_cate(rtn.data);
		}else {
			 console.log(rtn.errMsg);
	    }
	},"jsonp");
}

function show_fourth_cate(data)  //展示级目录  
{
	var datas = data;
	var showdetail = document.getElementById("div_four");
	showdetail.innerHTML = "";
	if(datas.length!=0)
	{
		showdetail.style.display = "";
	}
	else
	{
		showdetail.style.display = "none";
	}
	var newtab = '';
	newtab +="<select name='pid_one4' id='pid_one4'>";
	newtab +="<option value=''>请选择子类别</option>";  
	for(var i=0; i<datas.length; i++)
	{
		newtab +="<option value='"+datas[i].id+"'>"+datas[i].name+"</option>";		  
	}
	newtab +="</select>";
	showdetail.innerHTML = newtab;
}
//回车搜索
$(".servar.wh-servar").keydown(function(event){
	if(event.keyCode==13){
		$("#search").trigger("click");
	}
});
//页面加载完成后加载图片
$(function(){
	var url  = web_api + "json.php?mod=command&act=getSkuImg";
	var skuArr	= $('img[name="skuimg"]'), imgurl="", spu="", sku="";
	$.each(skuArr,function(i,item){
		spu	= $(item).attr('spu');
		$.ajax({
			url: url,
			type: "POST",
			async: true,
			timeout: 10000,
			dataType: "jsonp",
// 		jsonpCallback:"replay",
			success: function(rtn){
							sku	= $(item).attr('id').substring(5);
							if ($.trim(rtn.data)) {
								$("#imgs-"+sku).attr({"src":rtn.data,"width":"60px","height":"60px"});
							    $("#imga-"+sku).attr("href",rtn.data);
							} else {
								$("#imgs-"+sku).attr({"src":"./public/img/no_image.gif","width":"60px","height":"60px"});
							    $("#imga-"+sku).attr("href","./public/img/no_image.gif");
							}
				}	
			});
	});
});



</script><?php 
    }
Exemple #3
0
 public function view_abnormalStockList()
 {
     global $memc_obj;
     $pagesize = 200;
     //页面大小
     //var_dump($AbOrderList); exit;
     $omAvailableAct = new OmAvailableAct();
     $TransAPIAct = new TransAPIAct();
     $OrderindexAct = new OrderindexAct();
     $GoodsAct = new GoodsAct();
     $OrderRefundAct = new OrderRefundAct();
     //平台信息
     $OmAccountAct = new OmAccountAct();
     $WarehouseAPIAct = new WarehouseAPIAct();
     $AbOrderList = $WarehouseAPIAct->act_getAbOrderList();
     //var_dump($AbOrderList); exit;
     $AbOrderListArr = array();
     $AbOrderids = array();
     $AbOrderShow = array();
     foreach ($AbOrderList as $orderId) {
         $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($orderId['id']);
         $AbOrderListArr[$orderId['originOrderId']] = $AbOrderInfo;
         $AbOrderids[] = $orderId['originOrderId'];
         $AbOrderShow[$orderId['originOrderId']] = $orderId['id'];
     }
     //var_dump($AbOrderListArr); exit;
     $this->smarty->assign('AbOrderListArr', $AbOrderListArr);
     $this->smarty->assign('AbOrderShow', $AbOrderShow);
     //var_dump($AbOrderListArr); exit;
     $platform = $OmAccountAct->act_getPlatformListByPower();
     $this->smarty->assign('platform', $platform);
     $account = $OmAccountAct->act_accountAllListById();
     //账号信息
     /**导航 start**/
     $ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : 0;
     $this->smarty->assign('ostatus', 770);
     $StatusMenuAct = new StatusMenuAct();
     $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0');
     //var_dump($ostatusList);
     $this->smarty->assign('ostatusList', $ostatusList);
     //二级目录
     /*$o_secondlevel =  $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc');
     		$this->smarty->assign('o_secondlevel', $o_secondlevel);*/
     $second_count = array();
     $second_type = array();
     foreach ($ostatusList as $o_secondinfo) {
         $orderStatus = $o_secondinfo['statusCode'];
         //echo $orderStatus."============"; echo "<br>";
         $s_total = $OrderindexAct->act_showSearchOrderNum($orderStatus);
         //echo $orderStatus."==".$s_total; echo "<br>";
         $second_count[$o_secondinfo['statusCode']] = $s_total;
         $s_type = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $orderStatus . '" AND is_delete=0 order by sort asc');
         $second_type[$orderStatus] = $s_type[0]['statusCode'];
     }
     $this->smarty->assign('second_count', $second_count);
     $this->smarty->assign('second_type', $second_type);
     //退款数量
     $where = " WHERE is_delete=0 ";
     $accountList = $_SESSION['accountList'];
     $platformList = $_SESSION['platformList'];
     //echo "<pre>"; print_r($accountList); exit;
     $platformsee = array();
     for ($i = 0; $i < count($platformList); $i++) {
         $platformsee[] = $platformList[$i];
     }
     if ($platformsee) {
         $where .= ' AND platformId IN (' . join(",", $platformsee) . ') ';
     } else {
         //$where .= " AND 1=2 ";
     }
     $accountsee = array();
     for ($i = 0; $i < count($accountList); $i++) {
         $accountsee[] = $accountList[$i];
     }
     if ($accountsee) {
         $where .= ' AND accountId IN (' . join(",", $accountsee) . ') ';
     } else {
         //$where .= " AND 1=2 ";
     }
     //if($where){
     //$refund_total = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 ");
     $refund_total = $OrderRefundAct->act_getRecordNums();
     //}else{
     //$refund_total = 0;
     //}
     $this->smarty->assign('refund_total', $refund_total);
     //三级目录
     /*$refund_one = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=0");
     		$this->smarty->assign('refund_one', $refund_one);
     		$refund_two = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=1");
     		$this->smarty->assign('refund_two', $refund_two);
     		$refund_three = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=2");
     		$this->smarty->assign('refund_three', $refund_three);*/
     /**导航 end**/
     $toptitle = '异常缺货统计页面';
     //头部title
     $this->smarty->assign('toptitle', $toptitle);
     $this->smarty->assign('toplevel', 0);
     $threelevel = '1';
     //当前的三级菜单
     $this->smarty->assign('threelevel', $threelevel);
     $statusMenu = $omAvailableAct->act_getTNameList('om_status_menu', ' * ', 'WHERE is_delete=0');
     $this->smarty->assign('statusMenu', $statusMenu);
     /* $where =	' WHERE is_delete = 0 '.$where;
        $total = $omAvailableAct->act_getTNameCount('om_order_refund', $where);*/
     $parameterArr = array();
     $parameterArr['AbOrderList'] = $AbOrderids;
     $total = $OrderindexAct->act_showABOrder($ostatus, $otype, '', $parameterArr);
     $this->smarty->assign('abnormal_total', $total);
     //echo $total; exit;
     $num = $pagesize;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     //$limit	=	$page->limit;
     //var_dump($parameterArr);
     $omOrderList = $OrderindexAct->act_showABOrder($ostatus, $otype, $page->limit, $parameterArr);
     $this->smarty->assign('omOrderList', $omOrderList);
     $pm = $GoodsAct->act_getMaterInfoByList();
     $transportationList = $TransAPIAct->act_getCarrierListById();
     $this->smarty->assign('transportationList', $transportationList);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     //获取系统所有状态
     //$statusList = copyOrderModel::selectStatusList();
     //var_dump($statusList); exit;
     //$this->smarty->assign('statusList', $statusList);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('account', $account);
     //$this->smarty->assign('sku', $sku);
     $this->smarty->assign('pm', $pm);
     $this->smarty->assign('omOrderList', $omOrderList);
     $this->smarty->display('orderindex.htm');
 }
Exemple #4
0
 /**
  * 功能:通过sku获取spu
  * @param str $sku
  * @return void
  * @author wxb
  * @date 2013/11/15
  */
 public function getSpuBySku($sku)
 {
     $ret = GoodsModel::getSpuBySku($sku);
     if ($ret == false) {
         self::$errCode = GoodsModel::$errCode;
         self::$errMsg = GoodsModel::$errMsg;
         return false;
     }
     return $ret;
 }
Exemple #5
0
 public function view_updateIsNewBatchExcelImportOn()
 {
     $useId = $_SESSION['userId'];
     $personName = getPersonNameById($useId);
     if (empty($personName)) {
         $status = "<font color=red>系统找不到登录人信息!</font><br/>";
         echo $status;
         exit;
     }
     if (isset($_POST['submit']) && $_POST['submit'] != '') {
         $uploadfile = 'updateIsNewBatchExcelImport_' . date("Y") . date("m") . date("d") . date("H") . date('i') . date('s') . '_' . $personName . ".xls";
         if (move_uploaded_file($_FILES['upfile']['tmp_name'], 'upload/' . $uploadfile)) {
             echo "<font color=BLUE>文件上传成功!</font><br>";
         } else {
             echo "<font color=red> 文件上传失败!</font>";
             exit;
         }
         $fileName = 'upload/' . $uploadfile;
         $filePath = $fileName;
         $PHPExcel = new PHPExcel();
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($filePath)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($filePath)) {
                 echo 'no Excel';
                 return;
             }
         }
         $PHPExcel = $PHPReader->load($filePath);
         $currentSheet = $PHPExcel->getSheet(0);
         $highestRow = $currentSheet->getHighestRow();
         //表格中的最大行数
         //var_dump($highestRow);exit;
         if ($highestRow > 500) {
             echo "表格不能超过500行,请重新整理表格导入,谢谢!";
             exit;
         }
         $status = '';
         $flag = true;
         //标识检测结果
         for ($i = 2; $i <= $highestRow; $i++) {
             //先检查导入表格的正确性
             $spu = trim($currentSheet->getCell('A' . $i)->getValue());
             //spu
             $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
             $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
             if (empty($spu)) {
                 $status .= "第 {$i} 行,SPU为空 <br/>";
                 $flag = false;
                 continue;
             }
             $tName = 'pc_products';
             $where = "WHERE is_delete=0 and productsStatus=2 and spu='{$spu}'";
             $spuCount = OmAvailableModel::getTNameCount($tName, $where);
             if (!$spuCount) {
                 $status .= "第 {$i} 行,{$spu} 不在领取料号状态 <br/>";
                 $flag = false;
                 continue;
             }
         }
         if (!$flag) {
             //验证不通过
             echo "<font color=red>{$status}</font>";
             exit;
         } else {
             $status = '';
             for ($i = 2; $i <= $highestRow; $i++) {
                 //先检查导入表格的正确性
                 $spu = trim($currentSheet->getCell('A' . $i)->getValue());
                 //spu
                 $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
                 $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
                 $tName = 'pc_products';
                 $where = "WHERE is_delete=0 and productsStatus=2 and spu='{$spu}'";
                 $dataArr = array();
                 $dataArr['productsStatus'] = 3;
                 $dataArr['productsCompleteTime'] = time();
                 OmAvailableModel::updateTNameRow2arr($tName, $dataArr, $where);
                 $_POST['spu'] = $spu;
                 $_POST['isNew'] = 0;
                 $goodsAct = new GoodsAct();
                 $goodsAct->act_updateIsNewBatch();
                 $status .= "第 {$i} 行,{$spu} 更新成功 <br/>";
             }
             echo "<font color=green>{$status}</font>";
             exit;
         }
     }
 }
Exemple #6
0
 public function view_getSpuHscodeTaxList()
 {
     $goodsAct = new GoodsAct();
     $spuHscodeTaxList = $goodsAct->act_getSpuHscodeTaxList();
     $navlist = array(array('url' => 'index.php?mod=goods&act=getGoodsList', 'title' => '产品信息'), array('url' => 'index.php?mod=goods&act=getSpuHscodeTaxList', 'title' => 'SPU-海关编码'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 1);
     $this->smarty->assign('twovar', 18);
     $this->smarty->assign('show_page', $spuHscodeTaxList['show_page']);
     $this->smarty->assign('title', 'SPU-海关编码');
     $this->smarty->assign('spuHscodeTaxList', empty($spuHscodeTaxList['spuHscodeTaxList']) ? array() : $spuHscodeTaxList['spuHscodeTaxList']);
     $this->smarty->display("spuHscodeTaxList.htm");
 }
Exemple #7
0
 function act_updateSpuHsRelaById()
 {
     $id = intval($_POST['id']);
     if ($id <= 0) {
         self::$errCode = '101';
         self::$errMsg = '无效记录';
         return false;
     }
     $userId = $_SESSION['userId'];
     if ($id <= 0) {
         self::$errCode = '103';
         self::$errMsg = '登陆超时';
         return false;
     }
     $personName = getPersonNameById($userId);
     $tName = 'pc_spu_tax_hscode';
     $select = 'spu';
     $where = "WHERE id='{$id}'";
     $psthList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($psthList)) {
         self::$errCode = '102';
         self::$errMsg = "无记录";
         return false;
     }
     $dataTmpArr = array();
     $dataTmpArr['customsName'] = !empty($_POST['customsName']) ? $_POST['customsName'] : '';
     $dataTmpArr['materialCN'] = !empty($_POST['materialCN']) ? $_POST['materialCN'] : '';
     $dataTmpArr['customsNameEN'] = !empty($_POST['customsNameEN']) ? $_POST['customsNameEN'] : '';
     $dataTmpArr['materialEN'] = !empty($_POST['materialEN']) ? $_POST['materialEN'] : '';
     $dataTmpArr['hsCode'] = !empty($_POST['hsCode']) ? $_POST['hsCode'] : '';
     $dataTmpArr['exportRebateRate'] = !empty($_POST['exportRebateRate']) ? $_POST['exportRebateRate'] : '';
     $dataTmpArr['importMFNRates'] = !empty($_POST['importMFNRates']) ? $_POST['importMFNRates'] : '';
     $dataTmpArr['generalRate'] = !empty($_POST['generalRate']) ? $_POST['generalRate'] : '';
     $dataTmpArr['RegulatoryConditions'] = !empty($_POST['RegulatoryConditions']) ? $_POST['RegulatoryConditions'] : '';
     $dataTmpArr = array_filter($dataTmpArr);
     $jsonData = json_encode($dataTmpArr);
     if (!empty($dataTmpArr)) {
         OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
         error_log(date('Y-m-d_H:i') . "——{$psthList[0]['spu']} 更新成功 BY {$personName}, data: {$jsonData} \r\n", 3, WEB_PATH . "log/spuHscodeTax.txt");
         self::$errCode = '200';
         self::$errMsg = "更新成功";
         return true;
     } else {
         self::$errCode = '200';
         self::$errMsg = "无数据提交";
         return true;
     }
 }
Exemple #8
0
 public function view_handleGood()
 {
     global $mod, $act;
     $condition = " WHERE 1 ";
     $type = isset($_GET['type']) ? $_GET['type'] : '';
     $id = isset($_GET['id']) ? $_GET['id'] : '';
     $qc = new RtnQcDataAct();
     $condition .= "AND id = {$id}";
     $rtndata = $qc->act_QcData('1', $condition, '1', 'badgood');
     $data = $rtndata['data'][1];
     $data[0]['spu'] = GoodsAct::getSpuBySku($data[0]['sku']);
     if ($type == 'scrapped') {
         $title = '不良品报废处理页面';
         $sign = '报废处理';
         $category = 1;
     } else {
         if ($type == 'return') {
             $title = '不良品退货处理页面';
             $sign = '退货处理';
             $category = 3;
         } else {
             if ($type == 'interhandle') {
                 $title = '不良品内部处理页面';
                 $sign = '内部处理';
                 $category = 2;
             }
         }
     }
     $this->smarty->assign('title', $title);
     $this->smarty->assign('sign', $sign);
     $this->smarty->assign('mod', $mod);
     //模块权限
     $this->smarty->assign('web_api', WEB_API);
     //API 接口地址
     $hasNum = $data[0]['defectiveNum'] - $data[0]['processedNum'];
     $this->smarty->assign('numid', $id);
     $this->smarty->assign('data', $data[0]);
     $this->smarty->assign('infoId', $data[0]['infoId']);
     $this->smarty->assign('spu', $data[0]['spu']);
     $this->smarty->assign('sku', $data[0]['sku']);
     $this->smarty->assign('defectiveNum', $data[0]['defectiveNum']);
     $this->smarty->assign('processedNum', $data[0]['processedNum']);
     $this->smarty->assign('category', $category);
     $this->smarty->assign('hasNum', $hasNum);
     $this->smarty->display('handleBadGood.htm');
 }