rabin před 2 roky
rodič
revize
ff25237944

+ 1 - 1
module/scm_product/assets/pc/html/set_supplier_goods.html

@@ -60,7 +60,7 @@
                                 <th lay-data="{field:'id'}">商品ID</th>
                                 <th lay-data="{field:'name'}">商品名称</th>
                                 <th lay-data="{field:'old_cost_price', edit: 'text'}">成本价</th>
-                                <th lay-data="{field:'cost_price', edit: 'text'}">出厂价</th>
+                                <th lay-data="{field:'cost_price', edit: 'text'}">新成本价</th>
                                 <th lay-data="{field:'operation'}">操作</th>
                             </tr>
                         </thead>

+ 21 - 38
module/scm_product/database/info.php

@@ -99,8 +99,8 @@ $config = array
 
 	'end' => array
 	(
-		'insert' => 'scm_product/lib/manage.infoUpdate',
-		'update' => 'scm_product/lib/manage.infoUpdate',
+		'insert' => 'scm_product/lib/manage.updateInfo',
+		'update' => 'scm_product/lib/manage.updateInfo',
 	),
 
 	# 同步更新另外一个或多个表的数据,将数据同步到关联表中
@@ -173,39 +173,22 @@ $config = array
 			'control'	=> 'type',
 		),
 
