diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index f574b2fd8..31ac8bf99 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -331,7 +331,7 @@ class BeforehandOrderLogic extends BaseLogic } $finds = WarehouseProduct::where('oid', $res['id'])->field('sum(nums) as nums,sum(total_price) as total_price')->find(); WarehouseOrder::where('id', $res['id'])->update(['total_price' => $finds['total_price'], 'nums' => $finds['nums']]); - BeforehandOrder::update(['outbound_id' => $res['id']], ['id' => $params['bhoid']]); + $order->save(['outbound_id' => $res['id'],'is_outbound'=>1]); Db::commit(); return true; } catch (\Throwable $e) { diff --git a/app/admin/logic/store_order/StoreOrderLogic.php b/app/admin/logic/store_order/StoreOrderLogic.php index 7aa407f15..ad1a1ba4b 100644 --- a/app/admin/logic/store_order/StoreOrderLogic.php +++ b/app/admin/logic/store_order/StoreOrderLogic.php @@ -210,8 +210,8 @@ class StoreOrderLogic extends BaseLogic $transaction_id = StoreFinanceFlow::where('order_id', $detail['id'])->value('transaction_id'); StoreFinanceFlow::where('order_id', $detail['id'])->update(['delete_time' => time()]); $detail['refund_price']=$refund_price; + StoreOrder::where('id', $detail['id'])->inc('refund_price',$refund_price)->inc('refund_num',$refund_num)->update(); CommissionnLogic::setStore($detail, $village_uid, $brigade_uid, $transaction_id); - StoreOrder::where('id', $detail['id'])->inc('refund_price',$refund_price)->inc('refund_num',$refund_num)->update(); } } diff --git a/app/common/logic/CommissionnLogic.php b/app/common/logic/CommissionnLogic.php index d070ea47a..d0e8da795 100644 --- a/app/common/logic/CommissionnLogic.php +++ b/app/common/logic/CommissionnLogic.php @@ -21,14 +21,16 @@ class CommissionnLogic extends BaseLogic } else { $uid = $order['spread_uid']; } + self::store($order, 1, $transaction_id, 0); //门店 + self::platform($order, 2, $transaction_id); //平台 + self::attrition($order, 6, $transaction_id, 16); //损耗金 + self::suppliter($order, $transaction_id); + self::user($order, 0, $transaction_id, $uid, 12); //会员、厨师 // self::user($order, 5, $transaction_id, $uid, 20); //会员、厨师 self::user($order, 3, $transaction_id, $village_uid, 14); //村长 self::user($order, 4, $transaction_id, $brigade_uid, 15); //队长 - self::platform($order, 2, $transaction_id); //平台 - self::store($order, 1, $transaction_id, 0); //门店 - self::attrition($order, 6, $transaction_id, 16); //损耗金 - self::suppliter($order, $transaction_id); + } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index ebee3d311..b2b2a6d04 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -317,12 +317,14 @@ class PayNotifyLogic extends BaseLogic UserSignLogic::RefundRecharge($orderRe); return true; } - $order->status = OrderEnum::REFUND_PAY; - $order->refund_status = OrderEnum::REFUND_STATUS_FINISH; - $order->refund_price = bcdiv($extra['amount']['refund'], 100, 2); - $order->refund_reason_time = time(); - $order->refund_num += 1; - $order->save(); + $refund=bcdiv($extra['amount']['refund'], 100, 2); + if($refund==$order['pay_price']){ + $order->status = OrderEnum::REFUND_PAY; + $order->refund_status = OrderEnum::REFUND_STATUS_FINISH; + $order->refund_price = $refund; + $order->refund_reason_time = time(); + $order->save(); + } // $deal_money = bcdiv($extra['amount']['refund'], 100, 2); //对应比例得退礼品券逻辑 // $discount = self::getDiscount($user->user_ship); @@ -330,17 +332,17 @@ class PayNotifyLogic extends BaseLogic //订单购物详情 StoreOrderCartInfo::where('oid', $order['id'])->update(['status' => OrderEnum::REFUND_STATUS_FINISH]); - self::balance_purchase_refund($order); + // self::balance_purchase_refund($order); //处理财务流水退还 - (new StoreFinanceFlowLogic())->store_finance_back($orderSn, $order['store_id']); + // (new StoreFinanceFlowLogic())->store_finance_back($orderSn, $order['store_id']); //积分 UserSignLogic::RefundOrder($order); //微信日志 user_order_refund - $user = User::where('id', $order['uid'])->findOrEmpty(); - $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $order['pay_price'], '', 1); - self::addStock($order['id']); //微信 + // $user = User::where('id', $order['uid'])->findOrEmpty(); + // $capitalFlowDao = new CapitalFlowLogic($user); + // $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $order['pay_price'], '', 1); + // self::addStock($order['id']); //微信 return true; }