<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>直销商_菜单</title>
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="{$vd['content']}css/style.css" type="text/css">
<script type="text/javascript" src="{$vd['content']}js/utils.js"></script>
<script language="JavaScript" type="text/JavaScript">
function toggle(targetid){
	if (document.getElementById){
		target=document.getElementById(targetid);
			if (target.style.display==""){
				target.style.display = "none";
			} else {
				target.style.display = "";
			}
	}
}
</script>
</head>
<body class="leftbg">
<table width="180" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
			<div id="menuuserinfo" onclick="toggle('div66')"></div>
			<div class="usermain" id="div66">
				<ul>
					<li>编 号：<span id="mchaid">{#DisplayCode($vd['agent'][7],4,0)}</span></li>
					<li id="staffid" <!--if(isset($vd['agent'][9]) && $vd['agent'][9] > 0){--><!--}else{-->style="display:none"<!--}-->>员 工：<span id="mchstaffid">{#DisplayCode($vd['agent'][9],2)}</span></li>
					<li>级 别：<span id="mchalv">{$vd['agent'][2]}</span></li>
					<li>区 域：<span id="mchaddr">{$vd['agent'][3]}</span></li>
					
					<li id="mchremainid">余 额：<a href="{$vd['root']}index.php?m=mod_agent&c=funds&a=AddFunds" target="main"><span class="ye" id="mcharemain">{$vd['lang']['moneysymbol']}{$vd['agent'][6]}</span></a></li>
					<li id="mcharrearsid">欠 款：<a href="{$vd['root']}index.php?m=mod_agent&c=loan&a=Create" target="main"><span class="ye" id="mcharrears">{$vd['lang']['moneysymbol']}{$vd['arrears']}</span></a></li>
					<li id="mchcreditid">信 用：<a href="{$vd['root']}index.php?m=mod_agent&c=loan&a=Create" target="main"><span class="ye" id="mchcredit">{$vd['lang']['moneysymbol']}{$vd['credit']}</span></a></li>
				  <li id="mchparentidid"><label>上 级：</label><span id="mchparentid" style="font-weight:bold">{#DisplayCode($vd['agent'][4])}</span></li>
				</ul>
				<div id="userbottom"></div>
				<script type="text/javascript">
					$("mchremainid").style.display = getCookie('umebiz_com_1') == "0" ? "none" : "";
          $("mchparentidid").style.display = getCookie('umebiz_com_2') == "0" ? "none" : "";
          $("mcharrearsid").style.display = getCookie('umebiz_com_9') == "0" ? "none" : "";
          $("mchcreditid").style.display = getCookie('umebiz_com_10') == "0" ? "none" : "";
				</script>
			</div>
		</td>
	</tr>
	<?php
  $tmp = array();
  if(isset($vd['agent'][9]) && $vd['agent'][9] > 0)
  {
    $staffrights = $vd['agent'][11];
    $tmp = explode(',',$staffrights);
  }
  else
  {
  	$staffrights = $vd['agent'][11];
    $tmp = explode(',',$staffrights);
    $len = count($tmp);
    if($len < 20)
    {
  	  for($i = 0; $i < 80; $i++)
  	  {
  	  	$tmp[$i] = '0';
  	  }
    }
  }
  
  $leftinfo = array(
  array(
    'name' => '我要进货',
    'cls'  => 'jh',
    'id'   => array(0,0,0,0),
    'val'  => array(
        array(
        'id'   => 0,
        'txt' => '购卡售用户',
        'url'  => 'index.php?m=mod_b2b&c=Category',
        'nobr' => 1
        ),
        
        array(
        'id'   => 0,
        'txt'  => '收藏夹',
        'url'  => 'index.php?m=mod_b2b&c=Fav'
        ),
        
        array(
        'id'   => 0,
        'txt' => '库存取卡售用户',
        'url'  => 'index.php?m=mod_b2b&c=Category'
        ),
        
        array(
        'id'   => 0,
        'txt' => '便民中心',
        'url'  => 'index.php?m=mod_b2b&c=Quick',
        )
        
      ),
    ),
  array(
    'name' => '销售记录',
    'cls'  => 'xsjl',
    'id'   => array(5,1,34,11,38),
    'val'  => array(
        array(
        'id'   => 5,
        'txt' => '加款扣款记录',
        'url'  => 'index.php?m=mod_agent&c=trade&tpl=history'
        ),
        array(
        'id'   => 1,
        'txt' => '进货记录查询',
        'url'  => 'index.php?m=mod_agent&c=order'
        ),
        array(
        'id'   => 34,
        'txt' => '销售记录查询',
        'url'  => 'index.php?m=mod_agent&c=VOrder&ordstate=2'
        ),
        array(
        'id'   => 11,
        'txt' => '员工零售利润报表',
        'url'  => 'index.php?m=mod_agent&c=order&a=staffProfit'
        ),
        array(
        'id'   => 38,
        'txt' => '员工结帐管理',
        'url'  => 'index.php?m=mod_agent&c=Check&a=Add'
        )
      ),
    ),
    array(
    'name' => '账户管理',
    'cls'  => 'zhgl',
    'id'   => array(3,6,6,26,27,1001,12,23,35),
    'val'  => array(
        array(
        'id'   => 3,
        'txt' => '帐户余额充值',
        'url'  => 'index.php?m=mod_agent&c=funds&a=AddFunds',
        ),
        array(
        'id'   => 6,
        'txt' => '资金锁定',
        'url'  => 'index.php?m=mod_agent&c=funds&a=lock',
        'nobr' => 1
        ),
        array(
        'id'   => 6,
        'txt' => '记录',
        'url'  => 'index.php?m=mod_agent&c=funds&a=LockHistory'
        ),
        array(
        'id'   => 26,
        'txt' => '借款申请',
        'url'  => 'index.php?m=mod_agent&c=loan&a=Create',
        'nobr' => 1
        ),
        array(
        'id'   => 26,
        'txt' => '记录',
        'url'  => 'index.php?m=mod_agent&c=loan'
        ),
        array(
        'id'   => 1001,
        'txt' => '帐户资料修改',
        'url'  => 'index.php?m=mod_agent&c=Home'
        ),
        array(
        'id'   => 12,
        'txt' => '操作日志',
        'url'  => 'index.php?m=mod_agent&c=log'
        ),
        array(
        'id'   => 23,
        'txt' => '员工帐户管理',
        'url'  => 'index.php?m=mod_agent&c=staff&nrows=500'
        ),
        array(
        'id'   => 35,
        'txt' => '员工零售价设定',
        'url'  => 'index.php?m=mod_b2b&c=product&a=PriceMy'
        )
      ),
    ),
    array(
    'name' => '安全管理',
    'cls'  => 'aqgl',
    'id'   => array(20,39,40,41,42),
    'val'  => array(
        array(
        'id'   => 20,
        'txt' => '帐户密码设定',
        'url'  => 'index.php?m=mod_agent&c=home&a=modifyPass'
        ),
        array(
        'id'   => 39,
        'txt' => 'IP及所在地安全绑定',
        'url'  => 'index.php?m=mod_agent&c=IPCheck&a=IP'
        ),
        array(
        'id'   => 40,
        'txt' => '硬件信息安全绑定',
        'url'  => 'index.php?m=mod_agent&c=PCCheck&a=CPU'
        ),
        array(
        'id'   => 41,
        'txt' => '手机令牌安全绑定',
        'url'  => 'index.php?m=mod_agent&c=Mobile&a=Apply'
        ),
        array(
        'id'   => 42,
        'txt' => '密保产品安全绑定',
        'url'  => 'index.php?m=mod_agent&c=MiBaoKa&a=Apply'
        )
      ),
    ),
    array(
    'name' => '积分管理',
    'cls'  => 'xsjl',
    'id'   => array(52,52,52),
    'val'  => array(
        array(
        'id'   => 52,
        'txt' => '积分商品',
        'url'  => 'index.php?m=mod_b2b&c=Scored'
        ),
        array(
        'id'   => 52,
        'txt' => '积分兑换记录',
        'url'  => 'index.php?m=mod_b2b&c=Scored&a=OrderList'
        ),
        array(
        'id'   => 52,
        'txt' => '积分累积记录',
        'url'  => 'index.php?m=mod_b2b&c=Scored&a=ScoredList'
        ),
      ),
    ),
    array(
    'name' => '服务与支持',
    'cls'  => 'kf',
    'id'   => array(16,18,19),
    'val'  => array(
        array(
        'id'   => 16,
        'txt' => '在线投诉系统',
        'url'  => 'index.php?m=mod_agent&c=Complaint'
        ),
        array(
        'id'   => 18,
        'txt' => '平台内部短信',
        'url'  => 'index.php?m=mod_agent&c=Messenger'
        ),
        array(
        'id'   => 19,
        'txt' => '汇款通知书',
        'url'  => 'index.php?m=mod_agent&c=Remit&a=Add',
        'nobr' => 1
        ),
        array(
        'id'   => 19,
        'txt' => '记录',
        'url'  => 'index.php?m=mod_agent&c=Remit&a=Mon'
        )
      ),
    ),
    array(
    'name' => '淘宝自动充值',
    'cls'  => 'fw',
    'id'   => array(64,65,66),
    'val'  => array(
        array(
        'id'   => 64,
        'txt' => '淘宝小店列表/挂机',
        'url'  => 'index.php?m=mod_agent&c=Tb'
        ),
        array(
        'id'   => 65,
        'txt' => '淘宝小店添加',
        'url'  => 'index.php?m=mod_agent&c=Tb&a=Add'
        ),
        array(
        'id'   => 66,
        'txt' => '淘宝订单记录',
        'url'  => 'index.php?m=mod_agent&c=Tb&a=Orders'
        )
      )
    )
  );
  //1001 : 只有老板可以访问
  //1002 : 所有员工都可以访问
  $i = 0;
  foreach($leftinfo as $item)
  {
  	$totle = 0;
  	foreach($item['id'] as $item2)
  	{
  		if($item['name'] == '淘宝自动充值' && $vd['ainfo']['tbcz'] != 1)
      {
        continue;
      }
    
  		if($item2 == 1002 || ($item2 != 1001 && $tmp[$item2] == '1'))
  		{
  			$totle = 1;
  		}
  		else if($item2 == 1001 && isset($vd['agent'][9]) && $vd['agent'][9]==0)
  		{
  			$totle = 1;
  		}
  	}
  	
  	if($totle == 1)
  	{
  		$go = 1;
  		$i++;
  		echo '<tr><td><div id="menutop" onclick="toggle(\'div'.$i.'\')"><span class="'.$item['cls'].'">'.$item['name'].'</span></div><div class="menumain" id="div'.$i.'"><ul>';
  	  foreach($item['val'] as $item1)
  	  {
  	  	if($item1['id'] == 1002 || ( $item1['id'] != 1001 && $tmp[$item1['id']]=='1') || ($item1['id'] == 1001 && isset($vd['agent'][9]) && $vd['agent'][9]==0))
  	  	{
  	  		if($go)
  	  		{
  	  	    echo '<li><span onMouseOver="this.className = \'leftmenubg\'" onMouseOut="this.className=\'none\'"><a href="'.$vd['root'].$item1['url'].'" target="main">'.$item1['txt'].'</a>';
  	  	  } 
  	  	  
  	  	  if($go == 0)
  	  	  { 
  	  	    echo ' / <a href="'.$vd['root'].$item1['url'].'"  target="main">'.$item1['txt'].'</a>';
  	  	    $go = 1;
  	  	  }
  	  	  
  	  	  if(isset($item1['nobr']))
  	  	  {
  	  	    $go = 0;
  	  	  }
  	  	    
  	  	  if($go)
  	  	  {  
  	  	    echo '</span></li>';
  	  	  }
  	  	}
  	  }
  	  echo '</ul><div id="menubottom"></div></div></td></tr>';
    }
  }
?>
</table>
<script type="text/javascript">
	function RemainAlert(){
    var xmlhttptop;
    
    var obj = document.getElementById("mcharemain");
    
    try{
      xmlhttptop=new XMLHttpRequest();
    }
    catch(e){
      xmlhttptop=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttptop.onreadystatechange=function(){
      if (xmlhttptop.readyState==4){
        if (xmlhttptop.status==200){
          var data=xmlhttptop.responseText;

          if(data == "-1")
          {
          	alert("系统已经退出，请重新登陆");
          	window.top.location.href = "{$vd['root']}index.php?m=mod_b2b&a=logout";
          }
          else
          {
          	if(data.length > 20)
          	{
          		obj.innerHTML = "--";
          	}
            else
          	{
              obj.innerHTML = "{$vd['lang']['moneysymbol']}" + data;
            }
          }
          
          $("mchremainid").style.display = getCookie('umebiz_com_1') == "0" ? "none" : "";
          $("mchparentidid").style.display = getCookie('umebiz_com_2') == "0" ? "none" : "";
          $("mcharrearsid").style.display = getCookie('umebiz_com_9') == "0" ? "none" : "";
          $("mchcreditid").style.display = getCookie('umebiz_com_10') == "0" ? "none" : "";
        }
      }
    }
    xmlhttptop.open("post", "{$vd['root']}index.php?m=mod_b2b&c=Frame&a=Remain", true);
    xmlhttptop.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttptop.send('');
  }
  
  setInterval(RemainAlert, 10000);

  if (screen.width<=1024)
  {
  document.getElementById("div3").style.display="none";
  document.getElementById("div4").style.display="none";
  }
</script>
</body>
</html>
