diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index 86e64e45..e234f95c 100755 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -648,7 +648,7 @@ class StoreOrderRepository extends BaseRepository $noDeliver = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(3))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $done = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(5))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); - $refund = StoreRefundOrder::alias('t1')->join('store_order t2', 't1.order_id=t2.order_id')->where('t1.uid', $uid)->where('t1.status', 3)->where('t2.activity_type', $product_type)->count(); + $refund = StoreRefundOrder::alias('t1')->join('store_order t2', 't1.order_id=t2.order_id')->where('t1.uid', $uid)->whereIn('t1.status', [0, 1, 2])->where('t2.activity_type', $product_type)->count(); $orderPrice = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(8))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->sum('pay_price'); $orderCount = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); return compact('noComment', 'done', 'refund', 'noDeliver', 'noPay', 'noPostage', 'orderPrice', 'orderCount'); diff --git a/app/common/repositories/store/order/StoreRefundOrderRepository.php b/app/common/repositories/store/order/StoreRefundOrderRepository.php index 1bfc8ab6..afa4e54a 100755 --- a/app/common/repositories/store/order/StoreRefundOrderRepository.php +++ b/app/common/repositories/store/order/StoreRefundOrderRepository.php @@ -1186,14 +1186,6 @@ class StoreRefundOrderRepository extends BaseRepository //退供应链订单 (new StoreOrderOtherDao())->refund($refundOrder); - //订单退款,减少当前商户销售金额和下单商户采购金额 - $money = bcadd($refundOrder['refund_price'], $refundOrder['refund_consumption'], 2); - Merchant::where('mer_id', $refundOrder['mer_id'])->update(['sale_amount' => Db::raw('sale_amount-' . $money)]); - $merId = Merchant::where('uid', $refundOrder['uid'])->value('mer_id'); - if (!empty($merId)) { - Merchant::where('mer_id', $merId)->update(['purchase_amount' => Db::raw('purchase_amount-' . $money)]); - } - $productIds = CloudProduct::where('activity_id', 2)->column('product_id'); StoreActivityOrderProduct::where('user_id', $refundOrder->order['uid']) ->whereIn('product_id', $productIds)