
<!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 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>经销级别：<span id="mchaid">{$vd['agent'][2]}</span></li>
					<li>负责区域：<span id="mchaddr">{$vd['agent'][3]}</span></li>
					<li>帐户余额：<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>未转提成：<a href="index.php?m=mod_agent&c=funds&a=detail" target="main"><span class="ye" id="mchincome">{$vd['lang']['moneysymbol']}--</span></a></li>
					
					<li<!--if($vd['custom'] != 1){--> style="display:none"<!--}-->>未转收入：<a href="index.php?m=mod_agent&c=funds&a=detail" target="main"><span class="ye" id="mchfunds">{$vd['lang']['moneysymbol']}--</span></a></li>
				</ul>
				<div id="userbottom"></div>
			</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'  => 'xskh',
    'id'   => array(13,14,30,46,47),
    'val'  => array(
        array(
        'id'   => 13,
        'txt' => '代注册下级帐号',
        'url'  => 'index.php?m=mod_agent&c=Underling&a=Add'
        ),
        
        array(
        'id'   => 14,
        'txt'  => '下级客户档案管理',
        'url'  => 'index.php?m=mod_agent&c=Underling'
        ),
        
        array(
        'id'   => 30,
        'txt' => '下级客户价格管理',
        'url'  => 'index.php?m=mod_b2b&c=price'
        ),
        
        array(
        'id'   => 46,
        'txt'  => '下级客户购卡权限',
        'url'  => 'index.php?m=mod_agent&c=Underling&a=right'
        ),
        
        array(
        'id'   => 47,
        'txt'  => '下级客户消费记录',
        'url'  => 'index.php?m=mod_agent&c=Underling&a=Consump'
        )
      ),
    ),
  array(
    'name' => '财务管理',
    'cls'  => 'zhcw',
    'id'   => array(9,35,10,4),
    'val'  => array(
        array(
        'id'   => 4,
        'txt' => '帐户余额详细',
        'url'  => 'index.php?m=mod_agent&c=funds&a=detail',
        ),
        array(
        'id'   => 9,
        'txt' => '划款给下级客户',
        'url'  => 'index.php?m=mod_agent&c=funds&a=tran'
        ),
        array(
        'id'   => 35,
        'txt' => '下级汇款通知书',
        'url'  => 'index.php?m=mod_agent&c=Remit'
        ),
        array(
        'id'   => 10,
        'txt' => '销售提成报表查询',
        'url'  => 'index.php?m=mod_agent&c=trade&tpl=profit&tradetype=11'
        ),
        array(
        'id'   => 4,
        'txt' => '提成或收入转余额',
        'url'  => 'index.php?m=mod_agent&c=funds&a=detail'
        )
      ),
    ),
    array(
    'name' => '自有商品管理',
    'cls'  => 'zhgl',
    'id'   => array(28,31,44,32,56,56,44,10,16),
    'val'  => array(
        array(
        'id'   => 28,
        'txt' => '商品发布与管理',
        'url'  => 'index.php?m=mod_agent&c=Product'
        ),
        array(
        'id'   => 31,
        'txt' => '商品库存管理',
        'url'  => 'index.php?m=mod_agent&c=Product&a=Stock'
        ),
        array(
        'id'   => 44,
        'txt' => '商品销售报表查询',
        'url'  => 'index.php?m=mod_agent&c=AOrder&a=Simple'
        ),
        array(
        'id'   => 32,
        'txt' => '销售收入入帐记录',
        'url'  => 'index.php?m=mod_agent&c=AOrder'
        ),
        array(
        'id'   => 56,
        'txt' => '手工商品代充',
        'url'  => 'index.php?m=mod_agent&c=AOrder&a=CzOrder&ptype=sd&ordstate=1&by=1',
        'nobr' => 1
        ),
        array(
        'id'   => 56,
        'txt' => '记录',
        'url'  => 'index.php?m=mod_agent&c=AOrder&a=CzOrderList&ptype=sd'
        ),
        array(
        'id'   => 44,
        'txt' => '虚拟卡密交易记录',
        'url'  => 'index.php?m=mod_agent&c=AOrder&&a=Simple&optype=km'
        ),
        array(
        'id'   => 10,
        'txt' => '自有商品收入报表',
        'url'  => 'index.php?m=mod_agent&c=trade&tpl=Sup&tradetype=12'
        ),
        array(
        'id'   => 16,
        'txt' => '订单投诉处理',
        'url'  => 'index.php?m=mod_agent&c=Complaint&msgdirect=1'
        )
      ),
    ),
    array(
    'name' => '业务员管理',
    'cls'  => 'ywy',
    'id'   => array(49,50),
    'val'  => array(
        array(
        'id'   => 49,
        'txt' => '业务员帐户管理',
        'url'  => 'index.php?m=mod_agent&c=Sales'
        ),
        array(
        'id'   => 50,
        'txt' => '业务员业绩查询',
        'url'  => 'index.php?m=mod_agent&c=Sales&a=Achievement'
        )
      ),
    ),
    
    array(
    'name' => 'VIP平台管理',
    'cls'  => 'ywy',
    'id'   => array(53,62,63,55,54,53),
    'val'  => array(
        array(
        'id'   => 53,
        'txt' => 'VIP平台设置',
        'url'  => 'index.php?m=mod_agent&c=Vip'
        ),
        array(
        'id'   => 62,
        'txt' => 'VIP风格选择',
        'url'  => 'index.php?m=mod_agent&c=VipTheme'
        ),
        array(
        'id'   => 63,
        'txt' => 'VIP风格自定义',
        'url'  => 'index.php?m=mod_agent&c=VipTheme&a=Diy'
        ),
        array(
        'id'   => 55,
        'txt' => 'VIP平台公告',
        'url'  => 'index.php?m=mod_agent&c=VipArticle'
        ),
        array(
        'id'   => 54,
        'txt' => 'VIP平台广告',
        'url'  => 'index.php?m=mod_agent&c=VipAd'
        ),
        array(
        'id'   => 53,
        'txt' => 'VIP平台LOGO',
        'url'  => 'index.php?m=mod_agent&c=VipLogo'
        )
      ),
    ),
    array(
    'name' => '一卡通经销管理',
    'cls'  => 'cwgl',
    'id'   => array(57,58,59,60),
    'val'  => array(
        array(
        'id'   => 57,
        'txt' => '代理一卡通列表',
        'url'  => 'index.php?m=mod_agent&c=Ykt&nrows=100'
        ),
        array(
        'id'   => 58,
        'txt' => '代理一卡通换购记录',
        'url'  => 'index.php?m=mod_agent&c=Ykt&a=Order'
        ),
        array(
        'id'   => 59,
        'txt' => '换购商品返点费率',
        'url'  => 'index.php?m=mod_agent&c=Ykt&a=Reward&nrows=40'
        ),
        array(
        'id'   => 60,
        'txt' => '一卡通返点明细',
        'url'  => 'index.php?m=mod_agent&c=Ykt&a=RewardTrade'
        )
      ),
    )
  );

  $i = 0;
  foreach($leftinfo as $item)
  {
    if($item['name'] == 'VIP平台管理' && $vd['ainfo']['vipshop'] != 1)
    {
      continue;
    }
    
  	if($item['name'] == '自有商品管理' && $vd['custom'] != 1)
  	{
  		continue;
  	}
    
    if($item['name'] == '一卡通经销管理' && $vd['ainfo']['forykt'] != 1)
    {
      continue;
    }
    
  	$totle = 0;
  	foreach($item['id'] as $item2)
  	{
  		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;
          tmp = data.split(",");

          if(data == "-1")
          {
          	alert("系统已经退出，请重新登陆");
          	window.top.location.href = "{$vd['root']}index.php?m=mod_b2b&a=logout";
          }
          else
          {
            obj.innerHTML = "{$vd['lang']['moneysymbol']}" + tmp[0];
            document.getElementById("mchincome").innerHTML = "{$vd['lang']['moneysymbol']}" + tmp[1];
            document.getElementById("mchfunds").innerHTML = "{$vd['lang']['moneysymbol']}" + tmp[2];
          }
        }
      }
    }
    xmlhttptop.open("post", "{$vd['root']}index.php?m=mod_b2b&c=Dealer&a=Remain", true);
    xmlhttptop.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttptop.send('');
  }
  RemainAlert();
  setInterval(RemainAlert, 10000);

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