dever 3 years ago
parent
commit
f1c6b42639
1 changed files with 14 additions and 10 deletions
  1. 14 10
      app/shop/lib/Refund.php

+ 14 - 10
app/shop/lib/Refund.php

@@ -146,26 +146,30 @@ class Refund
             if ($order_goods_id) {
                 $info = Dever::db($this->goods_table)->find(array('id' => $order_goods_id, 'order_id' => $data['id'], 'status' => 1));
                 if ($info) {
+
+                    Dever::db($this->goods_table)->update(array('where_id' => $info['id'], 'status' => 2));
+                    
                     if (!$num) {
                         $num = $info['num'];   
                     }
-                    Dever::db($this->goods_table)->update(array('where_id' => $info['id'], 'status' => 2));
-                	if (isset($info['coupon_cash']) && $info['coupon_cash']) {
-                		$cash = $info['total_price'] - $info['coupon_cash'];
-                	} else {
-                		$cash = $info['total_price'];
-                	}
-
-                    $kou = $data['card_code_cash'] + $data['wallet_cash'];
                     $info['total_price'] = $info['price'] * $num;
+                    $kou = $data['card_code_cash'] + $data['wallet_cash'];
+                    
                     if ($kou > 0) {
                         if ($info['total_price'] >= $kou) {
-                            $cash = $info['total_price'] - $kou;
+                            $info['total_price'] = $info['total_price'] - $kou;
                         } else {
-                            $cash = 0;
+                            $info['total_price'] = 0;
                         }
                     }
 
+                	if (isset($info['coupon_cash']) && $info['coupon_cash']) {
+                		$cash = $info['total_price'] - $info['coupon_cash'];
+                	} else {
+                		$cash = $info['total_price'];
+                	}
+                    
+
                     if (isset($info['p_price'])) {
                         $p_cash = $info['p_price'] * $num;
                     } else {