Browse Source

加菜出现小数点

gorden 3 months ago
parent
commit
112e91216e
1 changed files with 19 additions and 1 deletions
  1. 19 1
      app/admin/controller/order/WholeController.php

+ 19 - 1
app/admin/controller/order/WholeController.php

@@ -3460,6 +3460,19 @@ class WholeController extends Curd
             if ($order->order_status_payment == 'SUCCESS') {
                 throw new BusinessException("订单已支付,无法加菜");
             }
+            $zhekou = 'N';
+            // 检查优惠券,折扣券和其他
+            if (!empty($order->order_discount_json)) {
+                $orderDiscountJson = json_decode($order->order_discount_json, true);
+                $couponId = '';
+                foreach ($orderDiscountJson as $coupon){
+                    $couponId = $coupon['coupon_id'];
+                }
+                $coupon = Coupon::where('coupon_id',$couponId)->select('coupon_classify')->first();
+                if (!empty($coupon) && $coupon->coupon_classify == '折扣券'){
+                    $zhekou = 'Y';
+                }
+            }
             $payDetail = PayDetail::where('join_pay_order_id', $order->order_groupby)->first();
             $sheet = OrderSheet::where('join_sheet_order_id', $params['order_id'])->orderBy('order_sheet_addtimes', 'DESC')->first();
             $sheetComponentJson = [];
@@ -3471,7 +3484,12 @@ class WholeController extends Curd
             foreach ($params['goodsContentList'] as $goods) {
                 //{"unit": "份", "table": null, "premises": "15"}
                 $price = floatval($goods['goods_sales_price']);
-                $orderSheetPricePay = round(($order->order_amount_pay / $order->order_amount_total) * $price, 2);
+                if ($zhekou == 'Y'){
+                    $orderSheetPricePay = round(($order->order_amount_pay / $order->order_amount_total) * $price, 2);
+                }else{
+                    $orderSheetPricePay = $price;
+                }
+
                 $data = [
                     'join_sheet_member_id' => $order->join_order_member_id,
                     'join_sheet_order_id' => $params['order_id'],