mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
优化数据模块
This commit is contained in:
parent
d7a4cf300d
commit
4ae194f100
@ -32,7 +32,7 @@ class ShopGoods extends Controller
|
||||
{
|
||||
$this->title = '商品数据管理';
|
||||
$query = $this->_query($this->table);
|
||||
$query->like('name,mark')->equal('status,cate');
|
||||
$query->like('code,name,mark')->equal('status,cate');
|
||||
// 加载对应数据
|
||||
$this->type = $this->request->get('type', 'index');
|
||||
if ($this->type === 'index') $query->where(['deleted' => 0]);
|
||||
@ -51,7 +51,7 @@ class ShopGoods extends Controller
|
||||
public function select()
|
||||
{
|
||||
$query = $this->_query($this->table);
|
||||
$query->equal('status,cate')->like('name,mark');
|
||||
$query->equal('status,cate')->like('code,name,mark');
|
||||
$query->where(['deleted' => 0])->order('sort desc,id desc')->page();
|
||||
}
|
||||
|
||||
|
@ -23,18 +23,18 @@
|
||||
<input data-upload-image name="img[]" type="hidden">
|
||||
</div>
|
||||
<label class="layui-input-inline nowrap relative margin-bottom-5" style="width:300px">
|
||||
<span>图片名称 </span>
|
||||
<input class="layui-input inline-block" style="width:240px" name="name[]" value="#" required placeholder="请输入图片标题">
|
||||
<span class="notselect">图片名称 </span>
|
||||
<input class="layui-input inline-block" style="width:240px" name="name[]" value="#" required placeholder="请输入图片名称">
|
||||
<a data-item-up class="layui-btn layui-btn-primary margin-left-5"><i class="layui-icon layui-icon-up margin-0"></i></a>
|
||||
<a data-item-dn class="layui-btn layui-btn-primary margin-left-5"><i class="layui-icon layui-icon-down margin-0"></i></a>
|
||||
<a data-item-rm class="layui-btn layui-btn-primary margin-left-5"><i class="layui-icon layui-icon-close margin-0"></i></a>
|
||||
</label>
|
||||
<label class="layui-input-inline nowrap relative margin-bottom-5" style="width:300px">
|
||||
<span>跳转活动 </span>
|
||||
<input class="layui-input inline-block" style="width:240px" name="rule[]" value="#" required placeholder="请输入跳转活动">
|
||||
<span class="notselect">跳转规则 </span>
|
||||
<input class="layui-input inline-block" style="width:240px" name="rule[]" value="#" required placeholder="请输入跳转规则">
|
||||
<a data-item-news class="layui-btn layui-btn-primary margin-left-5" style="margin-top:-3px">选择文章</a>
|
||||
<a data-item-goods class="layui-btn layui-btn-primary margin-left-5" style="margin-top:-3px">选择商品</a>
|
||||
<span class="help-block block">若要跳转页面,请填写正确的 URL 地址,不跳转以“#”号表示。</span>
|
||||
<span class="help-block block notselect">若要跳转页面,请选择对应的数据或填写跳转的 URL 地址,不跳转以“#”号表示。</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,20 +7,20 @@
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{/notempty}
|
||||
<tbody>
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr data-dbclick>
|
||||
<td class="text-left nowrap">{$vo.title|default=''}</td>
|
||||
<td class="text-left nowrap">{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">使用中</span>{/if}</td>
|
||||
<td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
|
||||
<td class='text-left nowrap'><a class="layui-btn layui-btn-sm layui-btn-normal" data-news="{$vo.id}">选择文章</a></td>
|
||||
{foreach $list as $key => $vo}
|
||||
<tr>
|
||||
<td class="nowrap">{$vo.title|default=''}</td>
|
||||
<td>{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">使用中</span>{/if}</td>
|
||||
<td>{$vo.create_at|format_datetime}</td>
|
||||
<td class='text-right'><a class="layui-btn layui-btn-sm layui-btn-normal" data-news="{$vo.id}">选择文章</a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
@ -29,15 +29,27 @@
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name='style'}
|
||||
<style>
|
||||
.pagination-container {
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
background: #fff;
|
||||
text-indent: 20px;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
{block name='script'}
|
||||
<script>
|
||||
$(function () {
|
||||
layui.form.render();
|
||||
$.form.reInit(), layui.form.render();
|
||||
$('[data-news]').on('click', function () {
|
||||
top.setCheckValue(this.getAttribute('data-news') || '');
|
||||
top.setCheckValue(this.getAttribute('data-goods') || '');
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
});
|
||||
$.form.reInit($('[data-select-container]'));
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
@ -1,6 +1,12 @@
|
||||
<fieldset>
|
||||
<legend>条件搜索</legend>
|
||||
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">商品编号</label>
|
||||
<label class="layui-input-inline">
|
||||
<input name="code" value="{:input('code','')}" placeholder="请输入商品编号" class="layui-input">
|
||||
</label>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">商品名称</label>
|
||||
<label class="layui-input-inline">
|
||||
|
@ -7,9 +7,9 @@
|
||||
{notempty name='list'}
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='text-left nowrap'>商品信息</th>
|
||||
<th class='text-left nowrap'></th>
|
||||
<th class='text-left nowrap'>商品状态</th>
|
||||
<th>商品信息</th>
|
||||
<th>分类标签</th>
|
||||
<th>商品状态</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -18,8 +18,8 @@
|
||||
{foreach $list as $key=>$vo}
|
||||
<tr>
|
||||
<td class='nowrap'>
|
||||
{notempty name='vo.logo'}
|
||||
<img data-tips-image style="width:auto;height:60px" src="{$vo.logo|default=''}" class="margin-right-5" alt="img">
|
||||
{notempty name='vo.cover'}
|
||||
<img data-tips-image style="width:auto;height:40px" src="{$vo.cover|default=''}" class="margin-right-5" alt="img">
|
||||
{/notempty}
|
||||
<div class="inline-block text-top">
|
||||
商品编号:{$vo.code|default='--'}<br>
|
||||
@ -30,29 +30,38 @@
|
||||
所属分类:{$vo.cate.name|default=''}<br>
|
||||
{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'>
|
||||
剩余库存:{$vo.number_stock|default='0'} 件<br>
|
||||
销售状态:{eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">销售中</span>{/eq}<br>
|
||||
</td>
|
||||
<td class='nowrap'>
|
||||
<a class="layui-btn layui-btn-sm layui-btn-normal" data-goods="{$vo.code}">选择商品</a>
|
||||
<td class='nowrap sub-span-blue'>
|
||||
销售状态:{if $vo.status eq 0}<b class="layui-badge">已下架</b>{else}<b class="layui-badge layui-bg-green">销售中</b>{/if}<br>
|
||||
剩余库存 <span>{$vo.stock_total-$vo.stock_sales}</span> 件 ( 已销售 <span>{$vo.stock_sales}</span> 件 )<br>
|
||||
</td>
|
||||
<td class='text-right'><a class="layui-btn layui-btn-sm layui-btn-normal" data-goods="{$vo.code}">选择商品</a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
|
||||
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name='style'}
|
||||
<style>
|
||||
.pagination-container {
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
background: #fff;
|
||||
text-indent: 20px;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
{block name='script'}
|
||||
<script>
|
||||
layui.form.render();
|
||||
$('[data-goods]').on('click', function () {
|
||||
top.setCheckValue(this.getAttribute('data-goods') || '');
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
|
Loading…
x
Reference in New Issue
Block a user