瀏覽代碼

退款退货

林琦海 5 年之前
父節點
當前提交
e85a86fe83

+ 5 - 0
app-ghs/controllers/OrderController.php

@@ -529,6 +529,11 @@ class OrderController extends BaseController
             }
         }
         $post['product'] = $productList;
+
+        if (bccomp($post['price'] , $order['realPrice'], 2) == 1) {
+            util::fail("退款金额不能大于实际支付金额");
+        }
+
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {

+ 30 - 0
app-ghs/controllers/RefundController.php

@@ -0,0 +1,30 @@
+<?php
+//退款退货
+namespace ghs\controllers;
+
+use Yii;
+use bizGhs\order\classes\RefundOrderClass;
+use common\components\util;
+use bizGhs\product\classes\ProductClass;
+
+class RefundController extends BaseController
+{
+
+
+    //列表
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        $where['shopId'] = $this->shopId;
+        $list = RefundOrderClass::getOrderList($where);
+        util::success($list);
+    }
+
+    public function actionDetail()
+    {
+        $orderSn = Yii::$app->request->get('orderSn', '');
+        $orderData = RefundOrderClass::getOrderDetailByRelateOrder($orderSn, $this->shopId);
+        util::success($orderData);
+    }
+}

+ 26 - 1
biz-ghs/order/classes/RefundOrderClass.php

@@ -118,7 +118,7 @@ class RefundOrderClass extends BaseClass
     {
         $orderData = self::getByCondition($where);
         if (!$orderData) {
-            util::fail('订单不存在或不能取消');
+            util::fail('订单不存在');
         }
         return $orderData;
     }
@@ -165,4 +165,29 @@ class RefundOrderClass extends BaseClass
         return $batchData;
     }
 
+    //2021.1.23 linqh 订单详情
+    public static function getOrderDetailByRelateOrder($orderSn,$shopId)
+    {
+        $orderData = self::orderExist(['relateOrderSn' => $orderSn, 'shopId' => $shopId]);
+        $orderInfo = RefundOrderItemClass::getOrderItemDetail($orderData['orderSn']);
+        $itemData = [];
+        if ($orderInfo) {
+            foreach ($orderInfo as $v) {
+                $info = json_decode($v['itemInfo'], true);
+                $tmp = $info;
+                $tmp['itemCover'] = self::groupImg($info['itemCover']);
+                unset($v['itemInfo']);
+                //兼容 旧数据,没有 rank (花材等级 默认给B)
+                if (!isset($tmp['rank'])) {
+                    $tmp['rank'] = 'B';
+                }
+                $tmp = array_merge($tmp, $v);
+                $itemData[] = $tmp;
+            }
+        }
+        //下面注释放开前,员工id要用shopAdminId
+        //$orderData = self::groupAdmin($orderData);
+        $orderData['itemInfo'] = $itemData;
+        return $orderData;
+    }
 }