feat: 修改订单逻辑和门店财务流水逻辑以优化核销流程

This commit is contained in:
mkm 2024-06-27 17:28:10 +08:00
parent 5113989f7b
commit 6cb0bb359a
2 changed files with 7 additions and 6 deletions

View File

@ -449,14 +449,14 @@ class OrderLogic extends BaseLogic
UserSign::where(['uid' => $order['uid'],'order_id' => $order['order_id']])->update(['status'=>1]); UserSign::where(['uid' => $order['uid'],'order_id' => $order['order_id']])->update(['status'=>1]);
} }
if ($order['spread_uid'] > 0) { if ($order['spread_uid'] > 0) {
$spread_number=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>12,'other_uid'=>$order['spread_uid']])->value('number'); $spread_find=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>12,'other_uid'=>$order['spread_uid']])->find();
if($spread_number){ if($spread_find){
$financeFlowLogic->updateStatusUser($v['id'],$order['spread_uid'],$spread_number,$v['order_id']); $financeFlowLogic->updateStatusUser($spread_find['id'],$order['spread_uid'],$spread_find['number'],$order['order_id']);
} }
} }
$deposit=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>11])->value('number'); $deposit=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>11])->value('number');
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number'); $money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
$financeFlowLogic->updateStatusStore($v['id'],$order['store_id'],$money,$deposit); $financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
Db::commit(); Db::commit();
return true; return true;

View File

@ -141,8 +141,9 @@ class StoreFinanceFlowLogic extends BaseLogic
/** /**
* 核销后更新门店余额 * 核销后更新门店余额
*/ */
public function updateStatusStore($id,$store_id,$money,$deposit){ public function updateStatusStore($order_id,$store_id,$money,$deposit){
StoreFinanceFlow::where('id', $id)->update(['status' => 1]); StoreFinanceFlow::where(['order_id'=>$order_id,'financial_pm'=>1,'financial_type'=>11])->update(['status' => 1]);
StoreFinanceFlow::where(['order_id'=>$order_id,'financial_pm'=>1,'financial_type'=>2])->update(['status' => 1]);
if($money){ if($money){
SystemStore::where('id', $store_id)->inc('store_money', $money)->update(); SystemStore::where('id', $store_id)->inc('store_money', $money)->update();
} }