-		'goods'       => array
-        (
-            'type'      => 'text-1000',
-            'name'      => '商品配置-套餐和组合商品可以选择多个套餐或者组合内的商品',
-            'default'   => '',
-            'desc'      => '商品配置',
-            'match'     => 'is_string',
-            'show'      => 'type=11,12',
-            'update'    => array
-            (
-                array
-                (
-                    'col'       => 'goods_id',
-                    'name'      => '选择商品',
-                    'default'   => '',
-                    'desc'      => '选择商品',
-                    'match'     => 'option',
-                    'update'    => 'select',
-                    'update_search' => 'scm_product/lib/manage.searchProduct?{id}',
-                ),
-
-                array
-                (
-                    'col'       => 'num',
-                    'name'      => '数量',
-                    'default'   => '1',
-                    'desc'      => '数量',
-                    'match'     => 'is_string',
-                    'update'    => 'text',
-                ),
-            ),
-            'tab'		=> 1,
-        ),
+        'scm_product-info_goods'=> array
+		(
+			'name' 		=> '商品配置-套餐和组合商品可以选择多个套餐或者组合内的商品',
+			'default' 	=> '',
+			'desc' 		=> '商品配置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'info_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            //'list_name' => '商品信息',
+			//'list'		=> 'Dever::load("scm_servicer/lib/manage.getGoods", {id})',
+			'tab'		=> 1,
+			'show'      => 'type=11,12',
+		),
 
         'stock'        => array
         (
@@ -263,9 +246,9 @@ $config = array
 		'commission'		=> array
 		(
 			'type' 		=> 'varchar-20',
-			'name' 		=> '销售商佣金-设置佣金之后,销售商销售了商品,能得到的相应佣金,也可以在销售商里单独设置,填写10%就是销售价的百分之10,直接填写数字就是佣金数额,填0就是无佣金,填负数会扣减佣金账户',
+			'name' 		=> '销售佣金-设置佣金之后,经销商或者其下级分销商销售了商品,经销商能得到的总佣金,也可以在经销商里单独设置,填写10%就是销售价的百分之10,直接填写数字就是佣金数额,填0就是无佣金,填负数会扣减佣金账户',
 			'default' 	=> '0',
-			'desc' 		=> '销售佣金',
+			'desc' 		=> '销售佣金',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
 			'tab'		=> 1,
@@ -346,7 +329,7 @@ $config = array
 
 		'scm_product-info_spec'=> array
 		(
-			'name' 		=> '规格设置-成本价为平台进货成本价格,采购价为销售采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格',
+			'name' 		=> '规格设置-成本价为平台进货成本价格,采购价为销售采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格',
 			'default' 	=> '',
 			'desc' 		=> '规格设置',
 			'match' 	=> 'option',

+ 131 - 0
module/scm_product/database/info_goods.php

@@ -0,0 +1,131 @@
+<?php
+
+$type = array
+(
+    1 => '正常商品',
+    2 => '赠品',
+);
+
+return array
+(
+    # 表名
+    'name' => 'info_goods',
+    # 显示给用户看的名称
+    'lang' => '套餐商品表',
+    'menu' => false,
+    'end' => array
+    (
+        'insert' => 'scm_product/lib/order.updateGoods?table=scm_product/info_goods',
+        'update' => 'scm_product/lib/order.updateGoods?table=scm_product/info_goods',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品表id',
+            'default'   => '',
+            'desc'      => '商品表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'option',
+            'update'    => 'select',
+            'update_search' => 'scm_product/lib/manage.searchProduct?{goods_id}',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'is_numeric',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '-1',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '数量',
+            'default'   => '1',
+            'desc'      => '数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'update'	=> 'text',
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '类型',
+            'match'     => 'is_numeric',
+            'update'  => 'select',
+            'option'    => $type,
+            'search'    => 'select',
+            'list'      => 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})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'insert' => false,
+        'delete' => false,
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 6 - 0
module/scm_product/lib/Info.php

@@ -306,4 +306,10 @@ class Info
 
         return $info;
     }
+
+    # 获取商品的基本信息,只包括名称-价格等信息
+    public function getBaseInfo($info, $sku = false)
+    {
+        $info = is_array($info) ? $info : Dever::db('scm_product/info')->one($info);
+    }
 }

+ 2 - 2
module/scm_product/lib/Manage.php

@@ -16,7 +16,7 @@ class Manage
      *
      * @return mixed
      */
-    public function infoUpdate($id, $name, $data)
+    public function updateInfo($id, $name, $data)
     {
         # 更新分类id
         $category = Dever::param('category', $data);
@@ -99,7 +99,7 @@ class Manage
             $supplier_goods = Dever::db('scm_supplier/goods')->one(array('supplier_id' => $supplier_id));
             if ($supplier_goods) {
                 $where['supplier_id'] = $supplier_id;
-                $data = Dever::search('scm_supplier/goods', $where);
+                $data = Dever::search('scm_supplier/goods_sku', $where);
             } else {
                 $supplier = Dever::db('scm_supplier/info')->find($supplier_id);
                 if ($supplier && $supplier['category']) {

+ 53 - 0
module/scm_product/lib/Order.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace Scm_product\Lib;
+
+use Dever;
+
+class Order
+{
+    public function updateGoods($id, $name, $data)
+    {
+        $table = Dever::input('table');
+        $goods = Dever::param('goods', $data);
+        if ($table && $goods) {
+            $temp = explode('-', $goods);
+            $update = array();
+            $update['where_id'] = $id;
+            $update['goods_id'] = $temp[0];
+            $update['sku_id'] = $temp[1];
+            if (isset($temp[2])) {
+                $update['cash'] = $temp[2];
+            }
+            
+            Dever::db($table)->update($update);
+
+            Dever::config('base')->hook = false;
+        }
+    }
+
+    public function updateOrderNum($id, $name, $data)
+    {
+        $table = Dever::input('table');
+        $prefix = Dever::input('prefix');
+        if ($table && $prefix) {
+            $update['order_num'] = $this->getOrderNum($table, $prefix);
+            $update['where_id'] = $id;
+            Dever::db($table)->update($update);
+            Dever::config('base')->hook = false;
+        }
+    }
+
+    # 生成订单号
+    public function getOrderNum($table, $prefix = 'C')
+    {
+        $prefix = $prefix . ucfirst(substr($table, 0, 1));
+        $where['order_num'] = Dever::order($prefix);
+        $state = Dever::db($table)->one($where);
+        if (!$state) {
+            return $where['order_num'];
+        } else {
+            return $this->getOrderNum($table);
+        }
+    }
+}

+ 9 - 2
module/scm_product/lib/Sku.php

@@ -20,17 +20,24 @@ class Sku
     # 获取某个商品的sku商品列表
     public function getList($info, &$data)
     {
-        if ($info['spec_type'] == 2) {
+        if ($info['spec_type']) {
             $where['info_id'] = $info['id'];
+            if (isset($info['sku_id'])) {
+                $where['id'] = $info['sku_id'];
+            }
             $sku = Dever::db('scm_product/info_sku')->select($where);
             if ($sku) {
                 foreach ($sku as $k => $v) {
                     $copy = $info;
+                    $copy['id'] .= '-' . $v['id'];
+                    if (isset($info['supplier_id']) && isset($info['cost_price'])) {
+                        $copy['id'] .= '-' . $info['cost_price'];
+                    }
+
                     $key = str_replace('-', ',', $v['key']);
                     $spec = Dever::db('scm_product/info_spec_value')->getGroupData(array('ids' => $key));
                     if ($spec) {
                         $copy['name'] .= '-' . $spec['name'];
-                        $copy['id'] .= '-' . $v['id'];
                         if (isset($copy['value'])) {
                             $copy['value'] = $copy['id'];
                         }

+ 30 - 0
module/scm_product/lib/Stock.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace Scm_product\Lib;
+
+use Dever;
+
+class Stock
+{
+    # 库存管理
+    public function get_api()
+    {
+    	$id = Dever::input('id');
+    	return $this->getData($id);
+    }
+
+    # 获取基本信息列表
+    public function getData($info_id, $method = 'getAll')
+    {
+        $result = array();
+    	if ($info_id) {
+    		$result = Dever::db('scm_product/info_spec')->$method(array('info_id' => $info_id));
+    		if ($result) {
+    			foreach ($result as $k => $v) {
+    				$result[$k]['child'] = Dever::db('scm_product/info_spec_value')->$method(array('info_id' => $info_id, 'spec_id' => $v['id']));
+    			}
+    		}
+    	}
+    	return $result;
+    }
+}

+ 78 - 32
module/scm_servicer/database/in_order.php

@@ -2,16 +2,23 @@
 
 $status = array
 (
-    1 => '待审核',
-    2 => '已审核',
-    3 => '已驳回',
+    1 => array('name' => '待审核', 'style' => 'font-weight:bold;color:#436EEE'),
+    2 => array('name' => '已审核', 'style' => 'font-weight:bold;color:#003366'),
+    3 => array('name' => '已驳回', 'style' => 'font-weight:bold;color:#993333'),
+);
+
+$audit = array
+(
+    //1 => '待审核',
+    2 => '审核通过',
+    3 => '审核未通过',
 );
 
 $store = array();
 $servicer_id = Dever::input('search_option_servicer_id');
 if ($servicer_id) {
 	$store = function() use($servicer_id) {
-		return Dever::db('scm_servicer/store')->select(array('servicer_id' => $servicer_id));
+		return Dever::db('scm_servicer/store')->state(array('servicer_id' => $servicer_id));
 	};
 }
 
@@ -19,6 +26,10 @@ $supplier = function() use($servicer_id) {
 	return Dever::db('scm_servicer/supplier')->getData(array('servicer_id' => $servicer_id));
 };
 
+$servicer = function() {
+    return Dever::db('scm_servicer/info')->state();
+};
+
 return array
 (
     # 表名
@@ -30,6 +41,11 @@ return array
     (
     	'status' => $status,
     ),
+    'end' => array
+    (
+        'insert' => 'scm_product/lib/order.updateOrderNum?table=scm_servicer/in_order&prefix=C',
+        'update' => 'scm_product/lib/order.updateOrderNum?table=scm_servicer/in_order&prefix=C',
+    ),
 
     # 数据结构
     'struct' => array
@@ -54,15 +70,15 @@ return array
             'match'     => 'is_string',
             'search'    => 'fulltext',
             'list_name'	=> '订单信息',
-            //'list'      => 'Dever::load("scm_order/lib/sell.info#order", {id})',
+            'list'      => 'Dever::load("scm_servicer/lib/in.info", {id})',
         ),
 
         'servicer_id'      => array
         (
             'type'      => 'int-11',
-            'name'      => '配送商ID',
+            'name'      => '配送商',
             'default'   => '',
-            'desc'      => '配送商ID',
+            'desc'      => '配送商',
             'match'     => 'is_numeric',
             'update'    => 'hidden',
             'searchs'    => array
@@ -71,7 +87,10 @@ return array
                 'col' => 'name',
                 'result' => 'id',
             ),
+            'search'    => 'select',
+            'option'    => $servicer,
             'value'     => $servicer_id,
+            //'list'      => 'Dever::load("scm_servicer/info-one#name", {servicer_id})',
         ),
 
         'servicer_store_id'      => array
@@ -83,7 +102,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'select',
             'option'    => $store,
-            'list'		=> true,
+            //'list'      => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',
         ),
 
         'supplier_id'      => array
@@ -95,7 +114,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'select',
             'option'    => $supplier,
-            'list'		=> true,
+            'list'      => 'Dever::load("scm_supplier/info-one#name", {supplier_id})',
         ),
 
         'info'      => array
@@ -106,6 +125,53 @@ return array
             'desc'      => '订单备注',
             'match'     => 'option',
             'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'scm_servicer-in_order_goods'=> array
+		(
+			'name' 		=> '商品设置',
+			'default' 	=> '',
+			'desc' 		=> '商品设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'order_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            'list_name' => '商品信息',
+			'list'		=> 'Dever::load("scm_servicer/lib/manage.getGoods", {id})',
+		),
+
+        'audit'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '审核状态',
+            'default'   => '2',
+            'desc'      => '审核状态',
+            'match'     => 'is_numeric',
+            'option'    => $audit,
+            'update'    => 'radio',
+        ),
+
+        'audit_desc'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '审核备注',
+            'default'   => '',
+            'desc'      => '审核备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'audit_admin'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核人',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '审核人',
+            //'list'      => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
         ),
 
         'status'        => array
@@ -117,25 +183,12 @@ return array
             'match'     => 'is_numeric',
             'option'    => $status,
             'search'    => 'select',
+            'list'      => true,
             //'search_after' => '<br />',
             //'mul'   => true,
             //'mul_option' => array(2 => '批量审核', 5 => '确认收货'),
         ),
 
-        'scm_servicer-in_order_goods'=> array
-		(
-			'name' 		=> '商品设置',
-			'default' 	=> '',
-			'desc' 		=> '商品设置',
-			'match' 	=> 'option',
-			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
-			'sync'		=> array('id', 'order_id'),
-			'update'	=> array(1),
-			# 1纵向展示 2横向展示
-			'update_type' => 2,
-			//'list'		=> 'Dever::load("scm_servicer/lib/manage.getStore", {id})',
-		),
-
         'state'     => array
         (
             'type'      => 'tinyint-1',
@@ -173,16 +226,9 @@ return array
 
         'list_button' => array
         (
-            //fast_list
-            /*
-            'list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=&search_option_shop_type='.$search_option_shop_type.'"'),
-
-            'list11' => array('查看采购单', '"buy_order&project=shop&search_option_type=1&&search_option_parent_type=2&search_option_parent_order_id={id}&oper_table=sell_order&search_option_shop_type='.$search_option_shop_type.'"', '{status} >= 3 && {audit} == 2 && {shop_type} == 2'),
-
-            'list1' => array('审核', '"sell_order_goods&project=shop&order_id={id}&audit=1&page_type=&search_option_shop_type='.$search_option_shop_type.'"', '{status} == 2 && {shop_type} == 2'),
+            'list' => array('查看详情', '"in_order_goods&&order_id={id}"'),
 
-            'oper'  => array('确认收货', '"shop/lib/manage.setSellOrderStatus?shop_id={shop_id}&order_id={id}"', '{status} == 4 && {shop_type} == 2'),
-            */
+            'fast' => array('审核', '"in_order&where_id={id}&col=audit,audit_desc"', '{status} == 1'),
         ),
     ),
 

+ 3 - 3
module/scm_servicer/database/in_order_goods.php

@@ -17,8 +17,8 @@ return array
     'status' => $status,
     'end' => array
     (
-        'insert' => 'scm_servicer/lib/manage.updateGoods?table=in_order_goods',
-        'update' => 'scm_servicer/lib/manage.updateGoods?table=in_order_goods',
+        'insert' => 'scm_product/lib/order.updateGoods?table=scm_servicer/in_order_goods',
+        'update' => 'scm_product/lib/order.updateGoods?table=scm_servicer/in_order_goods',
     ),
     # 数据结构
     'struct' => array
@@ -53,7 +53,7 @@ return array
             'desc'      => '商品',
             'match'     => 'option',
             'update'    => 'select',
-            'update_search' => 'scm_product/lib/manage.searchProduct?{id}{supplier_id}',
+            'update_search' => 'scm_product/lib/manage.searchProduct?{supplier_id}',
         ),
 
         'goods_id'      => array

+ 11 - 0
module/scm_servicer/database/info.php

@@ -1,4 +1,15 @@
 <?php
+$category = function()
+{
+    $array = array();
+    $data = Dever::load('scm_product/category-getTop');
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+
 $category = function()
 {
 	$array = array();

+ 1 - 1
module/scm_servicer/database/supplier.php

@@ -109,7 +109,7 @@ return array
             ),
             'type' => 'all',
             'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
-            'col' => '*,t_2.name',
+            'col' => '*,t_2.name,t_2.id as id|id',
         ),
     ),
 );

+ 32 - 0
module/scm_servicer/lib/In.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace Scm_servicer\Lib;
+
+use Dever;
+
+class In
+{
+	# 获取订单信息
+    public function info($id)
+    {
+    	Dever::load('manage/auth.init');
+
+    	$info = Dever::db('scm_servicer/in_order')->find($id);
+
+    	$string = '';
+
+    	$string = $info['order_num'];
+
+    	$servicer = Dever::db('scm_servicer/info')->one($info['servicer_id']);
+
+    	$string .= '<br />' . $servicer['name'];
+
+    	$store = Dever::db('scm_servicer/store')->one($info['servicer_store_id']);
+
+    	$string .= '.' . $store['name'];
+
+    	$string .= '<br />' . $info['info'];
+
+    	return $string;
+    }
+}

+ 64 - 11
module/scm_servicer/lib/Manage.php

@@ -26,7 +26,7 @@ class Manage
             	if ($v['status'] == 2) {
             		$status_name = '(已禁用)';
             	}
-            	$oper = '<a class="layui-btn" href="'.Dever::url('lib/set.home?role=servicer/store&id=' . $v['id'], 'scm_product').'">商品列表</a>';
+            	$oper = '<a class="layui-btn" href="'.Dever::url('lib/set.home?role=servicer/store&id=' . $v['id'], 'scm_product').'">仓库明细</a>';
                 $table['body'][$k][] = $v['name'] . $status_name;
                 $table['body'][$k][] = $v['code'];
                 $table['body'][$k][] = $oper;
@@ -45,19 +45,72 @@ class Manage
         }
     }
 
+    public function getGoods($id)
+    {
+        $table = array();
+        $table['head'] = array('名称', '单价', '数量', '状态');
+        $table['body'] = array();
+
+        $data = Dever::db('scm_servicer/in_order_goods')->select(array('order_id' => $id));
+
+        if ($data) {
+            $status = Dever::db('scm_servicer/in_order_goods')->config['status'];
+            foreach ($data as $k => $v) {
+                $status_name = Dever::status($status, $v['status']);
+                $table['body'][$k][] = $v['goods'];
+                $table['body'][$k][] = $v['cash'];
+                $table['body'][$k][] = $v['num'];
+                $table['body'][$k][] = $status_name;
+            }
+        }
+        $body[''] = array
+        (
+            'type' => 'table',
+            'content' => $table,
+        );
+
+        if ($table['body']) {
+            return Dever::show('', $body);
+        } else {
+            return '暂无';
+        }
+    }
+
     public function updateGoods($id, $name, $data)
     {
     	$table = Dever::input('table');
-        $info = Dever::db('scm_servicer/in_order_goods')->find($id);
-        if ($info) {
-            print_r($info);die;
-            $temp = explode('-', $info['goods']);
-            $update['where_id'] = $id;
-            $update['goods_id'] = $temp[0];
-            $update['sku_id'] = $temp[1];
-            Dever::db('scm_servicer/' . $table)->update($update);
-
-            Dever::config('base')->hook = false;
+        $goods = Dever::param('goods', $data);
+        if ($goods) {
+            $info = Dever::db('scm_servicer/' . $table . '_goods')->find($id);
+            if ($info) {
+                $order = Dever::db('scm_servicer/' . $table)->find($info['order_id']);
+                $update['where_id'] = $info['order_id'];
+                $update['order_num'] = $this->getOrderId($table);
+                Dever::db('scm_servicer/' . $table)->update($update);
+
+                $temp = explode('-', $goods);
+                $update = array();
+                $update['where_id'] = $id;
+                $update['goods_id'] = $temp[0];
+                $update['sku_id'] = $temp[1];
+                $update['cash'] = $temp[2];
+                Dever::db('scm_servicer/' . $table . '_goods')->update($update);
+
+                Dever::config('base')->hook = false;
+            }
+        }
+    }
+
+    # 生成订单号
+    public function getOrderId($table)
+    {
+        $first = ucfirst(substr($table, 0, 1));
+        $where['order_num'] = Dever::order('C' . $first);
+        $state = Dever::db('scm_servicer/' . $table)->one($where);
+        if (!$state) {
+            return $where['order_num'];
+        } else {
+            return $this->getOrderId($table);
         }
     }
 }

+ 1 - 1
module/scm_supplier/database/goods.php

@@ -113,7 +113,7 @@ return array
             ),
             'type' => 'all',
             'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
-            'col' => '*,t_2.*',
+            'col' => '*,t_2.*,t_2.id as value, "" as selected, "" as disabled',
         ),
 
         'getData' => array

+ 27 - 0
module/scm_supplier/database/goods_sku.php

@@ -138,6 +138,33 @@ $config = array
     # request 请求接口定义
     'request' => array
     (
+        # 后台搜索用到,也可以不加,自动生成
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'supplier_id' => array('yes-t_1.supplier_id'),
+                'status' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'scm_product/info',
+                    'type' => 'left join',
+                    'on' => array('goods_id','id'),
+                    'col' => 'goods_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.*,t_2.id as value, "" as selected, "" as disabled',
+        ),
+
         'getDataPage' => array
         (
             # 匹配的正则或函数 选填项