edit-api-edit_orde

This commit is contained in:
lccsw
2021-12-23 11:02:14 +08:00
parent 8e0da26543
commit 96ae11d6f2
+9 -4
View File
@@ -696,11 +696,16 @@ class Orders_entity{
$to_com_price = $money_json['price_car']-$money_json['price_loan'] - $money_json['price_book']; //车价-贷款首付-定金
}
$to_com_price = $to_com_price>0 ? $to_com_price : 0;
$old_last_money = $this->ci->app_liche_orders_model->sum('total_price',['o_id'=>$oid,'type'=>3,'pid'=>$p_row['id']]); //尾款订单
if($to_com_price>$old_last_money['total_price']){ //尾款高出
if($to_com_price){
$last_row = $this->ci->app_liche_orders_model->get(['o_id'=>$oid,'type'=>3,'pid'=>$p_row['id']]);//尾款父订单
if($last_row){
$this->ci->app_liche_orders_model->update(['status'=>0,'total_price'=>$to_com_price],['id'=>$last_row['id']]);
$old_last_money = $this->ci->app_liche_orders_model->sum('total_price',['o_id'=>$oid,'type'=>3,'pid'=>$last_row['id'],'status'=>1]); //已支付尾款
if($last_row){ //存在尾款订单
if($to_com_price>$last_row['total_price']){ //尾款高出
$this->ci->app_liche_orders_model->update(['status'=>0,'total_price'=>$to_com_price],['id'=>$last_row['id']]);
}
if($to_com_price<$last_row['total_price'] && $to_com_price>$old_last_money['total_price']){ //低于旧订单并且已支付要小于新尾款金额
$this->ci->app_liche_orders_model->update(['status'=>0,'total_price'=>$to_com_price],['id'=>$last_row['id']]);
}
}else{
$order_type = 3;
$add_data[] = [