优化退款流程和佣金逻辑
- 修改了预订单逻辑中的出库操作 - 优化了门店订单的退款处理 - 调整了佣金分配顺序 - 完善了支付通知中的退款流程
This commit is contained in:
parent
ed97ed62a4
commit
4d883fd749
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user