Преглед изворни кода

商品列表、商品详情:pv值取值商品规格表字段

family пре 1 година
родитељ
комит
1dce7c850f

+ 11 - 8
app/common/repositories/store/product/ProductRepository.php

@@ -1704,12 +1704,14 @@ class ProductRepository extends BaseRepository
1704 1704
                 ];
1705 1705
 
1706 1706
             }else if($product['mer_id'] == 439){
1707
+                $productSku = Db::name('store_product_attr_value')->where('product_id', $good_id)->order('price asc')->find();
1707 1708
                 //精彩生活和商贸区
1708 1709
                 $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1709 1710
                 $jd = $product['price'] - round($product['concession_pri']*0.35, 2) . ' + ' . round($product['concession_pri']*0.35, 2);
1710 1711
                 if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1711 1712
                     $yanglao = round($product['concession_pri'] * 0.3, 2);
1712
-                    $pv = round($product['concession_pri'] * 0.35, 2);
1713
+//                    $pv = round($product['concession_pri'] * 0.35, 2);
1714
+                    $pv = $productSku['plate_mer_profit']??0.00;
1713 1715
                     $srtArry['jfduihuan'] =$jf;
1714 1716
                     $srtArry['jdduihuan'] = $jd;
1715 1717
                     $jifen = round($product['concession_pri'] * 0.35, 2);
@@ -1749,8 +1751,11 @@ class ProductRepository extends BaseRepository
1749 1751
 
1750 1752
                 }
1751 1753
             }else if($product['mer_id'] == 491){
1752
-                $num_yl = $product['price'];
1753
-                $pv= $num_yl * 0.3;
1754
+//                $num_yl = $product['price'];
1755
+//                $pv= $num_yl * 0.3;
1756
+                // 获取商品sku
1757
+                $productSku = Db::name('store_product_attr_value')->where('product_id', $good_id)->order('price asc')->find();
1758
+                $pv = $productSku['plate_mer_profit']??0.00;
1754 1759
                 $yanglao = round($pv * 0.5, 2);
1755 1760
                 //$v['vr']=$v['price'];
1756 1761
                 //1:为会员专区,
@@ -1769,12 +1774,14 @@ class ProductRepository extends BaseRepository
1769 1774
                 $merchantInfo = $merchant->get($product['mer_id']);
1770 1775
                 // 1企业2个体3个人
1771 1776
                 if ($merchantInfo && in_array($merchantInfo['type'],[2,3])) {
1777
+                    $productSku = Db::name('store_product_attr_value')->where('product_id', $good_id)->order('price asc')->find();
1772 1778
                     //商贸区
1773 1779
                     $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1774 1780
                     $jd = $product['price'] - round($product['concession_pri']*0.35, 2) . ' + ' . round($product['concession_pri']*0.35, 2);
1775 1781
                     if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1776 1782
                         $yanglao = round($product['concession_pri'] * 0.3, 2);
1777
-                        $pv = round($product['concession_pri'] * 0.35, 2);
1783
+//                        $pv = round($product['concession_pri'] * 0.35, 2);
1784
+                        $pv = $productSku['plate_mer_profit']??0.00;
1778 1785
                         $srtArry['jfduihuan'] =$jf;
1779 1786
                         $srtArry['jdduihuan'] = $jd;
1780 1787
                         $jifen = round($product['concession_pri'] * 0.35, 2);
@@ -1801,10 +1808,6 @@ class ProductRepository extends BaseRepository
1801 1808
                     }
1802 1809
                 }
1803 1810
             }
1804
-
1805
-
1806
-
1807
-
1808 1811
         }else{//线下商品
1809 1812
 
1810 1813
             if ($mer_id>0){

+ 10 - 3
app/common/repositories/system/merchant/MerchantRepository.php

@@ -468,20 +468,27 @@ class MerchantRepository extends BaseRepository
468 468
                 ];
469 469
 
470 470
             }else if($merId == 439 || $is_commercetrade){
471
+                // 获取商品sku
472
+                $productSku = Db::name('store_product_attr_value')->where('product_id', $v['product_id'])->order('price asc')->find();
471 473
                 //精彩生活和商贸区
472 474
                 $jf = $v['price'] - round($v['concession_pri']*0.3, 2) . ' + ' . round($v['concession_pri']*0.3, 2);
473 475
                 $jd = $v['price'] - round($v['concession_pri']*0.35, 2) . ' + ' . round($v['concession_pri']*0.35, 2);
474 476
                 if($v['concession_pri'] !=null || $v['concession_pri'] !=0){
475 477
                     $v['yanglao'] = round($v['concession_pri'] * 0.3, 2);
476
-                    $v['pv'] = round($v['concession_pri'] * 0.35, 2);
478
+//                    $v['pv'] = round($v['concession_pri'] * 0.35, 2);
479
+                    $v['pv'] = $productSku['plate_mer_profit']??0.00;
477 480
                     $v['jfduihuan'] =$jf;
478 481
                     $v['jdduihuan'] = $jd;
479 482
                     $v['jifen'] = round($v['concession_pri'] * 0.35, 2);
480 483
                     $v['gongxian'] = round($v['concession_pri'] * 0.35, 2);
481 484
                 }
482 485
             }else if($merId == 491){
483
-                $num_yl = $v['price'];
484
-                $pv= $num_yl * 0.3;
486
+                // 获取商品sku
487
+                $productSku = Db::name('store_product_attr_value')->where('product_id', $v['product_id'])->order('price asc')->find();
488
+                $pv = $productSku['plate_mer_profit']??0.00;
489
+
490
+//                $num_yl = $v['price'];
491
+//                $pv= $num_yl * 0.3;
485 492
                 $yanglao = round($pv * 0.5, 2);
486 493
                 $v['pv'] = $pv;
487 494
                 $v['yanglao'] = $yanglao;