Преглед на файлове

Merge branch 'master' into minus

shish преди 1 година
родител
ревизия
037b713d1f

+ 4 - 3
app-ghs/controllers/StatController.php

@@ -77,7 +77,7 @@ class StatController extends BaseController
         if (getenv('YII_ENV') == 'production') {
             //小向花卉
             if ($this->mainId == 23390) {
-                if (in_array($this->adminId, [28456,31105,52528])) {
+                if (in_array($this->adminId, [28456, 31105, 52528])) {
                     $hasPower = 1;
                 }
             }
@@ -103,7 +103,7 @@ class StatController extends BaseController
         set_time_limit(0);
         $mainId = $this->mainId;
         $arr = StatSaleClass::send($mainId);
-        util::success(['list'=>$arr]);
+        util::success(['list' => $arr]);
     }
 
     public function actionIncomeOutItem()
@@ -135,13 +135,14 @@ class StatController extends BaseController
         $income = $respond['income'] ?? 0;
         $expend = $respond['expend'] ?? 0;
         $balance = $respond['balance'] ?? 0;
+        $payCodeIncome = $respond['payCodeIncome'] ?? 0;
 
         //由于损耗而造成少赚的钱
         $wastageRespond = StatSaleClass::wastage($mainId);
         $wastagePrice = $wastageRespond['totalPrice'] ?? 0;
         $wastagePrice = floatval($wastagePrice);
 
-        util::success(['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'wastagePrice' => $wastagePrice]);
+        util::success(['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'wastagePrice' => $wastagePrice, 'payCodeIncome' => $payCodeIncome]);
     }
 
     //按月统计损耗情况

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

@@ -33,6 +33,7 @@ class StatKdController extends BaseController
         $return = StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
         $incomeList = $return['incomeList'];
         $staffAmountList = $return['staffAmountList'];
+        $payCodeIncome = $return['payCodeIncome'];
         $totalIncome = 0;
         if (!empty($incomeList)) {
             foreach ($incomeList as $item) {
@@ -41,7 +42,7 @@ class StatKdController extends BaseController
                 $totalIncome = floatval($totalIncome);
             }
         }
-        util::success(['list' => $incomeList, 'totalIncome' => $totalIncome, 'staffAmountList' => $staffAmountList]);
+        util::success(['list' => $incomeList, 'totalIncome' => $totalIncome, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome]);
     }
 
 }

+ 8 - 11
app-mall/controllers/BaseController.php

@@ -24,7 +24,7 @@ class BaseController extends PublicController
     public $validate = true;
     public $guestAccess = [];
     public $userId = 0, $user, $shopId, $shop;
-    public $sjId, $sj, $sjExtend, $customId = 0, $custom, $hd, $mainId = 0, $main;
+    public $sjId, $sj, $sjExtend, $customId = 0, $custom, $hd, $hdId, $mainId = 0, $main;
     public $isWx;
 
     public function beforeAction($action)
@@ -41,7 +41,7 @@ class BaseController extends PublicController
         $user = UserClass::getById($userId, true);
         if (empty($user)) {
             if (!in_array($action->id, $this->guestAccess)) {
-                util::fail('请先登录');
+                util::fail('请先登录');
             }
         }
         $this->user = $user;
@@ -63,16 +63,13 @@ class BaseController extends PublicController
                 if (!empty($hdId)) {
                     $hd = HdClass::getById($hdId, true);
                     if (!empty($hd)) {
-                        if ($hd->userId != $this->userId) {
-                            util::fail('不是你的花店,无法访问哦');
+                        if (!empty($this->userId) && $hd->userId == $this->userId && $shopId == $hd->shopId) {
+                            $this->hd = $hd;
+                            $this->hdId = $hdId;
+                            $customId = $hd->customId ?? 0;
+                            $custom = CustomClass::getById($customId, true);
+                            $this->custom = $custom;
                         }
-                        if ($shopId != $hd->shopId) {
-                            util::fail('花店信息有问题哦');
-                        }
-                        $this->hd = $hd;
-                        $customId = $hd->customId ?? 0;
-                        $custom = CustomClass::getById($customId, true);
-                        $this->custom = $custom;
                     }
                 }
             }

+ 13 - 13
app-mall/controllers/OrderController.php

@@ -586,8 +586,8 @@ class OrderController extends BaseController
         $post['customId'] = $this->customId;
         $user = isset($this->user->attributes) ? $this->user->attributes : [];
         $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
-        $bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
-        $bookMobile = empty($bookMobile) && isset($user['mobile']) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
+        $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
+        $bookMobile = empty($bookMobile) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
         $post['bookMobile'] = $bookMobile;
         $prePrice = round($post['prePrice'], 2);
         $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
@@ -600,7 +600,7 @@ class OrderController extends BaseController
         $post['realPrice'] = $actPrice;
         $post['mainPay'] = $actPrice;
         $post['payStyle'] = 0;
-        $post['sjId'] = $this->sjId;
+        $post['userId'] = $this->userId;
         $post['needPrint'] = dict::getDict('needPrint', 'noNeed');
         $now = time();
         $expireTime = $now + 300;//订单5分钟后过期
@@ -613,29 +613,29 @@ class OrderController extends BaseController
         $post['modPrice'] = $this->isWx ? 0 : 1;
         $post['goodsNum'] = 1;
         $post['fromType'] = $post['fromType'] ?? 1;
-        $post['reachDate'] = isset($post['reachDate']) && !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';
+        $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';
         $post['onlinePay'] = dict::getDict('onlinePay', 'yes');
 
         //前端未修改时这边做兼容
-        if (isset($post['receiveAddress']) && !empty($post['receiveAddress'])) {
+        if (!empty($post['receiveAddress'])) {
             $post['address'] = $post['receiveAddress'];
-            if (isset($post['receiveProvince']) && !empty($post['receiveProvince'])) {
+            if (!empty($post['receiveProvince'])) {
                 $post['province'] = $post['receiveProvince'];
             }
-            if (isset($post['receiveCity']) && !empty($post['receiveCity'])) {
+            if (!empty($post['receiveCity'])) {
                 $post['city'] = $post['receiveCity'];
             }
-            if (isset($post['receiveFloor']) && !empty($post['receiveFloor'])) {
+            if (!empty($post['receiveFloor'])) {
                 $post['floor'] = $post['receiveFloor'];
             }
-            if (isset($post['latitude']) && !empty($post['latitude'])) {
+            if (!empty($post['latitude'])) {
                 $post['lat'] = $post['latitude'];
             }
-            if (isset($post['longitude']) && !empty($post['longitude'])) {
+            if (!empty($post['longitude'])) {
                 $post['long'] = $post['longitude'];
             }
             $city = $post['receiveCity'] ?? '';
-            $address = $post['receiveAddress'] ?? '';
+            $address = $post['receiveAddress'];
             $floor = $post['receiveFloor'] ?? '';
             $post['fullAddress'] = $city . $address . $floor;
         }
@@ -682,7 +682,7 @@ class OrderController extends BaseController
                 'couponId' => $couponId,
             ];
             $response = $laResource->driveWxPay($wxParams);
-            if (isset($response['code']) == false || $response['code'] != 'BBS00000') {
+            if (!isset($response['code']) || $response['code'] != 'BBS00000') {
                 $errMsg = $response['msg'] ?? '';
                 noticeUtil::push($errMsg, '15280215347');
                 util::fail('支付失败');
@@ -733,7 +733,7 @@ class OrderController extends BaseController
                 'subject' => $subject,
             ];
             $response = $laResource->cashierPay($cashParams);
-            if (isset($response['code']) == false || $response['code'] != '000000') {
+            if (!isset($response['code']) || $response['code'] != '000000') {
                 util::fail('支付失败了');
             }
             $url = $response['resp_data']['counter_url'] ? $response['resp_data']['counter_url'] : '';

+ 1 - 1
biz-ghs/order/classes/OrderClass.php

@@ -1990,7 +1990,7 @@ class OrderClass extends BaseClass
 
         if (getenv('YII_ENV') == 'production') {
             //丽子鲜花、花样年华、镜中花卉、满天星、世纪花、盛丰、福清辉煌、美阁都不显示扫码买花
-            if (!in_array($orderInfo->shopId, [1527, 1585, 1596, 16454, 33668, 38492, 36596, 35389, 38322, 43274, 40312, 44556, 42946, 51758, 8391])) {
+            if (!in_array($orderInfo->shopId, [1527, 1585, 1596, 16454, 33668, 38492, 36596, 35389, 38322, 43274, 40312, 44556, 42946, 51758, 8391, 65591])) {
                 //勇记、国恋、花悠星零售开单不需要打印扫码买花
                 if ($customId != 12145 || $customId != 12487 || $customId != 12281) {
                     $content .= "<BR>";

+ 12 - 148
biz-ghs/stat/classes/StatKdClass.php

@@ -178,7 +178,7 @@ class StatKdClass extends BaseClass
                 $book = $ghsOrder['book'] ?? 0;
                 $staffId = $ghsOrder['shopAdminId'] ?? 0;
                 $staffName = $ghsOrder['shopAdminName'] ?? '';
-                if($staffId==0){
+                if ($staffId == 0) {
                     $staffName = '系统';
                 }
                 if ($status == 0 || $status == 5) {
@@ -192,7 +192,7 @@ class StatKdClass extends BaseClass
                     $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
                     $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $actPrice, 2);
                 } else {
-                    $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName,'staffId'=>$staffId];
+                    $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName, 'staffId' => $staffId];
                 }
 
                 if ($debtPrice > 0) {
@@ -272,7 +272,9 @@ class StatKdClass extends BaseClass
             }
         }
 
+
         //零售开单
+        $payCodeIncome = 0;
         $hdWhere = ['mainId' => $mainId, 'status' => ['in', [HdOrderClass::ORDER_STATUS_UN_SEND, HdOrderClass::ORDER_STATUS_SENDING, HdOrderClass::ORDER_STATUS_COMPLETE]]];
         $hdWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
         $hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
@@ -290,6 +292,8 @@ class StatKdClass extends BaseClass
             $staffId = $ghsOrder['shopAdminId'] ?? 0;
             $staffName = $ghsOrder['shopAdminName'] ?? '';
 
+            $repeat = $hdOrder['repeat'] ?? 0;
+
             if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
 
                 if (isset($staffAmountList[$staffId])) {
@@ -306,6 +310,11 @@ class StatKdClass extends BaseClass
                 $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
                 $incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
                 $incomeList['system']['category']['ls']['num'] = bcadd($incomeList['system']['category']['ls']['num'], 1);
+
+                if ($repeat == 1) {
+                    $payCodeIncome = bcadd($payCodeIncome, $mainPay, 2);
+                }
+
                 if ($cash > 0) {
                     $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $cash, 2);
                     $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
@@ -410,152 +419,7 @@ class StatKdClass extends BaseClass
             }
 
         }
-
-        if ($contain == 1) {
-            //批发结帐收入
-            $clearWhere = ['ghsShopId' => $ghsShopId, 'status' => 2];
-            $clearWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
-            $clearList = ClearClass::getAllByCondition($clearWhere, null, '*');
-            if (!empty($clearList)) {
-                foreach ($clearList as $cKey => $clear) {
-                    $payWay = $clear['payWay'] ?? 0;
-                    $actPrice = $clear['actPrice'] ?? 0;
-                    $onlinePay = $clear['onlinePay'] ?? 0;
-                    $getStaffId = $clear['ghsShopAdminId'] ?? 0;
-                    if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
-                        $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $actPrice, 2);
-                        $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
-                        $incomeList['system']['category']['pfJz']['amount'] = bcadd($incomeList['system']['category']['pfJz']['amount'], $actPrice, 2);
-                        $incomeList['system']['category']['pfJz']['num'] = bcadd($incomeList['system']['category']['pfJz']['num'], 1);
-                    } else {
-                        //使用非在线支付
-                        switch ($payWay) {
-                            case dict::getDict('payWay', 'wxPay'):
-                                //员工微信总共收了多少笔多少钱
-                                $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $actPrice, 2);
-                                $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
-                                //批发开单、零售开单、批发结账、零售尾款各收了多少现金
-                                $incomeList['kfWx']['category']['pfJz']['amount'] = bcadd($incomeList['kfWx']['category']['pfJz']['amount'], $actPrice, 2);
-                                $incomeList['kfWx']['category']['pfJz']['num'] = bcadd($incomeList['kfWx']['category']['pfJz']['num'], 1);
-                                //客1 客2 客3各收了多少钱
-                                if (isset($incomeList['kfWx']['class'][$getStaffId])) {
-                                    $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $actPrice, 2);
-                                    $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
-                                }
-                                //每个客服收的明细
-                                if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz'])) {
-                                    $incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['amount'], $actPrice, 2));
-                                    $incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['num'], 1);
-                                }
-                                break;
-                            case dict::getDict('payWay', 'alipay'):
-                                $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
-                                $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
-                                $incomeList['aliPay']['category']['pfJz']['amount'] = bcadd($incomeList['aliPay']['category']['pfJz']['amount'], $actPrice, 2);
-                                $incomeList['aliPay']['category']['pfJz']['num'] = bcadd($incomeList['aliPay']['category']['pfJz']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'cash'):
-                                $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $actPrice, 2);
-                                $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
-                                $incomeList['cash']['category']['pfJz']['amount'] = bcadd($incomeList['cash']['category']['pfJz']['amount'], $actPrice, 2);
-                                $incomeList['cash']['category']['pfJz']['num'] = bcadd($incomeList['cash']['category']['pfJz']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'balancePay'):
-                                $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $actPrice, 2);
-                                $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
-                                $incomeList['balancePay']['category']['pfJz']['amount'] = bcadd($incomeList['balancePay']['category']['pfJz']['amount'], $actPrice, 2);
-                                $incomeList['balancePay']['category']['pfJz']['num'] = bcadd($incomeList['balancePay']['category']['pfJz']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'bankCard'):
-                                $incomeList['bankCard']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
-                                $incomeList['bankCard']['num'] = bcadd($incomeList['aliPay']['num'], 1);
-                                $incomeList['bankCard']['category']['pfJz']['amount'] = bcadd($incomeList['bankCard']['category']['pfJz']['amount'], $actPrice, 2);
-                                $incomeList['bankCard']['category']['pfJz']['num'] = bcadd($incomeList['bankCard']['category']['pfJz']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'unknown'):
-                                $incomeList['other']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
-                                $incomeList['other']['num'] = bcadd($incomeList['aliPay']['num'], 1);
-                                $incomeList['other']['category']['pfJz']['amount'] = bcadd($incomeList['other']['category']['pfJz']['amount'], $actPrice, 2);
-                                $incomeList['other']['category']['pfJz']['num'] = bcadd($incomeList['other']['category']['pfJz']['num'], 1);
-                                break;
-                            default:
-                        }
-                    }
-                }
-            }
-
-            //零售尾款收入
-            $settleWhere = ['shopId' => $lsShopId, 'status' => 2];
-            $settleWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
-            $settleList = SettleClass::getAllByCondition($settleWhere, null, '*');
-
-            if (!empty($settleList)) {
-                foreach ($settleList as $sKey => $settle) {
-                    $payWay = $settle['payWay'] ?? 0;
-                    $actPrice = $settle['actPrice'] ?? 0;
-                    $getStaffId = $settle['hdShopAdminId'] ?? 0;
-                    $onlinePay = $settle['onlinePay'] ?? 0;
-                    if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
-
-                    } else {
-                        //使用非在线支付
-                        switch ($payWay) {
-                            case dict::getDict('payWay', 'wxPay'):
-                                //员工微信总共收了多少笔多少钱
-                                $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $actPrice, 2);
-                                $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
-                                //批发开单、零售开单、批发结账、零售尾款各收了多少现金
-                                $incomeList['kfWx']['category']['lsWk']['amount'] = bcadd($incomeList['kfWx']['category']['lsWk']['amount'], $actPrice, 2);
-                                $incomeList['kfWx']['category']['lsWk']['num'] = bcadd($incomeList['kfWx']['category']['lsWk']['num'], 1);
-                                //客1 客2 客3各收了多少钱
-                                if (isset($incomeList['kfWx']['class'][$getStaffId])) {
-                                    $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $actPrice, 2);
-                                    $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
-                                }
-                                //每个客服收的明细
-                                if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk'])) {
-                                    $incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['amount'], $actPrice, 2));
-                                    $incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['num'], 1);
-                                }
-                                break;
-                            case dict::getDict('payWay', 'alipay'):
-                                $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
-                                $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
-                                $incomeList['aliPay']['category']['lsWk']['amount'] = bcadd($incomeList['aliPay']['category']['lsWk']['amount'], $actPrice, 2);
-                                $incomeList['aliPay']['category']['lsWk']['num'] = bcadd($incomeList['aliPay']['category']['lsWk']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'cash'):
-                                $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $actPrice, 2);
-                                $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
-                                $incomeList['cash']['category']['lsWk']['amount'] = bcadd($incomeList['cash']['category']['lsWk']['amount'], $actPrice, 2);
-                                $incomeList['cash']['category']['lsWk']['num'] = bcadd($incomeList['cash']['category']['lsWk']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'balancePay'):
-                                $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $actPrice, 2);
-                                $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
-                                $incomeList['balancePay']['category']['lsWk']['amount'] = bcadd($incomeList['balancePay']['category']['lsWk']['amount'], $actPrice, 2);
-                                $incomeList['balancePay']['category']['lsWk']['num'] = bcadd($incomeList['balancePay']['category']['lsWk']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'bankCard'):
-                                $incomeList['bankCard']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
-                                $incomeList['bankCard']['num'] = bcadd($incomeList['aliPay']['num'], 1);
-                                $incomeList['bankCard']['category']['lsWk']['amount'] = bcadd($incomeList['bankCard']['category']['lsWk']['amount'], $actPrice, 2);
-                                $incomeList['bankCard']['category']['lsWk']['num'] = bcadd($incomeList['bankCard']['category']['lsWk']['num'], 1);
-                                break;
-                            case dict::getDict('payWay', 'unknown'):
-                                $incomeList['other']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
-                                $incomeList['other']['num'] = bcadd($incomeList['aliPay']['num'], 1);
-                                $incomeList['other']['category']['lsWk']['amount'] = bcadd($incomeList['other']['category']['lsWk']['amount'], $actPrice, 2);
-                                $incomeList['other']['category']['lsWk']['num'] = bcadd($incomeList['other']['category']['lsWk']['num'], 1);
-                                break;
-                            default:
-                        }
-                    }
-
-                }
-            }
-        }
-        return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList];
+        return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome];
 
     }
 

