<? if (!defined('ROOT')) exit('Can\'t Access !'); include template('admin_header','admin'); ?>
  <div id="right">
    <div class="right">
      <div style="width:auto;overflow-x:hidden;overflow-y:auto">
      
      <? if($_GET['get']=='list') { ?>
        <div class="tags">
          <div id="tagscontent">
            <div id="con_one_1">
              <div class="table_td" style="margin-top:10px;">
                  <table border="0" cellspacing="2" cellpadding="4" class="list" name="table" id="table" width="100%">
                    <thead>
                      <tr>
                        <th align="center">编号</th>
                        <th align="center">关联会员</th>
                        <th align="center">商家名称</th>
                        <th align="center">联系人</th>
                        <th align="center">联系电话</th>
                        <th align="center">所属分类</th>
                        <th align="center">加入时间</th>
                        <th align="center">目前状态</th>
                        <th align="center">操作</th>
                      </tr>
                    </thead>
                    
            <? if(is_array($this->companylist)) { foreach($this->companylist as $value) { ?>                    <tbody>
                      <tr class="s_out" onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                        <td align="center"><?=$value['id']?></td>
                        <td align="center"><?=$value['username']?></td>
                        <td align="center"><?=$value['name']?></td>
                        <td align="center"><?=$value['person']?></td>
                        <td align="center"><?=$value['telphone']?></td>
                        <td align="center"><?=$value['typename']?></td>
                        <td align="center"><?=$value['addtime']?></td>
                        <td align="center"><?=$value['checked']?></td>   
                        <td align="center"><a href="<?=$value['editurl']?>">编辑</a></td>
                      </tr>
                    </tbody>
            <? } } ?>                    

                  </table>
                <div class="blank20"></div>
                <div class="page"><span><?=$this->pagetotal?>条记录/<? echo $_GET['page'] ? $_GET['page'] : 1  ?>页</span><?=$this->showpage?></div>
                <div class="blank20"></div>
              </div>
            </div>
          </div>
        </div>
        <div class="blank20"></div>
      <? } ?>
        
      <? if($_GET['get']=='add'||$_GET['get']=='edit') { ?>
        <div class="tags">
          <div id="tagstitle"><a class="hover"><?=$getName?></a></div>
          <div id="tagscontent">
            <form method="post" name="form1" action="">
              <div>
                <table border="0" cellspacing="2" cellpadding="4" class="list" name="table" id="table" width="100%">
                  <tbody>
                  
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">商家名称</td>
                      <td>
                        <?=config::form('name',$this->company['name'],'input','','class=\'skey\'');?>                      
                        </td>
                    </tr>

                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">商家地址</td>
                      <td> 
                        <?=config::form('address',$this->company['address'],'input','','class=\'skey\'');?>   
                      </td>
                    </tr>
                        
 
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">联系人</td>
                      <td> 
                        <?=config::form('person',$this->company['person'],'input','','class=\'skey\'');?>   
                      </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">联系电话</td>
                      <td> 
                        <?=config::form('telphone',$this->company['telphone'],'input','','class=\'skey\'');?>   
                      </td>
                    </tr>
                                                             
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">所属分类</td>
                      <td> 
                     <?=config::form('typeid',$this->company['typeid'],'select',$this->typelist);?>
                      </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">所属地区</td>
                      <td> 
<select id="s_province" name="s_province"></select>&nbsp;&nbsp;
    <select id="s_city" name="s_city" ></select>&nbsp;&nbsp;
    <select id="s_county" name="s_county"></select>
    <script type="text/javascript" src="<?=$this->appdir?>area.js"></script>
    <script type="text/javascript">
<? if($_GET['get']=='edit') { ?>
var opt0 = ["<?=$this->company['s_province']?>","<?=$this->company['s_city']?>","<?=$this->company['s_county']?>"];//初始值
<? } else { ?>
var opt0 = ["省份","地级市","市、县级市"];//初始值
<? } ?>
_init_area();
    
    </script>
                      </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">加入时间</td>
                      <td>
                       <?=config::form('addtime',formattime($this->company['addtime'],'Y-m-d'),'data',false,'datefmt');?>                    
                        </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">商家详细介绍</td>
                      <td> 
                      <?=config::form('content',$this->company['content'],'editor','0','<1@1>');?>
                      </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff" >
                      <td class="left">缩略图片</td>
                      <td style="padding-left:10px;"> 
                       <font color="#FF3300">把第 <?=config::form('pics',$this->company['pics'],'input','','class=\'skey\' style=\'width:20px;\'');?> 张作为缩略图</font>
                      </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">商家状态</td>
                      <td> 
                      <?=config::form('checked',$this->company['checked'],'radio','[<1><审核>][<0><未审核>]');?>
                      </td>
                    </tr>
                    
                    <tr onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                      <td class="left">是否推荐</td>
                      <td> 
                      <?=config::form('ishot',$this->company['ishot'],'radio','[<1><推荐>][<0><不推荐>]');?>
                      </td>
                    </tr>
                    
                    
                  </tbody>
                </table>
              </div>
              <div class="blank20"></div>
               <?=config::form('button','提交','submit','','class=\'button\'');?>
            </form>
          </div>
        </div>
        <div class="blank20"></div>
      <? } ?>
        

      <? if($_GET['get']=='type') { ?>
        <div class="tags">
          <div id="tagscontent">
            <div id="con_one_1">
              <div class="table_td" style="margin-top:10px;">
              <form method="post" action="" onsubmit="return remind();">
                  <table border="0" cellspacing="2" cellpadding="4" class="list" name="table" id="table" width="100%">
                    <thead>
                      <tr>
                        <th align="center">编号</th>
                        <th align="center">分类名称</th>
                        <th align="center">排序</th>
                        <th align="center">操作</th>
                      </tr>
                    </thead>
                    <tbody id="type">         
            <? if(is_array($this->typelist)) { foreach($this->typelist as $value) { ?>                      <tr class="s_out" onmouseover="this.bgColor='#F5F5F5';" onmouseout="this.bgColor='ffffff';" bgcolor="#ffffff">
                        <td align="center"><?=$value['id']?><input type="hidden" name="id[]" value="<?=$value['id']?>"></td>
                        <td align="left" style="padding-left:10px;">
                          <?=config::form('typename[]',$value['typename'],'input','','class=\'skey\' style=\'width:130px;\'');?>
                        </td>
                        <td align="left" style="padding-left:10px;">
                          <?=config::form('typeorder[]',$value['typeorder'],'input','','class=\'skey\' style=\'width:50px;\'');?>
                        </td>
                        <td align="center"><a onclick="return remind();" href="<?=$value['delurl']?>">删除</a></td>
                      </tr>

            <? } } ?>                    </tbody>      

                  </table>
                <div class="blank20"></div>
                 <?=config::form('button','确认修改','submit','','class=\'button\'');?> 
                 <input type="button" name="button" id="typebutton" value="添加一个分类" onclick="addtype();" class="button" />
              </form>
              </div>
            </div>
          </div>
        </div>
        <div class="blank20"></div>
      <? } ?>



      </div>
      <div class="clear"></div>
    </div>
    <div class="clear"></div>
  </div>
</div>
<? include template('admin_footer','admin'); ?>
