Commit 0824f955 authored by hangjun83's avatar hangjun83

后端:修复1)未付款订单销售明细没做取消,2)未付款的订单不做退款和转预存

parent 0e5a072c
......@@ -270,12 +270,16 @@ class BhOrdersService
if($num == 0){
$createArr['si_amount'] = $refundInfo->handle_fee;
}else{
$createArr['si_amount'] = bcsub($currentAmount, $updateArr['si_amount'], 2);
$createArr['si_amount'] = bcmul($refundInfo->refund_nums, $soItem['si_discount'], 2);
}
$createArr['si_discount'] = bcdiv($createArr['si_amount'], $createArr['si_num'], 2);
} // 没有手续费的情况下
else{
$createArr['si_discount'] = $soItem['si_discount'];
$createArr['si_amount'] = bcmul($soItem['si_discount'], $refundInfo->refund_nums, 2);
}
$createArr['si_num'] = $refundInfo->refund_nums;
$createArr['si_assigned_num'] = $createArr['si_num'];
$createArr['si_discount'] = bcdiv($createArr['si_amount'], $createArr['si_num'], 2);
if($createArr['si_amount'] < 0){
throw new \LogicException('手续费异常,处理失败!',500);
......@@ -614,10 +618,9 @@ class BhOrdersService
}
}
if($sOrderDetail['so_pay_status'] == 0){
return ;
//throw new \LogicException('未完成付款的订单不能取消转预存款!',500);
}
/*if($sOrderDetail['so_pay_status'] == 0){
throw new \LogicException('未完成付款的订单不能取消转预存款!',500);
}*/
if($sOrderDetail['so_pay_status'] == 1){
throw new \LogicException('部分付款的订单不能取消明细,请联系管理员!',500);
}
......@@ -711,6 +714,7 @@ class BhOrdersService
if($siAmountTotalPid > 0){
$refund_amount = $soItem['si_amount'];
if($sOrderDetail['so_pay_status'] > 0){
// 退款
if($refundInfo->transfer_pre == 0){
......@@ -745,12 +749,14 @@ class BhOrdersService
$si_cancel_time = time();
}
}
app(BhSordersRepository::class)->update(['so_total'=>$siAmountTotal],$sOrderItem['so_id']);
app(BhSoitemsRepository::class)->update(['si_if_cancel'=>'1','si_cancel_time'=>$si_cancel_time],$si_id);
}else {
if($sOrderDetail['so_pay_status'] > 0){
//得到退款金额
$sOrder = app(BhSordersRepository::class)->find($sOrderItem['so_id']);
if (!$sOrder) {
......@@ -793,6 +799,7 @@ class BhOrdersService
$si_cancel_time = time();
}
}
app(BhSordersRepository::class)->update(['so_review_status' => '3', 'so_total' => '0'], $sOrderItem['so_id']);
app(BhSoitemsRepository::class)->update(['si_if_cancel' => '1', 'si_cancel_time' => $si_cancel_time], $sOrderItem['so_id']);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment