rabin 1 år sedan
förälder
incheckning
f0ccc9b22b

+ 7 - 4
src/yuan/goods/database/info.php

@@ -165,7 +165,7 @@ $config = array
 			'option'	=> $type,
 			'search'	=> 'select',
 			'list'		=> true,
-			'tab'		=> 1,
+			'tab'		=> 3,
 			'control'	=> 'type',
 		),
 
@@ -180,10 +180,10 @@ $config = array
 			'update'	=> array(1),
 			# 1纵向展示 2横向展示
 			'update_type' => 2,
-			'update_show' => '显示',
+			'update_show' => array('goods/info_sku-one#price' => 'show_price', 'goods/info_sku-one#buy_price' => 'show_buy_price', 'num' => 'show_num'),
             //'list_name' => '商品信息',
 			//'list'		=> 'Dever::load("servicer/lib/manage.getGoods", {id})',
-			'tab'		=> 1,
+			'tab'		=> 3,
 			'show'      => 'type=11,12',
 		),
 
@@ -330,13 +330,14 @@ $config = array
 
 		'goods/info_spec'=> array
 		(
-			'name' 		=> '规格设置-此处所有价格均为基本单位价格,成本价为平台进货成本价格,采购价为经销商采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格',
+			'name' 		=> '规格设置-此处所有价格均为基本单位价格,成本价为平台进货成本价格,采购价为经销商采购商品价格,销售价为用户购买价格,划线价为用户购买价的划线价格,如是套餐或者组合商品,这里未填写则价格使用商品配置中总计价格',
 			'default' 	=> '',
 			'desc' 		=> '规格设置',
 			'match' 	=> 'option',
 			'sync'		=> array('info_id' => 'id'),
 			'update'	=> 'sku',
 			'tab'		=> 3,
+			//'show'		=> 'type=1',
 		),
 
 		'spec_type'		=> array
@@ -494,6 +495,8 @@ $config = array
 		# 定义sku对应的表
 		'sku' => array
 		(
+			# 显示规格类型选项,1是显示所有,2是只显示单规格,3是只显示多规格
+			'show' => 1,
 			# 定义表名
 			'spec' => 'info_spec', 
 			'sku' => 'info_sku',

+ 7 - 7
src/yuan/goods/database/info_goods.php

@@ -53,6 +53,7 @@ return array
             'update'    => 'select',
             'update_search' => 'goods/lib/manage.searchProduct',
             'update_search_value'     => '"{goods_id},{sku_id}"',
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showGroupInfo', 'goods'), 'col' => 'goods_id,sku_id')),
         ),
 
         'sku_id'      => array
@@ -67,23 +68,21 @@ return array
 
         'goods/info_sku-one#price'        => array
         (
-            'type'      => 'int-11',
             'name'      => '销售价',
-            'default'   => '1',
+            'default'   => '',
             'desc'      => '销售价',
-            'match'     => 'is_numeric',
-            'sync'      => array('id' => 'sku_id'),
+            'match'     => 'option',
+            'sync'      => array('id' => 'sku_id', 'info_id' => 'goods_id'),
             'update'    => 'show',
         ),
 
         'goods/info_sku-one#buy_price'        => array
         (
-            'type'      => 'int-11',
             'name'      => '采购价',
-            'default'   => '1',
+            'default'   => '',
             'desc'      => '采购价',
             'match'     => 'is_numeric',
-            'sync'      => array('id' => 'sku_id'),
+            'sync'      => array('id' => 'sku_id', 'info_id' => 'goods_id'),
             'update'    => 'show',
         ),
 
@@ -96,6 +95,7 @@ return array
             'match'     => 'is_numeric',
             'search'    => 'select',
             'update'	=> 'text',
+            'bind'        => array('onkeyup', 'total', array('url' => Dever::url('lib/manage.showTotal', 'goods'), 'col' => 'goods--info_sku-one_price,goods--info_sku-one_buy_price,num')),
         ),
 
         'type'        => array

+ 30 - 0
src/yuan/goods/lib/Manage.php

@@ -308,4 +308,34 @@ class Manage
         
         return array('data' => $data, 'html' => '', 'remove' => $remove);
     }
+
+    # 展示总计
+    public function showTotal_api()
+    {
+        $num = Dever::input('value');
+        $col = Dever::input('col');
+        $price = Dever::input('goods--info_sku-one_price');
+        $buy_price = Dever::input('goods--info_sku-one_buy_price');
+        
+        if ($price && $buy_price) {
+            return array('show_price' => $price * $num, 'show_buy_price' => $buy_price * $num, 'show_num' => (float)$num);
+        }
+    }
+
+    # 显示组合商品或者套餐商品的销售价和采购价
+    public function showGroupInfo_api()
+    {
+        $goods = Dever::input('value');
+        list($goods_id, $sku_id) = explode('-', $goods);
+        $goods_info = Dever::load('goods/lib/info')->getBaseInfo($goods_id, $sku_id);
+        $option = array();
+        $result = array();
+        if ($goods_info) {
+            $result['goods--info_sku-one_price'] = $goods_info['price'];
+            $result['goods--info_sku-one_buy_price'] = $goods_info['buy_price'];
+            $result['num'] = 'onload';
+        }
+        
+        return array('data' => $result, 'html' => '', 'option' => $option);
+    }
 }

+ 7 - 6
src/yuan/goods/src/Seller.php

@@ -39,20 +39,21 @@ class Seller
 
     public function browser()
     {
+        //https://puppeteer.bootcss.com/
         Dever::apply('vendor/autoload', 'browser');
         $puppeteer = new \Nesk\Puphpeteer\Puppeteer();
-        echo 11;die;
         $browser = $puppeteer->launch([
             'args' => ['--no-sandbox', '--disable-setuid-sandbox'],
-            'headless' => false
+            'executablePath' => '/usr/bin/chromium-browser',
+            //'headless' => false,
         ]);
 
         $page = $browser->newPage();
-        $page->goto('https://example.com/');
-        var_dump($page->content()); // Prints the HTML
+        $page->goto('http://daili.uat.churenyiliao.com/');
+        print_r($page->content()); // Prints the HTML
+        //18612165722
 
-        return 'ok';
-        $page->screenshot(['path' => Dever::data() . 'example.png']);
+        //$page->screenshot(['path' => Dever::data() . 'example.png']);
 
         $browser->close();
     }