diff --git a/app/admin/logic/statistic/TradeStatisticLogic.php b/app/admin/logic/statistic/TradeStatisticLogic.php index 90408c87..d2504b60 100644 --- a/app/admin/logic/statistic/TradeStatisticLogic.php +++ b/app/admin/logic/statistic/TradeStatisticLogic.php @@ -310,6 +310,40 @@ class TradeStatisticLogic extends BaseLogic ]; $Chain['out_ye'] = $outYeCurve; + //保证金金额 + $depositWehre = $where; + $depositWehre['financial_type'] = 11; + $orderDepositMoney = $this->getFinanceFlow($depositWehre, "sum"); + $lastOrderDepositMoney = $this->getFinanceFlow($dateWhere, "sum", "", $isNum); + $OrderDepositCurve = $this->getFinanceFlow($where, "group", "create_time"); + $OrderDepositChain = countRate($orderDepositMoney, $lastOrderDepositMoney); + + $topData[8] = [ + 'title' => '保证金金额', + 'desc' => '门店未交满,订单扣除的保证金', + 'total_money' => $orderDepositMoney, + 'rate' => $OrderDepositChain, + 'value' => $OrderDepositCurve['y'], + 'type' => 1, + 'sign' => 'deposit', + ]; + $Chain['deposit'] = $OrderDepositCurve; + //兑换礼品券 + $userSign = $this->getUserSign($where, 'sum'); + $userSignTwo = $this->getUserSign($where, 'sum', "", $isNum); + $userSignGroup = $this->getUserSign($where, 'group', "create_time"); + $userSignRate = countRate($userSign, $userSignTwo); + $topData[9] = [ + 'title' => '兑换礼品券', + 'desc' => '后台给推广员支付的兑换礼品券,以实际支付为准', + 'total_money' => $userSign, + 'rate' => $userSignRate, + 'value' => $userSignGroup['y'], + 'type' => 1, + 'sign' => 'user_sign', + ]; + $Chain['user_sign'] = $userSignGroup; + /** 充值金额 */ $rechgeMoneyHome = $this->getRechargeTotalMoney($where, 'sum'); $rechgeMoneyAdmin = $this->getBillYeTotalMoney($where, 'sum'); @@ -321,7 +355,7 @@ class TradeStatisticLogic extends BaseLogic $RechgeAdminCurve = $this->getBillYeTotalMoney($where, 'group', "create_time"); $RechgeTotalCurve = $this->totalArrData([$RechgeHomeCurve, $RechgeAdminCurve]); $RechgeChain = countRate($rechgeMoneyTotal, $lastRechgeMoneyTotal); - $topData[12] = [ + $topData[10] = [ 'title' => '充值金额', 'desc' => '选定条件下,用户成功充值的金额', 'total_money' => $rechgeMoneyTotal, @@ -332,22 +366,6 @@ class TradeStatisticLogic extends BaseLogic ]; $Chain['rechage'] = $RechgeTotalCurve; - //商品退款金额 - $outOrderRefund = $this->getOrderRefundTotalMoney(['create_time' => $where['create_time']], 'sum'); - $lastOutOrderRefund = $this->getOrderRefundTotalMoney(['create_time' => $dateWhere['create_time']], 'sum', "", $isNum); - $outOrderRefundCurve = $this->getOrderRefundTotalMoney(['create_time' => $where['create_time']], 'group', 'create_time'); - $orderRefundChain = countRate($outOrderRefund, $lastOutOrderRefund); - $topData[9] = [ - 'title' => '商品退款金额', - 'desc' => '用户成功退款的商品金额', - 'total_money' => $outOrderRefund, - 'rate' => $orderRefundChain, - 'value' => $outOrderRefundCurve['y'], - 'type' => 0, - 'sign' => 'refund', - ]; - $Chain['refund'] = $outOrderRefundCurve; - //支出金额 // $outTotalMoney = bcadd($outYeMoney, $outExtractMoney, 2); // $lastOutTotalMoney = bcadd($lastOutYeMoney, $lastOutExtractMoney, 2); @@ -367,40 +385,22 @@ class TradeStatisticLogic extends BaseLogic ]; $Chain['out'] = $outTotalCurve; - //兑换礼品券 - $userSign = $this->getUserSign($where, 'sum'); - $userSignTwo = $this->getUserSign($where, 'sum', "", $isNum); - $userSignGroup = $this->getUserSign($where, 'group', "create_time"); - $userSignRate = countRate($userSign, $userSignTwo); - $topData[8] = [ - 'title' => '兑换礼品券', - 'desc' => '后台给推广员支付的兑换礼品券,以实际支付为准', - 'total_money' => $userSign, - 'rate' => $userSignRate, - 'value' => $userSignGroup['y'], - 'type' => 1, - 'sign' => 'user_sign', + //商品退款金额 + $outOrderRefund = $this->getOrderRefundTotalMoney(['create_time' => $where['create_time']], 'sum'); + $lastOutOrderRefund = $this->getOrderRefundTotalMoney(['create_time' => $dateWhere['create_time']], 'sum', "", $isNum); + $outOrderRefundCurve = $this->getOrderRefundTotalMoney(['create_time' => $where['create_time']], 'group', 'create_time'); + $orderRefundChain = countRate($outOrderRefund, $lastOutOrderRefund); + $topData[12] = [ + 'title' => '商品退款金额', + 'desc' => '用户成功退款的商品金额', + 'total_money' => $outOrderRefund, + 'rate' => $orderRefundChain, + 'value' => $outOrderRefundCurve['y'], + 'type' => 0, + 'sign' => 'refund', ]; - $Chain['user_sign'] = $userSignGroup; + $Chain['refund'] = $outOrderRefundCurve; - //保证金金额 - $depositWehre = $where; - $depositWehre['financial_type'] = 11; - $orderDepositMoney = $this->getFinanceFlow($depositWehre, "sum"); - $lastOrderDepositMoney = $this->getFinanceFlow($dateWhere, "sum", "", $isNum); - $OrderDepositCurve = $this->getFinanceFlow($where, "group", "create_time"); - $OrderDepositChain = countRate($orderDepositMoney, $lastOrderDepositMoney); - - $topData[10] = [ - 'title' => '保证金金额', - 'desc' => '门店未交满,订单扣除的保证金', - 'total_money' => $orderDepositMoney, - 'rate' => $OrderDepositChain, - 'value' => $OrderDepositCurve['y'], - 'type' => 1, - 'sign' => 'deposit', - ]; - $Chain['deposit'] = $OrderDepositCurve; /** @var 营业额 $inTotalMoney */