Browse Source

全额退款退券

gorden 5 months ago
parent
commit
022f162ba2
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/admin/controller/order/RefundController.php

+ 4 - 1
app/admin/controller/order/RefundController.php

@@ -302,18 +302,21 @@ class RefundController extends Curd
         $response = [];
         Db::beginTransaction();
         try {
+            dump("开始退券",sprintf("%.2f", $amount),sprintf("%.2f", $order->order_amount_pay));
             // 全额退款,检查优惠券,恢复可使用
             if (sprintf("%.2f", $amount) == sprintf("%.2f", $order->order_amount_pay)) {
                 if (!empty($order->order_discount_json)) {
+                    dump("有优惠");
                     $discountJson = json_decode($order->order_discount_json, true);
                     foreach ($discountJson as $item){
                         if (empty($item['coupon_id'])){
                             continue;
                         }
 
+                        dump("检查是否有拆单");
                         // 是否有其他订单一起使用优惠券
                         if(!Order::where('order_groupby',$order->order_groupby)->where('order_id','<>',$order->order_id)->where('order_is_complete','<>','R')->exists()){
-                            dump("有没退的");
+                            dump("有没退的");
                             CouponDetail::where('coupon_detail_id',$item['coupon_id'])->update([
                                 'coupon_detail_status'=>'ACTIVED',
                                 'coupon_detail_used_datetime'=>''