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

Merge branch 'master' of git.huaml.com:zhh/huahuibao

shizhongqi пре 4 година
родитељ
комит
e5a534285e

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

@@ -355,8 +355,8 @@ class OrderController extends BaseController
         $post['shopAdminId'] = $this->shopAdminId ?? 0;
         $post['shopAdminName'] = $this->shopAdmin->name ?? '';
         $groupId = isset($post['groupId']) && !empty($post['groupId']) ? $post['groupId'] : 0;
-        //门店
-        $post['fromType'] = 1;
+        //1 门店(收银台开单)
+        $post['fromType'] = $post['fromType'] ?? 1;
         //客户
         $customId = isset($post['customId']) && $post['customId'] > 0 ? $post['customId'] : 0;
         if (empty($customId)) {
@@ -382,19 +382,15 @@ class OrderController extends BaseController
         $hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay');
 
         $productJson = $post['product'] ?? '';
-        if (empty($productJson) && empty($groupId)) {
-            if (isset($post['lsGoodsPrice']) == false || $post['lsGoodsPrice'] <= 0) {
-                util::fail('请填写金额或选商品');
-            }
+        $productList = [];
+        if (!empty($productJson)) {
+            $productList = json_decode($productJson, true);
         }
-        $productList = json_decode($productJson, true);
         if (empty($productList) && empty($groupId)) {
             //商家上传图片开单并要求生成制作单
             if (isset($post['unitGoodsPrice']) && !empty($post['unitGoodsPrice'])) {
                 $productList = GoodsClass::kdWorkGoods($post);
-                print_r($productList);
             }
-            echo 'aaa';die;
         }
 
         if (empty($productList) && empty($groupId)) {

+ 14 - 0
app-hd/controllers/WorkController.php

@@ -4,6 +4,7 @@ namespace hd\controllers;
 
 use bizHd\goods\classes\CategoryClass;
 use bizHd\goods\classes\GoodsClass;
+use bizHd\order\classes\OrderClass;
 use bizHd\work\classes\WorkClass;
 use bizHd\work\classes\WorkItemClass;
 use common\components\dict;
@@ -17,6 +18,19 @@ class WorkController extends BaseController
 
     public $guestAccess = [];
 
+    //根据订单id查询制作单信息 ssh 20220625
+    public function actionGetInfoByOrderId()
+    {
+        $orderId = Yii::$app->request->get('orderId', 0);
+        $order = OrderClass::getById($orderId, true);
+        OrderClass::valid($order, $this->mainId);
+        $info = WorkClass::getByCondition(['orderId' => $orderId], true);
+        if (empty($info)) {
+            util::fail('没有找到');
+        }
+        util::success(['info' => $info]);
+    }
+
     //打印制作单 ssh 20220601
     public function actionPrint()
     {

+ 2 - 0
biz-hd/goods/classes/GoodsClass.php

@@ -590,6 +590,7 @@ class GoodsClass extends BaseClass
             $orderId = $params['orderId'] ?? 0;
             $shopId = $params['shopId'] ?? 0;
             $orderPrice = $params['orderPrice'] ?? 0;
+            $fromType = $params['fromType'] ?? 1;
             $hasReachTime = 0;
             $reachPeriod = 0;
             $reachDate = '0000-00-00';
@@ -624,6 +625,7 @@ class GoodsClass extends BaseClass
                 'staffId' => $staffId,
                 'bookName' => $bookName,
                 'orderPrice' => $orderPrice,
+                'fromType' => $fromType,
             ];
             $main = MainClass::getById($mainId, true);
             if (empty($main)) {

+ 2 - 0
biz-hd/work/classes/WorkClass.php

@@ -100,6 +100,7 @@ class WorkClass extends BaseClass
         $staffName = $data['staffName'] ?? '';
         $staffId = $data['staffId'] ?? 0;
         $orderPrice = $data['orderPrice'] ?? 0;
+        $fromType = $data['fromType'] ?? 1;
 
         $ids = array_column($goods, 'productId');
         $info = GoodsClass::getByIds($ids, null, 'id');
@@ -160,6 +161,7 @@ class WorkClass extends BaseClass
                 'staffName' => $staffName,
                 'staffId' => $staffId,
                 'orderPrice' => $orderPrice,
+                'fromType' => $fromType,
             ];
             self::createFinish($current, $main);
         }

+ 3 - 1
biz-mall/order/classes/OrderGoodsClass.php

@@ -30,7 +30,9 @@ class OrderGoodsClass extends BaseClass
                 $goodsId = $goods->goodsId ?? 0;
                 $num = $goods->num ?? 0;
                 $orderPrice = $order->orderPrice ?? 0;
-                $params = ['orderId' => $orderId, 'orderSn' => $orderSn, 'shopId' => $shopId, 'orderPrice' => $orderPrice];
+                $fromType = $order->fromType ?? 1;
+                $params = ['orderId' => $orderId, 'orderSn' => $orderSn, 'shopId' => $shopId,
+                    'fromType' => $fromType, 'orderPrice' => $orderPrice];
                 $flower = $goods->flower ?? 0;
                 //鲜花类不需要验证库存,库存可以负数,并相应生成制作单
                 $checkStock = $flower == 0 ? true : false;

+ 2 - 2
common/components/dict.php

@@ -317,14 +317,14 @@ class dict
         'fromType' => [
             'shop' => 1,//门店
             'mall' => 2,//商城
-            'friend' => 3,//朋友圈
+            'friend' => 3,//微信
             'mt' => 4,//美团
             'elm' => 5,//饿了么
         ],
         'fromTypeMap' => [
             1 => '门店',
             2 => '商城',
-            3 => '朋友圈',
+            3 => '微信',
             4 => '美团',
             5 => '饿了么',
         ],