shish 5 lat temu
rodzic
commit
a7787a1614

+ 44 - 33
biz-ghs/order/classes/OrderClass.php

@@ -405,47 +405,58 @@ class OrderClass extends BaseClass
             $list[$key]['customAvatarUrl'] = imgUtil::groupImg($val['customAvatar']);
             $list[$key]['customName'] = isset($val['customId']) && !empty($val['customId']) ? $val['customName'] : '散客';
 
-            $printProduct = [];
-            if (isset($showItem['list']) && !empty($showItem['list'])) {
-                foreach ($showItem['list'] as $itemKey => $itemVal) {
-                    $bigNum = $itemVal['bigNum'] ?? 0;
-                    $smallNum = $itemVal['smallNum'] ?? 0;
-                    $printProduct[] = [
-                        'name' => $itemVal['name'] ?? '',
-                        'num' => $bigNum . '/' . $smallNum,
-                        'price' => $itemVal['price'] ?? '0.00'
-                    ];
-                }
-            }
-
-            $sendNum = $val['sendNum'] ?? '';
             $customId = $val['customId'] ?? '';
             $debtAmount = $customInfoList[$customId]['debtAmount'] ?? 0.00;
-            $printData = [
-                'address' => '集美区乐海路186-4',
-                'sendCost' => $val['sendCost'] ?? '0.00',
-                'prePrice' => $val['prePrice'] ?? '0.00',
-                'discountAmount' => $val['discountAmount'] ?? '0.00',
-                'realPrice' => $val['realPrice'] ?? '0.00',
-                'debt' => $val['debt'] ?? 0,
-                'orderSn' => $val['orderSn'] ?? '',
-                'date' => $val['addTime'] ?? '',
-                'remark' => $val['remark'] ?? '',
-                'custom' => [
-                    'customName' => $val['customName'] ?? '',
-                    'customMobile' => $val['customMobile'] ?? '',
-                    'fullAddress' => $val['fullAddress'] ?? '',
-                ],
-                'product' => $printProduct,
-                'sendNum' => date("d") . $sendNum,
-                'debtAmount' => $debtAmount,
-            ];
+
+            //打印数据组合
+            $printData = self::getPrintData($val, $debtAmount, $showItem);
             $list[$key]['printData'] = json_encode($printData);
+
             $list[$key]['debtAmount'] = $debtAmount;
         }
         return $list;
     }
 
+    //打印数据 shish 20210702
+    public static function getPrintData($val, $debtAmount, $showItem)
+    {
+        $printProduct = [];
+        if (isset($showItem['list']) && !empty($showItem['list'])) {
+            foreach ($showItem['list'] as $itemKey => $itemVal) {
+                $bigNum = $itemVal['bigNum'] ?? 0;
+                $smallNum = $itemVal['smallNum'] ?? 0;
+                $printProduct[] = [
+                    'name' => $itemVal['name'] ?? '',
+                    'num' => $bigNum . '/' . $smallNum,
+                    'price' => $itemVal['price'] ?? '0.00'
+                ];
+            }
+        }
+
+        $sendNum = $val['sendNum'] ?? '';
+
+        $printData = [
+            'address' => '集美区乐海路186-4',
+            'sendCost' => $val['sendCost'] ?? '0.00',
+            'prePrice' => $val['prePrice'] ?? '0.00',
+            'discountAmount' => $val['discountAmount'] ?? '0.00',
+            'realPrice' => $val['realPrice'] ?? '0.00',
+            'debt' => $val['debt'] ?? 0,
+            'orderSn' => $val['orderSn'] ?? '',
+            'date' => $val['addTime'] ?? '',
+            'remark' => $val['remark'] ?? '',
+            'custom' => [
+                'customName' => $val['customName'] ?? '',
+                'customMobile' => $val['customMobile'] ?? '',
+                'fullAddress' => $val['fullAddress'] ?? '',
+            ],
+            'product' => $printProduct,
+            'sendNum' => date("d") . $sendNum,
+            'debtAmount' => $debtAmount,
+        ];
+        return $printData;
+    }
+
     //订单的验证 ssh 2021.3.2
     public static function valid($info, $shopId)
     {

+ 11 - 1
biz-ghs/order/services/OrderService.php

@@ -102,7 +102,17 @@ class OrderService extends BaseService
 
         self::payAfter($return, $payWay);
 
-        return $return->attributes;
+        $orderInfo = $return->attributes;
+
+        //组合打印数据
+        $showItem = OrderClass::getShowItem(true, $orderInfo);
+        $customId = $orderInfo['customId'] ?? 0;
+        $custom = CustomClass::getById($customId);
+        $debtAmount = $custom['debtAmount'] ?? 0.00;
+        $printData = OrderClass::getPrintData($orderInfo, $debtAmount, $showItem);
+        $orderInfo['printData'] = $printData;
+
+        return $orderInfo;
     }
 
     //自取免配送流程处理 ssh 2021.1.24