Просмотр исходного кода

Merge branch 'zhongqi-discount' into dev

shizhongqi 4 месяцев назад
Родитель
Сommit
2e0c5deed5

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

@@ -471,7 +471,8 @@ class TestController extends BaseController
             //['name' => '宿州温馨鲜花批发', 'merchantNo' => '82237405992003T', 'wx' => [880834087, 880834521], 'zfb' => '2088480300332087'],
             //['name' => '宿州温馨鲜花批发', 'merchantNo' => '82237405992003T', 'wx' => [880834087, 880834521], 'zfb' => '2088480300332087'],
             //['name' => '济南万花田', 'merchantNo' => '8224510599200NN', 'wx' => [881205017, 881205264], 'zfb' => '2088480339301423'],
             //['name' => '济南万花田', 'merchantNo' => '8224510599200NN', 'wx' => [881205017, 881205264], 'zfb' => '2088480339301423'],
             //['name' => '济南万花田鲜花', 'merchantNo' => '8224510599200NP', 'wx' => [881375592, 881375991], 'zfb' => '2088480345092520'],
             //['name' => '济南万花田鲜花', 'merchantNo' => '8224510599200NP', 'wx' => [881375592, 881375991], 'zfb' => '2088480345092520'],
-            ['name' => '温州易批花', 'merchantNo' => '8223330599200E0', 'wx' => [882196314, 882196905], 'zfb' => '2088480379232415'],
+            //['name' => '温州易批花', 'merchantNo' => '8223330599200E0', 'wx' => [882196314, 882196905], 'zfb' => '2088480379232415'],
+            ['name' => '莆田我要花辉皇店', 'merchantNo' => '82239405992007T', 'wx' => [884613202, 884611698], 'zfb' => '2088480542516472'],
             //['name' => '藏花林', 'merchantNo' => '8227310599200ZC', 'wx' => [868558224, 868558410], 'zfb' => '2088380587657250'],
             //['name' => '藏花林', 'merchantNo' => '8227310599200ZC', 'wx' => [868558224, 868558410], 'zfb' => '2088380587657250'],
             //['name' => '昆明藏花林花卉', 'merchantNo' => '8227310599200ZN', 'wx' => [869670880, 869668881], 'zfb' => '2088380691198135'],
             //['name' => '昆明藏花林花卉', 'merchantNo' => '8227310599200ZN', 'wx' => [869670880, 869668881], 'zfb' => '2088380691198135'],
             //['name' => '昆明藏花林鲜花', 'merchantNo' => '8227310599200ZJ', 'wx' => [869361939, 869362520], 'zfb' => '2088380669365761'],
             //['name' => '昆明藏花林鲜花', 'merchantNo' => '8227310599200ZJ', 'wx' => [869361939, 869362520], 'zfb' => '2088380669365761'],

+ 5 - 5
app-hd/controllers/PurchaseController.php

