wpfw_ewei_shopv2/template/web_v3/goods/index.html
2023-02-14 19:57:32 +08:00

743 lines
38 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{template '_header'}
<style>
tbody tr td{
position: relative;
}
tbody tr .icow-weibiaoti--{
visibility: hidden;
display: inline-block;
color: #fff;
height:18px;
width:18px;
background: #e0e0e0;
text-align: center;
line-height: 18px;
vertical-align: middle;
}
tbody tr:hover .icow-weibiaoti--{
visibility: visible;
}
tbody tr .icow-weibiaoti--.hidden{
visibility: hidden !important;
}
.full .icow-weibiaoti--{
margin-left:10px;
}
.full>span{
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
vertical-align: middle;
align-items: center;
}
tbody tr .label{
margin: 5px 0;
}
.goods_attribute a{
cursor: pointer;
}
.newgoodsflag{
width: 22px;height: 16px;
background-color: #ff0000;
color: #fff;
text-align: center;
position: absolute;
bottom: 70px;
left: 57px;
font-size: 12px;
}
.modal-dialog {
min-width: 720px !important;
position: absolute;
left: 0;
right: 0;
top: 50%;
}
.catetag{
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
}
/* 更改价格库存排序 */
.sorting {
color: #bcbdba;
display: none;
}
.hover_sanj, .hover_sank {
position: relative;
}
.hover_sanj:hover .sorting, .hover_sank:hover .sorting {
display: block;
}
.sorting .icon {
height: 8px;
position: absolute;
left: 40px;
font-size: 0.3rem;
text-align: center;
}
.sorting .icon-sanjiao2 {
top: 5px;
}
.sorting .icon-sanjiao1 {
bottom: 12px;
}
.sorting .color_red {
color: #f55;
}
</style>
<div class="page-header">
当前位置:<span class="text-primary">商品管理</span>
</div>
<div class="page-content">
<div class="fixed-header">
<div style="width:25px;"></div>
<div style="width:80px;text-align:center;">排序</div>
<div style="width:80px;">商品</div>
<div class="flex1">&nbsp;</div>
<div style="width: 100px;">价格</div>
<div style="width: 80px;">库存</div>
<div style="width: 80px;">销量</div>
<div style="width: 80px;">实际销量</div>
{if $goodsfrom!='cycle'}
<div style="width:80px;" >状态</div>
{/if}
<div class="flex1">属性</div>
<div style="width: 120px;">操作</div>
</div>
<form action="./index.php" method="get" class="form-horizontal form-search" role="form">
<input type="hidden" name="c" value="site" />
<input type="hidden" name="a" value="entry" />
<input type="hidden" name="m" value="{EWEI_SHOP_V2_MODULE_NAME}" />
<input type="hidden" name="do" value="web" />
<input type="hidden" name="r" value="goods.{$goodsfrom}" />
<div class="page-toolbar">
<span class="pull-left" style="margin-right:30px;">
{ifp 'goods.add'}
<a class='btn btn-sm btn-primary' href="{php echo webUrl('goods/add')}"><i class='fa fa-plus'></i> 添加商品</a>
{/if}
{ifp 'goods.add'}
<a class='btn btn-sm btn-primary' href="{php echo webUrl('goods/create')}"><i class='fa fa-plus'></i> 快速添加商品</a>
{/if}
{if p('taobao')}
{ifp 'taobao'}
<a class='btn btn-sm btn-primary' href="{php echo webUrl('taobao')}"><i class='fa fa-plus'></i> 导入商品</a>
{/if}
{/if}
</span>
<div class="input-group col-sm-6 pull-right">
<span class="input-group-select">
<select name="attribute" class='form-control select2' style="width:200px;" data-placeholder="商品属性">
<option value="" {if empty($_GPC['attribute'])}selected{/if}>商品属性</option>
<option value="new" {if $_GPC['attribute']=='new'}selected{/if}>新品</option>
<option value="hot" {if $_GPC['attribute']=='hot'}selected{/if} >热卖</option>
<option value="recommand" {if $_GPC['attribute']=='recommand'}selected{/if} >推荐</option>
<option value="discount" {if $_GPC['attribute']== 'discount'}selected{/if} >促销</option>
<option value="sendfree" {if $_GPC['attribute']== 'sendfree'}selected{/if} >包邮</option>
<option value="time" {if $_GPC['attribute'] == 'time'}selected{/if} >限时卖</option>
<option value="nodiscount" {if $_GPC['attribute'] == 'nodiscount'}selected{/if} >不参与折扣</option>
</select>
</span>
<span class="input-group-select">
<select name="cate" class='form-control select2' style="width:200px;" data-placeholder="商品分类">
<option value="" {if empty($_GPC['cate'])}selected{/if} >商品分类</option>
{loop $category $c}
<option value="{$c['id']}" {if $_GPC['cate']==$c['id']}selected{/if} >{$c['name']}</option>
{/loop}
</select>
</span>
<input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="ID/名称/编号/条码{if $merch_plugin}/商户名称{/if}">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit"> 搜索</button>&nbsp;
<button type="submit" value="1" name="export" class="btn btn-sm btn-success">导出商品</button>
</span>
</div>
</div>
</form>
{if count($list)>0 && cv('goods.main')}
<div class="row">
<div class="col-md-12">
<div class="page-table-header">
<input type='checkbox' />
<div class="btn-group">
{ifp 'goods.edit'}
{if $_GPC['goodsfrom']=='sale'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('goods/status',array('status'=>0))}">
<i class='icow icow-xiajia3'></i> 下架
</button>
{/if}
{if $_GPC['goodsfrom']=='stock'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('goods/status',array('status'=>1))}">
<i class='icow icow-shangjia2'></i> 上架
</button>
{/if}
{/if}
{if $_GPC['goodsfrom']=='cycle'}
{ifp 'goods.delete1'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="如果商品存在购买记录,会无法关联到商品, 确认要彻底删除吗?" data-href="{php echo webUrl('goods/delete1')}">
<i class='icow icow-shanchu1'></i> 彻底删除</button>
{/if}
{ifp 'goods.restore'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要恢复?" data-href="{php echo webUrl('goods/restore')}">
<i class='icow icow-huifu1'></i> 恢复到仓库</button>
{/if}
{else}
{ifp 'goods.delete'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="{php echo webUrl('goods/delete')}">
<i class='icow icow-shanchu1'></i> 删除</button>
{/if}
{/if}
{if $_GPC['goodsfrom']=='verify'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确定要通过审核吗?" data-href="{php echo webUrl('goods/checked')}">
<i class='icow icow-shenhetongguo'></i> 批量审核通过</button>
{/if}
{ifp 'goods.edit'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchcatesbut" >批量分类</button>
{/if}
</div>
</div>
<table class="table table-responsive">
<thead class="navbar-inner">
<tr>
<th style="width:25px;"></th>
<th style="width:80px;text-align:center;">排序</th>
<th style="width:80px;">商品</th>
<th style="">&nbsp;</th>
<form action="" method="get" class="form-horizontal form-search" role="form" id="orderBy">
<input type="hidden" name="c" value="site" />
<input type="hidden" name="a" value="entry" />
<input type="hidden" name="m" value="{EWEI_SHOP_V2_MODULE_NAME}" />
<input type="hidden" name="do" value="web" />
<input type="hidden" name="r" value="goods.{$goodsfrom}" />
<input type="hidden" name="orderby" value="" />
<th class="hover_sanj" style="width: 100px;">
<button type="submit" style="background: transparent;text-align: left;width: 100%;">价格
<span class="sorting">
<i class="icon icon-sanjiao2"></i>
<i class="icon icon-sanjiao1"></i>
</span>
</button>
</th>
<th class="hover_sank" style="width: 80px;">
<button type="submit" style="background: transparent;text-align: left;width: 100%;">库存
<span class="sorting">
<i class="icon icon-sanjiao2"></i>
<i class="icon icon-sanjiao1"></i>
</span></button>
</th>
</form>
<th style="width: 80px;">销量</th>
<th style="width: 80px;" data-toggle="tooltip" data-placement="top" title="" data-original-title="不包含已申请维权订单">实际销量</th>
{if $goodsfrom!='cycle'}
<th style="width:80px;" >状态</th>
{/if}
<th>属性</th>
<th style="width: 120px;">操作</th>
</tr>
</thead>
<tbody>
{loop $list $item}
<tr>
<td>
<input type='checkbox' value="{$item['id']}"/>
</td>
<td style='text-align:center;'>
{ifp 'goods.edit'}
<a href='javascript:;' data-toggle='ajaxEdit' data-href="{php echo webUrl('goods/change',array('type'=>'displayorder','id'=>$item['id']))}" >{$item['displayorder']}</a>
<i class="icow icow-weibiaoti-- " data-toggle="ajaxEdit2"></i>
{else}
{$item['displayorder']}
{/if}
</td>
<td>
<a href="{php echo webUrl('goods/edit', array('id' => $item['id'],'goodsfrom'=>$goodsfrom,'page'=>$page))}">
<img src="{php echo tomedia($item['thumb'])}" style="width:72px;height:72px;padding:1px;border:1px solid #efefef;margin: 7px 0" onerror="this.src='../addons/{EWEI_SHOP_V2_MODULE_NAME}/static/images/nopic.png'" />
</a>
{if !empty($item['newgoods'])}
<!---->
<div class="newgoodsflag"></div>
{/if}
</td>
<td class='full' >
<span>
<span style="display: block;width: 100%;">
{ifp 'goods.edit'}
<a href='javascript:;' data-toggle='ajaxEdit' data-edit='textarea' data-href="{php echo webUrl('goods/change',array('type'=>'title','id'=>$item['id']))}" style="overflow : hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;">
{$item['title']}
</a>
{else}
{$item['title']}
{/if}
<span class="catetag">
{loop $item['allcates'] $index $item1}
{if $category[$item['allcates'][$index]]['level'] ==1}
<span class="text-danger">[{$category[$item['allcates'][$index]]['name']}]</span>
{elseif $category[$item['allcates'][$index]]['level'] ==2}
<span class="text-info">[{$category[$item['allcates'][$index]]['name']}]</span>
{elseif $category[$item['allcates'][$index]]['level'] ==3 && intval($shopset['catlevel']==3)}
<span class="text-info">[{$category[$item['allcates'][$index]]['name']}]</span>
{/if}
{/loop}
<!--{if !empty($category[$item['pcate']])}-->
<!--<span class="text-danger">[{$category[$item['pcate']]['name']}]</span>-->
<!--{/if}-->
<!--{if !empty($category[$item['ccate']])}-->
<!--<span class="text-info">[{$category[$item['ccate']]['name']}]</span>-->
<!--{/if}-->
<!--{if !empty($category[$item['tcate']]) && intval($shopset['catlevel'])==3}-->
<!--<span class="text-info">[{$category[$item['tcate']]['name']}]</span>-->
<!--{/if}-->
</span>
</span>
{ifp 'goods.edit'}
<i class="icow icow-weibiaoti-- " data-toggle="ajaxEdit2"></i>
{/if}
</span>
</td>
<td>&yen;
{if $item['hasoption']==1}
{ifp 'goods.edit'}
<span data-toggle='tooltip' title='多规格不支持快速修改'>{$item['marketprice']}</span>
{else}
{$item['marketprice']}
{/if}
{else}
{ifp 'goods.edit'}
<a href='javascript:;' data-toggle='ajaxEdit' data-href="{php echo webUrl('goods/change',array('type'=>'marketprice','id'=>$item['id']))}" >{$item['marketprice']}</a>
<i class="icow icow-weibiaoti-- " data-toggle="ajaxEdit2"></i>
{else}
{$item['marketprice']}
{/if}{/if}
</td>
<td>
{if !empty($item['hoteldaystock'])}
<span data-toggle='tooltip' title='民宿类商品显示每日库存'>{$item['hoteldaystock']}/日</span>
{else if $item['hasoption']==1}
{ifp 'goods.edit'}
<span data-toggle='tooltip' title='多规格不支持快速修改'>
{if $item['total']<=$goodstotal}<span class="text-danger">{$item['total']}</span>{else}{$item['total']}{/if}
</span>
{else}
{if $item['total']<=$goodstotal}<span class="text-danger">{$item['total']}</span>{else}{$item['total']}{/if}
{/if}
{else}
{ifp 'goods.edit'}
<a href='javascript:;' data-toggle='ajaxEdit' data-href="{php echo webUrl('goods/change',array('type'=>'total','id'=>$item['id']))}" >
{if $item['total']<=$goodstotal}<span class="text-danger">{$item['total']}</span>{else}{$item['total']}{/if}
</a>
<i class="icow icow-weibiaoti-- " data-toggle="ajaxEdit2"></i>
{else}
{if $item['total']<=$goodstotal}<span class="text-danger">{$item['total']}</span>{else}{$item['total']}{/if}
{/if}
{/if}
</td>
<td>{$item['sales']}</td>
<td>{php echo !empty($item['sale_cpcount']) ? $item['sale_cpcount'] : 0;}</td>
{if $goodsfrom!='cycle'}
<td style="overflow:visible;">
{if $item['status']==2}
<span class="label label-danger">赠品</span>
{else}
<span class='label {if $item['status']==1}label-primary{else}label-default{/if}'
{ifp 'goods.edit'}
data-toggle='ajaxSwitch'
data-confirm = "确认是{if $item['status']==1}下架{else}上架{/if}"
data-switch-refresh='true'
data-switch-value='{$item['status']}'
data-switch-value0='0|下架|label label-default|{php echo webUrl('goods/status',array('status'=>1,'id'=>$item['id']))}'
data-switch-value1='1|上架|label label-success|{php echo webUrl('goods/status',array('status'=>0,'id'=>$item['id']))}'
{/if}
>
{if $item['status']==1}上架{else}下架{/if}</span>
{/if}
{if !empty($item['merchid'])}
<br>
<span class='label {if $item['checked']==0}label-primary{else}label-warning{/if}'
{ifp 'goods.edit'}
data-toggle='ajaxSwitch'
data-confirm = "确认是{if $item['checked']==0}审核中{else}审核通过{/if}"
data-switch-refresh='true'
data-switch-value='{$item['checked']}'
data-switch-value1='1|审核中|label label-warning|{php echo webUrl('goods/checked',array('checked'=>0,'id'=>$item['id']))}'
data-switch-value0='0|通过|label label-success|{php echo webUrl('goods/checked',array('checked'=>1,'id'=>$item['id']))}'
{/if}
>
{if $item['checked']==0}通过{else}审核中{/if}</span>
{/if}
</td>
{/if}
<td class="goods_attribute">
<a class='{if $item['isnew']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
data-switch-value='{$item['isnew']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'new', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'new','data'=>0,'id'=>$item['id']))}'
{/if}
>新品</a>
<a class='{if $item['ishot']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
data-switch-value='{$item['ishot']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'hot', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'hot','data'=>0,'id'=>$item['id']))}'
{/if}
>热卖</a>
<a class='{if $item['isrecommand']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
data-switch-value='{$item['isrecommand']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'recommand', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'recommand','data'=>0,'id'=>$item['id']))}'
{/if}
>推荐</a>
<a class='{if $item['isdiscount']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
data-switch-value='{$item['isdiscount']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'discount', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'discount','data'=>0,'id'=>$item['id']))}'
{/if}
>促销</a>
<a class='{if $item['issendfree']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
data-switch-value='{$item['issendfree']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'sendfree', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'sendfree','data'=>0,'id'=>$item['id']))}'
{/if}
>包邮</a>
<a class='{if $item['istime']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
data-switch-value='{$item['istime']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'time', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'time','data'=>0,'id'=>$item['id']))}'
{/if}
>限时卖</a>
<a class='{if $item['isnodiscount']==1}text-danger{else}text-default{/if}'
{ifp 'goods.property'}
data-toggle='ajaxSwitch'
{if $item['merchid']>0}data-confirm='多商户的商品如果设置参与会员折扣,给多商户结算的时候是按照折扣前的价格结算,您确定要做修改?'{/if}
data-switch-value='{$item['isnodiscount']}'
data-switch-value0='0||text-default|{php echo webUrl('goods/property',array('type'=>'nodiscount', 'data'=>1,'id'=>$item['id']))}'
data-switch-value1='1||text-danger|{php echo webUrl('goods/property',array('type'=>'nodiscount','data'=>0,'id'=>$item['id']))}'
{/if}
>不参与折扣</a>
</td>
<td style="overflow:visible;position:relative">
{if empty($item['ishotel'])}
{ifp 'goods.edit|goods.view'}
<a class='btn btn-op btn-operation' href="{php echo webUrl('goods/edit', array('id' => $item['id'],'goodsfrom'=>$goodsfrom,'page'=>$page))}" >
<span data-toggle="tooltip" data-placement="top" title="" data-original-title="{ifp 'goods.edit'}编辑{else}查看{/if}">
<i class="icow icow-bianji2"></i>
</span>
</a>
{/if}
{else}
{ifp 'hotelreservation.goods.edit|hotelreservation.goods.view'}
<a class='btn btn-op btn-operation' href="{php echo webUrl('hotelreservation/goods/edit', array('id' => $item['id'],'goodsfrom'=>$goodsfrom,'page'=>$page))}">
<span data-toggle="tooltip" data-placement="top" title="" data-original-title="{ifp 'goods.edit'}编辑{else}查看{/if}">
{ifp 'goods.edit'}
<i class='icow icow-bianji2'></i>
{else}
<i class='icow icow-chakan-copy'></i>
{/if}
</span>
</a>
{/if}
{/if}
{if $_GPC['goodsfrom']=='cycle'}
{ifp 'goods.restore'}
<a class='btn btn-op btn-operation' data-toggle='ajaxRemove' href="{php echo webUrl('goods/restore', array('id' => $item['id']))}" data-confirm='确认要恢复?'>
<span data-toggle="tooltip" data-placement="top" title="" data-original-title="恢复">
<i class='icow icow-huifu1'></i>
</span>
</a>
{/if}
{ifp 'goods.delete1'}
<a class='btn btn-op btn-operation' data-toggle='ajaxRemove' href="{php echo webUrl('goods/delete1', array('id' => $item['id']))}" data-confirm='如果此商品存在购买记录,会无法关联到商品, 确认要彻底删除吗?'>
<span data-toggle="tooltip" data-placement="top" title="" data-original-title="彻底删除">
<i class='icow icow-shanchu1'></i>
</span>
</a>
{/if}
{else}
{ifp 'goods.delete'}
<a class='btn btn-op btn-operation' data-toggle='ajaxRemove' href="{php echo webUrl('goods/delete', array('id' => $item['id']))}" data-confirm='确认彻底删除此商品?'>
<span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
<i class='icow icow-shanchu1'></i>
</span>
</a>
{/if}
{/if}
{if $_GPC['goodsfrom']!='cycle'}
<a href="javascript:;" class='btn btn-op btn-operation js-clip' data-url="{php echo mobileUrl('goods/detail', array('id' => $item['id']),true)}">
<span data-toggle="tooltip" data-placement="top" data-original-title="复制链接">
<i class='icow icow-lianjie2'></i>
</span>
</a>
<a href="javascript:void(0);" class="btn btn-op btn-operation" data-toggle="popover" data-trigger="hover" data-html="true"
data-content="<img src='{$item['qrcode']}' width='130' alt='链接二维码'>" data-placement="auto right">
<i class="icow icow-erweima3"></i>
</a>
{/if}
</td>
</tr>
{if !empty($item['merchname']) && $item['merchid'] > 0}
<tr style="background: #f9f9f9">
<td colspan='{if $goodsfrom=='cycle'}9{else}10{/if}' style='text-align: left;border-top:none;padding:5px 0;' class='aops'>
<span class="text-default" style="margin-left: 10px;">商户名称:</span><span class="text-info">{$item['merchname']}</span>
</td>
</tr>
{/if}
{/loop}
</tbody>
<tfoot>
<tr>
<td><input type="checkbox"></td>
<td {if $goodsfrom!='cycle'}colspan="4"{else}colspan="3" {/if}>
<div class="btn-group">
{ifp 'goods.edit'}
{if $_GPC['goodsfrom']=='sale'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('goods/status',array('status'=>0))}">
<i class='icow icow-xiajia3'></i> 下架</button>
{/if}
{if $_GPC['goodsfrom']=='stock'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('goods/status',array('status'=>1))}">
<i class='icow icow-shangjia2'></i> 上架</button>
{/if}
{/if}
{if $_GPC['goodsfrom']=='cycle'}
{ifp 'goods.delete1'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="如果商品存在购买记录,会无法关联到商品, 确认要彻底删除吗?" data-href="{php echo webUrl('goods/delete1')}">
<i class='icow icow-shanchu1'></i> 彻底删除</button>
{/if}
{ifp 'goods.restore'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要恢复?" data-href="{php echo webUrl('goods/restore')}">
<i class='icow icow-huifu1'></i> 恢复到仓库</button>
{/if}
{else}
{ifp 'goods.delete'}
<button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要彻底删除吗?" data-href="{php echo webUrl('goods/delete1')}">
<i class='icow icow-shanchu1'></i> 彻底删除</button>
{/if}
{/if}
</div>
</td>
<td colspan="5" style="text-align: right">
{$pager}
</td>
</tr>
</tfoot>
</table>
</div>
</div>
{else}
<div class="panel panel-default">
<div class="panel-body empty-data">暂时没有任何商品!</div>
</div>
{/if}
</div>
{template 'goods/batchcates'}
{template '_footer'}
<script>
//获得分类标签
// var length = $('#catetag').children().length;
// if (length >10){
// for (var i=2;i<length;i++)
// {
// $('#catetag').children().eq(i).hide();
// }
// $('#catetag').append('...等');
// }
//显示批量分类
$('#batchcatesbut').click(function () {
$('#batchcates').show();
})
//关闭批量分类
$('.modal-header .close').click(function () {
$('#batchcates').hide();
})
// 取消批量分类
$('.modal-footer .btn.btn-default').click(function () {
$('#batchcates').hide();
})
//确认
$('.modal-footer .btn.btn-primary').click(function () {
var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
var goodsids = selected_checkboxs.map(function () {
return $(this).val()
}).get();
var cates=$('#cates').val();
var iscover=$('input[name="iscover"]:checked').val();
$.post(biz.url('goods/ajax_batchcates'),{'goodsids':goodsids,'cates': cates,'iscover':iscover}, function (ret) {
if (ret.status == 1) {
$('#batchcates').hide();
tip.msgbox.suc('修改成功');
window.location.reload();
return
} else {
tip.msgbox.err('修改失败');
}
}, 'json');
})
$(document).on("click", '[data-toggle="ajaxEdit2"]',
function (e) {
var _this = $(this)
$(this).addClass('hidden')
var obj = $(this).parent().find('a'),
url = obj.data('href') || obj.attr('href'),
data = obj.data('set') || {},
html = $.trim(obj.text()),
required = obj.data('required') || true,
edit = obj.data('edit') || 'input';
var oldval = $.trim($(this).text());
e.preventDefault();
submit = function () {
e.preventDefault();
var val = $.trim(input.val());
if (required) {
if (val == '') {
tip.msgbox.err(tip.lang.empty);
return;
}
}
if (val == html) {
input.remove(), obj.html(val).show();
//obj.closest('tr').find('.icow').css({visibility:'visible'})
return;
}
if (url) {
$.post(url, {
value: val
}, function (ret) {
ret = eval("(" + ret + ")");
if (ret.status == 1) {
obj.html(val).show();
} else {
tip.msgbox.err(ret.result.message, ret.result.url);
}
input.remove();
}).fail(function () {
input.remove(), tip.msgbox.err(tip.lang.exception);
});
} else {
input.remove();
obj.html(val).show();
}
obj.trigger('valueChange', [val, oldval]);
},
obj.hide().html('<i class="fa fa-spinner fa-spin"></i>');
var input = $('<input type="text" class="form-control input-sm" style="width: 80%;display: inline;" />');
if (edit == 'textarea') {
input = $('<textarea type="text" class="form-control" style="resize:none;" rows=3 width="100%" ></textarea>');
}
obj.after(input);
input.val(html).select().blur(function () {
submit(input);
_this.removeClass('hidden')
}).keypress(function (e) {
if (e.which == 13) {
submit(input);
_this.removeClass('hidden')
}
});
});
// 页面排序进入取参orderby
function orderBy(param) {
var reg = new RegExp("(^|&)" + param + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return decodeURI(r[2]);
return null;
}
console.log(orderBy('orderby'));
if(orderBy('orderby') == 'price1') {
$('.hover_sanj').find('i:eq(0)').addClass('color_red');
}else if(orderBy('orderby') == 'price2') {
$('.hover_sanj').find('i:eq(1)').addClass('color_red');
}else if(orderBy('orderby') == 'total1') {
$('.hover_sank').find('i:eq(0)').addClass('color_red');
}else if(orderBy('orderby') == 'total2') {
$('.hover_sank').find('i:eq(1)').addClass('color_red');
}
// 价格与库存点击排序
$('.hover_sanj').on('click',function () {
$('.hover_sank').find('i:eq(0)').removeClass('color_red').end().find('i:eq(1)').removeClass('color_red');
var xiao = $(this).find('i:eq(0)').hasClass('color_red');
var da = $(this).find('i:eq(1)').hasClass('color_red');
if(!xiao && !da) {
$(this).find('i:eq(0)').addClass('color_red');
//价格倒叙
$('input[name=orderby]').val('price1');
}else if(xiao && !da) {
$(this).find('i:eq(0)').removeClass('color_red').end().find('i:eq(1)').addClass('color_red');
//价格正序
$('input[name=orderby]').val('price2');
}else if(!xiao && da) {
$(this).find('i:eq(1)').removeClass('color_red').end().find('i:eq(0)').addClass('color_red');
//价格倒叙
$('input[name=orderby]').val('price1');
}
});
$('.hover_sank').on('click',function () {
$('.hover_sanj').find('i:eq(0)').removeClass('color_red').end().find('i:eq(1)').removeClass('color_red');
var xiao = $(this).find('i:eq(0)').hasClass('color_red');
var da = $(this).find('i:eq(1)').hasClass('color_red');
if(!xiao && !da) {
$(this).find('i:eq(0)').addClass('color_red');
//库存倒叙
$('input[name=orderby]').val('total1');
}else if(xiao && !da) {
$(this).find('i:eq(0)').removeClass('color_red').end().find('i:eq(1)').addClass('color_red');
//库存正序
$('input[name=orderby]').val('total2');
}else if(!xiao && da) {
$(this).find('i:eq(1)').removeClass('color_red').end().find('i:eq(0)').addClass('color_red');
//库存倒叙
$('input[name=orderby]').val('total1');
}
})
</script>