cxhxy/app/store/view/food/goods/index.html
test_service d3170b4d1c 1
2023-12-01 15:43:29 +08:00

1 line
8.5 KiB
HTML

{layout name="layout/food" /}
<div class="row-content am-cf">
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<div class="widget-head am-cf">
<div class="widget-title am-cf">商品列表 - <?= $shop_name?></div>
</div>
<div class="widget-body am-fr">
<!-- 工具栏 -->
<div class="page_toolbar am-margin-bottom am-cf">
<form class="toolbar-form" action="{:url('food.goods/index')}">
<input type="hidden" name="shop_id" value="{$shop_id}">
<div class="am-u-sm-12 am-u-md-3">
<div class="am-form-group">
<div class="am-btn-group am-btn-group-sm">
<a class="am-btn am-btn-primary am-radius"
href="{:url('food.goods/add',['shop_id'=>$shop_id])}">
<span class="am-icon-plus"></span> 新增
</a>
</div>
</div>
</div>
<div class="am-u-sm-12 am-u-md-9">
<div class="am-fr">
<div class="am-form-group am-fl">
<select name="category_id"
data-am-selected="{searchBox: 1, btnSize: 'sm', placeholder: '全部分类', maxHeight: 400}">
<option value=""></option>
{if isset($category)}
{foreach $category as $item}
<option value="{$item['category_id']}" {$category_id == $item['category_id'] ? 'selected' : ''}>
{$item['name']}</option>
{/foreach}
{/if}
</select>
</div>
<div class="am-form-group am-fl">
<div class="am-input-group am-input-group-sm tpl-form-border-form">
<input type="text" class="am-form-field" name="search" placeholder="请输入商品名称" value="{$search}">
<div class="am-input-group-btn">
<button class="am-btn am-btn-default am-icon-search" type="submit"></button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="am-scrollable-horizontal am-u-sm-12">
<table width="100%" class="am-table am-table-hover tpl-table-black">
<thead>
<tr>
<th>编号</th>
<th>图片</th>
<th>名称</th>
<th>分类</th>
<th>销量</th>
<th>库存</th>
<th>规格</th>
<th>状态</th>
<th>排序</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{if !$list->isEmpty()}
{foreach $list as $item}
<tr>
<td class="am-text-middle">{$item['goods_id']}</td>
<td class="am-text-middle">
<a href="{$item['image'][0]['url']}" title="点击查看大图" target="_blank">
<img src="{$item['image'][0]['url']}" width="50" height="50" alt="商品图片">
</a>
</td>
<td class="am-text-middle">
<p class="item-title">{$item['goods_name']}</p>
</td>
<td class="am-text-middle">{$item['category']['name']}</td>
<td class="am-text-middle">{$item['sales_actual']}</td>
<td class="am-text-middle">{$item['stock']}</td>
<td class="am-text-middle">
<span class="{$item['spec_type'] == 10 ? 'x-color-green' : 'x-color-red'}">
{$item['spec_type'] == 10 ? '单规格':'多规格'}
</span>
</td>
<td class="am-text-middle">
<span class="j-status am-badge x-cur-p {$item['goods_status']['value'] == 10 ? ' am-badge-success' : ' am-badge-warning'}"
data-id="{$item['goods_id']}"
data-status="{$item['goods_status']['value']}">
{$item['goods_status']['text']}
</span>
</td>
<td class="am-text-middle">{$item['goods_sort']}</td>
<td class="am-text-middle">{$item['create_time']}</td>
<td class="am-text-middle">
<div class="tpl-table-black-operation">
<a href="{:url('food.goods/edit',['id' => $item['goods_id'],'shop_id'=>$shop_id])}">
<i class="am-icon-pencil"></i> 编辑
</a>
<a href="javascript:;" class="item-del tpl-table-black-operation-del"
data-id="{$item['goods_id']}">
<i class="am-icon-trash"></i> 删除
</a>
{if $user['applet']['shop_mode']['value']==20}
<a class="tpl-table-black-operation-green" href="{:url('food.goods/copys',['id' => $item['goods_id'],'shop_id'=>$shop_id])}">
<i class="am-icon-clipboard"></i> 一键复制
</a>
{/if}
</div>
</td>
</tr>
{/foreach}
{else /}
<tr>
<td colspan="11" class="am-text-center">暂无记录</td>
</tr>
{/if}
</tbody>
</table>
</div>
<div class="am-u-lg-12 am-cf">
<div class="am-fr">{:$list->render()} </div>
<div class="am-fr pagination-total am-margin-right">
<div class="am-vertical-align-middle">总记录:{:$list->total()}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
// 切换上架状态
$('.j-status').click(function () {
var data = $(this).data();
var msg = '确定要'+(parseInt(data.status) === 10 ? '下架' : '上架')+'该商品?';
var url = "{:url('food.goods/status')}";
$('.j-status').del('id', url,msg);
});
// 删除元素
var url = "{:url('food.goods/delete',['shop_id'=>$shop_id])}";
$('.item-del').del('id', url);
});
</script>