浏览代码

拆单+打印

gorden 5 月之前
父节点
当前提交
6d58aa1aa0

+ 6 - 6
app/admin/controller/order/GoodsController.php

@@ -614,13 +614,13 @@ class GoodsController extends Curd
             $params['order_discount_json'] = json_encode($this->discountRecord($couponUseJson, $params));
             $orderAmountPay = $params['order_amount_pay'];
             $constituteList = array_column($params['pay_category_constitute_list'], 'amount', 'category');
-            // 验证金额
+
             $constituteAmount = 0;
             foreach ($params['pay_category_constitute_list'] as $item) {
-                $constituteAmount = $constituteAmount + $item['amount'];
+                $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
             }
-            if ($params['order_amount_pay'] != $constituteAmount) {
-                throw new BusinessException("组合支付金额与应付金额不一致");
+            if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
+                throw new BusinessException('组合支付金额与应付金额不一致');
             }
             $params['goods_classify'] = $goodsClassifys[0];
             // 验证库存
@@ -1526,9 +1526,9 @@ class GoodsController extends Curd
             $constituteList = array_column($params['pay_category_constitute_list'], 'amount', 'category');// 验证金额
             $constituteAmount = 0;
             foreach ($params['pay_category_constitute_list'] as $item) {
-                $constituteAmount = $constituteAmount + $item['amount'];
+                $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
             }
-            if ($params['order_amount_pay'] != $constituteAmount) {
+            if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
                 throw new BusinessException('组合支付金额与应付金额不一致');
             }
             if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) {  //线下付款

+ 5 - 5
app/admin/controller/order/PackagesController.php

@@ -759,10 +759,10 @@ class PackagesController extends Curd
             // 验证金额
             $constituteAmount = 0;
             foreach ($params['pay_category_constitute_list'] as $item) {
-                $constituteAmount = $constituteAmount + $item['amount'];
+                $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
             }
-            if ($params['order_amount_pay'] != $constituteAmount) {
-                throw new BusinessException("组合支付金额与应付金额不一致");
+            if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
+                throw new BusinessException('组合支付金额与应付金额不一致');
             }
             $params['goods_classify'] = $goodsClassifys[0];
             // 验证库存
@@ -1659,9 +1659,9 @@ class PackagesController extends Curd
             $constituteList = array_column($params['pay_category_constitute_list'], 'amount', 'category');// 验证金额
             $constituteAmount = 0;
             foreach ($params['pay_category_constitute_list'] as $item) {
-                $constituteAmount = $constituteAmount + $item['amount'];
+                $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
             }
-            if ($params['order_amount_pay'] != $constituteAmount) {
+            if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
                 throw new BusinessException('组合支付金额与应付金额不一致');
             }
             if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) {  //线下付款

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

@@ -599,10 +599,10 @@ class ServicesController extends Curd
             // 验证金额
             $constituteAmount = 0;
             foreach ($params['pay_category_constitute_list'] as $item) {
-                $constituteAmount = $constituteAmount + $item['amount'];
+                $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
             }
-            if ($params['order_amount_pay'] != $constituteAmount) {
-                throw new BusinessException("组合支付金额与应付金额不一致");
+            if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
+                throw new BusinessException('组合支付金额与应付金额不一致');
             }
             $params['goods_classify'] = $goodsClassifys[0];
             // 验证库存
@@ -1556,8 +1556,7 @@ class ServicesController extends Curd
             foreach ($params['pay_category_constitute_list'] as $item) {
                 $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
             }
-            dump($params['order_amount_pay'],$constituteAmount);
-            if ($params['order_amount_pay'] != $constituteAmount) {
+            if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
                 throw new BusinessException('组合支付金额与应付金额不一致');
             }
             if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) {  //线下付款