作者 何书鹏

商品管理显示库存

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