+ 10 - 1
biz-ghs/stat/classes/StatSaleClass.php

@@ -300,6 +300,7 @@ class StatSaleClass extends BaseClass
         }
 
         //零售开单
+        $payCodeIncome = 0;
         $lsIncome = 0;
         $lsSendCost = 0;
         $lsServiceFee = 0;
@@ -308,6 +309,8 @@ class StatSaleClass extends BaseClass
         $hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
         foreach ($hdOrderList as $hdKey => $hdOrder) {
             $actPrice = $hdOrder['mainPay'] ?? 0;
+            $onlinePay = $hdOrder['onlinePay'] ?? 1;
+
             if ($hdOrder['tkPrice'] && $hdOrder['tkPrice'] > 0) {
                 $actPrice = bcsub($actPrice, $hdOrder['tkPrice'], 2);
             }
@@ -322,6 +325,12 @@ class StatSaleClass extends BaseClass
                 $lsServiceFee = bcadd($lsServiceFee, $serviceFee, 2);
             }
             $totalOrderNum++;
+
+            if ($onlinePay == 2 && floatval($cash) <= 0) {
+                $payCodeIncome = bcadd($payCodeIncome, $actPrice, 2);
+                $payCodeIncome = floatval($payCodeIncome);
+            }
+
         }
 
         $condition = ['mainId' => $mainId, 'addTime' => ['between', [$currentStartTime, $currentEndTime]],];
@@ -386,7 +395,7 @@ class StatSaleClass extends BaseClass
             $balance = bcsub($balance, $amount, 2);
         }
 
-        return ['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'totalOrderNum' => $totalOrderNum];
+        return ['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'totalOrderNum' => $totalOrderNum, 'payCodeIncome' => $payCodeIncome];
     }
 
     //按花材统计收入 ssh 20231111