@@ -738,7 +738,7 @@ class PurchaseController extends BaseController
                 if ($ghsShopId == 91115) {
                 if ($ghsShopId == 91115) {
                     if ($respond->actPrice < 100) {
                     if ($respond->actPrice < 100) {
                         $transaction->rollBack();
                         $transaction->rollBack();
-                        $hasMust = array_intersect($ids, [4449812]);
+                        $hasMust = array_intersect($ids, [4449812, 4449811]);
                         if (empty($hasMust)) {
                         if (empty($hasMust)) {
                             util::fail('不满100,必选商品 补运费10元');
                             util::fail('不满100,必选商品 补运费10元');
                         }
                         }
@@ -750,7 +750,7 @@ class PurchaseController extends BaseController
                 if ($ghsShopId == 91115) {
                 if ($ghsShopId == 91115) {
                     if ($respond->actPrice < 100) {
                     if ($respond->actPrice < 100) {
                         $transaction->rollBack();
                         $transaction->rollBack();
-                        $hasMust = array_intersect($ids, [4449812]);
+                        $hasMust = array_intersect($ids, [4449812, 4449811]);
                         if (empty($hasMust)) {
                         if (empty($hasMust)) {
                             util::fail('不满100,必选商品 补运费10元');
                             util::fail('不满100,必选商品 补运费10元');
                         }
                         }
@@ -758,13 +758,13 @@ class PurchaseController extends BaseController
                 }
                 }
             }
             }
             if ($sendType == 3) {
             if ($sendType == 3) {
-                //温州易批花,物流,不满200,要选20元的补运费商品
+                //温州易批花,物流,不满200,要选10元的补运费商品
                 if ($ghsShopId == 91115) {
                 if ($ghsShopId == 91115) {
                     if ($respond->actPrice < 200) {
                     if ($respond->actPrice < 200) {
                         $transaction->rollBack();
                         $transaction->rollBack();
-                        $hasMust = array_intersect($ids, [4449811]);
+                        $hasMust = array_intersect($ids, [4449812, 4449811]);
                         if (empty($hasMust)) {
                         if (empty($hasMust)) {
-                            util::fail('不满200,必选商品 补运费20元');
+                            util::fail('不满200,必选商品 补运费10元');
                         }
                         }
                     }
                     }
                 }
                 }

+ 5 - 9
app-hd/controllers/ShopController.php

@@ -149,10 +149,13 @@ class ShopController extends BaseController
         $data['sjId'] = $this->sjId;
         $data['sjId'] = $this->sjId;
         $id = isset($data['id']) ? $data['id'] : 0;
         $id = isset($data['id']) ? $data['id'] : 0;
         unset($data['id']);
         unset($data['id']);
+        $data['meetNum'] = isset($data['meetNum']) ? intval($data['meetNum']) : 0;
+        $data['meetAmount'] = isset($data['meetAmount']) ? floatval($data['meetAmount']) : 0;
+        $data['cutAmount'] = isset($data['cutAmount']) ? floatval($data['cutAmount']) : 0;
+
         $shop = ShopService::getById($id);
         $shop = ShopService::getById($id);
-        ShopService::valid($shop, $this->sjId);
+        ShopClass::valid($shop, $this->sjId);
         $data['img'] = isset($data['img']) && is_array($data['img']) ? json_encode($data['img']) : '';
         $data['img'] = isset($data['img']) && is_array($data['img']) ? json_encode($data['img']) : '';
-        $mobile = $data['mobile'];
         //手机号具有唯一性,暂时不允许修改 --- 同批发端 app-ghs/controllers/ShopController.php 保持一致
         //手机号具有唯一性,暂时不允许修改 --- 同批发端 app-ghs/controllers/ShopController.php 保持一致
         unset($data['mobile']);
         unset($data['mobile']);
 
 
@@ -161,13 +164,6 @@ class ShopController extends BaseController
         $transaction = $connection->beginTransaction();
         $transaction = $connection->beginTransaction();
         try {
         try {
             ShopClass::updateShop($shop, $data);
             ShopClass::updateShop($shop, $data);
-
-            // 找出附近批发店,之后自动给建立关系,然后补充二个店之间的距离(计算距离使用高德接口)
-            // if(isset($data['openLocation']) && $data['openLocation'] == 1){
-            //     $toLat = $data['lat'] ?? null;
-            //     $toLnt = $data['long'] ?? null;
-            //     \biz\ghs\classes\GhsClass::buildNearbyGhsRelations($id, $this->shop->pfShopId, $toLat, $toLnt);
-            // }
             $transaction->commit();
             $transaction->commit();
             util::complete();
             util::complete();
         } catch (\Exception $exception) {
         } catch (\Exception $exception) {

+ 1 - 0
app-mall/controllers/OrderController.php

@@ -466,6 +466,7 @@ class OrderController extends BaseController
                 }
                 }
             }
             }
 
 
+            $post['bigNum'] = $totalNum;
             $post['modifyPrice'] = $modifyPrice;
             $post['modifyPrice'] = $modifyPrice;
             //多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
             //多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
             $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
             $return = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);

+ 8 - 16
biz-ghs/order/classes/OrderClass.php

@@ -1945,7 +1945,7 @@ class OrderClass extends BaseClass
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         $orderMainId = $orderInfo['mainId'] ?? 0;
         $orderMainId = $orderInfo['mainId'] ?? 0;
         if (getenv('YII_ENV') == 'production') {
         if (getenv('YII_ENV') == 'production') {
-            $map = [65726, 58, 25119, 28500];
+            $map = [65726, 58, 25119, 28500, 1294,12925];
         } else {
         } else {
             $map = [828];
             $map = [828];
         }
         }
@@ -3004,7 +3004,7 @@ XL;
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         $orderMainId = $order->mainId;
         $orderMainId = $order->mainId;
         if (getenv('YII_ENV') == 'production') {
         if (getenv('YII_ENV') == 'production') {
-            $map = [65726, 58, 25119, 28500];
+            $map = [65726, 58, 25119, 28500, 1294,12925];
         } else {
         } else {
             $map = [828];
             $map = [828];
         }
         }
@@ -3018,8 +3018,7 @@ XL;
                 return false;
                 return false;
             }
             }
         }
         }
-        $shortName = $custom->shortName ?? '';
-
+        $shortName = $custom->shortName ?? '未命名';
         $shortName = stringUtil::subStringUtf8($shortName, 5);
         $shortName = stringUtil::subStringUtf8($shortName, 5);
         $customMobile = $order->customMobile ?? '';
         $customMobile = $order->customMobile ?? '';
         if (empty($customMobile)) {
         if (empty($customMobile)) {
@@ -3040,7 +3039,7 @@ XL;
         }
         }
         $distId = $custom->distId ?? '';
         $distId = $custom->distId ?? '';
         $dist = DistClass::getById($distId, true);
         $dist = DistClass::getById($distId, true);
