|
@@ -38,11 +38,14 @@ class RefundService extends BaseService {
|
|
|
}else{
|
|
|
$orderInfoAmount=OrderInfo::where('order_id',$orderInfo->order_id)->whereIn('goods_id',$goodsId)->column('amount_goods_real','id');
|
|
|
}
|
|
|
- $totalAmount=array_sum(array_values($orderInfoAmount));
|
|
|
- $per=bcdiv($couponAmountTotal,$totalAmount);
|
|
|
- $num=$orderInfo['num'];
|
|
|
- $thisAmount=$orderInfo->amount_goods_real;
|
|
|
- $couponAmount=bcdiv($thisAmount/$per,$num);
|
|
|
+ if(isset($orderInfoAmount[$orderInfo->id])) {
|
|
|
+ $totalAmount = array_sum(array_values($orderInfoAmount));
|
|
|
+ $per = bcdiv($couponAmountTotal, $totalAmount);
|
|
|
+ $num = $orderInfo['num'];
|
|
|
+ $thisAmount = $orderInfo->amount_goods_real;
|
|
|
+ $couponAmount = bcdiv($thisAmount * $per, $num);
|
|
|
+ dd($couponAmount);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$amount=bcsub($amount,$couponAmount);
|
|
@@ -54,6 +57,7 @@ class RefundService extends BaseService {
|
|
|
}
|
|
|
#退商品金额,退安装费金额
|
|
|
$arr=[$amount,$amount_install];
|
|
|
+
|
|
|
if($total){
|
|
|
return bcadd($arr[0],$arr[1]);
|
|
|
}
|