Sfoglia il codice sorgente

Merge branch 'master' into zhongqi-memberLevel

shish 5 mesi fa
parent
commit
6f85795f36

+ 6 - 0
app-ghs/controllers/CheckOrderController.php

@@ -384,6 +384,12 @@ class CheckOrderController extends BaseController
                     $could = true;
                 }
             }
+            //花语鲜花批发
+            if($mainId == 85727){
+                if (in_array($this->adminId, [82699])) {
+                    $could = true;
+                }
+            }
         } else {
             $could = $staff->mobile == '17187822038' ? true : false;
             if ($mainId == 812) {

+ 1 - 1
app-ghs/controllers/ConsoleController.php

@@ -168,7 +168,7 @@ class ConsoleController extends BaseController
             }
         }
 
-        //$notice[] = ['title' => '节日期间急事找不到人连打二次 15280215347', 'action' => '', 'page' => ''];
+        //$notice[] = ['title' => '后台给客户开单,已支持花材满减', 'action' => '', 'page' => ''];
         //$notice[] = ['title' => '新功能:客户端和后台使用跑腿的流程', 'action' => '', 'page' => '/admin/book/detail?id=use_pt'];
         //$notice[] = ['title' => '快速设置:客户下单自动计算跑腿费', 'action' => '查看', 'page' => '/admin/book/detail?id=auto_calc_pt_fee'];
         //$notice[] = ['title' => '订单上如何一键呼叫跑腿', 'action' => '查看', 'page' => '/admin/book/detail?id=one_call_pt'];

+ 22 - 1
app-ghs/controllers/OrderController.php

@@ -1239,7 +1239,7 @@ class OrderController extends BaseController
         $addPriceMap['risePercent'] = $custom['risePercent'] ?? 0;
 
         $level = $custom['level'] ?? 1;
-        foreach ($productList as $currentProduct) {
+        foreach ($productList as $ptKey => $currentProduct) {
             $currentPrice = $currentProduct['price'] ?? 0;
             $currentId = $currentProduct['productId'] ?? 0;
             $systemInfo = $itemInfo[$currentId] ?? [];
@@ -1261,12 +1261,33 @@ class OrderController extends BaseController
                 }
             }
 
+            //后端开单,涉及花材满减,关键词 back_order_reach_discount_price
+            $post['reachDiscountPrice'] = 0;
+
             if (floatval($currentPrice) != floatval($systemPrice)) {
                 $diff[] = [
                     'name' => $name,
                     'price' => $systemPrice,
                     'kdPrice' => $currentPrice,
                 ];
+            } else {
+                //后端开单,如果没有改价格,并且数量达到花材满减要求,则自动给减价格,关键词 back_order_reach_discount_price
+                $bigNum = $currentProduct['bigNum'] ?? 0;
+                $reachNum = $systemInfo['reachNum'] ?? 0;
+                if ($reachNum > 0 && $bigNum >= $reachNum) {
+                    $reachNumDiscount = $systemInfo['reachNumDiscount'] ?? 0;
+                    $unitPrice = $currentProduct['price'] ?? 0;
+                    if ($unitPrice > $reachNumDiscount) {
+                        $newUnitPrice = bcsub($unitPrice, $reachNumDiscount, 2);
+                        $calcPrice = bcmul($reachNumDiscount, $bigNum, 2);
+                        if ($calcPrice > 0 && isset($post['modifyPrice']) && $post['modifyPrice'] > $calcPrice) {
+                            $productList[$ptKey]['price'] = $newUnitPrice;
+                            //提交给后端的总金额也要减掉,否则会有问题
+                            $post['modifyPrice'] = bcsub($post['modifyPrice'], $calcPrice, 2);
+                            $post['reachDiscountPrice'] = bcadd($post['reachDiscountPrice'], $calcPrice, 2);
+                        }
+                    }
+                }
             }
         }
         //解决开单提交订单时,别人修改价格,造成提交价格不是真实卖价问题!!

+ 2 - 1
app-ghs/controllers/TestController.php

@@ -458,7 +458,8 @@ class TestController extends BaseController
             //['name' => '昆明小向花卉批发', 'merchantNo' => '8227310599200Z2', 'wx' => [857900016, 857899180], 'zfb' => '2088280559651366'],
             //['name' => '昆明小玖花卉批发', 'merchantNo' => '8227310599200Z3', 'wx' => [858815386, 858815193], 'zfb' => '2088280613495934'],
             //['name' => '广州勇记鲜花', 'merchantNo' => '8225810599201NY', 'wx' => [865933677, 865933966], 'zfb' => '2088380356697908'],
-            ['name' => '永城花语鲜花批发', 'merchantNo' => '82250605992008U', 'wx' => [866677786, 866678419], 'zfb' => '2088380428301720'],
+            //['name' => '永城花语鲜花批发', 'merchantNo' => '82250605992008U', 'wx' => [866677786, 866678419], 'zfb' => '2088380428301720'],
+            ['name' => '昆明藏花林', 'merchantNo' => '8227310599200ZC', 'wx' => [868558224, 868558410], 'zfb' => '2088380587657250'],
             //['name' => '厦门都市鲜花批发', 'merchantNo' => '8223930599200HZ', 'wx' => [854245016, 854244735], 'zfb' => '2088280333454097'],
             //['name' => '深圳鼎盛皇室花卉', 'merchantNo' => '8225840599201MF', 'wx' => [807078304, 807076486], 'zfb' => '2088970117746334'],
             //['name' => '东莞惠雅鲜花(莞城店)', 'merchantNo' => '8226020599200GJ', 'wx' => [796953190, 796976959], 'zfb' => '2088770940104912'],

+ 3 - 0
biz-ghs/order/services/OrderService.php

@@ -223,6 +223,8 @@ class OrderService extends BaseService
         $remark = $data['remark'] ?? '';
         $xj = $data['xj'] ?? '';
         $book = $data['book'] ?? 0;
+		//后端开单,涉及花材满减,关键词 back_order_reach_discount_price
+        $reachDiscountPrice = $data['reachDiscountPrice'] ?? 0;
         $wlName = $data['wlName'] ?? '';
         $cgMainId = $ghs['ownMainId'] ?? 0;
         $purchaseData = [
@@ -255,6 +257,7 @@ class OrderService extends BaseService
             'wlName' => $wlName,
             'localOrder' => $localOrder,
             'transType' => $transType,
+            'reachDiscountPrice' => $reachDiscountPrice,
         ];
         if (isset($data['deadline']) && !empty($data['deadline'])) {
             $purchaseData['deadline'] = $data['deadline'];