mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-23 18:00:29 +08:00
修改商品管理
This commit is contained in:
parent
929129c7aa
commit
f553f74622
@ -32,7 +32,7 @@ class ShopGoods extends Controller
|
|||||||
{
|
{
|
||||||
$this->title = '商品数据管理';
|
$this->title = '商品数据管理';
|
||||||
$query = $this->_query($this->table);
|
$query = $this->_query($this->table);
|
||||||
$query->like('name')->equal('status,cate');
|
$query->like('name,mark')->equal('status,cate');
|
||||||
// 加载对应数据
|
// 加载对应数据
|
||||||
$this->type = $this->request->get('type', 'index');
|
$this->type = $this->request->get('type', 'index');
|
||||||
if ($this->type === 'index') $query->where(['deleted' => 0]);
|
if ($this->type === 'index') $query->where(['deleted' => 0]);
|
||||||
@ -63,10 +63,14 @@ class ShopGoods extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function _page_filter(&$data)
|
protected function _page_filter(&$data)
|
||||||
{
|
{
|
||||||
|
$this->marks = GoodsService::instance()->getMarkList();
|
||||||
$query = $this->app->db->name('ShopGoodsCate')->where(['deleted' => 0, 'status' => 1]);
|
$query = $this->app->db->name('ShopGoodsCate')->where(['deleted' => 0, 'status' => 1]);
|
||||||
$this->clist = DataExtend::arr2table($query->order('sort desc,id desc')->select()->toArray());
|
$this->clist = DataExtend::arr2table($query->order('sort desc,id desc')->select()->toArray());
|
||||||
$clist = $this->app->db->name('ShopGoodsCate')->whereIn('id', array_column($data, 'cate'))->column('pid,name,status', 'id');
|
$clist = $this->app->db->name('ShopGoodsCate')->whereIn('id', array_column($data, 'cate'))->column('pid,name,status', 'id');
|
||||||
foreach ($data as &$vo) $vo['cate'] = $clist[$vo['cate']] ?? $vo['cate'];
|
foreach ($data as &$vo) {
|
||||||
|
$vo['cate'] = $clist[$vo['cate']] ?? $vo['cate'];
|
||||||
|
$vo['mark'] = trim($vo['mark'], ',') ? explode(',', trim($vo['mark'], ',')) : [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,15 +37,16 @@
|
|||||||
<th class='list-table-sort-td'>
|
<th class='list-table-sort-td'>
|
||||||
<button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
|
<button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
|
||||||
</th>
|
</th>
|
||||||
<th class='text-left nowrap'>商品信息</th>
|
<th class='text-left nowrap'>商品名称</th>
|
||||||
<th class='text-left nowrap'></th>
|
<th class='text-left nowrap'>商品标签</th>
|
||||||
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{/notempty}
|
{/notempty}
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach $list as $key=>$vo}
|
{foreach $list as $key=>$vo}
|
||||||
<tr data-dbclick>
|
<tr>
|
||||||
<td class='list-table-check-td think-checkbox'>
|
<td class='list-table-check-td think-checkbox'>
|
||||||
<label><input class="list-check-box" value='{$vo.code}' type='checkbox'></label>
|
<label><input class="list-check-box" value='{$vo.code}' type='checkbox'></label>
|
||||||
</td>
|
</td>
|
||||||
@ -61,6 +62,9 @@
|
|||||||
商品名称:<span>{$vo.name|default='--'}</span><br>
|
商品名称:<span>{$vo.name|default='--'}</span><br>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="text-left">
|
||||||
|
{notempty name='vo.mark'}{foreach $vo.mark as $mark}<span class="margin-right-5 layui-badge layui-bg-cyan">{$mark}</span>{/foreach}{/notempty}
|
||||||
|
</td>
|
||||||
<td class='nowrap'>
|
<td class='nowrap'>
|
||||||
销售状态:{eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">销售中</span>{/eq}<br>
|
销售状态:{eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">销售中</span>{/eq}<br>
|
||||||
所属分类:{$vo.cate.name|default='-'}<br>
|
所属分类:{$vo.cate.name|default='-'}<br>
|
||||||
@ -68,7 +72,7 @@
|
|||||||
<td class='nowrap sub-span-blue'>
|
<td class='nowrap sub-span-blue'>
|
||||||
<div class="margin-bottom-5">剩余库存 <span>{$vo.stock_total-$vo.stock_sales}</span> 件 ( 已销售 <span>{$vo.stock_sales}</span> 件 )</div>
|
<div class="margin-bottom-5">剩余库存 <span>{$vo.stock_total-$vo.stock_sales}</span> 件 ( 已销售 <span>{$vo.stock_sales}</span> 件 )</div>
|
||||||
<!--{if auth("edit")}-->
|
<!--{if auth("edit")}-->
|
||||||
<a data-dbclick class="layui-btn layui-btn-xs" data-open='{:url("edit")}?code={$vo.code}'>编 辑</a>
|
<a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?code={$vo.code}'>编 辑</a>
|
||||||
<!--{else}-->
|
<!--{else}-->
|
||||||
<a data-tips-text="您没有编辑商品的权限哦!" class="layui-btn layui-btn-xs layui-btn-primary layui-disabled">编 辑</a>
|
<a data-tips-text="您没有编辑商品的权限哦!" class="layui-btn layui-btn-xs layui-btn-primary layui-disabled">编 辑</a>
|
||||||
<!--{/if}-->
|
<!--{/if}-->
|
||||||
|
@ -7,6 +7,19 @@
|
|||||||
<input name="title" value="{:input('title','')}" placeholder="请输入商品名称" class="layui-input">
|
<input name="title" value="{:input('title','')}" placeholder="请输入商品名称" class="layui-input">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-form-item layui-inline">
|
||||||
|
<label class="layui-form-label">商品标签</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select class="layui-select" name="mark" lay-search>
|
||||||
|
<option value="">-- 全部标签 --</option>
|
||||||
|
{foreach $marks as $mark}{if input('mark','') eq $mark}
|
||||||
|
<option selected value="{$mark}">{$mark}</option>
|
||||||
|
{else}
|
||||||
|
<option value="{$mark}">{$mark}</option>
|
||||||
|
{/if}{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-form-item layui-inline">
|
<div class="layui-form-item layui-inline">
|
||||||
<label class="layui-form-label">商品分类</label>
|
<label class="layui-form-label">商品分类</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user