|
|
@@ -488,17 +488,21 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
$order_info['paid_amount'] = \app\common\model\recharge\RechargeOrder::where(['order_type'=>0,'user_id'=>$params['user_id'],'work_id'=>$order_info['work_id']])->sum('paid_amount');
|
|
|
|
|
|
//搜索当前工单下的所有订单记录
|
|
|
- $order_info['pay_orders'] = \app\common\model\recharge\RechargeOrder::where(['work_id'=>$order_info['work_id']])->field('id as order_id, pay_status,payment_type,pay_way,pay_time,order_total,order_amount,coupon_price')->order('id asc')->select()->toArray();
|
|
|
+ $order_info['pay_orders'] = \app\common\model\recharge\RechargeOrder::where(['work_id'=>$order_info['work_id']])->field('id as order_id, pay_status,refund_status,payment_type,pay_way,pay_time,order_total,order_amount,coupon_price')->order('id asc')->select()->toArray();
|
|
|
|
|
|
$pay_status_data = DictData::where('type_value','pay_status')->column('name','value');
|
|
|
$payment_type_data = DictData::where('type_value','payment_type')->column('name','value');
|
|
|
$pay_way_data = DictData::where('type_value','pay_way')->column('name','value');
|
|
|
$coupon_price = 0;
|
|
|
+ //退款金额
|
|
|
+ $order_refund_amount = 0;
|
|
|
foreach ($order_info['pay_orders'] as $k=>&$v){
|
|
|
$v['pay_status_name'] = $pay_status_data[$v['pay_status']];
|
|
|
$v['payment_type_name'] = $payment_type_data[$v['payment_type']];
|
|
|
$v['pay_way_name'] = $pay_way_data[$v['pay_way']];
|
|
|
-
|
|
|
+ if($v['refund_status']==1){
|
|
|
+ $order_refund_amount += $v['order_amount'];
|
|
|
+ }
|
|
|
if($v['payment_type']!=1 and !empty($order_info['service_work']['spare_total'])){
|
|
|
$v['order_total'] = $v['order_total'] - $order_info['service_work']['spare_total'];
|
|
|
$v['order_amount'] = $v['order_amount'] - $order_info['service_work']['spare_total'] + $v['coupon_price'];
|
|
|
@@ -509,7 +513,8 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
|
|
|
//汇总优惠卷额度
|
|
|
$order_info['coupon_price'] = $coupon_price;
|
|
|
-
|
|
|
+ //退款汇总
|
|
|
+ $order_info['refund_amount'] = $order_refund_amount;
|
|
|
// 所有配件
|
|
|
$order_info['spare_total'] = $order_info['service_work']['spare_total']??0;
|
|
|
$order_info['spare_parts'] = [];
|