
<div class="loginwaper">
<div class="login">
      <p><label>商家编号：</label><span id="mchaid">{#DisplayCode($vd['agent'][7],4,0)}</span></p>
      <p><label>商家名称：</label><span id="mchcompany">{$vd['agent'][1]}</span></p>
      <p id="staffid" <!--if(isset($vd['agent'][9]) && $vd['agent'][9] > 0){--><!--}else{-->style="display:none"<!--}-->><label>员工编号：</label><span id="mchstaffid">{#DisplayCode($vd['agent'][9],2)}</span></p>
      <p><label>商家级别：</label><span id="mchalv">{$vd['agent'][2]}</span></p>
      
      <p><label>商家地址：</label><span id="mchaddr">{$vd['agent'][3]}</span></p>
      <p id="mchremainid"><label>商家余额：</label><span id="mcharemain">{$vd['ainfo']['aremain']}</span></p>
      <p id="mcharrearsid">当前欠款：<a href="{$vd['root']}index.php?m=mod_agent&c=loan&a=Create" target="main"><span class="ye" id="mcharrears">{$vd['ainfo']['arrears']}</span></a></p>
      <p id="mchcreditid">信用额度：<a href="{$vd['root']}index.php?m=mod_agent&c=loan&a=Create" target="main"><span class="ye" id="mchcredit">{$vd['ainfo']['credit']}</span></a></p>
      <p id="mchparentidid"><label>商家上级：</label><span id="mchparentid">{#DisplayCode($vd['agent'][4])}</span></p>
      <p class="loginBt"><a href="{$vd['root']}index.php?m=mod_b2b&a=logout" class="btn_4gray_link">退出系统</a></p>
</div>
<div style="clear:both;"></div>
</div>

<div class="iconzone"><div class="icondiv" id="icondiv" <!--if($vd['msgn'] == 0){-->style="display:none"<!--}-->><img src="{$vd['content']}images/msgnoread.gif" style="vertical-align:middle"/> <a href="index.php?m=mod_agent&c=Messenger"><span id="msgn" class="msgn">{$vd['msgn']}</span></a> 条</div></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>

<?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';
      }
    }
  }

  $ctemp = $vd['config'];
?>
<!--if( $tmp[18]==1 && isset($ctemp['19']) && $ctemp['19'] > 0){-->
<div id="rbbox" style="display:none">
  <a class="tipbutton" onclick="closeBox()">关闭</a>
  <iframe id="tipframe" src="index.php?m=mod_agent&c=Messenger&a=MsgNotRead" frameborder="0" height="200" width="300" scrolling="no"></iframe>
</div>

<script type="text/javascript">
  function showBox(o)
  {
    if (o == undefined) o = $("rbbox");
    if (o.clientHeight<230)
    {
      o.style.height=o.clientHeight+2+"px";
      setTimeout(function(){showBox(o)},5); 
    }
  }
  function closeBox()
  {
    $("rbbox").style.display="none"; 
  }  

	function LeftMsgAlert(){
    var xmlhttptop;
    var obj = $("msgn");
    var content = "错误！"
    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;
          obj.innerHTML = data;
          if(data != "" && data.length < 4 && data > 0)
          {
            if(data > 0)
            {
            	<!--if( isset($ctemp['18']) && $ctemp['18'] == 1){-->
            	tipobj  = document.all ? window.frames["tipframe"] : window.document.getElementById("tipframe").contentWindow;
            	tipobj.location.reload();
            	$("rbbox").style.display = "";
          	  showBox();
          	  <!--}-->
          	  $("icondiv").style.display = "";
            }
            else
          	{
          		closeBox();
          		$("icondiv").style.display = "none";
          	}
          }
          else
        	{
        		closeBox();
          	$("icondiv").style.display = "none";
        	}
        }
      }
    }
    xmlhttptop.open("post", "{$vd['root']}index.php?m=mod_b2b&c=Frame&a=Msg", true);
    xmlhttptop.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttptop.send('');
  }
  setInterval(LeftMsgAlert, <!--echo $ctemp['19']*1000;-->);
  <!--if($vd['msgn'] > 0 && isset($ctemp['18']) && $ctemp['18'] == 1){-->
  	$("rbbox").style.display = "";
    showBox();
  <!--}-->
</script>
<!--}-->
<div style="clear:both;"></div>
<!--if($vd['mygid'] > 1){-->
<div class="turnjxs" onclick="javascript:window.location.href='index.php?m=mod_b2b&c=Dealer&a=Home'" ><div class="">转入经销商系统</div></div>
<!--}else{-->
<br/>
<!--}-->
<div id="main">
<?php
  $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'  => 'jfgl',
    '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'  => 'fw',
    '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'
        )
      )
    )
  );
  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;
      echo '<div class="agenttitle"><div class="'.$item['cls'].'">'.$item['name'].'</div></div><div class="box agentlist"><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><a href="'.$vd['root'].$item1['url'].'">'.$item1['txt'].'</a>';
          } 
          
          if($go == 0)
          { 
            echo ' / <a href="'.$vd['root'].$item1['url'].'">'.$item1['txt'].'</a>';
            $go = 1;
          }
          
          if(isset($item1['nobr']))
          {
            $go = 0;
          }
            
          if($go)
          {  
            echo '</li>';
          }
        }
      }
      echo '</ul></div>';
    }
  }
?>
</div>
<br/>