dever 3 years ago
parent
commit
64c8bd1bcb
2 changed files with 7 additions and 4 deletions
  1. 1 0
      app/shop/database/sell_order_goods.php
  2. 6 4
      app/shop/lib/Refund.php

+ 1 - 0
app/shop/database/sell_order_goods.php

@@ -189,6 +189,7 @@ return array
                 'uid' => 'yes',
                 'shop_id' => 'yes',
                 'order_id' => 'yes',
+                'status' => 'yes',
                 'state' => 1,
             ),
             'type' => 'all',

+ 6 - 4
app/shop/lib/Refund.php

@@ -290,7 +290,7 @@ class Refund
         	Dever::alert('操作失败');
         }
 
-        $update = array();
+        $update = $data = array();
         if ($process == 3) {
             if ($info['num'] && $info['num'] > 0) {
                 //$update['num'] = $order['num'] + $info['num'];
@@ -326,6 +326,9 @@ class Refund
             }
         } else {
             if ($info['type'] == 2) {
+                if ($info['order_goods_id']) {
+                    $data = Dever::db($this->goods_table)->getDataByIds(array('ids' => $info['order_goods_id'], 'order_id' => $info['order_id'], 'clear' => true));
+                }
                 $state = Dever::db($this->goods_table)->update(array('where_id' => $info['order_goods_id'], 'status' => 3));
                 if ($state) {
                     $this->notice($state, $order, $info);
@@ -397,7 +400,7 @@ class Refund
                                 }
                             }
                         }
-                    }   
+                    }
                 }
             } else {
                 $update['where_id'] = $order['id'];
@@ -410,6 +413,7 @@ class Refund
                 $update['refund_status'] = 4;
                 $state = Dever::db($this->order_table)->update($update);
                 if ($state) {
+                    $data = Dever::db($this->goods_table)->getDataByIds(array('order_id' => $order['id'], 'status' => 2, 'clear' => true));
                     Dever::db($this->goods_table)->updates(array('option_order_id' => $order['id'], 'option_status' => 2, 'set_status' => 3));
 
                     $this->notice($state, $order, $info);
@@ -445,8 +449,6 @@ class Refund
             }
         }
 
-        $data = Dever::db($this->goods_table)->getDataByIds(array('ids' => $info['order_goods_id']));
-
         if ($this->type == 'sell' && $process == 2) {
             # 如果是销售单,退款后要减少销量
             Dever::load('shop/lib/goods')->oper($order, 2, 2, $data);