index.php 5.86 KB
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<?php if($this->view->status == 0):?>
<ul class="nav nav-tabs">
  <li>
  		<a href="/admin/brand">品牌列表</a>
  </li>
  <li class="active">
  		<a href="/admin/prod">商品列表</a>
  </li>
</ul>
<?php endif;?>
<?php if($this->view->status == 0):?>
    <?php if(!empty($this->view->brand)):?>
		<h4>
			<img src="<?php echo Lib_Images::getImageUrl($this->view->brand['logo'],'0200x0150','fragmentimg');?>"  width="50" height="50"/>
		  <?php echo $this->view->brand['name'];?> 商品列表 
	  </h4>
	<?php else:?>
		<h4>商品列表</h4>
	<?php endif;?>
<?php else:?>
	<h4>限量商品</h4>
<?php endif;?>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
    <button class="btn" style="float:left;" id="add_prod" href="javascript:void(0)">添加商品</button>
    </caption>
   <thead>
      <td width="9%">编号</td>
      <td width="9%">名称</td>
      <td width="9%">品牌ID</td>
      <td width="9%">品牌LOGO</td>
      <td>链接</td>
      <td width="6%">图片</td>
      <td width="9%">促销价格 ( 单位:元 ) </td>
      <td width="9%">市场价格 ( 单位:元 ) </td>
      <td width="12%">介绍</td>
      <td>排序(值越大,排序越靠前)</td>
      <td>创建时间</td>
      <td width="12%">操作</td>
   </thead>
   <?php if (empty($this->view->data)) :?>
   <tr><td colspan="10" style="text-align: center">无记录</td></tr>
   <?php else :?>
   
   <?php
	  $brands = $this->view->brands;
      foreach ($this->view->data as $prod) :?>
       <tr>
           <td><?php echo $prod['id']?></td>
           <td><?php echo $prod['name']?></td>
           <td><?php echo $prod['brand_id']?></td>
           <td><img src="<?php echo Lib_Images::getImageUrl($brands[$prod['brand_id']]['logo'], '0200x0150','fragmentimg');?>"  width="50" height="50" /></td>
           <td><a href='<?php echo $prod['url']?>' target="_blank">前往商品</a></td>
           <td pic=<?php echo $prod['pic'];?>>
            <?php 
               $arr = explode('|', $prod['pic']);
               foreach ($arr as $val)
               {
                   echo '<img src="'.$val.'" width="40" height="30">';
               }    
              ?>
           </td>
           <td><?php echo $prod['price'];?></td>
           <td><?php echo $prod['market_price'];?></td>
           <td><?php echo $prod['text']?></td>
           <td><?php echo $prod['sort']?></td>
           <td>
           		<?php echo date('Y-m-d h:i:s', $prod['create_time']);?>
           		<span id="prod_info" market_price="<?php echo $prod['market_price']?>" product_skn="<?php echo $prod['product_skn']?>" product_id="<?php echo $prod['product_id']?>"></span>
           </td>
           <td>
           		<button id="look_one_<?php echo $prod['id'];?>" class="btn look" recom_status="<?php echo $prod['recom_status'];?>">编辑</button>
           		<button val="<?php echo $prod['id'];?>" class="btn btn-danger del">删除</button>
           </td>
       </tr>
   <?php endforeach;?>
   <?php endif;?>
</table>
<?php $this->_component('Common_Pagination',array(
    'pagination' => $this->view->pagination,'show_count' =>true,
 ));?>
 
 <div id="form_pan" admin="<?php echo $this->view->admin?>" style="display:none">
       <table class="table table-bordered">
          <tbody>
            <tr>
              <td>商品链接</td>
              <td colspan="3">
                <input type="hidden" id="id" name="id"/>
                <input type="text" id="url" name="url" />&nbsp;<button id="get_prod" class="btn" style="margin-top: -10px;">提取</button>
              </td>
            </tr>
            <tr>
              <td>商品名称</td>
              <td>
                <input type="text" id="name" name="name" />
              </td>
              <td>排序</td>
              <td>
                <input type="text" id="sort" name="sort" value="0"/>
              </td>
            </tr>
             <tr>
              <td>图片<span class="text-error"> * </span></td>
              <td>
               <input type="hidden" id='pic' name='pic' />
              </td>
              <td>介绍<span class="text-error"> * </span></td>
              <td>
                 <textarea type="text"  id="text" name="text" style="height: 90px; width: 300px;"> </textarea>
              </td>
            </tr>
            <tr>
              <td>品牌ID</td>
              <td><input type="text" id="brand_id" name="brand_id" value="<?php echo $this->view->brand_id;?>"/></td>
              <td>创建时间</td>
              <td>
                <input type="text" readonly="readonly" class='span3 Wdate' id="create_time" name="create_time" />
              </td>
            </tr>
            <tr>
              <td>
              	促销价格  <span class="text-error"> * </span>
              	<br/>(单位:元)
              	<input type="hidden" name="market_price" id="market_price" value="0"/>
              	<input type="hidden" name="product_skn"  id="product_skn"  value="0" />
              	<input type="hidden" name="product_skn"  id="product_id"  value="0" />
              </td>
              <td>
   					<input type="price"  id="price" name="text" value=""/>
              </td>
              <td>推荐状态<span class="text-error"> * </span></td>
              <td>
                 <select name="recom_status" id="recom_status">
                 	<option value="0">不推荐</option>
                 	<option value="1">推荐</option>
                 </select>
              </td>
            </tr>
          </tbody>
    </table>
</div>
<?php $this->_endblock();?>

<?php $this->_block('js');?>
<?php $this->_js('star.js', array(
    SITE_JS . '/lib/seajs.js',
));?>
<script type="text/javascript" src="<?php echo SITE_JS?>/lib/ui/date/WdatePicker.js"></script>
<script type="text/javascript">
seajs.use('admin/prod');
</script>
<?php $this->_endblock();?>