'goods_sku',
# 显示给用户看的名称
'lang' => '商品价格设置',
'order' => 200,
'menu' => false,
'desc' => '1、当前库存是当前可售的库存,零售下单支付成功就会扣掉
2、占用库存是当前卖了多少
3、总库存是总进货多少,采购下单整个订单完成才会增加
4、在途库存是当前有多少库存在运送中,采购下单整个订单完成才会增加',
'end' => array
(
'insert' => 'shop/lib/manage.skuUpdate',
'update' => 'shop/lib/manage.skuUpdate',
),
# 数据结构 不同的字段放这里
'struct' => array
(
'id' => array
(
'type' => 'int-11',
'name' => 'ID',
'default' => '',
'desc' => '',
'match' => 'is_numeric',
//'list' => true,
),
'shop-info-sid'=> array
(
'name' => '门店编号',
'default' => '',
'desc' => '门店编号',
'match' => 'option',
# 读取另外表的关联方式
'sync' => array('shop_id', 'id'),
'list' => true,
'list_order' => 1,
),
'shop_id' => array
(
'type' => 'int-11',
'name' => '门店名称',
'default' => '',
'desc' => '门店名称',
'match' => 'is_numeric',
'search' => 'select',
//'option' => $shop,
'update' => 'hidden',
'search' => 'hidden',
'search' => array
(
'api' => 'shop/info-like',
'col' => 'name',
'result' => 'id',
),
'value' => Dever::input('search_option_shop_id'),
'list' => 'Dever::load("shop/info-one#name", {shop_id})',
'list_order' => 2,
),
'shop-info-type'=> array
(
'name' => '门店类型',
'default' => '',
'desc' => '门店类型',
'match' => 'option',
# 读取另外表的关联方式
'sync' => array('shop_id', 'id'),
'list' => 'Dever::load("shop/lib/manage.shopInfoType", {shop-info-type})',
'list_order' => 3,
),
'goods-info_sku-code'=> array
(
'name' => '商品编码',
'default' => '',
'desc' => '商品编码',
'match' => 'option',
# 读取另外表的关联方式
'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
'list' => true,
'list_order' => 4,
),
'goods-info_sku-price'=> array
(
'name' => '零售单价',
'default' => '',
'desc' => '零售单价',
'match' => 'option',
# 读取另外表的关联方式
'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
'list' => true,
'list_order' => 7,
),
'area' => array
(
'type' => 'varchar-500',
'name' => '所在街道',
'default' => '',
'desc' => '所在街道',
'match' => 'option',
'search' => 'linkage',
'update' => 'linkage',
'option' => Dever::url('lib/area.get', 'shop'),
//'list' => 'Dever::load("area/api.string", "{area}")',
),
'goods_id' => array
(
'type' => 'int-11',
'name' => '商品名称',
'default' => '',
'desc' => '商品名称',
'match' => 'is_numeric',
'search' => array
(
'api' => 'goods/info-like',
'col' => 'name',
'result' => 'id',
),
'list' => 'Dever::load("goods/info-find#name", {goods_id})',
'list_order' => 5,
),
'sku_id' => array
(
'type' => 'int-11',
'name' => '规格型号',
'default' => '-1',
'desc' => '规格型号',
'match' => 'is_numeric',
'list' => 'Dever::load("shop/lib/manage.getSku", {goods_id}, {sku_id})',
'list_order' => 6,
),
'price_id' => array
(
'type' => 'int-11',
'name' => '价格模板',
'default' => '0',
'desc' => '价格模板',
'match' => 'option',
),
'add_num' => array
(
'type' => 'float-11,2',
'name' => '新增库存-输入小于0的数字,则为减少库存',
'default' => '0',
'desc' => '新增库存',
'match' => 'is_numeric',
'list_name' => '当前库存',
'list' => '{total_num} - {sell_num}',
'list_order' => 8,
),
'total_num' => array
(
'type' => 'float-11,2',
'name' => '总库存',
'default' => '0',
'desc' => '总库存',
'match' => 'is_numeric',
'list' => true,
'list_order' => 10,
),
'sell_num' => array
(
'type' => 'float-11,2',
'name' => '销量',
'default' => '0',
'desc' => '请填写销量',
'match' => 'option',
//'search' => 'order',
'list_name' => '占用库存',
'list' => true,
'list_order' => 9,
),
'min' => array
(
'type' => 'float-11,2',
'name' => '起购数',
'default' => '1',
'desc' => '起购数',
'match' => 'is_string',
'update' => 'text',
//'list' => true,
'list_name' => '采购在途库存',
'list' => 'Dever::load("shop/lib/manage.getGoodsTotal", 1, {shop_id}, "{goods_id}", "{sku_id}")',
'list_order' => 10,
),
'reorder' => array
(
'type' => 'int-11',
'name' => '排序-数值越大越靠前,相当于置顶',
'default' => '1',
'desc' => '请输入排序',
'match' => 'option',
//'update' => 'textgetGoodsTotal
'search' => 'order',
//'list' => true,
'order' => 'desc',
//'edit' => true,
),
'state' => array
(
'type' => 'tinyint-1',
'name' => '数据状态',
'default' => '1',
'desc' => '请选择状态',
'match' => 'is_numeric',
),
'cdate' => array
(
'type' => 'int-11',
'name' => '发布时间',
'match' => array('is_numeric', time()),
'desc' => '',
# 只有insert时才生效
'insert' => true,
//'search' => 'date',
//'list' => 'date("Y-m-d H:i:s", {cdate})',
),
),
'alter' => array
(
3 => array
(
array('update', 'add_num', 'add_num', 'decimal-11,2 0 新增库存'),
array('update', 'total_num', 'total_num', 'decimal-11,2 0 总库存'),
array('update', 'sell_num', 'sell_num', 'decimal-11,2 0 销量'),
array('update', 'min', 'min', 'decimal-11,2 0 起购数'),
),
'version' => 3,
),
'manage' => array
(
'insert' => false,
'edit' => false,
'delete' => false,
'num' => false,
'excel' => array(array('导出门店库存', '门店库存', '')),
'page_list_table' => 'sku',
# 自定义快捷新增和编辑
'button' => array
(
//'自定义属性' => array('fast', 1, 'config&where_id=1'),
),
),
# request 请求接口定义
'request' => array
(
'getDataPage' => array
(
# 匹配的正则或函数 选填项
'option' => array
(
'shop_id' => array('yes-t_1.shop_id'),
'name' => array('yes-t_2.name', 'like'),
'total' => array('yes|t_1.total_num-t_1.sell_num', '<'),
'column' => array('yes-t_2.column_id', 'like'),
'category' => array('yes-t_2.category', 'like'),
'top_category_id' => array('yes-t_2.top_category_id'),
'second_category_id' => array('yes-t_2.second_category_id'),
'category_id' => array('yes-t_2.category_id'),
'state' => 'yes-t_2.state-1',
'state_1' => 'yes-t_1.state-1',
'status' => 'yes-t_2.status',
),
# 联表
'join' => array
(
array
(
'table' => 'goods/info',
'type' => 'left join',
'on' => array('goods_id','id'),
'col' => 'goods_id',
),
),
'type' => 'all',
//'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
'order' => array('t_1.total_num-t_1.sell_num desc,t_2.reorder desc,t_2.id desc,t_2.price', 'asc'),
'page' => array(10, 'list'),
'col' => '*,t_2.name,t_2.cover,t_2.id as id,t_1.total_num-t_1.sell_num as total,t_1.sell_num',
),
'getAllData' => array
(
# 匹配的正则或函数 选填项
'option' => array
(
'shop_id' => array('yes-t_1.shop_id'),
'name' => array('yes-t_2.name', 'like'),
'total' => array('yes|t_1.total_num-t_1.sell_num', '<'),
'column' => array('yes-t_2.column_id', 'like'),
'category' => array('yes-t_2.category', 'like'),
'top_category_id' => array('yes-t_2.top_category_id'),
'second_category_id' => array('yes-t_2.second_category_id'),
'category_id' => array('yes-t_2.category_id'),
'state' => 'yes-t_2.state-1',
'state_1' => 'yes-t_1.state-1',
'status' => 'yes-t_2.status',
),
# 联表
'join' => array
(
array
(
'table' => 'goods/info',
'type' => 'left join',
'on' => array('goods_id','id'),
'col' => 'goods_id',
),
),
'type' => 'all',
//'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
'order' => array('t_1.total_num-t_1.sell_num desc,t_2.reorder desc,t_2.id desc,t_2.price', 'asc'),
'page' => array(1000, 'list'),
'col' => '*,t_2.name,t_2.cover,t_2.id as id,t_1.total_num-t_1.sell_num as total,t_1.sell_num',
),
# 列表
'getData' => array
(
# 匹配的正则或函数 选填项
'option' => array
(
'shop_id' => 'yes',
'goods_id' => 'yes',
'sku_id' => 'yes',
'state' => 1,
),
'type' => 'all',
'order' => array('id' => 'desc'),
'col' => '*,total_num-sell_num as total|sku_id',
),
# 获取单条数据
'getOne' => array
(
# 匹配的正则或函数 选填项
'option' => array
(
'shop_id' => 'yes',
'goods_id' => 'yes',
'sku_id' => 'yes',
'state' => 1,
),
'type' => 'one',
'col' => '*,total_num-sell_num as total',
),
# 更新售出量
'incSell' => array
(
'type' => 'update',
'where' => array
(
'shop_id' => 'yes',
'goods_id' => 'yes',
'sku_id' => 'yes',
),
'set' => array
(
'sell_num' => array('yes', '+='),
),
),
# 减少售出量
'decSell' => array
(
'type' => 'update',
'where' => array
(
'shop_id' => 'yes',
'goods_id' => 'yes',
'sku_id' => 'yes',
),
'set' => array
(
'sell_num' => array('yes', '-='),
),
),
# 更新总库存
'updateTotal' => array
(
'type' => 'update',
'where' => array
(
'id' => 'yes',
),
'set' => array
(
'total_num' => array('yes', '+='),
),
),
# 增加总库存
'incTotal' => array
(
'type' => 'update',
'where' => array
(
'shop_id' => 'yes',
'goods_id' => 'yes',
'sku_id' => 'yes',
),
'set' => array
(
'total_num' => array('yes', '+='),
),
),
# 减少总库存
'decTotal' => array
(
'type' => 'update',
'where' => array
(
'shop_id' => 'yes',
'goods_id' => 'yes',
'sku_id' => 'yes',
),
'set' => array
(
'total_num' => array('yes', '-='),
),
),
),
);
return $config;