-        $distName = $dist->name ?? '';
+        $distName = $dist->name ?? '未分区';
 
 
         $address = $order->address ?? '';
         $address = $order->address ?? '';
         $floor = $order->floor ?? '';
         $floor = $order->floor ?? '';
@@ -3062,9 +3061,6 @@ XL;
         $p = new printUtil($wlLabelSn);
         $p = new printUtil($wlLabelSn);
 
 
         if (!in_array($orderMainId, $map)) {
         if (!in_array($orderMainId, $map)) {
-            if (empty($shortName)) {
-                util::fail('客户短名没有设置');
-            }
             $p->times = 1;
             $p->times = 1;
             //安庆三叶鲜花批发,比较特殊
             //安庆三叶鲜花批发,比较特殊
             if ($orderMainId == 2071) {
             if ($orderMainId == 2071) {
@@ -3101,14 +3097,10 @@ XL;
             $itemNum = floatval($itemNum);
             $itemNum = floatval($itemNum);
             $payTime = $order->payTime ?? '';
             $payTime = $order->payTime ?? '';
             $payDate = date('m-d H:i', strtotime($payTime));
             $payDate = date('m-d H:i', strtotime($payTime));
-            $content = '<TEXT x="400" y="30" font="12" w="4" h="4" r="90">' . $shortName . '</TEXT>';
-            $content .= '<TEXT x="290" y="30" font="12" w="2" h="3" r="90">' . $customName . '</TEXT>';
-            $content .= '<TEXT x="195" y="30" font="12" w="1" h="2" r="90">' . $fullAddress . '</TEXT>';
-            $content .= '<TEXT x="128" y="30" font="12" w="2" h="2" r="90">' . $customMobile . ' ' . $itemNum . '扎</TEXT>';
-            //福州易批花,温州易批花,不仅要自动打印,还要打印出物流名称
-            if ($orderMainId == 25119 || $orderMainId == 28500) {
-                $content .= '<TEXT x="70" y="30" font="12" w="2" h="2" r="90">片区 ' . $distName . ' ' . $payDate . '</TEXT>';
-            }
+            $content = '<TEXT x="400" y="30" font="12" w="3" h="3" r="90">' . $customName . '</TEXT>';
+            $content .= '<TEXT x="280" y="30" font="12" w="2" h="2" r="90">' . $fullAddress . '</TEXT>';
+            $content .= '<TEXT x="180" y="30" font="12" w="2" h="2" r="90">' . $customMobile . '  ' . $itemNum . '扎</TEXT>';
+            $content .= '<TEXT x="86" y="30" font="12" w="2" h="2" r="90">' . $distName . ' ' . $payDate . '</TEXT>';
             /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
             /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         }
         }
         $p->printLabelMsg($content);
         $p->printLabelMsg($content);

+ 30 - 0
biz-hd/order/classes/OrderClass.php

@@ -273,6 +273,36 @@ class OrderClass extends BaseClass
         }
         }
         $data['reachTime'] = strtotime($data['reachDate'] . ' ' . $data['reachPeriod']);
         $data['reachTime'] = strtotime($data['reachDate'] . ' ' . $data['reachPeriod']);
 
 
+        // 客户自己下单才有整单满减
+        if (isset($data['fromType']) && $data['fromType'] == dict::getDict('fromType', 'mall')) {
+            $book = $data['book'] ?? 0;
+            if ($book == 0) {
+                $actPrice = $data['actPrice'];
+                $meetNum = $shop->meetNum ?? 0;
+                $meetAmount = $shop->meetAmount ?? 0;
+                $cutOption = $shop->cutAmount ?? 0;
+                $cutStyle = $shop->cutStyle ?? 0;
+
+                if ($cutStyle == 0) {
+                    $cutAmount = $cutOption;
+                } else {
+                    $miniOption = bcsub(1, $cutOption, 2);
+                    $cutAmount = bcmul($actPrice, $miniOption, 2);
+                }
+                if ($cutAmount > 0 && $meetNum > 0 && $meetAmount > 0) {
+                    if (isset($data['bigNum']) && $data['bigNum'] >= $meetNum && $data['actPrice'] >= $meetAmount) {
+                        if ($cutAmount < $actPrice) {
+                            $actPrice = bcsub($actPrice, $cutAmount, 2);
+                            $data['orderReachDiscountPrice'] = $cutAmount;
+                            $data['actPrice'] = $actPrice;
+                        } else {
+                            noticeUtil::push('订单金额不足满减金额,customId:' . $data['customId'], '15280215347');
+                        }
+                    }
+                }
+            }
+        }
+
         //将花店每月的总订单数作为编号
         //将花店每月的总订单数作为编号
         $riseNum = StatOrderCountClass::addOrder($shop, $main);
         $riseNum = StatOrderCountClass::addOrder($shop, $main);
         $data['sendNum'] = date("j") . $riseNum;
         $data['sendNum'] = date("j") . $riseNum;