作者 何书鹏

商品管理显示库存

... ... @@ -2,6 +2,7 @@
namespace app\admin\controller\litestore;
use app\admin\model\litestore\Litestoregoodsspec;
use app\common\controller\Backend;
use app\admin\model\litestore\Litestorespec as SpecModel;
use app\admin\model\litestore\Litestorespecvalue as SpecValueModel;
... ... @@ -82,6 +83,7 @@ class Litestoregoods extends Backend
$row->getRelation('category')->visible(['name']);
$row->getRelation('activity')->visible(['name']);
// $row->getRelation('freight')->visible(['name']);
$row->stock_num = Litestoregoodsspec::where('goods_id',$row['goods_id'])->sum('stock_num');
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
... ...
... ... @@ -36,7 +36,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg
{field: 'image', title: __('Image'), formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), formatter: Table.api.formatter.images},
{field: 'spec_type', title: __('Spec_type'), searchList: {"10":__('Spec_type 10'),"20":__('Spec_type 20')}, formatter: Table.api.formatter.normal},
{field: 'deduct_stock_type', title: __('Deduct_stock_type'), searchList: {"10":__('Deduct_stock_type 10'),"20":__('Deduct_stock_type 20')}, formatter: Table.api.formatter.normal},
{field: 'stock_num', title: __('库存'),operate: false},
// {field: 'deduct_stock_type', title: __('Deduct_stock_type'), searchList: {"10":__('Deduct_stock_type 10'),"20":__('Deduct_stock_type 20')}, formatter: Table.api.formatter.normal},
// {field: 'freight.name', title: __('Freight.name')},
// {field: 'sales_initial', title: __('Sales_initial')},
{field: 'sales_actual', title: __('Sales_actual')},
... ...
... ... @@ -38,7 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'order_status', title: __('Order_status'), searchList: {"10":__('Order_status 10'),"20":__('Order_status 20'),"30":__('Order_status 30')},
formatter: Controller.api.status_formatter},
{field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'address.name', title: __('Address.name'),operate: false},
{field: 'address.name', title: __('Address.name'),operate: 'LIKE'},
{
field: 'rider.nickname',
title: __('选择配送骑手'),
... ...