소스 검색

商户修改选品价格

xialei 1 년 전
부모
커밋
7f0ae4b344
2개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 3
      app/common/repositories/store/product/ProductRepository.php
  2. 4 4
      app/controller/merchant/gong/Goods.php

+ 5 - 3
app/common/repositories/store/product/ProductRepository.php

@@ -1944,16 +1944,18 @@ class ProductRepository extends BaseRepository
1944
                 ->where('product_id', $product_id)
1944
                 ->where('product_id', $product_id)
1945
                 ->select()->toArray();
1945
                 ->select()->toArray();
1946
             $attrInfo = array_column($attrInfo, null, 'gong_sku_id');
1946
             $attrInfo = array_column($attrInfo, null, 'gong_sku_id');
1947
-            $updateData = [];
1947
+            $updateData = [];   
1948
             // 组装数据
1948
             // 组装数据
1949
             foreach ($skuArr as $key => $value) {
1949
             foreach ($skuArr as $key => $value) {
1950
                 if (isset($attrInfo[$value['sku_id']])) {
1950
                 if (isset($attrInfo[$value['sku_id']])) {
1951
+
1951
                     if ($value['edit_price'] > $attrInfo[$value['sku_id']]['gong_market_price']) {
1952
                     if ($value['edit_price'] > $attrInfo[$value['sku_id']]['gong_market_price']) {
1952
                         // 上调价格计算创客利润
1953
                         // 上调价格计算创客利润
1953
                         $diff = bcsub($value['edit_price'], $attrInfo[$value['sku_id']]['gong_market_price'], 2);
1954
                         $diff = bcsub($value['edit_price'], $attrInfo[$value['sku_id']]['gong_market_price'], 2);
1954
-                        $diff_profit = bcmul($diff, 0.7, 2);
1955
+                        // $diff_profit = bcmul($diff, 0.7, 2);
1956
+                        $diff_profit = $diff;
1955
                         $plate_mer_profit = bcadd($attrInfo[$value['sku_id']]['gong_mer_profit'], $diff_profit, 2);
1957
                         $plate_mer_profit = bcadd($attrInfo[$value['sku_id']]['gong_mer_profit'], $diff_profit, 2);
1956
-                    } else {
1958
+                    } else {    
1957
                         // 下调价格计算创客利润
1959
                         // 下调价格计算创客利润
1958
                         $diff = bcsub($attrInfo[$value['sku_id']]['gong_market_price'], $value['edit_price'], 2);
1960
                         $diff = bcsub($attrInfo[$value['sku_id']]['gong_market_price'], $value['edit_price'], 2);
1959
                         $plate_mer_profit = bcsub($attrInfo[$value['sku_id']]['gong_mer_profit'], $diff, 2);
1961
                         $plate_mer_profit = bcsub($attrInfo[$value['sku_id']]['gong_mer_profit'], $diff, 2);

+ 4 - 4
app/controller/merchant/gong/Goods.php

@@ -320,10 +320,10 @@ class Goods extends BaseController
320
                     'cost_price'=>$v['cost_price'],
320
                     'cost_price'=>$v['cost_price'],
321
                     'extension_one'=>5,
321
                     'extension_one'=>5,
322
                     'gong_sku_id'=>$v['sku_id'],
322
                     'gong_sku_id'=>$v['sku_id'],
323
-                    'gong_mer_profit' => $v['profit'],
323
+                    'gong_mer_profit' => $v['mer_profit'],
324
                     'gong_pension' => $v['yanglaojin'],
324
                     'gong_pension' => $v['yanglaojin'],
325
                     'gong_market_price' => $v['market_price'],
325
                     'gong_market_price' => $v['market_price'],
326
-                    'plate_mer_profit' => $v['profit']
326
+                    'plate_mer_profit' => $v['mer_profit']
327
                 ]);
327
                 ]);
328
                 $key='';
328
                 $key='';
329
                 $num++;
329
                 $num++;
@@ -357,10 +357,10 @@ class Goods extends BaseController
357
                     'cost_price'=>$v['cost_price'],
357
                     'cost_price'=>$v['cost_price'],
358
                     'extension_one'=>5,
358
                     'extension_one'=>5,
359
                     'gong_sku_id'=>$v['sku_id'],
359
                     'gong_sku_id'=>$v['sku_id'],
360
-                    'gong_mer_profit' => $v['profit'],
360
+                    'gong_mer_profit' => $v['mer_profit'],
361
                     'gong_pension' => $v['yanglaojin'],
361
                     'gong_pension' => $v['yanglaojin'],
362
                     'gong_market_price' => $v['market_price'],
362
                     'gong_market_price' => $v['market_price'],
363
-                    'plate_mer_profit' => $v['profit']
363
+                    'plate_mer_profit' => $v['mer_profit']
364
                 ]);
364
                 ]);
365
                 $key='';
365
                 $key='';
366
                 $num++;
366
                 $num++;