Browse Source

全额退款退券

gorden 5 months ago
parent
commit
2417c2ceae

+ 4 - 0
app/admin/controller/order/GoodsController.php

@@ -979,6 +979,8 @@ class GoodsController extends Curd
                         throw new BusinessException("计算优惠后,实付金额错误!");
                     }
                 }
+                $couponUseJson = $discountJson;
+                $this->changeOrderCouponStatus($couponUseJson, 'USED');
                 // 释放下单时选的优惠券
 //                $order->order_discount_json = $this->releaseCoupon($discountJson);
             }
@@ -1507,6 +1509,8 @@ class GoodsController extends Curd
                         throw new BusinessException("计算优惠后,实付金额错误!");
                     }
                 }
+                $couponUseJson = $discountJson;
+                $this->changeOrderCouponStatus($couponUseJson, 'USED');
                 // 释放下单时选的优惠券
 //                $order->order_discount_json = $this->releaseCoupon($discountJson);
             }

+ 4 - 0
app/admin/controller/order/PackagesController.php

@@ -1117,6 +1117,8 @@ class PackagesController extends Curd
                         throw new BusinessException("计算优惠后,实付金额错误!");
                     }
                 }
+                $couponUseJson = $discountJson;
+                $this->changeOrderCouponStatus($couponUseJson, 'USED');
                 // 释放下单时选的优惠券
 //                $order->order_discount_json = $this->releaseCoupon($discountJson);
             }
@@ -1640,6 +1642,8 @@ class PackagesController extends Curd
                         throw new BusinessException("计算优惠后,实付金额错误!");
                     }
                 }
+                $couponUseJson = $discountJson;
+                $this->changeOrderCouponStatus($couponUseJson, 'USED');
                 // 释放下单时选的优惠券
 //                $order->order_discount_json = $this->releaseCoupon($discountJson);
             }

+ 5 - 1
app/admin/controller/order/ServicesController.php

@@ -1006,12 +1006,14 @@ class ServicesController extends Curd
             $couponUseJson = [];
             $discountJson = [];
             if (!empty($order->order_discount_json)) {
-                $discountJson = json_decode($order->order_discount_json, true);
+                $discountJson = json_decode($order->order_discount_json, true);;
                 foreach ($discountJson as $item) {
                     if (isset($item['coupon_value']) && sprintf('%.2f', (floatval($order->order_amount_total) - floatval($params['order_amount_pay']))) != sprintf('%.2f', $item['coupon_value'])) {
                         throw new BusinessException("计算优惠后,实付金额错误!");
                     }
                 }
+                $couponUseJson = $discountJson;
+                $this->changeOrderCouponStatus($couponUseJson, 'USED');
 //                // 释放下单时选的优惠券
 //                $order->order_discount_json = $this->releaseCoupon($discountJson);
             }
@@ -1535,6 +1537,8 @@ class ServicesController extends Curd
                         throw new BusinessException("计算优惠后,实付金额错误!");
                     }
                 }
+                $couponUseJson = $discountJson;
+                $this->changeOrderCouponStatus($couponUseJson, 'USED');
                 // 释放下单时选的优惠券
 //                $order->order_discount_json = $this->releaseCoupon($discountJson);
             }