<extend name="./Apps/Home/View/default/shops/layout.html" />
<block name="content">
<style type="text/css">
#preview{border:1px solid #cccccc; background:#CCC;color:#fff; padding:5px; display:none; position:absolute;}
</style>
<script>
$(document).ready(function(){
    $('.imgPreview').imagePreview();
    <notempty name='shopCatId1'>
    getShopCatListForGoods('{$shopCatId1}','{$shopCatId2}');
    </notempty>
});
</script>
    <div class="wst-body"> 
       <div class='wst-page-header'>卖家中心 > 出售中的商品</div>
       <div class='wst-page-content'>
        <div class='wst-tbar-query'>
        店铺分类：<select id='shopCatId1' autocomplete="off" onchange='javascript:getShopCatListForGoods(this.value,"{$object['shopCatId2']}")'>
	         <option value='0'>请选择</option>
	         <volist name="shopCatsList" id="vo">
	         <option value='{$vo['catId']}' <if condition="$shopCatId1 == $vo['catId'] ">selected</if>>{$vo['catName']}</option>
	         </volist>
	     </select>
	     <select id='shopCatId2' autocomplete="off">
	         <option value='0'>请选择</option>
	     </select>
        商品：<input type='text' id='goodsName' value='{$goodsName}'/>
      <input type='hidden' id='pageNo' value='{$pageNo}'/>
      <button class='wst-btn-query' onclick='javascript:queryOnSale()'>查询</button>
        </div>
        <div class='wst-tbar-group'>
           <span></span>
           <a href='javascript:batchDel()'><span class='del btn'></span>删除</a>
           <a href='javascript:sale(0)'><span class='unSale btn'></span>下架</a>
           <a href='javascript:goodsSet("isRecomm","queryUnSaleByPage")'><span class='recomm btn'></span>推荐</a>
           <a href='javascript:goodsSet("isBest","queryUnSaleByPage")'><span class='best btn'></span>精品</a>
           <a href='javascript:goodsSet("isNew","queryUnSaleByPage")'><span class='new btn'></span>新品</a>
           <a href='javascript:goodsSet("isHot","queryUnSaleByPage")'><span class='hot btn'></span>热销</a>
        </div>
        <table class='wst-list'>
           <thead>
             <tr>
               <th width='30'><input type='checkbox' onclick='javascript:WST.checkChks(this,".chk")'/></th>
               <th width="60"></th>
               <th >商品名称</th>
               <th width="100">商品编号</th>
               <th width="80">价格</th>
               <th width="40">推荐</th>
               <th width="40">精品</th>
               <th width="40">新品</th>
               <th width="40">热销</th>
               <th width="40">上架</th>
               <th width="40">销量</th>
               <th width="100" >库存<br/>
               	<span style='color:red;font-weight:normal;'>(双击可修改)</span>
               </th>
               <th width='120'>操作</th>
             </tr>
           </thead>
           <tbody>
            <volist name="Page['root']" id="vo" key='i'>
             <tr>
               <td><input class='chk' type='checkbox' value='{$vo['goodsId']}'/></td>
               <td <if condition="$vo['goodsThums'] neq ''">img='{$vo['goodsThums']}' class='imgPreview'</if>>
               <div  style="position:relative;padding:4px 0;">
               <?php if($vo['isDistribut']==1 && (($shopConf["distributType"]==1 && $vo['commission']>0) || $shopConf["distributType"]==2)){ ?><span class="wst-distribut-tip">销</span><?php } ?>
               <img class='lazyImg' data-original="__ROOT__/{$vo['goodsThums']}" height="50" width="50"/>
               </div>
               </td>
               <td><div class="wst-gnowrap">{$vo['goodsName']}</div></td>
               
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:toEditGoodsBase(1,{$vo['goodsId']},0)">
               		<input id="ipt_1_{$vo['goodsId']}" onblur="javascript:editGoodsBase(1,{$vo['goodsId']})" style="display:none;width:100%;border:1px solid red;width:40px;" maxlength="20"/>
	               	<span id="span_1_{$vo['goodsId']}" style="display: inline;">{$vo['goodsSn']}</span>
					<img id="img_1_{$vo['goodsId']}" style="opacity: 0;display:none;" src="__ROOT__/Apps/Home/View/{$WST_STYLE}/images/action_check.gif">
               </td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:toEditGoodsBase(2,{$vo['goodsId']},'{$vo[attIsRecomm]}')">               		
               		<input id="ipt_2_{$vo['goodsId']}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberdoteKey(event)" onblur="javascript:editGoodsBase(2,{$vo['goodsId']})" style="display:none;width:100%;border:1px solid red;width:40px;" maxlength="10"/>
	               	<span id="span_2_{$vo['goodsId']}" style="display: inline;">{$vo['shopPrice']}</span>
					<img id="img_2_{$vo['goodsId']}" style="opacity: 0;display:none;" src="__ROOT__/Apps/Home/View/{$WST_STYLE}/images/action_check.gif">
               </td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},1)">
               <input id="isRecomm_{$vo['goodsId']}" type="hidden" value="{$vo[isRecomm]}"/>
               <div id="isRecomm_div_{$vo['goodsId']}">
	               <if condition="$vo['isRecomm'] == 1 ">
	               <span class='wst-state_yes'></span>
	               <else/>
	               <span class='wst-state_no'></span>
	               </if>
               </div>
               </td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},2)">
               <input id="isBest_{$vo['goodsId']}" type="hidden" value="{$vo[isBest]}"/>
               <div id="isBest_div_{$vo['goodsId']}">
	               <if condition="$vo['isBest'] == 1 ">
	               <span class='wst-state_yes'></span>
	               <else/>
	               <span class='wst-state_no'></span>
	               </if>
               </div>
               </td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},3)">
               <input id="isNew_{$vo['goodsId']}" type="hidden" value="{$vo[isNew]}"/>
               <div id="isNew_div_{$vo['goodsId']}">
	               <if condition="$vo['isNew'] == 1 ">
	               <span class='wst-state_yes'></span>
	               <else/>
	               <span class='wst-state_no'></span>
	               </if>
               </div>
               </td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},4)">
               <input id="isHot_{$vo['goodsId']}" type="hidden" value="{$vo[isHot]}"/>
               <div id="isHot_div_{$vo['goodsId']}">
	               <if condition="$vo['isHot'] == 1 ">
	               <span class='wst-state_yes'></span>
	               <else/>
	               <span class='wst-state_no'></span>
	               </if>
               </div>
               </td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:changSaleStatus({$vo['goodsId']},5)">
               <input id="isSale_{$vo['goodsId']}" type="hidden" value="{$vo[isSale]}"/>
               <div id="isSale_div_{$vo['goodsId']}">
	               <if condition="$vo['isSale'] == 1 ">
	               <span class='wst-state_yes'></span>
	               <else/>
	               <span class='wst-state_no'></span>
	               </if>
               </div>
               </td>
               <td>{$vo['saleCount']}</td>
               <td style="cursor:pointer;" title='双击修改' ondblclick="javascript:toEditGoodsBase(3,{$vo['goodsId']},'{$vo[attIsRecomm]}')" >
	               	<input id="ipt_3_{$vo['goodsId']}" onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberKey(event)" onblur="javascript:editGoodsBase(3,{$vo['goodsId']})" style="display:none;width:100%;border:1px solid red;width:40px;" maxlength="6"/>
	               	<span id="span_3_{$vo['goodsId']}" style="display: inline;">{$vo['goodsStock']}</span>
					<img id="img_3_{$vo['goodsId']}" style="opacity: 0;display:none;" src="__ROOT__/Apps/Home/View/{$WST_STYLE}/images/action_check.gif">
               </td>
               <td>
               <?php $isLast =  ($Page["totalPage"]==$Page["currPage"] && (count($Page['root'])==$i) && $i==1)?1:0; ?>
               <a href="{:U('Home/Goods/getGoodsDetails',array('goodsId'=>$vo['goodsId'],'kcode'=>$vo['kcode']))}" target="_blank" class='btn view' title='查看'></a>
               <a href="javascript:toEditGoods({$vo['goodsId']},'queryOnSaleByPage')" class='btn edit' title='编辑'></a>
               <a href="javascript:delGoods({$vo['goodsId']},{$isLast},'queryOnSaleByPage')" class='btn del' title='删除'></a>
               &nbsp;
               </td>
             </tr>
             </volist>
             <tfoot>
             <tr>
                <td colspan='13'>
                <div class="wst-page" style="float:right;padding-bottom:10px;">
						<div id="wst-page-items"></div>
				</div>
				  
                <script>
              
			    <if condition="$Page['totalPage'] gt 1">
			    $(document).ready(function(){
					laypage({
					    cont: 'wst-page-items',
					    pages: {$Page['totalPage']}, //总页数
					    skip: true, //是否开启跳页
					    skin: '#e23e3d',
					    groups: 3, //连续显示分页数
					    curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
					        var page = location.search.match(/p=(\d+)/);
					        return page ? page[1] : 1;
					    }(), 
					    jump: function(e, first){ //触发分页后的回调
					        if(!first){ //一定要加此判断，否则初始时会无限刷新
					        	var nuewurl = WST.splitURL("p");
					        	var ulist = nuewurl.split("?");
					        	if(ulist.length>1){
					        		location.href = nuewurl+'&p='+e.curr;
					        	}else{
					        		location.href = '?p='+e.curr;
					        	}
					            
					        }
					    }
					});
			    });
				</if>
				</script>
                </td>
             </tr>
             </tfoot>
           </tbody>
        </table>
        <div class='wst-tbar-group'>
           <span></span>
           <a href='javascript:batchDel()'><span class='del btn'></span>删除</a>
           <a href='javascript:sale(0)'><span class='unSale btn'></span>下架</a>
           <a href='javascript:goodsSet("isRecomm","queryUnSaleByPage")'><span class='recomm btn'></span>推荐</a>
           <a href='javascript:goodsSet("isBest","queryUnSaleByPage")'><span class='best btn'></span>精品</a>
           <a href='javascript:goodsSet("isNew","queryUnSaleByPage")'><span class='new btn'></span>新品</a>
           <a href='javascript:goodsSet("isHot","queryUnSaleByPage")'><span class='hot btn'></span>热销</a>
        </div>
        </div>
    </div>
</block> 