wugg 2 vuotta sitten
vanhempi
commit
5aba8c9130
1 muutettua tiedostoa jossa 26 lisäystä ja 5 poistoa
  1. 26 5
      app/admin/controller/Reorder.php

+ 26 - 5
app/admin/controller/Reorder.php

@@ -174,12 +174,19 @@ class Reorder extends \app\BaseController
            return error_show(1004,"未找到退货数据");
        }
        $orderinfo = Db::name("sale")->where(["orderCode"=>$info["orderCode"]])->find();
-        $goon = Db::name('good')->alias('b')->join("good_type a", "a.good_code=b.good_code", "left")
-            ->where(['a.type_code' => $info['good_code']])->find();
-        if (empty($goon)) {
+        if($orderinfo['order_type']==3|| $orderinfo['order_type']==4){
+            $goon = Db::name("good_zixun")->where(["spuCode"=>$orderinfo['good_code'],"is_del"=>0])->find();
+
+        }else {
+            $goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
+                ->where(['a.skuCode' => $orderinfo['skuCode']])->find();
+
+        }
+        if ($goon==false) {
             return error_show(1003, "未找到商品数据");
         }
         $int = isset($goon['cat_id']) && $goon['cat_id'] != 0 ? made($goon['cat_id']) : [];
+        $info['is_stock']=isset($goon['is_stock'])?$goon['is_stock']:'0';
        $info['good_code'] = isset($orderinfo['good_code'])?$orderinfo['good_code']:'';
        $info['good_name'] = isset($orderinfo['good_name'])?$orderinfo['good_name']:'';
        $info['good_num'] = isset($orderinfo['good_num'])?$orderinfo['good_num']:'';
@@ -330,7 +337,7 @@ class Reorder extends \app\BaseController
         if($orderinfo==false){
             return error_show(1004,"未找到订单数据");
         }
-        if($status==5){
+        if($status==4){
             $cgd=Db::name("order_num")->where(['orderCode'=>$info["orderCode"]])->order("send_num asc")->column('cgdNo');
             if(empty($cgd)){
                 return error_show(1004,"未找到商品库存数据");
@@ -345,6 +352,20 @@ class Reorder extends \app\BaseController
                 return error_show(1004,"未找到商品库存数据");
             }
         }
+
+        if($status==3){
+            $is_th =isset($this->post['is_th'])&&$this->post['is_th']!=="" ? intval($this->post['is_th']):"";
+            if($is_th===""){
+                return error_show(1004,"参数is_th不能为空");
+            }
+
+            $return_wsm =isset($this->post['return_wsm'])&&$this->post['return_wsm']!=="" ? intval($this->post['return_wsm']):"";
+            if($return_wsm===""){
+                return error_show(1004,"参数return_wsm 不能为空");
+            }
+
+        }
+
         Db::startTrans();
         try{
             $temp= $info['status'];
@@ -357,7 +378,7 @@ class Reorder extends \app\BaseController
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $ste = ["order_code"=>$code,"status"=>$temp,"action_remark"=>'',"action_type"=>"status"];
                 ActionLog::logAdd($this->post['token'],$ste,$info['order_type'] == 2?"ZXTHD":"QRTHD",$status,$info);
-                if($status==5){
+                if($status==4){
                     $orderinfo['wsend_num']-=$info['num'];
                     $orderinfo['th_num']+=$info['num'];
                     $orderinfo['send_status'] = $orderinfo['send_num'] == 0 ? 1 : $orderinfo['wsend_num'] == 0 ? 3 : 2;